1// run
2
3//go:build !wasm
4
5// Copyright 2021 The Go Authors. All rights reserved.
6// Use of this source code is governed by a BSD-style
7// license that can be found in the LICENSE file.
8
9package main
10
11// Test ensures that abi information producer and consumer agree about the
12// order of registers for inputs.  T's registers should be I0, F0, I1, F1.
13
14import "fmt"
15
16type P struct {
17	a int8
18	x float64
19}
20
21type T struct {
22	d, e P
23}
24
25//go:registerparams
26//go:noinline
27func G(t T) float64 {
28	return float64(t.d.a+t.e.a) + t.d.x + t.e.x
29}
30
31func main() {
32	x := G(T{P{10, 20}, P{30, 40}})
33	if x != 100.0 {
34		fmt.Printf("FAIL, Expected 100, got %f\n", x)
35	}
36}
37