Commit 8c3f6402 authored by Russ Cox's avatar Russ Cox

[dev.garbage] runtime: add prefetcht0, prefetcht1, prefetcht2, prefetcht3, prefetchnta for GC

We don't know what we need yet, so add them all.
Add them even on x86 architectures (as no-ops) so that
the GC can refer to them unconditionally.

Eventually we'll know what we want and probably
have just one 'prefetch' with an appropriate meaning
on each architecture.

LGTM=rlh
R=rlh
CC=golang-codereviews
https://golang.org/cl/179160043
parent cc73a44f
...@@ -2285,3 +2285,23 @@ TEXT runtime·getg(SB),NOSPLIT,$0-4 ...@@ -2285,3 +2285,23 @@ TEXT runtime·getg(SB),NOSPLIT,$0-4
MOVL AX, ret+0(FP) MOVL AX, ret+0(FP)
RET RET
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHT0 (AX)
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHT1 (AX)
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHT2 (AX)
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHNTA (AX)
RET
...@@ -2228,3 +2228,23 @@ TEXT runtime·getg(SB),NOSPLIT,$0-8 ...@@ -2228,3 +2228,23 @@ TEXT runtime·getg(SB),NOSPLIT,$0-8
MOVQ g(CX), AX MOVQ g(CX), AX
MOVQ AX, ret+0(FP) MOVQ AX, ret+0(FP)
RET RET
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
MOVQ addr+0(FP), AX
PREFETCHT0 (AX)
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
MOVQ addr+0(FP), AX
PREFETCHT1 (AX)
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
MOVQ addr+0(FP), AX
PREFETCHT2 (AX)
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
MOVQ addr+0(FP), AX
PREFETCHNTA (AX)
RET
...@@ -1079,3 +1079,24 @@ TEXT runtime·getg(SB),NOSPLIT,$0-4 ...@@ -1079,3 +1079,24 @@ TEXT runtime·getg(SB),NOSPLIT,$0-4
MOVL g(CX), AX MOVL g(CX), AX
MOVL AX, ret+0(FP) MOVL AX, ret+0(FP)
RET RET
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHT0 (AX)
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHT1 (AX)
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHT2 (AX)
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
MOVL addr+0(FP), AX
PREFETCHNTA (AX)
RET
...@@ -1320,3 +1320,15 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0 ...@@ -1320,3 +1320,15 @@ TEXT runtime·goexit(SB),NOSPLIT,$-4-0
TEXT runtime·getg(SB),NOSPLIT,$-4-4 TEXT runtime·getg(SB),NOSPLIT,$-4-4
MOVW g, ret+0(FP) MOVW g, ret+0(FP)
RET RET
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-4
RET
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-4
RET
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-4
RET
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-4
RET
...@@ -986,3 +986,15 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0 ...@@ -986,3 +986,15 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$0
TEXT runtime·goexit(SB),NOSPLIT,$-8-0 TEXT runtime·goexit(SB),NOSPLIT,$-8-0
MOVD R0, R0 // NOP MOVD R0, R0 // NOP
BL runtime·goexit1(SB) // does not return BL runtime·goexit1(SB) // does not return
TEXT runtime·prefetcht0(SB),NOSPLIT,$0-8
RETURN
TEXT runtime·prefetcht1(SB),NOSPLIT,$0-8
RETURN
TEXT runtime·prefetcht2(SB),NOSPLIT,$0-8
RETURN
TEXT runtime·prefetchnta(SB),NOSPLIT,$0-8
RETURN
...@@ -97,7 +97,10 @@ func testAtomic64() { ...@@ -97,7 +97,10 @@ func testAtomic64() {
z64 = 42 z64 = 42
x64 = 0 x64 = 0
// TODO: PREFETCH((unsafe.Pointer)(&z64)) prefetcht0(uintptr(unsafe.Pointer(&z64)))
prefetcht1(uintptr(unsafe.Pointer(&z64)))
prefetcht2(uintptr(unsafe.Pointer(&z64)))
prefetchnta(uintptr(unsafe.Pointer(&z64)))
if cas64(&z64, x64, 1) { if cas64(&z64, x64, 1) {
gothrow("cas64 failed") gothrow("cas64 failed")
} }
......
...@@ -231,3 +231,8 @@ func call536870912(fn, arg unsafe.Pointer, n, retoffset uint32) ...@@ -231,3 +231,8 @@ func call536870912(fn, arg unsafe.Pointer, n, retoffset uint32)
func call1073741824(fn, arg unsafe.Pointer, n, retoffset uint32) func call1073741824(fn, arg unsafe.Pointer, n, retoffset uint32)
func systemstack_switch() func systemstack_switch()
func prefetcht0(addr uintptr)
func prefetcht1(addr uintptr)
func prefetcht2(addr uintptr)
func prefetchnta(addr uintptr)
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