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>
This commit is contained in:
Guoqi Chen 2025-08-27 14:45:58 +08:00 committed by abner chenc
parent 6a08e80399
commit d4b17f5869

View file

@ -19,7 +19,7 @@ TEXT ·Cas(SB), NOSPLIT, $0-17
MOVW new+12(FP), R6
MOVBU internalcpu·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 internalcpu·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: