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 12package main 13 14var sink int 15 16//go:registerparams 17//go:noinline 18func F(a, b, c, d, e, f, g, h, i, j, k, l, m *int) { 19 G(m, l, k, j, i, h, g, f, e, d, c, b, a) 20 // did the pointers get properly updated? 21 sink = *a + *m 22} 23 24//go:registerparams 25//go:noinline 26func G(a, b, c, d, e, f, g, h, i, j, k, l, m *int) { 27 // Do not reference the parameters 28 var scratch [1000 * 100]int 29 I := *c - *e - *l // zero. 30 scratch[I] = *d 31 println("Got this far!") 32 sink += scratch[0] 33} 34 35func main() { 36 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 37 F(&a, &b, &c, &d, &e, &f, &g, &h, &i, &j, &k, &l, &m) 38 println("Sink =", sink-7) 39} 40