aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2026-01-30 14:16:40 -0800
committerKeith Randall <khr@golang.org>2026-03-20 13:51:47 -0700
commitc8df1410d50f69b50eb5e643d15b6a3aab0ada06 (patch)
treef6b3ab8d0c87fa8d7875eb3fca15b3b769a77a01 /test/codegen
parent51abbb12c478ad44949367c0c478ee8f87c1f6bf (diff)
downloadgo-c8df1410d50f69b50eb5e643d15b6a3aab0ada06.tar.xz
cmd/compile: on arm64 pair a load with a load in a subsequent block
Look into the following block(s) for a load that can be paired with the load we're trying to pair up. This particularly helps the generated equality functions. Instead of doing MOVD x(R0), R2 MOVD x(R1), R3 CMP R2, R3 BNE noteq MOVD x+8(R0), R2 MOVD x+8(R1), R3 CMP R2, R3 BNE noteq we do LDP x(R0), (R2, R4) LDP x(R1), (R3, R5) CMP R2, R3 BNE noteq CMP R4, R5 BNE noteq Removes 5296 bytes of code from cmd/go. Change-Id: I6368686892ac944783c8b07ed7252126d1ef4031 Reviewed-on: https://go-review.googlesource.com/c/go/+/740741 Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/memcombine.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index deac9e2091..6feef26ce8 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -1027,6 +1027,15 @@ func dwloadResult2(p *[2]int64) (int64, int64) {
return p[1], p[0]
}
+func dwloadConditional(p *[2]int64) (int64, int64) {
+ // arm64:"LDP \\(R0\\), \\(R0, R1\\)"
+ x := p[0]
+ if x == 0 {
+ return x, 0
+ }
+ return x, p[1]
+}
+
// ---------------------------------- //
// Arm64 double-register stores //
// ---------------------------------- //