diff options
author | Keith Randall <khr@golang.org> | 2020-03-19 17:48:42 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2020-04-01 17:03:26 +0000 |
commit | bba88467f86472764a656e61f5f3265ed6853692 (patch) | |
tree | f273d22b7653968840064691453760107989cf01 /test/codegen | |
parent | 7ffbea9fd838be851c287b2a21ee6ce1e2776b54 (diff) | |
download | go-bba88467f86472764a656e61f5f3265ed6853692.tar.gz go-bba88467f86472764a656e61f5f3265ed6853692.zip |
cmd/compile: add indexed-load CMP instructions
Things like CMPQ 4(AX)(BX*8), CX
Fixes #37955
Change-Id: Icbed430f65c91a0e3f38a633d8321d79433ad8b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/224219
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r-- | test/codegen/memops.go | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/codegen/memops.go b/test/codegen/memops.go index 0df191480d..bf5ffb6c4f 100644 --- a/test/codegen/memops.go +++ b/test/codegen/memops.go @@ -243,3 +243,63 @@ func idxStorePlusOp(x []int32, i int, v int32) { // 386: `XORL\t[$]77, 36\([A-Z]+\)\([A-Z]+\*4\)` x[i+9] ^= 77 } + +func idxCompare(i int) int { + // amd64: `CMPB\t1\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), [A-Z]+[0-9]*` + if x8[i+1] < x8[0] { + return 0 + } + // amd64: `CMPW\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), [A-Z]+[0-9]*` + if x16[i+1] < x16[0] { + return 0 + } + // amd64: `CMPW\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), [A-Z]+[0-9]*` + if x16[16*i+1] < x16[0] { + return 0 + } + // amd64: `CMPL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), [A-Z]+[0-9]*` + if x32[i+1] < x32[0] { + return 0 + } + // amd64: `CMPL\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), [A-Z]+[0-9]*` + if x32[16*i+1] < x32[0] { + return 0 + } + // amd64: `CMPQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), [A-Z]+[0-9]*` + if x64[i+1] < x64[0] { + return 0 + } + // amd64: `CMPQ\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), [A-Z]+[0-9]*` + if x64[16*i+1] < x64[0] { + return 0 + } + // amd64: `CMPB\t2\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*1\), \$77` + if x8[i+2] < 77 { + return 0 + } + // amd64: `CMPW\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*2\), \$77` + if x16[i+2] < 77 { + return 0 + } + // amd64: `CMPW\t4\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[12]\), \$77` + if x16[16*i+2] < 77 { + return 0 + } + // amd64: `CMPL\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*4\), \$77` + if x32[i+2] < 77 { + return 0 + } + // amd64: `CMPL\t8\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[14]\), \$77` + if x32[16*i+2] < 77 { + return 0 + } + // amd64: `CMPQ\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*8\), \$77` + if x64[i+2] < 77 { + return 0 + } + // amd64: `CMPQ\t16\([A-Z]+[0-9]*\)\([A-Z]+[0-9]*\*[18]\), \$77` + if x64[16*i+2] < 77 { + return 0 + } + return 1 +} |