[Bug target/126959] -march=znver4 prefers load from memory for mask register

"cvs-commit at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126959

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <[email protected]>:

https://gcc.gnu.org/g:086b41669e64fda333cd91144070314912ae4ae9

commit r17-3496-g086b41669e64fda333cd91144070314912ae4ae9
Author: H.J. Lu <[email protected]>
Date:   Thu Aug 20 12:17:41 2026 +0800

    x86: Allow minus ones for Kn and standard constants for XMMn

    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.

    gcc/

            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/testsuite/

            PR target/126959
            * 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.

    Signed-off-by: H.J. Lu <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.