pos: []string{"\tBTQ\t\\$60"},
},
// Intrinsic tests for math/bits
- {
- fn: `
- func f41(a uint64) int {
- return bits.TrailingZeros64(a)
- }
- `,
- pos: []string{"\tBSFQ\t", "\tMOVL\t\\$64,", "\tCMOVQEQ\t"},
- },
- {
- fn: `
- func f42(a uint32) int {
- return bits.TrailingZeros32(a)
- }
- `,
- pos: []string{"\tBSFQ\t", "\tORQ\t[^$]", "\tMOVQ\t\\$4294967296,"},
- },
- {
- fn: `
- func f43(a uint16) int {
- return bits.TrailingZeros16(a)
- }
- `,
- pos: []string{"\tBSFQ\t", "\tORQ\t\\$65536,"},
- },
- {
- fn: `
- func f44(a uint8) int {
- return bits.TrailingZeros8(a)
- }
- `,
- pos: []string{"\tBSFQ\t", "\tORQ\t\\$256,"},
- },
{
fn: `
func f45(a uint64) uint64 {
pos: []string{"\tFMSUBS\t"},
},
// Intrinsic tests for math/bits
- {
- fn: `
- func f18(a uint64) int {
- return bits.TrailingZeros64(a)
- }
- `,
- pos: []string{"\tFLOGR\t"},
- },
- {
- fn: `
- func f19(a uint32) int {
- return bits.TrailingZeros32(a)
- }
- `,
- pos: []string{"\tFLOGR\t", "\tMOVWZ\t"},
- },
- {
- fn: `
- func f20(a uint16) int {
- return bits.TrailingZeros16(a)
- }
- `,
- pos: []string{"\tFLOGR\t", "\tOR\t\\$65536,"},
- },
- {
- fn: `
- func f21(a uint8) int {
- return bits.TrailingZeros8(a)
- }
- `,
- pos: []string{"\tFLOGR\t", "\tOR\t\\$256,"},
- },
- // Intrinsic tests for math/bits
{
fn: `
func f22(a uint64) uint64 {
//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)
+}