# Pastebin vA8mHqCF diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index 54bb0a66518..75beb907a6f 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -94,7 +94,7 @@ (define_insn "atomic_" (match_operand:SI 2 "const_int_operand")] ;; model UNSPEC_SYNC_OLD_OP))] "TARGET_ATOMIC" - "amo.%A2\tzero,%z1,%0" + "amo.%A2\tzero,%z1,%0\; fence w,o" [(set_attr "type" "atomic") (set (attr "length") (const_int 4))]) @@ -202,7 +202,8 @@ (define_insn "subword_atomic_fetch_strong_nand" "and\t%7, %0, %5\;" "or\t%7, %7, %6\;" "sc.w%J3\t%6, %7, %1\;" - "bnez\t%6, 1b"; + "bnez\t%6, 1b\:" + "fence w,o"; } [(set_attr "type" "multi") (set (attr "length") (const_int 32))]) @@ -257,7 +258,7 @@ (define_insn "atomic_exchange" (set (match_dup 1) (match_operand:GPR 2 "register_operand" "0"))] "TARGET_ATOMIC" - "amoswap.%A3\t%0,%z2,%1" + "amoswap.%A3\t%0,%z2,%1; fence w,o" [(set_attr "type" "atomic") (set (attr "length") (const_int 4))]) @@ -310,7 +311,8 @@ (define_insn "subword_atomic_exchange_strong" "and\t%5, %0, %4\;" "or\t%5, %5, %2\;" "sc.w%J3\t%5, %5, %1\;" - "bnez\t%5, 1b"; + "bnez\t%5, 1b\;" + "fence w,o"; } [(set_attr "type" "multi") (set (attr "length") (const_int 20))]) @@ -337,6 +339,7 @@ (define_insn "atomic_cas_value_strong" "bne\t%0,%z2,1f\;" "sc.%J5\t%6,%z3,%1\;" "bnez\t%6,1b\;" + "fence w,o\;" "1:"; } [(set_attr "type" "multi")