On Tue, May 17, 2022 at 5:52 PM Roger Sayle <ro...@nextmovesoftware.com> wrote: > > > This is a revised version of my i386 backend patch to avoid andn with -Oz, > when an explicit not;and (or not;test) would be (one byte) shorter. > https://gcc.gnu.org/pipermail/gcc-patches/2022-April/593168.html > This revision incorporates Michael Matz's feedback/suggestions with > explicit checks for LEGACY_INT_REG_P and REX_INT_REG_P. > > This patch has been tested against gcc13 trunk 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. Ok for mainline? > > 2022-05-17 Roger Sayle <ro...@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.
OK. Thanks, Uros. > > > Thanks in advance, > Roger > -- > > > -----Original Message----- > > From: Michael Matz <m...@suse.de> > > Sent: 13 April 2022 14:11 > > To: Roger Sayle <ro...@nextmovesoftware.com> > > Cc: gcc-patches@gcc.gnu.org > > Subject: Re: [x86 PATCH] Avoid andn and generate shorter not;and with -Oz. > > > > Hello, > > > > On Wed, 13 Apr 2022, Roger Sayle wrote: > > > > > 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. > > > > _And_ when no REX prefixes are necessary for the notl,andn, which they are > if > > the respective registers are %r8 or beyond. As you seem to be fine with > saving > > just a byte you ought to test that as well to not waste one again :-) > > > > > > Ciao, > > Michael.