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;
}

> 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 SSE and MASK registers.
> * 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.
>
> --
> H.J.



-- 
BR,
Hongtao

Reply via email to