Commit 85dcc709 authored by Alberto Donizetti's avatar Alberto Donizetti

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/98795Reviewed-by: 's avatarGiovanni Bajo <rasky@develer.com>
parent df8c2b90
......@@ -523,38 +523,6 @@ var linuxAMD64Tests = []*asmTest{
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 {
......@@ -1230,39 +1198,6 @@ var linuxS390XTests = []*asmTest{
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 {
......
......@@ -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)
}
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