[Bug tree-optimization/94782] Simple multiplication-related arithmetic not optimized to direct multiplication
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 17 18:24:04 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94782
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |TREE
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It is fixed on the RTL level but not the gimple level.
Combine does it for x86_64:
Trying 7, 8 -> 9:
7: {r91:SI=r93:SI-0x1;clobber flags:CC;}
REG_DEAD r93:SI
REG_UNUSED flags:CC
8: {r92:SI=r91:SI*r94:SI;clobber flags:CC;}
REG_UNUSED flags:CC
REG_DEAD r91:SI
9: r90:SI=r92:SI+r94:SI
REG_DEAD r94:SI
REG_DEAD r92:SI
Successfully matched this instruction:
(set (reg:SI 90)
(mult:SI (reg:SI 93)
(reg:SI 94)))
allowing combination of insns 7, 8 and 9
original costs 4 + 12 + 4 = 20
replacement cost 12
But it fails to do it on aarch64:
Trying 7 -> 14:
7: r101:SI=r103:SI-0x1
REG_DEAD r103:SI
14: x0:SI=r101:SI*r104:SI+r104:SI
REG_DEAD r101:SI
REG_DEAD r104:SI
More information about the Gcc-bugs
mailing list