Atomic load does not modify the memory.  Atomic store does not read the
memory, thus we can use "=" instead.

gcc/ChangeLog:

        * config/loongarch/sync.md (atomic_load<mode>): Remove "+" for
        the memory operand.
        (atomic_store<mode>): Use "=" instead of "+" for the memory
        operand.
---
 gcc/config/loongarch/sync.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/loongarch/sync.md b/gcc/config/loongarch/sync.md
index 75b134cd853..15413e4df1b 100644
--- a/gcc/config/loongarch/sync.md
+++ b/gcc/config/loongarch/sync.md
@@ -105,7 +105,7 @@ (define_insn "mem_thread_fence_1"
 (define_insn "atomic_load<mode>"
   [(set (match_operand:QHWD 0 "register_operand" "=r")
     (unspec_volatile:QHWD
-      [(match_operand:QHWD 1 "memory_operand" "+m")
+      [(match_operand:QHWD 1 "memory_operand" "m")
        (match_operand:SI 2 "const_int_operand")]                        ;; 
model
       UNSPEC_ATOMIC_LOAD))]
   ""
@@ -142,7 +142,7 @@ (define_insn "atomic_load<mode>"
 
 ;; Implement atomic stores with amoswap.  Fall back to fences for atomic loads.
 (define_insn "atomic_store<mode>"
-  [(set (match_operand:QHWD 0 "memory_operand" "+m")
+  [(set (match_operand:QHWD 0 "memory_operand" "=m")
     (unspec_volatile:QHWD
       [(match_operand:QHWD 1 "reg_or_0_operand" "rJ")
        (match_operand:SI 2 "const_int_operand")]      ;; model
-- 
2.48.1

Reply via email to