aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2024-08-26 15:14:24 -0700
committerAndrew Pinski <quic_apinski@quicinc.com>2024-08-28 14:03:49 -0700
commit3c89c41991d8e84d28d3aba22bb06b2712a29523 (patch)
tree55fd9a3d6f9ba86d00deff8fb4db827c7dd55a33
parentb68561dd7925dfee1836f75d3fa8d33fff5c2498 (diff)
downloadgcc-3c89c41991d8e84d28d3aba22bb06b2712a29523.zip
gcc-3c89c41991d8e84d28d3aba22bb06b2712a29523.tar.gz
gcc-3c89c41991d8e84d28d3aba22bb06b2712a29523.tar.bz2
expand: Add debug dump on the cost for `popcount==1` expand
While working on PR 114224, I found it would be useful to dump the different costs of the expansion to make easier to understand why one was chosen over the other. Changes since v1: * v2: make the dump a single line Bootstrapped and tested on x86_64-linux-gnu. Build and tested for aarch64-linux-gnu. gcc/ChangeLog: * internal-fn.cc (expand_POPCOUNT): Dump the costs for the two choices.
-rw-r--r--gcc/internal-fn.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/internal-fn.cc b/gcc/internal-fn.cc
index 89da13b..78997ef 100644
--- a/gcc/internal-fn.cc
+++ b/gcc/internal-fn.cc
@@ -5351,6 +5351,11 @@ expand_POPCOUNT (internal_fn fn, gcall *stmt)
unsigned popcount_cost = (seq_cost (popcount_insns, speed_p)
+ seq_cost (popcount_cmp_insns, speed_p));
unsigned cmp_cost = seq_cost (cmp_insns, speed_p);
+
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf(dump_file, "popcount == 1: popcount cost: %u; cmp cost: %u\n",
+ popcount_cost, cmp_cost);
+
if (popcount_cost <= cmp_cost)
emit_insn (popcount_insns);
else