Skip to content

Commit fba83cd

Browse files
4a6f656cgopherbot
authored andcommitted
cmd/compile/internal/ssa: correct MOVDnop handling for arm64
The extension-removing rules for ARM64 were moved to late lower in CL 568616. This means that the late lower pass can now generate MOVDreg, however the rules that potentially eliminate MOVDreg only exist in the earlier pass. Fix this by duplicating the MOVDreg/NOVDnop rules in late lower, such that we can potentially eliminate conversions. Removes 400+ instructions from the Go binary on openbsd/arm64. Change-Id: I14aad06b994c9179f3ecdda566629793ba167511 Reviewed-on: https://go-review.googlesource.com/c/go/+/651819 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent a650782 commit fba83cd

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/cmd/compile/internal/ssa/_gen/ARM64latelower.rules

+8
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,11 @@
8585
(MOVWUreg x:(MOVBUreg _)) => (MOVDreg x)
8686
(MOVWUreg x:(MOVHUreg _)) => (MOVDreg x)
8787
(MOVWUreg x:(MOVWUreg _)) => (MOVDreg x)
88+
89+
// if a register move has only 1 use, just use the same register without emitting instruction
90+
// MOVDnop doesn't emit instruction, only for ensuring the type.
91+
(MOVDreg x) && x.Uses == 1 => (MOVDnop x)
92+
93+
// TODO: we should be able to get rid of MOVDnop all together.
94+
// But for now, this is enough to get rid of lots of them.
95+
(MOVDnop (MOVDconst [c])) => (MOVDconst [c])

src/cmd/compile/internal/ssa/rewriteARM64latelower.go

+35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)