]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
LoongArch: Don't use "+" for atomic_{load, store} "m" constraint
authorXi Ruoyao <xry111@xry111.site>
Sat, 1 Mar 2025 03:46:43 +0000 (11:46 +0800)
committerLulu Cheng <chenglulu@loongson.cn>
Mon, 18 Aug 2025 01:09:34 +0000 (09:09 +0800)
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

index f712c2fe07e226982b474a0f171f71cb1dc87234..63929abba457e2bc19dd5d8aaf783961b46ff629 100644 (file)
 (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))]
   ""
 
 ;; 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