Commit 7c96d87e authored by Alberto Donizetti's avatar Alberto Donizetti

test/codegen: test ppc64 TrailingZeros, OnesCount codegen

This change adds codegen tests for the intrinsification on ppc64 of
the OnesCount{64,32,16,8}, and TrailingZeros{64,32,16,8} math/bits
functions.

Change-Id: Id3364921fbd18316850e15c8c71330c906187fdb
Reviewed-on: https://go-review.googlesource.com/c/141897Reviewed-by: default avatarLynn Boger <laboger@linux.vnet.ibm.com>
parent a55f3ee4
...@@ -104,6 +104,7 @@ func OnesCount(n uint) int { ...@@ -104,6 +104,7 @@ func OnesCount(n uint) int {
// amd64:"POPCNTQ",".*support_popcnt" // amd64:"POPCNTQ",".*support_popcnt"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT","VUADDLV"
// s390x:"POPCNT" // s390x:"POPCNT"
// ppc64:"POPCNTD"
return bits.OnesCount(n) return bits.OnesCount(n)
} }
...@@ -111,6 +112,7 @@ func OnesCount64(n uint64) int { ...@@ -111,6 +112,7 @@ func OnesCount64(n uint64) int {
// amd64:"POPCNTQ",".*support_popcnt" // amd64:"POPCNTQ",".*support_popcnt"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT","VUADDLV"
// s390x:"POPCNT" // s390x:"POPCNT"
// ppc64:"POPCNTD"
return bits.OnesCount64(n) return bits.OnesCount64(n)
} }
...@@ -118,6 +120,7 @@ func OnesCount32(n uint32) int { ...@@ -118,6 +120,7 @@ func OnesCount32(n uint32) int {
// amd64:"POPCNTL",".*support_popcnt" // amd64:"POPCNTL",".*support_popcnt"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT","VUADDLV"
// s390x:"POPCNT" // s390x:"POPCNT"
// ppc64:"POPCNTW"
return bits.OnesCount32(n) return bits.OnesCount32(n)
} }
...@@ -125,11 +128,13 @@ func OnesCount16(n uint16) int { ...@@ -125,11 +128,13 @@ func OnesCount16(n uint16) int {
// amd64:"POPCNTL",".*support_popcnt" // amd64:"POPCNTL",".*support_popcnt"
// arm64:"VCNT","VUADDLV" // arm64:"VCNT","VUADDLV"
// s390x:"POPCNT" // s390x:"POPCNT"
// ppc64:"POPCNTW"
return bits.OnesCount16(n) return bits.OnesCount16(n)
} }
func OnesCount8(n uint8) int { func OnesCount8(n uint8) int {
// s390x:"POPCNT" // s390x:"POPCNT"
// ppc64:"POPCNTB"
return bits.OnesCount8(n) return bits.OnesCount8(n)
} }
...@@ -224,24 +229,28 @@ func RotateLeftVariable32(n uint32, m int) uint32 { ...@@ -224,24 +229,28 @@ func RotateLeftVariable32(n uint32, m int) uint32 {
func TrailingZeros(n uint) int { func TrailingZeros(n uint) int {
// amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ" // amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
// s390x:"FLOGR" // s390x:"FLOGR"
// ppc64:"ANDN","POPCNTD"
return bits.TrailingZeros(n) return bits.TrailingZeros(n)
} }
func TrailingZeros64(n uint64) int { func TrailingZeros64(n uint64) int {
// amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ" // amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
// s390x:"FLOGR" // s390x:"FLOGR"
// ppc64:"ANDN","POPCNTD"
return bits.TrailingZeros64(n) return bits.TrailingZeros64(n)
} }
func TrailingZeros32(n uint32) int { func TrailingZeros32(n uint32) int {
// amd64:"BTSQ\\t\\$32","BSFQ" // amd64:"BTSQ\\t\\$32","BSFQ"
// s390x:"FLOGR","MOVWZ" // s390x:"FLOGR","MOVWZ"
// ppc64:"ANDN","POPCNTW"
return bits.TrailingZeros32(n) return bits.TrailingZeros32(n)
} }
func TrailingZeros16(n uint16) int { func TrailingZeros16(n uint16) int {
// amd64:"BSFL","BTSL\\t\\$16" // amd64:"BSFL","BTSL\\t\\$16"
// s390x:"FLOGR","OR\t\\$65536" // s390x:"FLOGR","OR\t\\$65536"
// ppc64:"POPCNTD","OR\\t\\$65536"
return bits.TrailingZeros16(n) return bits.TrailingZeros16(n)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment