]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Narrow test instructions with immediate operands [PR111698]
authorUros Bizjak <ubizjak@gmail.com>
Wed, 25 Oct 2023 14:26:57 +0000 (16:26 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 25 Oct 2023 14:28:09 +0000 (16:28 +0200)
commit678e6c328c77db383431751bcfcf867b02369bd6
treed46342f158cb08944263f4958b29893bb9fb2be0
parentf7dbf6230453c76a19921607601eff968bb70169
i386: Narrow test instructions with immediate operands [PR111698]

Narrow test instructions with immediate operand that test memory location
for zero.  E.g. testl $0x00aa0000, mem can be converted to testb $0xaa, mem+2.
Reject targets where reading (possibly unaligned) part of memory location
after a large write to the same address causes store-to-load forwarding stall.

PR target/111698

gcc/ChangeLog:

* config/i386/x86-tune.def (X86_TUNE_PARTIAL_MEMORY_READ_STALL):
New tune.
* config/i386/i386.h (TARGET_PARTIAL_MEMORY_READ_STALL): New macro.
* config/i386/i386.md: New peephole pattern to narrow test
instructions with immediate operands that test memory locations
for zero.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr111698.c: New test.
gcc/config/i386/i386.h
gcc/config/i386/i386.md
gcc/config/i386/x86-tune.def
gcc/testsuite/gcc.target/i386/pr111698.c [new file with mode: 0644]