aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorKeith Randall <khr@golang.org>2024-11-23 10:58:47 -0800
committerKeith Randall <khr@golang.org>2025-02-13 14:08:07 -0800
commita0029e95e5d6f15cab70e533d447c75aa4211636 (patch)
tree50eb120bb865c7446b1c5d31f0ffae303e4e47da /test/codegen
parent20d7c57422143d07f5ef85d674687dbc0a4871ce (diff)
downloadgo-a0029e95e5d6f15cab70e533d447c75aa4211636.tar.xz
cmd/compile: regalloc: handle desired registers of 2-output insns
Particularly with 2-word load instructions, this becomes important. Classic example is: func f(p *string) string { return *p } We want the two loads to put the return values directly into the two ABI return registers. At this point in the stack, cmd/go is 1.1% smaller. Change-Id: I51fd1710238e81d15aab2bfb816d73c8e7c207b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/631137 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.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/codegen/memcombine.go b/test/codegen/memcombine.go
index 2a9cc68ab0..9345391b61 100644
--- a/test/codegen/memcombine.go
+++ b/test/codegen/memcombine.go
@@ -1004,6 +1004,16 @@ func dwloadArg(a [2]int64) int64 {
return a[0] + a[1]
}
+func dwloadResult1(p *string) string {
+ // arm64:"LDP\t\\(R0\\), \\(R0, R1\\)"
+ return *p
+}
+
+func dwloadResult2(p *[2]int64) (int64, int64) {
+ // arm64:"LDP\t\\(R0\\), \\(R1, R0\\)"
+ return p[1], p[0]
+}
+
// ---------------------------------- //
// Arm64 double-register stores //
// ---------------------------------- //