[Bug rtl-optimization/82889] Unnecessary sign extension of int32 to int64
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 8 15:17:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82889
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On the other side, in REE nonzero_bits on the operand of SIGN_EXTEND on the
last testcase above doesn't return 0x7fffffff, but 0xffffffff, maybe it is too
late to use SSA_NAME_RANGE_INFO at that point.
So, perhaps use range info (possibly improved with the on-demand VRP) in the
expander when emitting a SIGN_EXTEND or ZERO_EXTEND and ask the backend what is
generally cheaper to use if the value range indicates value between 0 and
signed integral maximum of the corresponding precision. Then we'd use
ZERO_EXTEND on x86 any time we'd otherwise emit SIGN_EXTEND if range info tells
us the MSB is clear.
More information about the Gcc-bugs
mailing list