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 11import "fmt" 12 13// Test that register results are correctly returned (and passed) 14 15type MagicLastTypeNameForTestingRegisterABI func(int, MagicLastTypeNameForTestingRegisterABI) (int, int) 16 17//go:noinline 18func f(x int, unused MagicLastTypeNameForTestingRegisterABI) (int, int) { 19 20 if x < 3 { 21 return 0, x 22 } 23 24 a, b := f(x-2, unused) 25 c, d := f(x-1, unused) 26 return a + d, b + c 27} 28 29func main() { 30 x := 40 31 a, b := f(x, f) 32 fmt.Printf("f(%d)=%d,%d\n", x, a, b) 33} 34