aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorCarlos Eduardo Seo <cseo@linux.vnet.ibm.com>2019-02-08 16:18:12 -0200
committerCarlos Eduardo Seo <cseo@linux.vnet.ibm.com>2019-03-20 20:27:00 +0000
commit3023d7da49cad1a6fae4684d1b9313c51a4085d4 (patch)
tree5360e2a9e92ca4c2b632054b986bd5562c8bfc24 /test/codegen/mathbits.go
parent23b476a3c8b5d915c4b50957a0f3935a40261eac (diff)
downloadgo-3023d7da49cad1a6fae4684d1b9313c51a4085d4.tar.xz
cmd/compile/internal, cmd/internal/obj/ppc64: generate new count trailing zeros instructions on POWER9
This change adds new POWER9 instructions for counting trailing zeros (CNTTZW/CNTTZD) to the assembler and generates them in SSA when GOPPC64=power9. name old time/op new time/op delta TrailingZeros-160 1.59ns ±20% 1.45ns ±10% -8.81% (p=0.000 n=14+13) TrailingZeros8-160 1.55ns ±23% 1.62ns ±44% ~ (p=0.593 n=13+15) TrailingZeros16-160 1.78ns ±23% 1.62ns ±38% -9.31% (p=0.003 n=14+14) TrailingZeros32-160 1.64ns ±10% 1.49ns ± 9% -9.15% (p=0.000 n=13+14) TrailingZeros64-160 1.53ns ± 6% 1.45ns ± 5% -5.38% (p=0.000 n=15+13) Change-Id: I365e6ff79f3ce4d8ebe089a6a86b1771853eb596 Reviewed-on: https://go-review.googlesource.com/c/go/+/167517 Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index 9a3b00cab7..5c541bfd29 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -261,8 +261,10 @@ func TrailingZeros(n uint) int {
// arm:"CLZ"
// arm64:"RBIT","CLZ"
// s390x:"FLOGR"
- // ppc64:"ANDN","POPCNTD"
- // ppc64le:"ANDN","POPCNTD"
+ // ppc64/power8:"ANDN","POPCNTD"
+ // ppc64le/power8:"ANDN","POPCNTD"
+ // ppc64/power9: "CNTTZD"
+ // ppc64le/power9: "CNTTZD"
// wasm:"I64Ctz"
return bits.TrailingZeros(n)
}
@@ -271,8 +273,10 @@ func TrailingZeros64(n uint64) int {
// amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
// arm64:"RBIT","CLZ"
// s390x:"FLOGR"
- // ppc64:"ANDN","POPCNTD"
- // ppc64le:"ANDN","POPCNTD"
+ // ppc64/power8:"ANDN","POPCNTD"
+ // ppc64le/power8:"ANDN","POPCNTD"
+ // ppc64/power9: "CNTTZD"
+ // ppc64le/power9: "CNTTZD"
// wasm:"I64Ctz"
return bits.TrailingZeros64(n)
}
@@ -282,8 +286,10 @@ func TrailingZeros32(n uint32) int {
// arm:"CLZ"
// arm64:"RBITW","CLZW"
// s390x:"FLOGR","MOVWZ"
- // ppc64:"ANDN","POPCNTW"
- // ppc64le:"ANDN","POPCNTW"
+ // ppc64/power8:"ANDN","POPCNTW"
+ // ppc64le/power8:"ANDN","POPCNTW"
+ // ppc64/power9: "CNTTZW"
+ // ppc64le/power9: "CNTTZW"
// wasm:"I64Ctz"
return bits.TrailingZeros32(n)
}
@@ -293,8 +299,10 @@ func TrailingZeros16(n uint16) int {
// arm:"ORR\t\\$65536","CLZ",-"MOVHU\tR"
// arm64:"ORR\t\\$65536","RBITW","CLZW",-"MOVHU\tR",-"RBIT\t",-"CLZ\t"
// s390x:"FLOGR","OR\t\\$65536"
- // ppc64:"POPCNTD","OR\\t\\$65536"
- // ppc64le:"POPCNTD","OR\\t\\$65536"
+ // ppc64/power8:"POPCNTD","OR\\t\\$65536"
+ // ppc64le/power8:"POPCNTD","OR\\t\\$65536"
+ // ppc64/power9:"CNTTZD","OR\\t\\$65536"
+ // ppc64le/power9:"CNTTZD","OR\\t\\$65536"
// wasm:"I64Ctz"
return bits.TrailingZeros16(n)
}