aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2025-03-01 11:46:43 +0800
committerLulu Cheng <chenglulu@loongson.cn>2025-08-18 09:09:34 +0800
commitd1d7ecfbc6d86f660ec79ca272b20aea9d6c3ca7 (patch)
tree591e26d14eccb7c1c6b84d9a1299976fb76b4603
parentb8e147d46ea5e78be0a390e645600afc4cbae645 (diff)
downloadgcc-d1d7ecfbc6d86f660ec79ca272b20aea9d6c3ca7.zip
gcc-d1d7ecfbc6d86f660ec79ca272b20aea9d6c3ca7.tar.gz
gcc-d1d7ecfbc6d86f660ec79ca272b20aea9d6c3ca7.tar.bz2
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.
-rw-r--r--gcc/config/loongarch/sync.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/config/loongarch/sync.md b/gcc/config/loongarch/sync.md
index f712c2f..63929ab 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