summaryrefslogtreecommitdiff
path: root/test/abi
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-03-15 21:12:08 +0000
committerDavid Chase <drchase@google.com>2021-03-15 21:28:45 +0000
commite61c9ddb7f1a790f6a52f563dccb4ac264f2e704 (patch)
treecf3c49cf8575bfe24eb7fae5b66220f274e6ba95 /test/abi
parent8ed438c077d82c4b4662c327dbbdb3c64e7547ca (diff)
downloadgo-git-e61c9ddb7f1a790f6a52f563dccb4ac264f2e704.tar.gz
Revert "cmd/compile: spill output parameters passed in registers as autos"
This reverts commit 8ed438c077d82c4b4662c327dbbdb3c64e7547ca, CL 300749. Reason for revert: Looks like it crashes on link-register architectures Change-Id: I0c261df58900008cada3359889d2a87508158447 Reviewed-on: https://go-review.googlesource.com/c/go/+/302053 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'test/abi')
-rw-r--r--test/abi/fibish2.go4
-rw-r--r--test/abi/leaf.go36
-rw-r--r--test/abi/leaf2.go43
-rw-r--r--test/abi/methods.go11
-rw-r--r--test/abi/spills3.go48
-rw-r--r--test/abi/spills4.go44
6 files changed, 7 insertions, 179 deletions
diff --git a/test/abi/fibish2.go b/test/abi/fibish2.go
index 388aabc8b0..14f3f9ada7 100644
--- a/test/abi/fibish2.go
+++ b/test/abi/fibish2.go
@@ -13,12 +13,12 @@ import "fmt"
// Test that register results are correctly returned (and passed)
-type MagicLastTypeNameForTestingRegisterABI func(int, MagicLastTypeNameForTestingRegisterABI) int
+type MagicLastTypeNameForTestingRegisterABI func(int,MagicLastTypeNameForTestingRegisterABI) int
//go:registerparams
//go:noinline
func minus(decrement int) MagicLastTypeNameForTestingRegisterABI {
- return MagicLastTypeNameForTestingRegisterABI(func(x int, _ MagicLastTypeNameForTestingRegisterABI) int { return x - decrement })
+ return MagicLastTypeNameForTestingRegisterABI( func(x int, _ MagicLastTypeNameForTestingRegisterABI) int { return x-decrement} )
}
//go:noinline
diff --git a/test/abi/leaf.go b/test/abi/leaf.go
deleted file mode 100644
index f893f5dddb..0000000000
--- a/test/abi/leaf.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.
-
-// wasm is excluded because the compiler chatter about register abi pragma ends up
-// on stdout, and causes the expected output to not match.
-
-package main
-
-import "fmt"
-
-type i5f5 struct {
- a, b int16
- c, d, e int32
- r, s, t, u, v float32
-}
-
-//go:registerparams
-//go:noinline
-func F(x i5f5) i5f5 {
- return x
-}
-
-func main() {
- x := i5f5{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
- y := x
- z := F(x)
- if y != z {
- fmt.Printf("y=%v, z=%v\n", y, z)
- }
-}
diff --git a/test/abi/leaf2.go b/test/abi/leaf2.go
deleted file mode 100644
index d2018d5313..0000000000
--- a/test/abi/leaf2.go
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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.
-
-// wasm is excluded because the compiler chatter about register abi pragma ends up
-// on stdout, and causes the expected output to not match.
-
-package main
-
-import "fmt"
-
-type i4 struct {
- a, b, c, d int
-}
-
-//go:registerparams
-//go:noinline
-func F(x i4) i4 {
- ab := x.a + x.b
- bc := x.b + x.c
- cd := x.c + x.d
- ad := x.a + x.d
- ba := x.a - x.b
- cb := x.b - x.c
- dc := x.c - x.d
- da := x.a - x.d
-
- return i4{ab*bc + da, cd*ad + cb, ba*cb + ad, dc*da + bc}
-}
-
-func main() {
- x := i4{1, 2, 3, 4}
- y := x
- z := F(x)
- if (i4{12, 34, 6, 8}) != z {
- fmt.Printf("y=%v, z=%v\n", y, z)
- }
-}
diff --git a/test/abi/methods.go b/test/abi/methods.go
index 3dcd3e327a..9ecae9833e 100644
--- a/test/abi/methods.go
+++ b/test/abi/methods.go
@@ -14,7 +14,7 @@ import (
)
type toobig struct {
- a, b, c string
+ a,b,c string
}
//go:registerparams
@@ -29,8 +29,8 @@ type AnInterface interface {
//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}
}
// AnIid prevents the compiler from figuring out what the interface really is.
@@ -40,13 +40,12 @@ func AnIid(x AnInterface) AnInterface {
}
var tmp toobig
-
func main() {
x := I("Ahoy", "1,", "2")
y := I("3", "there,", "4")
z := I("5", "6,", "Matey")
- tmp = x.MagicMethodNameForTestingRegisterABI(y, z)
+ tmp = x.MagicMethodNameForTestingRegisterABI(y,z)
fmt.Println(tmp.a, tmp.b, tmp.c)
- tmp = AnIid(&x).MagicMethodNameForTestingRegisterABI(y, z)
+ tmp = AnIid(&x).MagicMethodNameForTestingRegisterABI(y,z)
fmt.Println(tmp.a, tmp.b, tmp.c)
}
diff --git a/test/abi/spills3.go b/test/abi/spills3.go
deleted file mode 100644
index 247828437b..0000000000
--- a/test/abi/spills3.go
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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.
-
-// wasm is excluded because the compiler chatter about register abi pragma ends up
-// on stdout, and causes the expected output to not match.
-
-package main
-
-import "fmt"
-
-type i4 struct {
- a, b, c, d int
-}
-
-//go:noinline
-func spills(px *i4) {
-}
-
-//go:registerparams
-//go:noinline
-func F(x i4) i4 {
- ab := x.a + x.b
- bc := x.b + x.c
- cd := x.c + x.d
- ad := x.a + x.d
- ba := x.a - x.b
- cb := x.b - x.c
- dc := x.c - x.d
- da := x.a - x.d
- i := i4{ab*bc + da, cd*ad + cb, ba*cb + ad, dc*da + bc}
- spills(&i)
- return i
-}
-
-func main() {
- x := i4{1, 2, 3, 4}
- y := x
- z := F(x)
- if z != (i4{12, 34, 6, 8}) {
- fmt.Printf("y=%v, z=%v\n", y, z)
- }
-}
diff --git a/test/abi/spills4.go b/test/abi/spills4.go
deleted file mode 100644
index 205f5a64c0..0000000000
--- a/test/abi/spills4.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.
-
-// wasm is excluded because the compiler chatter about register abi pragma ends up
-// on stdout, and causes the expected output to not match.
-
-package main
-
-import "fmt"
-
-type i5f5 struct {
- a, b int16
- c, d, e int32
- r, s, t, u, v float32
-}
-
-//go:noinline
-func spills(_ *float32) {
-
-}
-
-//go:registerparams
-//go:noinline
-func F(x i5f5) i5f5 {
- y := x.v
- spills(&y)
- x.r = y
- return x
-}
-
-func main() {
- x := i5f5{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
- y := x
- z := F(x)
- if (i5f5{1, 2, 3, 4, 5, 10, 7, 8, 9, 10}) != z {
- fmt.Printf("y=%v, z=%v\n", y, z)
- }
-}