From: Archana R Date: Mon, 7 Mar 2022 07:54:14 +0000 (-0600) Subject: cmd/compile: fix PrefetchStreamed builtin implementation on PPC64 X-Git-Tag: go1.19beta1~1068 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7b15e297a26842f1f3408ee9d7942f8cfab2e5ea;p=gostls13.git cmd/compile: fix PrefetchStreamed builtin implementation on PPC64 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 Reviewed-by: Cherry Mui Run-TryBot: Cherry Mui TryBot-Result: Gopher Robot --- diff --git a/src/cmd/compile/internal/ssa/gen/PPC64.rules b/src/cmd/compile/internal/ssa/gen/PPC64.rules index c3f07a4e22..eb9fe3cf72 100644 --- a/src/cmd/compile/internal/ssa/gen/PPC64.rules +++ b/src/cmd/compile/internal/ssa/gen/PPC64.rules @@ -1479,7 +1479,11 @@ && 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]) diff --git a/src/cmd/compile/internal/ssa/rewritePPC64.go b/src/cmd/compile/internal/ssa/rewritePPC64.go index 7592b4f505..5da6d9641c 100644 --- a/src/cmd/compile/internal/ssa/rewritePPC64.go +++ b/src/cmd/compile/internal/ssa/rewritePPC64.go @@ -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 }