https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127153

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

https://gcc.gnu.org/g:85c39785487e242162cdc28675b334ad23951edb

commit r17-4193-g85c39785487e242162cdc28675b334ad23951edb
Author: Xi Ruoyao <[email protected]>
Date:   Mon Aug 31 16:18:12 2026 +0800

    LoongArch: fix miscompile of both_non_zero{,_subreg} when operands[0] ==
operands[2] [PR 127153]

    Here operands[0] is written before the instruction is finished using
    operands[2] so it cannot lie in a register that is read by the
    instruction.  Thus it should be an earlyclobber operand.  As operands[1]
    is only used before the early result is written, it can be tied to the
    earlyclobber operand so explicitly allow doing so.

    Defer the split after reload as constrants do not apply to pseudos.

            PR target/127153

    gcc/

            * config/loongarch/loongarch.md (both_non_zero): Defer the split
            post reload and add constraint to ensure operands[0] and
            operands[2] are in different hard registers.
            (both_non_zero_subreg): Likewise.

    gcc/testsuite/

            * c-c++-common/pr127153.c: New test.

Reply via email to