aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2025-02-22 23:26:21 +1100
committerJoel Sing <joel@sing.id.au>2025-02-27 03:45:44 -0800
commit927fdb7843ce96b42791912b42d0d3e6735e8dde (patch)
tree27ebbc2cf16f07ccb33f555d31327ce758e5bf4d /test/codegen/mathbits.go
parent01ba8bfe868df2eea10ea8dd5bfbe5af0549909d (diff)
downloadgo-927fdb7843ce96b42791912b42d0d3e6735e8dde.tar.xz
cmd/compile: simplify intrinsification of TrailingZeros16 and TrailingZeros8
Decompose Ctz16 and Ctz8 within the SSA rules for LOONG64, MIPS, PPC64 and S390X, rather than having a custom intrinsic. Note that for PPC64 this actually allows the existing Ctz16 and Ctz8 rules to be used. Change-Id: I27a5e978f852b9d75396d2a80f5d7dfcb5ef7dd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/651816 Reviewed-by: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index baed4f7c67..78556c636f 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -409,7 +409,7 @@ func TrailingZeros16(n uint16) int {
// arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t"
// loong64:"CTZV"
// s390x:"FLOGR","OR\t\\$65536"
- // ppc64x/power8:"POPCNTD","ORIS\\t\\$1"
+ // ppc64x/power8:"POPCNTW","ADD\t\\$-1"
// ppc64x/power9:"CNTTZD","ORIS\\t\\$1"
// wasm:"I64Ctz"
return bits.TrailingZeros16(n)
@@ -421,6 +421,8 @@ func TrailingZeros8(n uint8) int {
// arm:"ORR\t\\$256","CLZ",-"MOVBU\tR"
// arm64:"ORR\t\\$256","RBITW","CLZW",-"MOVBU\tR",-"RBIT\t",-"CLZ\t"
// loong64:"CTZV"
+ // ppc64x/power8:"POPCNTB","ADD\t\\$-1"
+ // ppc64x/power9:"CNTTZD","OR\t\\$256"
// s390x:"FLOGR","OR\t\\$256"
// wasm:"I64Ctz"
return bits.TrailingZeros8(n)