aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilco Dijkstra <wilco.dijkstra@arm.com>2024-04-17 17:18:23 +0100
committerWilco Dijkstra <wilco.dijkstra@arm.com>2024-05-20 16:06:38 +0100
commite14c673ea9ab2eca5de4db91b478f0b5297ef321 (patch)
treeb61170f0c458a7e4dcf25940776859f0766ebe25
parent804fa0bb92f8073394b3859edb810c3e23375530 (diff)
downloadgcc-e14c673ea9ab2eca5de4db91b478f0b5297ef321.zip
gcc-e14c673ea9ab2eca5de4db91b478f0b5297ef321.tar.gz
gcc-e14c673ea9ab2eca5de4db91b478f0b5297ef321.tar.bz2
AArch64: Improve costing of ctz
Improve costing of ctz - both TARGET_CSSC and vector cases were not handled yet. gcc: * config/aarch64/aarch64.cc (aarch64_rtx_costs): Improve CTZ costing.
-rw-r--r--gcc/config/aarch64/aarch64.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 662ff5a..ee12d88 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -14349,10 +14349,24 @@ aarch64_rtx_costs (rtx x, machine_mode mode, int outer ATTRIBUTE_UNUSED,
return false;
case CTZ:
- *cost = COSTS_N_INSNS (2);
-
- if (speed)
- *cost += extra_cost->alu.clz + extra_cost->alu.rev;
+ if (VECTOR_MODE_P (mode))
+ {
+ *cost = COSTS_N_INSNS (3);
+ if (speed)
+ *cost += extra_cost->vect.alu * 3;
+ }
+ else if (TARGET_CSSC)
+ {
+ *cost = COSTS_N_INSNS (1);
+ if (speed)
+ *cost += extra_cost->alu.clz;
+ }
+ else
+ {
+ *cost = COSTS_N_INSNS (2);
+ if (speed)
+ *cost += extra_cost->alu.clz + extra_cost->alu.rev;
+ }
return false;
case COMPARE: