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

commit r16-3250-gd1d7ecfbc6d86f660ec79ca272b20aea9d6c3ca7
Author: Xi Ruoyao <xry...@xry111.site>
Date:   Sat Mar 1 11:46:43 2025 +0800

    LoongArch: Don't use "+" for atomic_{load, store} "m" constraint
    
    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.

Diff:
---
 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 f712c2fe07e2..63929abba457 100644
--- a/gcc/config/loongarch/sync.md
+++ b/gcc/config/loongarch/sync.md
@@ -102,7 +102,7 @@
 (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))]
   ""
@@ -139,7 +139,7 @@
 
 ;; 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

Reply via email to