diff options
author | David Chase <drchase@google.com> | 2021-03-05 19:56:13 -0500 |
---|---|---|
committer | David Chase <drchase@google.com> | 2021-03-09 18:43:58 +0000 |
commit | 5eb99120844c0494d655678262e1fb41949a2b99 (patch) | |
tree | 490056b7db3ec8a587281577b3e6e84c60916bad /test/abi | |
parent | 48895d021bf631f15d68ecc10cab89ebd9cb28f6 (diff) | |
download | go-5eb99120844c0494d655678262e1fb41949a2b99.tar.gz go-5eb99120844c0494d655678262e1fb41949a2b99.zip |
cmd/compile: fix OpArg decomposer for registers in expandCalls
Includes test taken from
https://github.com/golang/go/issues/44816#issuecomment-791618179
and improved debugging output.
Updates #44816
Change-Id: I94aeb9c5255f175fe80727be29d218bad54bf7ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/299389
Trust: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/abi')
-rw-r--r-- | test/abi/double_nested_struct.go | 9 | ||||
-rw-r--r-- | test/abi/struct_lower_1.go | 30 | ||||
-rw-r--r-- | test/abi/struct_lower_1.out | 1 | ||||
-rw-r--r-- | test/abi/too_big_to_ssa.go | 7 |
4 files changed, 39 insertions, 8 deletions
diff --git a/test/abi/double_nested_struct.go b/test/abi/double_nested_struct.go index 70d8ea4bce..814341e701 100644 --- a/test/abi/double_nested_struct.go +++ b/test/abi/double_nested_struct.go @@ -8,7 +8,7 @@ // license that can be found in the LICENSE file. // wasm is excluded because the compiler chatter about register abi pragma ends up -// on stdout, and causes the expected output to not match. +// on stdout, and causes the expected output to not match. package main @@ -37,13 +37,12 @@ func H(spp stringPairPair) string { //go:registerparams //go:noinline -func G(a,b,c,d string) stringPairPair { - return stringPairPair{stringPair{a,b},stringPair{c,d}} +func G(a, b, c, d string) stringPairPair { + return stringPairPair{stringPair{a, b}, stringPair{c, d}} } - func main() { - spp := G("this","is","a","test") + spp := G("this", "is", "a", "test") s := H(spp) gotVsWant(s, "this is a test") } diff --git a/test/abi/struct_lower_1.go b/test/abi/struct_lower_1.go new file mode 100644 index 0000000000..b20de9be4b --- /dev/null +++ b/test/abi/struct_lower_1.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 passStruct6(a Struct6) Struct6 { + return a +} + +type Struct6 struct { + Struct1 +} + +type Struct1 struct { + A, B, C uint +} + +func main() { + fmt.Println(passStruct6(Struct6{Struct1{1, 2, 3}})) +} diff --git a/test/abi/struct_lower_1.out b/test/abi/struct_lower_1.out new file mode 100644 index 0000000000..d326cb6119 --- /dev/null +++ b/test/abi/struct_lower_1.out @@ -0,0 +1 @@ +{{1 2 3}} diff --git a/test/abi/too_big_to_ssa.go b/test/abi/too_big_to_ssa.go index a5c6abb0e4..6c55d31419 100644 --- a/test/abi/too_big_to_ssa.go +++ b/test/abi/too_big_to_ssa.go @@ -1,5 +1,6 @@ // run +//go:build !wasm // +build !wasm // Copyright 2021 The Go Authors. All rights reserved. @@ -16,7 +17,7 @@ var sink *string type toobig struct { // 6 words will not SSA but will fit in registers - a,b,c string + a, b, c string } //go:registerparams @@ -27,8 +28,8 @@ func H(x toobig) string { //go:registerparams //go:noinline -func I(a,b,c string) toobig { - return toobig{a,b,c} +func I(a, b, c string) toobig { + return toobig{a, b, c} } func main() { |