https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125628
--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #2)
> diff --git a/gcc/config/mips/sync.md b/gcc/config/mips/sync.md
> index 1d0a977066b..d968503f89c 100644
> --- a/gcc/config/mips/sync.md
> +++ b/gcc/config/mips/sync.md
> @@ -172,21 +172,21 @@ (define_expand "sync_old_<optab><mode>"
> })
>
> ;; Helper insn for sync_old_<optab><mode>
> (define_insn "sync_old_<optab>_12"
> [(set (match_operand:SI 0 "register_operand" "=&d")
> (match_operand:SI 1 "memory_operand" "+ZC"))
> (set (match_dup 1)
> (unspec_volatile:SI
> [(match_operand:SI 2 "register_operand" "d")
> (match_operand:SI 3 "register_operand" "d")
> - (atomic_hiqi_op:SI (match_dup 0)
> + (atomic_hiqi_op:SI (match_dup 1)
> (match_operand:SI 4 "reg_or_0_operand" "dJ"))]
> UNSPEC_SYNC_OLD_OP_12))
> (clobber (match_scratch:SI 5 "=&d"))]
> "GENERATE_LL_SC"
> { return mips_output_sync_loop (insn, operands); }
> [(set_attr "sync_insn1" "<insn>")
This patch is ok. I thought I had fixed this previously but it has been a few
years since I last worked on mips backend.