diff options
| author | Cherry Zhang <cherryyz@google.com> | 2021-04-12 14:00:49 -0400 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2021-04-12 21:59:59 +0000 |
| commit | 263e13d1f7d2d13782c5a63799c9979b9bbfd853 (patch) | |
| tree | 89e7f58b299069d76560c06899fd6a887772bebd /test/codegen/comparisons.go | |
| parent | 3d5e3a15f65f1dd622c87ffba58914c877c8112c (diff) | |
| download | go-263e13d1f7d2d13782c5a63799c9979b9bbfd853.tar.xz | |
test: make codegen tests work with both ABIs
Some codegen tests were written with the assumption that
arguments and results are in memory, and with a specific stack
layout. With the register ABI, the assumption is no longer true.
Adjust the tests to work with both cases.
- For tests expecting in memory arguments/results, change to use
global variables or memory-assigned argument/results.
- Allow more registers. E.g. some tests expecting register names
contain only letters (e.g. AX), but it can also contain numbers
(e.g. R10).
- Some instruction selection changes when operate on register vs.
memory, e.g. ADDQ vs. LEAQ, MOVB vs. MOVL. Accept both.
TODO: mathbits.go and memops.go still need fix.
Change-Id: Ic5932b4b5dd3f5d30ed078d296476b641420c4c5
Reviewed-on: https://go-review.googlesource.com/c/go/+/309335
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'test/codegen/comparisons.go')
| -rw-r--r-- | test/codegen/comparisons.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/test/codegen/comparisons.go b/test/codegen/comparisons.go index 719063cdc3..17dcd94ae1 100644 --- a/test/codegen/comparisons.go +++ b/test/codegen/comparisons.go @@ -90,9 +90,11 @@ func CompareArray6(a, b unsafe.Pointer) bool { // Test that LEAQ/ADDQconst are folded into SETx ops -func CmpFold(x uint32) bool { - // amd64:`SETHI\t.*\(SP\)` - return x > 4 +var r bool + +func CmpFold(x uint32) { + // amd64:`SETHI\t.*\(SB\)` + r = x > 4 } // Test that direct comparisons with memory are generated when |
