[Bug rtl-optimization/48688] [x64]: shift/or instead of lea
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 20 10:26:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48688
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ubizjak at gmail dot com
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-04-20 10:25:07 UTC ---
All 6 variants:
int fn1 (int x) { return (x << 3) | 5; }
int fn2 (int x) { return (x * 8) | 5; }
int fn3 (int x) { return (x << 3) + 5; }
int fn4 (int x) { return (x * 8) + 5; }
int fn5 (int x) { return (x << 3) ^ 5; }
int fn6 (int x) { return (x * 8) ^ 5; }
The problem is that for + this is turned into lea only in combine, and
at that spot it only calls ix86_legitimate_address_p, not
ix86_legitimize_address. So, either ix86_legitimate_address_p (well,
ix86_decompose_address) should also handle the IOR/XOR with constant case
because we can't just adjust it to the canonical plus through
ix86_legitimize_address, or either simplify-rtx.c or fold-const.c or whatever
should try to canonicalize the IOR/XOR resp. BIT_IOR_EXPR/BIT_XOR_EXPR into
PLUS_EXPR in those cases. For simplify-rtx.c or fold-const.c, the question is
why should be PLUS generally preferred over IOR/XOR though, yeah, it helps one
target, but x86 isn't the only target GCC supports.
More information about the Gcc-bugs
mailing list