mirror of
https://github.com/golang/go.git
synced 2025-10-30 16:20:58 +00:00
test: port bits.Len intrinsics tests to the new codegen harness
This change move bits.Len* intrinsification tests to the new codegen test harness, removing them from the old ssa_test file. Five different test functions (one for each bit.Len function tested) was used, to avoid possible unwanted interactions between multiple calls inside one function. Change-Id: Iffd5be55b58e88597fa30a562a28dacb01236d8b Reviewed-on: https://go-review.googlesource.com/98156 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Giovanni Bajo <rasky@develer.com>
This commit is contained in:
parent
63bcabed49
commit
c1806906d8
2 changed files with 53 additions and 202 deletions
|
|
@ -580,48 +580,6 @@ var linuxAMD64Tests = []*asmTest{
|
|||
`,
|
||||
pos: []string{"\tROLW\t\\$8,"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f48(a uint64) int {
|
||||
return bits.Len64(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tBSRQ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f49(a uint32) int {
|
||||
return bits.Len32(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tBSRQ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f50(a uint16) int {
|
||||
return bits.Len16(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tBSRQ\t"},
|
||||
},
|
||||
/* see ssa.go
|
||||
{
|
||||
fn:`
|
||||
func f51(a uint8) int {
|
||||
return bits.Len8(a)
|
||||
}
|
||||
`,
|
||||
pos:[]string{"\tBSRQ\t"},
|
||||
},
|
||||
*/
|
||||
{
|
||||
fn: `
|
||||
func f52(a uint) int {
|
||||
return bits.Len(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tBSRQ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f53(a uint64) int {
|
||||
|
|
@ -1364,46 +1322,6 @@ var linuxS390XTests = []*asmTest{
|
|||
`,
|
||||
pos: []string{"\tMOVWBR\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f24(a uint64) int {
|
||||
return bits.Len64(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tFLOGR\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f25(a uint32) int {
|
||||
return bits.Len32(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tFLOGR\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f26(a uint16) int {
|
||||
return bits.Len16(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tFLOGR\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f27(a uint8) int {
|
||||
return bits.Len8(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tFLOGR\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f28(a uint) int {
|
||||
return bits.Len(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tFLOGR\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f29(a uint64) int {
|
||||
|
|
@ -1501,46 +1419,6 @@ var linuxARMTests = []*asmTest{
|
|||
`,
|
||||
pos: []string{"\tMOVW\tR[0-9]+@>25,"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f3(a uint64) int {
|
||||
return bits.Len64(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f4(a uint32) int {
|
||||
return bits.Len32(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f5(a uint16) int {
|
||||
return bits.Len16(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f6(a uint8) int {
|
||||
return bits.Len8(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f7(a uint) int {
|
||||
return bits.Len(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f8(a uint64) int {
|
||||
|
|
@ -1715,46 +1593,6 @@ var linuxARM64Tests = []*asmTest{
|
|||
`,
|
||||
pos: []string{"\tREVW\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f24(a uint64) int {
|
||||
return bits.Len64(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f25(a uint32) int {
|
||||
return bits.Len32(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f26(a uint16) int {
|
||||
return bits.Len16(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f27(a uint8) int {
|
||||
return bits.Len8(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f28(a uint) int {
|
||||
return bits.Len(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f29(a uint64) int {
|
||||
|
|
@ -2177,46 +2015,6 @@ var linuxARM64Tests = []*asmTest{
|
|||
|
||||
var linuxMIPSTests = []*asmTest{
|
||||
// Intrinsic tests for math/bits
|
||||
{
|
||||
fn: `
|
||||
func f0(a uint64) int {
|
||||
return bits.Len64(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f1(a uint32) int {
|
||||
return bits.Len32(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f2(a uint16) int {
|
||||
return bits.Len16(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f3(a uint8) int {
|
||||
return bits.Len8(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f4(a uint) int {
|
||||
return bits.Len(a)
|
||||
}
|
||||
`,
|
||||
pos: []string{"\tCLZ\t"},
|
||||
},
|
||||
{
|
||||
fn: `
|
||||
func f5(a uint64) int {
|
||||
|
|
|
|||
53
test/codegen/mathbits.go
Normal file
53
test/codegen/mathbits.go
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// asmcheck
|
||||
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package codegen
|
||||
|
||||
import "math/bits"
|
||||
|
||||
// --------------- //
|
||||
// bits.Len* //
|
||||
// --------------- //
|
||||
|
||||
func Len(n uint) int {
|
||||
//amd64:"BSRQ"
|
||||
//s390x:"FLOGR"
|
||||
//arm:"CLZ" arm64:"CLZ"
|
||||
//mips:"CLZ"
|
||||
return bits.Len(n)
|
||||
}
|
||||
|
||||
func Len64(n uint64) int {
|
||||
//amd64:"BSRQ"
|
||||
//s390x:"FLOGR"
|
||||
//arm:"CLZ" arm64:"CLZ"
|
||||
//mips:"CLZ"
|
||||
return bits.Len64(n)
|
||||
}
|
||||
|
||||
func Len32(n uint32) int {
|
||||
//amd64:"BSRQ"
|
||||
//s390x:"FLOGR"
|
||||
//arm:"CLZ" arm64:"CLZ"
|
||||
//mips:"CLZ"
|
||||
return bits.Len32(n)
|
||||
}
|
||||
|
||||
func Len16(n uint16) int {
|
||||
//amd64:"BSRQ"
|
||||
//s390x:"FLOGR"
|
||||
//arm:"CLZ" arm64:"CLZ"
|
||||
//mips:"CLZ"
|
||||
return bits.Len16(n)
|
||||
}
|
||||
|
||||
func Len8(n uint8) int {
|
||||
//amd64 Len8 not intrisified
|
||||
//s390x:"FLOGR"
|
||||
//arm:"CLZ" arm64:"CLZ"
|
||||
//mips:"CLZ"
|
||||
return bits.Len8(n)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue