aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2018-03-06 09:39:14 +0100
committerAlberto Donizetti <alb.donizetti@gmail.com>2018-03-06 11:48:37 +0000
commit85dcc709a8523877063b05c6806631c7f47e99ab (patch)
tree0597d898c38d69be320a4fed84ae8e3a72d98948 /test/codegen/mathbits.go
parentdf8c2b905b5fb9d6cae9729a81c8f2c5034efe34 (diff)
downloadgo-85dcc709a8523877063b05c6806631c7f47e99ab.tar.xz
test/codegen: port math/bits.TrailingZeros tests to codegen
And remove them from ssa_test. Change-Id: Ib5de5c0d908f23915e0847eca338cacf2fa5325b Reviewed-on: https://go-review.googlesource.com/98795 Reviewed-by: Giovanni Bajo <rasky@develer.com>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index 98ee8f2a0b..f930046a3b 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -95,3 +95,37 @@ func Len8(n uint8) int {
//mips:"CLZ"
return bits.Len8(n)
}
+
+// ------------------------ //
+// bits.TrailingZeros //
+// ------------------------ //
+
+func TrailingZeros(n uint) int {
+ //amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
+ //s390x:"FLOGR"
+ return bits.TrailingZeros(n)
+}
+
+func TrailingZeros64(n uint64) int {
+ //amd64:"BSFQ","MOVL\t\\$64","CMOVQEQ"
+ //s390x:"FLOGR"
+ return bits.TrailingZeros64(n)
+}
+
+func TrailingZeros32(n uint32) int {
+ //amd64:"MOVQ\t\\$4294967296","ORQ\t[^$]","BSFQ"
+ //s390x:"FLOGR","MOVWZ"
+ return bits.TrailingZeros32(n)
+}
+
+func TrailingZeros16(n uint16) int {
+ //amd64:"BSFQ","ORQ\t\\$65536"
+ //s390x:"FLOGR","OR\t\\$65536"
+ return bits.TrailingZeros16(n)
+}
+
+func TrailingZeros8(n uint8) int {
+ //amd64:"BSFQ","ORQ\t\\$256"
+ //s390x:"FLOGR","OR\t\\$256"
+ return bits.TrailingZeros8(n)
+}