]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: fix PrefetchStreamed builtin implementation on PPC64
authorArchana R <aravind5@in.ibm.com>
Mon, 7 Mar 2022 07:54:14 +0000 (01:54 -0600)
committerPaul Murphy <murp@ibm.com>
Tue, 15 Mar 2022 15:12:55 +0000 (15:12 +0000)
This CL fixes encoding of PrefetchStreamed on PPC64 to be consistent
with what is implemented on AMD64 and ARM64 platforms which is
prefetchNTA (prefetch non-temporal access). Looking at the definition
of prefetchNTA, the closest corresponding Touch hint (TH) value to be
used on PPC64 is 16 that states that the address is accessed in a
transient manner. Current usage of TH=8 may cause degraded
performance.

Change-Id: I393bf5a9b971a22f632b3cbfb4fa659062af9a27
Reviewed-on: https://go-review.googlesource.com/c/go/+/390316
Reviewed-by: Paul Murphy <murp@ibm.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/compile/internal/ssa/gen/PPC64.rules
src/cmd/compile/internal/ssa/rewritePPC64.go

index c3f07a4e22cf3929a4af63e5a7482d70d7aafa60..eb9fe3cf72339feb5f8d7a0ef5359290ba4c37f7 100644 (file)
         && clobber(call)
         => (Move [sz] dst src mem)
 
-// Prefetch instructions (aux is option: 0 - DCBT ; 8 - DCBT stream)
+// Prefetch instructions (TH specified using aux field)
+// For DCBT Ra,Rb,TH, A value of TH indicates:
+//     0, hint this cache line will be used soon. (PrefetchCache)
+//     16, hint this cache line will not be used for long. (PrefetchCacheStreamed)
+// See ISA 3.0 Book II 4.3.2 for more detail. https://openpower.foundation/specifications/isa/
 (PrefetchCache ptr mem)          => (DCBT ptr mem [0])
-(PrefetchCacheStreamed ptr mem)  => (DCBT ptr mem [8])
+(PrefetchCacheStreamed ptr mem)  => (DCBT ptr mem [16])
 
index 7592b4f50582405812ba82999ed599e8e3a43cce..5da6d9641cee317f0ce0655b7effb0f171ba1a25 100644 (file)
@@ -14140,12 +14140,12 @@ func rewriteValuePPC64_OpPrefetchCacheStreamed(v *Value) bool {
        v_1 := v.Args[1]
        v_0 := v.Args[0]
        // match: (PrefetchCacheStreamed ptr mem)
-       // result: (DCBT ptr mem [8])
+       // result: (DCBT ptr mem [16])
        for {
                ptr := v_0
                mem := v_1
                v.reset(OpPPC64DCBT)
-               v.AuxInt = int64ToAuxInt(8)
+               v.AuxInt = int64ToAuxInt(16)
                v.AddArg2(ptr, mem)
                return true
        }