1
0
mirror of https://github.com/golang/go synced 2024-11-27 02:41:23 -07:00
go/test/abi/spills4.go
David Chase 0ec2c4abba cmd/compile: (fixed) spill output parameters passed in registers as autos
Repair of CL 300749.

ALSO:
found evidence that stack maps for bodyless methods are wrong.
gofmt in test/abi
removed never-executed code in types/size.go

Updates #44816.
Updates #40724.

Change-Id: Ifeb5fee60f60e7c7b58ee0457f58a3265d6cf3f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/302071
Trust: David Chase <drchase@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-03-16 19:22:44 +00:00

45 lines
769 B
Go

// 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)
}
}