From: Guoqi Chen Date: Wed, 27 Aug 2025 06:45:58 +0000 (+0800) Subject: internal/runtime/atomic: reset wrong jump target in Cas{,64} on loong64 X-Git-Tag: go1.26rc1~985 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d4b17f58695337c7eefa9d066cc51a425842e491;p=gostls13.git 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: sophie zhao Reviewed-by: Meidan Li --- 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: