[x86 PATCH] Avoid andn and generate shorter not;and with -Oz.
Roger Sayle
roger@nextmovesoftware.com
Wed Apr 13 08:09:16 GMT 2022
The x86 instruction encoding for SImode andn is longer than the
equivalent notl/andl sequence when the source for the not operand
is the same register as the destination. This patch adds post_reload
splitters to i386.md to avoid "-mbmi" (which enables andn) increasing
code size with "-Oz".
One minor subtlety with this patch is that the splitter for
*andn_si_ccno swaps the order of operands (match_dup 2 and match_dup 3)
as memory operands need to appear first in the *test<mode>_1 patterns.
This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
and make -k check, both with and without --target_board=unix{-m32},
with no new failures [and like the previous patch on CSiBE].
Ok for mainline?
2022-04-13 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/i386/i386.md (define_split): Split *andsi_1 and
*andn_si_ccno after reload with -Oz.
gcc/testsuite/ChangeLog
* gcc.target/i386/bmi-and-3.c: New test case.
Thanks in advance,
Roger
--
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchoz3.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20220413/9a7b0f7b/attachment.txt>
More information about the Gcc-patches
mailing list