Source file test/abi/more_intstar_input.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 (
    16  	"fmt"
    17  )
    18  
    19  var sink int
    20  
    21  //go:registerparams
    22  //go:noinline
    23  func F(a, b, c, d, e, f, g, h, i, j, k, l, m *int) {
    24  	G(m, l, k, j, i, h, g, f, e, d, c, b, a)
    25  	// did the pointers get properly updated?
    26  	sink = *a + *m
    27  }
    28  
    29  //go:registerparams
    30  //go:noinline
    31  func G(a, b, c, d, e, f, g, h, i, j, k, l, m *int) {
    32  	// Do not reference the parameters
    33  	var scratch [1000 * 100]int
    34  	I := *c - *e - *l // zero.
    35  	scratch[I] = *d
    36  	fmt.Println("Got this far!")
    37  	sink += scratch[0]
    38  }
    39  
    40  func main() {
    41  	a, b, c, d, e, f, g, h, i, j, k, l, m := 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
    42  	F(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k, &l, &m)
    43  	fmt.Printf("Sink = %d\n", sink-7)
    44  }
    45  

View as plain text