On Mon, Aug 4, 2025 at 11:05 PM H.J. Lu <hjl.to...@gmail.com> wrote:
>
> On Mon, Aug 4, 2025 at 8:50 AM Richard Sandiford
> <richard.sandif...@arm.com> wrote:
> >
> > Uros Bizjak <ubiz...@gmail.com> writes:
> > > On Sat, Aug 2, 2025 at 8:56 PM H.J. Lu <hjl.to...@gmail.com> wrote:
> > >>
> > >> On Fri, Aug 1, 2025 at 10:32 PM Uros Bizjak <ubiz...@gmail.com> wrote:
> > >> >
> > >> > On Sat, Aug 2, 2025 at 3:22 AM H.J. Lu <hjl.to...@gmail.com> wrote:
> > >> > >
> > >> > > After
> > >> > >
> > >> > > commit 965564eafb721f8000013a3112f1bba8d8fae32b
> > >> > > Author: Richard Sandiford <richard.sandif...@arm.com>
> > >> > > Date:   Tue Jul 29 15:58:34 2025 +0100
> > >> > >
> > >> > >     simplify-rtx: Simplify subregs of logic ops
> > >> > >
> > >> > > combine generates
> > >> > >
> > >> > > (set (zero_extract:SI (reg/v:SI 101 [ a ])
> > >> > >         (const_int 8 [0x8])
> > >> > >         (const_int 8 [0x8]))
> > >> > >     (not:SI (sign_extract:SI (reg:SI 107 [ b ])
> > >> > >             (const_int 8 [0x8])
> > >> > >             (const_int 8 [0x8]))))
> > >> > >
> > >> > > instead of
> > >> > >
> > >> > > (set (zero_extract:SI (reg/v:SI 101 [ a ])
> > >> > >         (const_int 8 [0x8])
> > >> > >         (const_int 8 [0x8]))
> > >> > >     (subreg:SI (not:QI (subreg:QI (sign_extract:SI (reg:SI 107 [ b ])
> > >> > >                     (const_int 8 [0x8])
> > >> > >                     (const_int 8 [0x8])) 0)) 0))
> > >> > >
> > >> > > Add *one_cmplqi_ext<mode>_2 to support the new pattern.
> > >> > >
> > >> > >         PR target/121306
> > >> > >         * config/i386/i386.md (*one_cmplqi_ext<mode>_2): New.
> > >> >
> > >> > Why not just change the old pattern? I'd expect that the old form is
> > >> > now obsolete.
> > >> >
> > >>
> > >> *one_cmplqi_ext<mode>_1 is still needed.  Otherwise combine will
> > >> fail to match this instruction:
> > >>
> > >> (set (zero_extract:SI (reg/v:SI 102 [ a ])
> > >>         (const_int 8 [0x8])
> > >>         (const_int 8 [0x8]))
> > >>     (subreg:SI (not:QI (subreg:QI (reg:SI 105 [ _2 ]) 0)) 0))
> > >
> > > Do you perhaps have a testcase that still shows this combination?
> > > Perhaps the author of the simplification (CC'd) would be interested in
> > > this missing case.
> > >
> > > I was under the impression that the new simplification should always
> > > trigger, there is no point in having it if the backend still has to
> > > provide simplified and non-simplified patterns.
> > >
> > > There are also other similar logic patterns in i386.md that would have
> > > to be amended.
> >
> > Sorry, I hadn't realised that there were still unfixed regressions
> > from that patch.  I suppose if we wanted to avoid two patterns here,
> > we'd need to extend the pre-existing word_mode folds to support
> > subword modes too (for !WORD_REGISTER_OPERATIONS).  The attached
> > untested patch does that, but I expect it would have similar
> > knock-on effects.  I'll give it a spin overnight on x86 anyway
> > just to see what happens.
>
> Yes, it fixes:
>
> FAIL: gcc.target/i386/pr82524.c scan-assembler-not mov[sz]bl
> FAIL: gcc.target/i386/pr82524.c scan-assembler [ \t]notb
>
> together with the enclosed patch.

+      (match_op_dup 2
+        [(match_dup 0)
+         (const_int 8)
+         (const_int 8)])))]

IMO, it is better to leave arguments to match_op_dup together in one
line, they fit into line character limit.

OK for the x86 part.

Thanks,
Uros.

Reply via email to