From: Wilco Dijkstra Date: Wed, 17 Apr 2024 16:18:23 +0000 (+0100) Subject: AArch64: Improve costing of ctz X-Git-Tag: basepoints/gcc-16~8857 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e14c673ea9ab2eca5de4db91b478f0b5297ef321;p=thirdparty%2Fgcc.git 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. --- diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 662ff5a9b0c..ee12d8897a8 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: