[Bug middle-end/91202] Unnecessary promotion of shift operands

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 19 08:35:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91202

--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #4)
> Looking at x86 shl/shr instructions, it seems they don't do the
> SHIFT_COUNT_TRUNCATED masking, but actually mask always the shift count with
> & 31 (unless 64-bit shift, then it is indeed SHIFT_COUNT_TRUNCATED).

Yes, this is the reason x86 doesn't define SHIFT_COUNT_TRUNCATED (also, the
documentation is confusing to me, talking about some "real or pretended" bit
field operations). OTOH, x86 has several combined patterns that remove masking
from SImode and DImode shift/rotate instructions.

It is possible to define TARGET_SHIFT_TRUNCATION_MASK, but when experimenting
with this hook, I didn't find any effect on shifts.


More information about the Gcc-bugs mailing list