Source file test/abi/leaf.go

     1  // run
     2  
     3  //go:build !wasm
     4  // +build !wasm
     5  
     6  // Copyright 2021 The Go Authors. All rights reserved.
     7  // Use of this source code is governed by a BSD-style
     8  // license that can be found in the LICENSE file.
     9  
    10  // wasm is excluded because the compiler chatter about register abi pragma ends up
    11  // on stdout, and causes the expected output to not match.
    12  
    13  package main
    14  
    15  import "fmt"
    16  
    17  type i5f5 struct {
    18  	a, b          int16
    19  	c, d, e       int32
    20  	r, s, t, u, v float32
    21  }
    22  
    23  //go:registerparams
    24  //go:noinline
    25  func F(x i5f5) i5f5 {
    26  	return x
    27  }
    28  
    29  func main() {
    30  	x := i5f5{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    31  	y := x
    32  	z := F(x)
    33  	if y != z {
    34  		fmt.Printf("y=%v, z=%v\n", y, z)
    35  	}
    36  }
    37  

View as plain text