[RFA] [target/87369] Prefer "bit" over "bfxil"
Jeff Law
law@redhat.com
Fri Dec 7 15:52:00 GMT 2018
As I suggested in the BZ, this patch rejects constants with just the
high bit set for the recently added "bfxil" pattern. As a result we'll
return to using "bit" for the test in the BZ.
I'm not versed enough in aarch64 performance tuning to know if "bit" is
actually a better choice than "bfxil". "bit" results in better code for
the testcase, but that seems more a function of register allocation than
"bit" being inherently better than "bfxil". Obviously someone with
more aarch64 knowledge needs to make a decision here.
My first iteration of the patch changed "aarch64_high_bits_all_ones_p".
We could still go that way too, though the name probably needs to change.
I've bootstrapped and regression tested on aarch64-linux-gnu and it
fixes the regression. I've also bootstrapped aarch64_be-linux-gnu, but
haven't done any kind of regression tested on that platform.
OK for the trunk?
Jeff
-------------- next part --------------
PR target/87369
* config/aarch64/aarch64.md (aarch64_bfxil<mode>): Do not accept
constant with just the high bit set. That's better handled by
the "bit" pattern.
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 88f66104db3..ad6822410c2 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -5342,9 +5342,11 @@
(match_operand:GPI 3 "const_int_operand" "n, Ulc"))
(and:GPI (match_operand:GPI 2 "register_operand" "0,r")
(match_operand:GPI 4 "const_int_operand" "Ulc, n"))))]
- "(INTVAL (operands[3]) == ~INTVAL (operands[4]))
- && (aarch64_high_bits_all_ones_p (INTVAL (operands[3]))
- || aarch64_high_bits_all_ones_p (INTVAL (operands[4])))"
+ "(INTVAL (operands[3]) == ~INTVAL (operands[4])
+ && ((aarch64_high_bits_all_ones_p (INTVAL (operands[3]))
+ && popcount_hwi (INTVAL (operands[3])) != 1)
+ || (aarch64_high_bits_all_ones_p (INTVAL (operands[4]))
+ && popcount_hwi (INTVAL (operands[4])) != 1)))"
{
switch (which_alternative)
{
More information about the Gcc-patches
mailing list