aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2025-10-09 15:12:47 -0400
committerDavid Chase <drchase@google.com>2025-10-24 11:05:14 -0700
commitf6b47110952ea1c19cbdc040489c83f306c36e73 (patch)
tree3908c2f5819808800047aa08e886857979f76ca2 /test
parentcf7c1a4cbb917b6c5d80d1d9443a40cb7720db75 (diff)
downloadgo-f6b47110952ea1c19cbdc040489c83f306c36e73.tar.xz
[dev.simd] cmd/compile, simd: add rewrite to convert logical expression trees into TERNLOG instructions
includes tests of both rewrite application and rewrite correctness Change-Id: I7983ccf87a8408af95bb6c447cb22f01beda9f61 Reviewed-on: https://go-review.googlesource.com/c/go/+/710697 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/simd.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/simd.go b/test/simd.go
index b1695fa514..32ed70d39a 100644
--- a/test/simd.go
+++ b/test/simd.go
@@ -1,4 +1,4 @@
-// errorcheck -0 -d=ssa/cpufeatures/debug=1
+// errorcheck -0 -d=ssa/cpufeatures/debug=1,ssa/rewrite_tern/debug=1
//go:build goexperiment.simd && amd64
@@ -95,3 +95,13 @@ b:
c:
println("c")
}
+
+func ternRewrite(m, w, x, y, z simd.Int32x16) (t0, t1, t2 simd.Int32x16) {
+ if !simd.HasAVX512() { // ERROR "has features avx[+]avx2[+]avx512$"
+ return // ERROR "has features avx[+]avx2[+]avx512$" // all blocks have it because of the vector size
+ }
+ t0 = w.Xor(y).Xor(z) // ERROR "Rewriting.*ternInt"
+ t1 = m.And(w.Xor(y).Xor(z.Not())) // ERROR "Rewriting.*ternInt"
+ t2 = x.Xor(y).Xor(z).And(x.Xor(y).Xor(z.Not())) // ERROR "Rewriting.*ternInt"
+ return // ERROR "has features avx[+]avx2[+]avx512$"
+}