From 263e13d1f7d2d13782c5a63799c9979b9bbfd853 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Mon, 12 Apr 2021 14:00:49 -0400 Subject: 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 Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: David Chase --- test/codegen/arithmetic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/codegen/arithmetic.go') diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go index dea7e0ba61..a27a17f6e1 100644 --- a/test/codegen/arithmetic.go +++ b/test/codegen/arithmetic.go @@ -139,7 +139,7 @@ func MergeMuls1(n int) int { } func MergeMuls2(n int) int { - // amd64:"IMUL3Q\t[$]23","ADDQ\t[$]29" + // amd64:"IMUL3Q\t[$]23","(ADDQ\t[$]29)|(LEAQ\t29)" // 386:"IMUL3L\t[$]23","ADDL\t[$]29" return 5*n + 7*(n+1) + 11*(n+2) // 23n + 29 } -- cgit v1.2.1