aboutsummaryrefslogtreecommitdiff
path: root/test/codegen/mathbits.go
diff options
context:
space:
mode:
authorAlberto Donizetti <alb.donizetti@gmail.com>2018-03-05 19:46:18 +0100
committerAlberto Donizetti <alb.donizetti@gmail.com>2018-03-05 19:52:04 +0000
commit83e41b3e76cb1e9033e6b2860e5f6cab5330dd23 (patch)
tree9df596b1f730a99a8ea7a46e87dc6c040bab61da /test/codegen/mathbits.go
parent7178267b59b238a40fcf839a31264b2e65fa6f70 (diff)
downloadgo-83e41b3e76cb1e9033e6b2860e5f6cab5330dd23.tar.xz
test/codegen: port math/bits.Leadingzero tests to codegen
Change-Id: Ic21d25db5d56ce77516c53082dfbc010e5875b81 Reviewed-on: https://go-review.googlesource.com/98655 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen/mathbits.go')
-rw-r--r--test/codegen/mathbits.go46
1 files changed, 45 insertions, 1 deletions
diff --git a/test/codegen/mathbits.go b/test/codegen/mathbits.go
index 02552e1fdb..98ee8f2a0b 100644
--- a/test/codegen/mathbits.go
+++ b/test/codegen/mathbits.go
@@ -8,6 +8,50 @@ package codegen
import "math/bits"
+// ----------------------- //
+// bits.LeadingZeros //
+// ----------------------- //
+
+func LeadingZeros(n uint) int {
+ //amd64:"BSRQ"
+ //s390x:"FLOGR"
+ //arm:"CLZ" arm64:"CLZ"
+ //mips:"CLZ"
+ return bits.LeadingZeros(n)
+}
+
+func LeadingZeros64(n uint64) int {
+ //amd64:"BSRQ"
+ //s390x:"FLOGR"
+ //arm:"CLZ" arm64:"CLZ"
+ //mips:"CLZ"
+ return bits.LeadingZeros64(n)
+}
+
+func LeadingZeros32(n uint32) int {
+ //amd64:"BSRQ"
+ //s390x:"FLOGR"
+ //arm:"CLZ" arm64:"CLZ"
+ //mips:"CLZ"
+ return bits.LeadingZeros32(n)
+}
+
+func LeadingZeros16(n uint16) int {
+ //amd64:"BSRQ"
+ //s390x:"FLOGR"
+ //arm:"CLZ" arm64:"CLZ"
+ //mips:"CLZ"
+ return bits.LeadingZeros16(n)
+}
+
+func LeadingZeros8(n uint8) int {
+ //amd64 LeadingZeros8 not intrinsified (see ssa.go)
+ //s390x:"FLOGR"
+ //arm:"CLZ" arm64:"CLZ"
+ //mips:"CLZ"
+ return bits.LeadingZeros8(n)
+}
+
// --------------- //
// bits.Len* //
// --------------- //
@@ -45,7 +89,7 @@ func Len16(n uint16) int {
}
func Len8(n uint8) int {
- //amd64 Len8 not intrisified
+ //amd64 Len8 not intrisified (see ssa.go)
//s390x:"FLOGR"
//arm:"CLZ" arm64:"CLZ"
//mips:"CLZ"