Wilco Dijkstra <wilco.dijks...@arm.com> writes: > Improve costing of ctz - both TARGET_CSSC and vector cases were not handled > yet. > > Passes regress & bootstrap - OK for commit? > > gcc: > * config/aarch64/aarch64.cc (aarch64_rtx_costs): Improve CTZ costing.
Ok, thanks. Richard > diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc > index > fe13c9a0d4863041eb9101882ea57c2094240d16..2a6f76f4008839bf0aa158504430af9b7777971c > 100644 > --- a/gcc/config/aarch64/aarch64.cc > +++ b/gcc/config/aarch64/aarch64.cc > @@ -14309,10 +14309,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: