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

--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Michiel Derhaeg <[email protected]>:

https://gcc.gnu.org/g:ca5cffec066fb8a7edd13dd12792505739381b42

commit r17-4751-gca5cffec066fb8a7edd13dd12792505739381b42
Author: Michiel Derhaeg <[email protected]>
Date:   Wed Jun 24 21:45:30 2026 +0000

    arc: Fix invalid register index addressing for uncached stores [PR126157]

    `stdi<mode>` incorrectly uses a too liberal predicate for the
    destination operand, producing something like this: stb.di r2,[r13,r1]
    These [reg,reg] operands are not valid.

    This bug appeared because the introduction of
    `-ffuse-ops-with-volatile-access` in r16-5947-ga6c50ec2c6ebcb.  Before
    its existence, recog/combine would've disallowed `(plus (reg) (reg))` as
    the destination operand.

    POST_INC (and friends) is now produced as well. Didn't try implementing
    that for *stdidi_split and simply disallowed it instead.

            PR target/126157

    gcc/ChangeLog:

            * config/arc/arc.cc (prepare_move_operands): Force the address of
            an uncached store into a register when it is not a valid store
            destination.
            * config/arc/arc.md (stdi<mode>): Use move_dest_operand for the
            destination operand.
            (*stdidi_split): Use non_mod_move_dest_operand for the destination
            operand.
            * config/arc/predicates.md (non_mod_move_dest_operand): New
            predicate that disallows PRE/POST_INC/DEC.

    gcc/testsuite/ChangeLog:

            * gcc.target/arc/uncached-10.c: New test.
            * gcc.target/arc/uncached-11.c: New test.

    Signed-off-by: Alexandru Turjan <[email protected]>
    Signed-off-by: Michiel Derhaeg <[email protected]>

Reply via email to