> -----Original Message----- > From: H.J. Lu <[email protected]> > Sent: Friday, August 21, 2026 12:03 PM > To: Hongtao Liu <[email protected]> > Cc: GCC Patches <[email protected]>; Uros Bizjak > <[email protected]>; Liu, Hongtao <[email protected]> > Subject: [PATCH v2] x86: Allow minus ones for Kn and standard constants for > XMMn > > On Fri, Aug 21, 2026 at 10:06 AM Hongtao Liu <[email protected]> wrote: > > > > On Fri, Aug 21, 2026 at 9:08 AM H.J. Lu <[email protected]> wrote: > > > > > > Since we can load minus ones into an SSE or MASK register, allow > > > minus ones for SSE and MASK registers so that > > > > > > > I think we should use standard_sse_constant_p (x, mode) for > > MAYBE_SSE_CLASS_P since there's no direct instruction to move -1 to > > sse register for scalar floating mode, pcmpeq is only used for vector > > mode. > > So how about > > > > if (CONSTANT_P (x)) > > { > > if (MAYBE_MAAX_CLASS_P (regclass)) > > return NO_REGS; > > if (MAYBE_MASK_CLASS_P (regclass)) > > return x == constm1_rtx ? regclass : NO_REG; > > if (MAYBE_SSE_CLASS_P (regclass)) > > return (mode != VOIDmode && stardard_sse_constant_p (x, mode)) ? > > regclass : NO_REGS; > > } > > Like this? Ok.
> > -- > H.J. > --- > Since we can load minus ones into a MASK register and standard SSE > constants into a SSE register, allow them for MASK and SSE registers so that > > kxnor %k0, %k0, %k0 > > is used to load -1 into mask register, instead of loading from memory. > > PR target/126959 > * config/i386/i386.cc (ix86_preferred_reload_class): Allow minus ones for > MASK register and standard SSE constants for SSE register. > * gcc.target/i386/pr126959-1a.c: New test. > * gcc.target/i386/pr126959-1b.c: Likewise. > * gcc.target/i386/pr126959-2a.c: Likewise. > * gcc.target/i386/pr126959-2b.c: Likewise.
