summaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/gen/AMD64.rules
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2023-05-04 09:30:24 -0700
committerCherry Mui <cherryyz@google.com>2023-05-11 14:15:56 +0000
commite738f1303ff1fd2839122bd8f4d2a8f17875cc37 (patch)
tree578256e84808da75f4c105bcebb7058308409283 /src/cmd/compile/internal/ssa/gen/AMD64.rules
parent484330d038d060c6e4db3dc8e6ea2b811b2a44d8 (diff)
downloadgo-git-release-branch.go1.19.tar.gz
[release-branch.go1.19] cmd/compile: fix bswap/load rewrite rulesrelease-branch.go1.19
When combining a byteswap and a load, the resulting combined op must go in the load's block, not the byteswap's block, as the load has a memory argument that might only be valid in its original block. Fixes #59974 Change-Id: Icd84863ef3a9ca1fc22f2bb794a003f2808c746f Reviewed-on: https://go-review.googlesource.com/c/go/+/492616 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-on: https://go-review.googlesource.com/c/go/+/492697 TryBot-Bypass: Cherry Mui <cherryyz@google.com> Run-TryBot: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/gen/AMD64.rules')
-rw-r--r--src/cmd/compile/internal/ssa/gen/AMD64.rules8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/ssa/gen/AMD64.rules b/src/cmd/compile/internal/ssa/gen/AMD64.rules
index 1c54b8cb75..74d92a07f7 100644
--- a/src/cmd/compile/internal/ssa/gen/AMD64.rules
+++ b/src/cmd/compile/internal/ssa/gen/AMD64.rules
@@ -2275,10 +2275,10 @@
(BSWAP(Q|L) (BSWAP(Q|L) p)) => p
// CPUID feature: MOVBE.
-(MOV(Q|L)store [i] {s} p x:(BSWAP(Q|L) w) mem) && x.Uses == 1 && buildcfg.GOAMD64 >= 3 => (MOVBE(Q|L)store [i] {s} p w mem)
-(BSWAP(Q|L) x:(MOV(Q|L)load [i] {s} p mem)) && x.Uses == 1 && buildcfg.GOAMD64 >= 3 => (MOVBE(Q|L)load [i] {s} p mem)
-(BSWAP(Q|L) (MOVBE(Q|L)load [i] {s} p m)) => (MOV(Q|L)load [i] {s} p m)
-(MOVBE(Q|L)store [i] {s} p (BSWAP(Q|L) x) m) => (MOV(Q|L)store [i] {s} p x m)
+(MOV(Q|L)store [i] {s} p x:(BSWAP(Q|L) w) mem) && x.Uses == 1 && buildcfg.GOAMD64 >= 3 => (MOVBE(Q|L)store [i] {s} p w mem)
+(MOVBE(Q|L)store [i] {s} p x:(BSWAP(Q|L) w) mem) && x.Uses == 1 => (MOV(Q|L)store [i] {s} p w mem)
+(BSWAP(Q|L) x:(MOV(Q|L)load [i] {s} p mem)) && x.Uses == 1 && buildcfg.GOAMD64 >= 3 => @x.Block (MOVBE(Q|L)load [i] {s} p mem)
+(BSWAP(Q|L) x:(MOVBE(Q|L)load [i] {s} p mem)) && x.Uses == 1 => @x.Block (MOV(Q|L)load [i] {s} p mem)
(MOVWstore [i] {s} p x:(ROLWconst [8] w) mem) && x.Uses == 1 && buildcfg.GOAMD64 >= 3 => (MOVBEWstore [i] {s} p w mem)
(MOVBEWstore [i] {s} p x:(ROLWconst [8] w) mem) && x.Uses == 1 => (MOVWstore [i] {s} p w mem)