Source file test/abi/leaf.go

     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  
     9  // wasm is excluded because the compiler chatter about register abi pragma ends up
    10  // on stdout, and causes the expected output to not match.
    11  
    12  package main
    13  
    14  import "fmt"
    15  
    16  type i5f5 struct {
    17  	a, b          int16
    18  	c, d, e       int32
    19  	r, s, t, u, v float32
    20  }
    21  
    22  //go:registerparams
    23  //go:noinline
    24  func F(x i5f5) i5f5 {
    25  	return x
    26  }
    27  
    28  func main() {
    29  	x := i5f5{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    30  	y := x
    31  	z := F(x)
    32  	if y != z {
    33  		fmt.Printf("y=%v, z=%v\n", y, z)
    34  	}
    35  }
    36  

View as plain text