diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2024-11-24 22:00:18 +0100 |
---|---|---|
committer | Uros Bizjak <ubizjak@gmail.com> | 2024-11-24 22:00:59 +0100 |
commit | 1ff69000b50e8ac184e925af71e794e7c3d5d2a6 (patch) | |
tree | 338a18764745d69a4ea030044c57eb6f766512b9 /gcc/function.cc | |
parent | cc0f32274deccfbbf2a6dab5ae77e49ce6aeb66d (diff) | |
download | gcc-1ff69000b50e8ac184e925af71e794e7c3d5d2a6.zip gcc-1ff69000b50e8ac184e925af71e794e7c3d5d2a6.tar.gz gcc-1ff69000b50e8ac184e925af71e794e7c3d5d2a6.tar.bz2 |
i386: x86 can use x >> -y for x >> 32-y [PR36503]
x86 targets mask 32-bit shifts with a 5-bit mask (and 64-bit with 6-bit mask),
so they can use x >> -y instead of x >> 32-y. This form is very common in
bitstream readers, where it's used to read the top N bits from a word.
The optimization converts:
movl $32, %ecx
subl %esi, %ecx
sall %cl, %eax
to:
negl %ecx
sall %cl, %eax
PR target/36503
gcc/ChangeLog:
* config/i386/i386.md (*ashl<mode>3_negcnt):
New define_insn_and_split pattern.
(*ashl<mode>3_negcnt_1): Ditto.
(*<insn><mode>3_negcnt): Ditto.
(*<insn><mode>3_negcnt_1): Ditto.
gcc/testsuite/ChangeLog:
* gcc.target/i386/pr36503-1.c: New test.
* gcc.target/i386/pr36503-2.c: New test.
Diffstat (limited to 'gcc/function.cc')
0 files changed, 0 insertions, 0 deletions