aboutsummaryrefslogtreecommitdiff
path: root/test/abi
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-02-19 17:11:40 -0500
committerDavid Chase <drchase@google.com>2021-03-04 16:19:12 +0000
commita2d92b5143ad6ed1b55b71032c5c1f468ba76fd4 (patch)
tree303c0fae9984d9e23366e183825d0dd5421dc7ae /test/abi
parent868a110c568591d9085996ba05c94593809a437a (diff)
downloadgo-a2d92b5143ad6ed1b55b71032c5c1f468ba76fd4.tar.gz
go-a2d92b5143ad6ed1b55b71032c5c1f468ba76fd4.zip
cmd/compile: register abi, morestack work and mole whacking
Morestack works for non-pointer register parameters Within a function body, pointer-typed parameters are correctly tracked. Results still not hooked up. For #40724. Change-Id: Icaee0b51d0da54af983662d945d939b756088746 Reviewed-on: https://go-review.googlesource.com/c/go/+/294410 Trust: David Chase <drchase@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/abi')
-rw-r--r--test/abi/f_ret_z_not.go14
-rw-r--r--test/abi/many_int_input.go30
-rw-r--r--test/abi/many_int_input.out1
-rw-r--r--test/abi/regabipragma.go1
4 files changed, 39 insertions, 7 deletions
diff --git a/test/abi/f_ret_z_not.go b/test/abi/f_ret_z_not.go
index b072aea75e..d890223ff7 100644
--- a/test/abi/f_ret_z_not.go
+++ b/test/abi/f_ret_z_not.go
@@ -16,18 +16,18 @@ type NZ struct {
}
//go:noinline
-func f(x,y int) (Z,NZ,Z) {
+func f(x, y int) (Z, NZ, Z) {
var z Z
- return z,NZ{x,y},z
+ return z, NZ{x, y}, z
}
//go:noinline
-func g() (Z,NZ,Z) {
- a,b,c := f(3,4)
- return c,b,a
+func g() (Z, NZ, Z) {
+ a, b, c := f(3, 4)
+ return c, b, a
}
func main() {
- _,b,_ := g()
- fmt.Println(b.x+b.y)
+ _, b, _ := g()
+ fmt.Println(b.x + b.y)
}
diff --git a/test/abi/many_int_input.go b/test/abi/many_int_input.go
new file mode 100644
index 0000000000..6c3332f842
--- /dev/null
+++ b/test/abi/many_int_input.go
@@ -0,0 +1,30 @@
+// run
+
+//go:build !wasm
+// +build !wasm
+
+// Copyright 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "fmt"
+)
+
+//go:registerparams
+//go:noinline
+func F(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z int64) {
+ G(z, y, x, w, v, u, t, s, r, q, p, o, n, m, l, k, j, i, h, g, f, e, d, c, b, a)
+}
+
+//go:registerparams
+//go:noinline
+func G(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z int64) {
+ fmt.Println(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
+}
+
+func main() {
+ F(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26)
+}
diff --git a/test/abi/many_int_input.out b/test/abi/many_int_input.out
new file mode 100644
index 0000000000..fecfa82581
--- /dev/null
+++ b/test/abi/many_int_input.out
@@ -0,0 +1 @@
+26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
diff --git a/test/abi/regabipragma.go b/test/abi/regabipragma.go
index 86f42f9779..070b3110d6 100644
--- a/test/abi/regabipragma.go
+++ b/test/abi/regabipragma.go
@@ -1,5 +1,6 @@
// skip
// runindir -gcflags=-c=1
+//go:build !windows
// +build !windows
// Copyright 2021 The Go Authors. All rights reserved.