diff options
author | Dmitriy Vyukov <dvyukov@google.com> | 2011-09-19 11:09:00 -0700 |
---|---|---|
committer | Dmitriy Vyukov <dvyukov@google.com> | 2011-09-19 11:09:00 -0700 |
commit | ab596cae9eac88db46326a7b01c99975da8729b6 (patch) | |
tree | 4c97c9fb2bdaaa267c097cd5cdc892da987edbf1 | |
parent | 6f18233373454eae26386f0ca11cefe41106e7a0 (diff) | |
download | go-ab596cae9eac88db46326a7b01c99975da8729b6.tar.gz go-ab596cae9eac88db46326a7b01c99975da8729b6.zip |
sync/atomic: replace MFENCE with LOCK XADD
MFENCE was introduced only on the Pentium4 (SSE2),
while XADD was introduced on the 486.
Fixes #2268.
R=golang-dev, rsc
CC=fshahriar, golang-dev
https://golang.org/cl/5056045
-rw-r--r-- | src/pkg/sync/atomic/asm_386.s | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pkg/sync/atomic/asm_386.s b/src/pkg/sync/atomic/asm_386.s index 0d9dec2167..d149eb66ab 100644 --- a/src/pkg/sync/atomic/asm_386.s +++ b/src/pkg/sync/atomic/asm_386.s @@ -103,6 +103,7 @@ TEXT ·LoadInt64(SB),7,$0 TEXT ·LoadUint64(SB),7,$0 MOVL addrptr+0(FP), AX + // MOVQ and EMMS were introduced on the Pentium MMX. // MOVQ (%EAX), %MM0 BYTE $0x0f; BYTE $0x6f; BYTE $0x00 // MOVQ %MM0, 0x8(%ESP) @@ -131,14 +132,18 @@ TEXT ·StoreInt64(SB),7,$0 TEXT ·StoreUint64(SB),7,$0 MOVL addrptr+0(FP), AX + // MOVQ and EMMS were introduced on the Pentium MMX. // MOVQ 0x8(%ESP), %MM0 BYTE $0x0f; BYTE $0x6f; BYTE $0x44; BYTE $0x24; BYTE $0x08 // MOVQ %MM0, (%EAX) BYTE $0x0f; BYTE $0x7f; BYTE $0x00 // EMMS BYTE $0x0F; BYTE $0x77 - // MFENCE - BYTE $0x0f; BYTE $0xae; BYTE $0xf0 + // This is essentially a no-op, but it provides required memory fencing. + // It can be replaced with MFENCE, but MFENCE was introduced only on the Pentium4 (SSE2). + XORL AX, AX + LOCK + XADDL AX, (SP) RET TEXT ·StoreUintptr(SB),7,$0 |