aboutsummaryrefslogtreecommitdiff
path: root/src/internal/runtime
diff options
context:
space:
mode:
authorGuoqi Chen <chenguoqi@loongson.cn>2025-08-27 14:45:58 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-08-31 18:32:58 -0700
commitd4b17f58695337c7eefa9d066cc51a425842e491 (patch)
treee43a4ca62eca730ee30b4c4ded6e5ec5bf4aa46f /src/internal/runtime
parent6a08e80399bd65b95e60e3c74b7e1f86754752a7 (diff)
downloadgo-d4b17f58695337c7eefa9d066cc51a425842e491.tar.xz
internal/runtime/atomic: reset wrong jump target in Cas{,64} on loong64
The implementation here needs to be consistent with ssa.OpLOONG64LoweredAtomicCas{32,64}, which was ignored in CL 613396. Change-Id: I72e8d2318e0c1935cc3a35ab5098f8a84e48bcd5 Reviewed-on: https://go-review.googlesource.com/c/go/+/699395 Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn> Reviewed-by: Meidan Li <limeidan@loongson.cn>
Diffstat (limited to 'src/internal/runtime')
-rw-r--r--src/internal/runtime/atomic/atomic_loong64.s6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/internal/runtime/atomic/atomic_loong64.s b/src/internal/runtime/atomic/atomic_loong64.s
index 95d3e2bdab..4215af24fe 100644
--- a/src/internal/runtime/atomic/atomic_loong64.s
+++ b/src/internal/runtime/atomic/atomic_loong64.s
@@ -19,7 +19,7 @@ TEXT ·Cas(SB), NOSPLIT, $0-17
MOVW new+12(FP), R6
MOVBU internal∕cpu·Loong64+const_offsetLOONG64HasLAMCAS(SB), R8
- BEQ R8, cas_again
+ BEQ R8, ll_sc
MOVV R5, R7 // backup old value
AMCASDBW R6, (R4), R5
BNE R7, R5, cas_fail0
@@ -30,6 +30,7 @@ cas_fail0:
MOVB R0, ret+16(FP)
RET
+ll_sc:
// Implemented using the ll-sc instruction pair
DBAR $0x14 // LoadAcquire barrier
cas_again:
@@ -60,7 +61,7 @@ TEXT ·Cas64(SB), NOSPLIT, $0-25
MOVV new+16(FP), R6
MOVBU internal∕cpu·Loong64+const_offsetLOONG64HasLAMCAS(SB), R8
- BEQ R8, cas64_again
+ BEQ R8, ll_sc_64
MOVV R5, R7 // backup old value
AMCASDBV R6, (R4), R5
BNE R7, R5, cas64_fail0
@@ -71,6 +72,7 @@ cas64_fail0:
MOVB R0, ret+24(FP)
RET
+ll_sc_64:
// Implemented using the ll-sc instruction pair
DBAR $0x14
cas64_again: