]> Cypherpunks repositories - gostls13.git/commitdiff
internal/runtime/atomic: add Xchg8 for 386
authorMauri de Souza Meneguzzo <mauri870@gmail.com>
Thu, 17 Oct 2024 12:57:26 +0000 (12:57 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 18 Oct 2024 22:36:53 +0000 (22:36 +0000)
For #69735

Change-Id: I5b9f57315d693d613dc88dc02c10bee39aeeef76
GitHub-Last-Rev: 690337e5b81a48bdcb808526d0c5f4837e8912b7
GitHub-Pull-Request: golang/go#69923
Reviewed-on: https://go-review.googlesource.com/c/go/+/620756
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
src/internal/runtime/atomic/atomic_386.go
src/internal/runtime/atomic/atomic_386.s
src/internal/runtime/atomic/xchg8_test.go

index a023baddb764fe90e38a0e4e00ec332c16eb0615..b6cdea61abbe9bc5f70202b6e85685657f29c54b 100644 (file)
@@ -53,6 +53,9 @@ func Xchg64(ptr *uint64, new uint64) uint64
 //go:noescape
 func Xchg(ptr *uint32, new uint32) uint32
 
+//go:noescape
+func Xchg8(ptr *uint8, new uint8) uint8
+
 //go:noescape
 func Xchguintptr(ptr *uintptr, new uintptr) uintptr
 
index 08812c37ecc61383d8ad2a83caa827a2a45d1f51..58a56e63c073aa26a7890ac8ea4a0411111a8b32 100644 (file)
@@ -153,6 +153,14 @@ addloop:
        MOVL    CX, ret_hi+16(FP)
        RET
 
+// uint8 Xchg8(uint8 *ptr, uint8 new)
+TEXT ·Xchg8(SB), NOSPLIT, $0-9
+       MOVL    ptr+0(FP), BX
+       MOVB    new+4(FP), AX
+       XCHGB   AX, 0(BX)
+       MOVB    AX, ret+8(FP)
+       RET
+
 TEXT ·Xchg(SB), NOSPLIT, $0-12
        MOVL    ptr+0(FP), BX
        MOVL    new+4(FP), AX
index a04fcfc4bdbdc693f6b6df18473a83c583b41ada..d9f1d8854ef68c9233a7e6a05702dd0ed6772f32 100644 (file)
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build amd64 || arm64 || ppc64 || ppc64le
+//go:build 386 || amd64 || arm64 || ppc64 || ppc64le
 
 package atomic_test