]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.regabi] cmd/compile: make ordering for InvertFlags more stable
authorDavid Chase <drchase@google.com>
Wed, 30 Dec 2020 17:05:57 +0000 (12:05 -0500)
committerDavid Chase <drchase@google.com>
Wed, 13 Jan 2021 02:40:43 +0000 (02:40 +0000)
commit9a19481acb93114948503d935e10f6985ff15843
treebdccf0f8413dfb40ca93862f642968229fc35a26
parentd9acf6f3a3758c3096ee5ef5a24c2bc5df9d9c8b
[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>
15 files changed:
src/cmd/compile/internal/ssa/gen/386.rules
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/gen/ARM.rules
src/cmd/compile/internal/ssa/gen/ARM64.rules
src/cmd/compile/internal/ssa/gen/PPC64.rules
src/cmd/compile/internal/ssa/gen/S390X.rules
src/cmd/compile/internal/ssa/rewrite.go
src/cmd/compile/internal/ssa/rewrite386.go
src/cmd/compile/internal/ssa/rewriteAMD64.go
src/cmd/compile/internal/ssa/rewriteARM.go
src/cmd/compile/internal/ssa/rewriteARM64.go
src/cmd/compile/internal/ssa/rewritePPC64.go
src/cmd/compile/internal/ssa/rewriteS390X.go
test/codegen/condmove.go
test/codegen/spectre.go