Using amoswap as atomic store is not an expected optimization and most likely causes a performance penalty. Neither SW nor HW have a benefit from this optimization, so let's simply drop it.
gcc/ PR 100265 * config/riscv/sync.md (atomic_store<mode>): Remove. --- gcc/config/riscv/sync.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/gcc/config/riscv/sync.md b/gcc/config/riscv/sync.md index aeeb2e854b68..efd49745a8e2 100644 --- a/gcc/config/riscv/sync.md +++ b/gcc/config/riscv/sync.md @@ -57,17 +57,6 @@ ;; Atomic memory operations. -;; Implement atomic stores with amoswap. Fall back to fences for atomic loads. -(define_insn "atomic_store<mode>" - [(set (match_operand:GPR 0 "memory_operand" "=A") - (unspec_volatile:GPR - [(match_operand:GPR 1 "reg_or_0_operand" "rJ") - (match_operand:SI 2 "const_int_operand")] ;; model - UNSPEC_ATOMIC_STORE))] - "TARGET_ATOMIC" - "amoswap.<amo>%A2 zero,%z1,%0" - [(set (attr "length") (const_int 8))]) - (define_insn "atomic_<atomic_optab><mode>" [(set (match_operand:GPR 0 "memory_operand" "+A") (unspec_volatile:GPR -- 2.31.1