Commit d5ff631e authored by Alberto Donizetti's avatar Alberto Donizetti

test/codegen: port last remaining misc bit/arithmetic tests

And delete them from asm_test.

Change-Id: I9a75efe9858ef9d7ac86065f860c2ae3f25b0941
Reviewed-on: https://go-review.googlesource.com/105597Reviewed-by: default avatarDaniel Martí <mvdan@mvdan.cc>
parent 49ed4cbe
...@@ -238,11 +238,6 @@ var allAsmTests = []*asmTests{ ...@@ -238,11 +238,6 @@ var allAsmTests = []*asmTests{
os: "linux", os: "linux",
tests: linuxARM64Tests, tests: linuxARM64Tests,
}, },
{
arch: "mips64",
os: "linux",
tests: linuxMIPS64Tests,
},
{ {
arch: "amd64", arch: "amd64",
os: "plan9", os: "plan9",
...@@ -251,14 +246,6 @@ var allAsmTests = []*asmTests{ ...@@ -251,14 +246,6 @@ var allAsmTests = []*asmTests{
} }
var linuxAMD64Tests = []*asmTest{ var linuxAMD64Tests = []*asmTest{
{
fn: `
func $(x int) int {
return x * 96
}
`,
pos: []string{"\tSHLQ\t\\$5,", "\tLEAQ\t\\(.*\\)\\(.*\\*2\\),"},
},
{ {
// make sure assembly output has matching offset and base register. // make sure assembly output has matching offset and base register.
fn: ` fn: `
...@@ -339,17 +326,6 @@ var linuxARM64Tests = []*asmTest{ ...@@ -339,17 +326,6 @@ var linuxARM64Tests = []*asmTest{
`, `,
pos: []string{"\tAND\t"}, pos: []string{"\tAND\t"},
}, },
{
// check that we don't emit comparisons for constant shift
fn: `
//go:nosplit
func $(x int) int {
return x << 17
}
`,
pos: []string{"LSL\t\\$17"},
neg: []string{"CMP"},
},
// Load-combining tests. // Load-combining tests.
{ {
fn: ` fn: `
...@@ -375,19 +351,6 @@ var linuxARM64Tests = []*asmTest{ ...@@ -375,19 +351,6 @@ var linuxARM64Tests = []*asmTest{
}, },
} }
var linuxMIPS64Tests = []*asmTest{
{
// check that we don't emit comparisons for constant shift
fn: `
func $(x int) int {
return x << 17
}
`,
pos: []string{"SLLV\t\\$17"},
neg: []string{"SGT"},
},
}
var plan9AMD64Tests = []*asmTest{ var plan9AMD64Tests = []*asmTest{
// We should make sure that the compiler doesn't generate floating point // We should make sure that the compiler doesn't generate floating point
// instructions for non-float operations on Plan 9, because floating point // instructions for non-float operations on Plan 9, because floating point
......
...@@ -30,6 +30,11 @@ func Pow2Muls(n1, n2 int) (int, int) { ...@@ -30,6 +30,11 @@ func Pow2Muls(n1, n2 int) (int, int) {
return a, b return a, b
} }
func Mul_96(n int) int {
// amd64:`SHLQ\t[$]5`,`LEAQ\t\(.*\)\(.*\*2\),`
return n * 96
}
// Multiplications merging tests // Multiplications merging tests
func MergeMuls1(n int) int { func MergeMuls1(n int) int {
......
...@@ -222,3 +222,11 @@ func ubfx11(x uint64) uint64 { ...@@ -222,3 +222,11 @@ func ubfx11(x uint64) uint64 {
// arm64:"UBFX\t[$]1, R[0-9]+, [$]19",-"LSL",-"LSR" // arm64:"UBFX\t[$]1, R[0-9]+, [$]19",-"LSL",-"LSR"
return ((x & 0xfffff) << 3) >> 4 return ((x & 0xfffff) << 3) >> 4
} }
// Check that we don't emit comparisons for constant shifts.
//go:nosplit
func shift_no_cmp(x int) int {
// arm64:`LSL\t[$]17`,-`CMP`
// mips64:`SLLV\t[$]17`,-`SGT`
return x << 17
}
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