Commit 9f8ecd75 authored by Keith Randall's avatar Keith Randall

cmd/compile: use SSA tests on legacy compiler

Why not?  Because the 386 backend can't handle one of them.
But other than that, it should work.

Change-Id: Iaeb9735f8c3c281136a0734376dec5ddba21be3b
Reviewed-on: https://go-review.googlesource.com/22748
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarDavid Chase <drchase@google.com>
parent 9dee7771
...@@ -23,9 +23,6 @@ func buildTest(t *testing.T, filename string) { ...@@ -23,9 +23,6 @@ func buildTest(t *testing.T, filename string) {
doTest(t, filename, "build") doTest(t, filename, "build")
} }
func doTest(t *testing.T, filename string, kind string) { func doTest(t *testing.T, filename string, kind string) {
if runtime.GOARCH != "amd64" {
t.Skipf("skipping SSA tests on %s for now", runtime.GOARCH)
}
testenv.MustHaveGoBuild(t) testenv.MustHaveGoBuild(t)
var stdout, stderr bytes.Buffer var stdout, stderr bytes.Buffer
cmd := exec.Command("go", kind, filepath.Join("testdata", filename)) cmd := exec.Command("go", kind, filepath.Join("testdata", filename))
...@@ -52,7 +49,12 @@ func TestBreakContinue(t *testing.T) { runTest(t, "break_ssa.go") } ...@@ -52,7 +49,12 @@ func TestBreakContinue(t *testing.T) { runTest(t, "break_ssa.go") }
func TestTypeAssertion(t *testing.T) { runTest(t, "assert_ssa.go") } func TestTypeAssertion(t *testing.T) { runTest(t, "assert_ssa.go") }
// TestArithmetic tests that both backends have the same result for arithmetic expressions. // TestArithmetic tests that both backends have the same result for arithmetic expressions.
func TestArithmetic(t *testing.T) { runTest(t, "arith_ssa.go") } func TestArithmetic(t *testing.T) {
if runtime.GOARCH == "386" {
t.Skip("legacy 386 compiler can't handle this test")
}
runTest(t, "arith_ssa.go")
}
// TestFP tests that both backends have the same result for floating point expressions. // TestFP tests that both backends have the same result for floating point expressions.
func TestFP(t *testing.T) { runTest(t, "fp_ssa.go") } func TestFP(t *testing.T) { runTest(t, "fp_ssa.go") }
......
...@@ -179,7 +179,7 @@ func lsh_1_uint64_ssa(a uint64) uint64 { ...@@ -179,7 +179,7 @@ func lsh_1_uint64_ssa(a uint64) uint64 {
//go:noinline //go:noinline
func lsh_uint64_4294967296_ssa(a uint64) uint64 { func lsh_uint64_4294967296_ssa(a uint64) uint64 {
return a << 4294967296 return a << uint64(4294967296)
} }
//go:noinline //go:noinline
...@@ -189,7 +189,7 @@ func lsh_4294967296_uint64_ssa(a uint64) uint64 { ...@@ -189,7 +189,7 @@ func lsh_4294967296_uint64_ssa(a uint64) uint64 {
//go:noinline //go:noinline
func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 { func lsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a << 18446744073709551615 return a << uint64(18446744073709551615)
} }
//go:noinline //go:noinline
...@@ -219,7 +219,7 @@ func rsh_1_uint64_ssa(a uint64) uint64 { ...@@ -219,7 +219,7 @@ func rsh_1_uint64_ssa(a uint64) uint64 {
//go:noinline //go:noinline
func rsh_uint64_4294967296_ssa(a uint64) uint64 { func rsh_uint64_4294967296_ssa(a uint64) uint64 {
return a >> 4294967296 return a >> uint64(4294967296)
} }
//go:noinline //go:noinline
...@@ -229,7 +229,7 @@ func rsh_4294967296_uint64_ssa(a uint64) uint64 { ...@@ -229,7 +229,7 @@ func rsh_4294967296_uint64_ssa(a uint64) uint64 {
//go:noinline //go:noinline
func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 { func rsh_uint64_18446744073709551615_ssa(a uint64) uint64 {
return a >> 18446744073709551615 return a >> uint64(18446744073709551615)
} }
//go:noinline //go:noinline
......
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