Commit 9735fcfc authored by Elias Naur's avatar Elias Naur

sync/atomic: add memory barriers to Load/StoreInt32 on darwin/arm

After switching to an iPhone 5 for the darwin/arm builds,
TestStoreLoadRelAcq32 started to timeout on every builder run.
Adding the same memory barriers as armLoadUint64 and armStoreUint64
makes the test complete successfully.

Fixes sync/atomic tests on the darwin/arm builder.

Change-Id: Id73de31679304e259bdbd7f2f94383ae7fd70ee4
Reviewed-on: https://go-review.googlesource.com/67390
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarDmitry Vyukov <dvyukov@google.com>
parent f2af0c17
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
// Darwin/ARM atomic operations. // Darwin/ARM atomic operations.
#define DMB_ISHST_7 \
WORD $0xf57ff05a // dmb ishst
#define DMB_ISH_7 \
WORD $0xf57ff05b // dmb ish
TEXT ·CompareAndSwapInt32(SB),NOSPLIT,$0 TEXT ·CompareAndSwapInt32(SB),NOSPLIT,$0
B ·CompareAndSwapUint32(SB) B ·CompareAndSwapUint32(SB)
...@@ -58,9 +64,11 @@ TEXT ·LoadUint32(SB),NOSPLIT,$0-8 ...@@ -58,9 +64,11 @@ TEXT ·LoadUint32(SB),NOSPLIT,$0-8
MOVW addr+0(FP), R1 MOVW addr+0(FP), R1
load32loop: load32loop:
LDREX (R1), R2 // loads R2 LDREX (R1), R2 // loads R2
DMB_ISHST_7
STREX R2, (R1), R0 // stores R2 STREX R2, (R1), R0 // stores R2
CMP $0, R0 CMP $0, R0
BNE load32loop BNE load32loop
DMB_ISH_7
MOVW R2, val+4(FP) MOVW R2, val+4(FP)
RET RET
...@@ -84,9 +92,11 @@ TEXT ·StoreUint32(SB),NOSPLIT,$0-8 ...@@ -84,9 +92,11 @@ TEXT ·StoreUint32(SB),NOSPLIT,$0-8
MOVW val+4(FP), R2 MOVW val+4(FP), R2
storeloop: storeloop:
LDREX (R1), R4 // loads R4 LDREX (R1), R4 // loads R4
DMB_ISHST_7
STREX R2, (R1), R0 // stores R2 STREX R2, (R1), R0 // stores R2
CMP $0, R0 CMP $0, R0
BNE storeloop BNE storeloop
DMB_ISH_7
RET RET
TEXT ·StoreInt64(SB),NOSPLIT,$0 TEXT ·StoreInt64(SB),NOSPLIT,$0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment