diff options
| author | Todd Neal <todd@tneal.org> | 2015-07-30 13:57:43 -0400 |
|---|---|---|
| committer | Todd Neal <todd@tneal.org> | 2015-07-30 19:39:20 +0000 |
| commit | 9271ecc8c62930e4cac73f9dfe8ef0b1bb97cee6 (patch) | |
| tree | 07887552252041626d37ab2c3ec737257b9efbdb /src/cmd/compile/internal/gc/testdata | |
| parent | 359747da15b0a933bab2d049ad00f1c4663701ee (diff) | |
| download | go-9271ecc8c62930e4cac73f9dfe8ef0b1bb97cee6.tar.xz | |
[dev.ssa] cmd/compile: fix SUBQ generation error
Fix code generation error that resulted in a multi-argument NEGQ
doasm: notfound ft=13 tt=13 00134 NEGQ AX, AX 13 13
Change-Id: I8b712d21a5523eccbae1f33ccea417844c27073e
Reviewed-on: https://go-review.googlesource.com/12869
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/gc/testdata')
| -rw-r--r-- | src/cmd/compile/internal/gc/testdata/arith_ssa.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/gc/testdata/arith_ssa.go b/src/cmd/compile/internal/gc/testdata/arith_ssa.go index 2731337dbf..3fd2fad457 100644 --- a/src/cmd/compile/internal/gc/testdata/arith_ssa.go +++ b/src/cmd/compile/internal/gc/testdata/arith_ssa.go @@ -75,6 +75,20 @@ func testBitwiseOr_ssa(a, b uint32) uint32 { return a | b } +// testSubqToNegq ensures that the SUBQ -> NEGQ translation works correctly. +func testSubqToNegq(a, b, c, d, e, f, g, h, i, j, k int64) { + want := a + 8207351403619448057 - b - 1779494519303207690 + c*8810076340510052032*d - 4465874067674546219 - e*4361839741470334295 - f + 8688847565426072650*g*8065564729145417479 + if got := testSubqToNegq_ssa(a, b, c, d, e, f, g, h, i, j, k); want != got { + println("testSubqToNegq failed, wanted", want, "got", got) + failed = true + } +} +func testSubqToNegq_ssa(a, b, c, d, e, f, g, h, i, j, k int64) int64 { + switch { // prevent inlining + } + return a + 8207351403619448057 - b - 1779494519303207690 + c*8810076340510052032*d - 4465874067674546219 - e*4361839741470334295 - f + 8688847565426072650*g*8065564729145417479 +} + var failed = false func main() { @@ -82,7 +96,7 @@ func main() { test64BitConstMult(1, 2) test64BitConstAdd(1, 2) testRegallocCVSpill(1, 2, 3, 4) - + testSubqToNegq(1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2) if failed { panic("failed") } |
