diff options
| author | David Chase <drchase@google.com> | 2020-12-30 12:05:57 -0500 |
|---|---|---|
| committer | David Chase <drchase@google.com> | 2021-01-13 02:40:43 +0000 |
| commit | 9a19481acb93114948503d935e10f6985ff15843 (patch) | |
| tree | bdccf0f8413dfb40ca93862f642968229fc35a26 /test/codegen | |
| parent | d9acf6f3a3758c3096ee5ef5a24c2bc5df9d9c8b (diff) | |
| download | go-9a19481acb93114948503d935e10f6985ff15843.tar.xz | |
[dev.regabi] cmd/compile: make ordering for InvertFlags more stable
Current many architectures use a rule along the lines of
// Canonicalize the order of arguments to comparisons - helps with CSE.
((CMP|CMPW) x y) && x.ID > y.ID => (InvertFlags ((CMP|CMPW) y x))
to normalize comparisons as much as possible for CSE. Replace the
ID comparison with something less variable across compiler changes.
This helps avoid spurious failures in some of the codegen-comparison
tests (though the current choice of comparison is sensitive to Op
ordering).
Two tests changed to accommodate modified instruction choice.
Change-Id: Ib35f450bd2bae9d4f9f7838ceaf7ec682bcf1e1a
Reviewed-on: https://go-review.googlesource.com/c/go/+/280155
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/condmove.go | 6 | ||||
| -rw-r--r-- | test/codegen/spectre.go | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/test/codegen/condmove.go b/test/codegen/condmove.go index f86da3459a..7579dd1890 100644 --- a/test/codegen/condmove.go +++ b/test/codegen/condmove.go @@ -31,7 +31,7 @@ func cmovuintptr(x, y uintptr) uintptr { if x < y { x = -y } - // amd64:"CMOVQCS" + // amd64:"CMOVQ(HI|CS)" // arm64:"CSEL\t(LO|HI)" // wasm:"Select" return x @@ -41,7 +41,7 @@ func cmov32bit(x, y uint32) uint32 { if x < y { x = -y } - // amd64:"CMOVLCS" + // amd64:"CMOVL(HI|CS)" // arm64:"CSEL\t(LO|HI)" // wasm:"Select" return x @@ -51,7 +51,7 @@ func cmov16bit(x, y uint16) uint16 { if x < y { x = -y } - // amd64:"CMOVWCS" + // amd64:"CMOVW(HI|CS)" // arm64:"CSEL\t(LO|HI)" // wasm:"Select" return x diff --git a/test/codegen/spectre.go b/test/codegen/spectre.go index 3753498d09..d845da35ce 100644 --- a/test/codegen/spectre.go +++ b/test/codegen/spectre.go @@ -13,12 +13,12 @@ func IndexArray(x *[10]int, i int) int { } func IndexString(x string, i int) byte { - // amd64:`CMOVQCC` + // amd64:`CMOVQLS` return x[i] } func IndexSlice(x []float64, i int) float64 { - // amd64:`CMOVQCC` + // amd64:`CMOVQLS` return x[i] } |
