rs6000, update effective target for tests builtins-10*.c and vec_perm-runnable-i128.c
[official-gcc.git] / libgo / go / runtime / closure_test.go
blob741c932eabde0d35f035312f87ac5d1504096986
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package runtime_test
7 import "testing"
9 var s int
11 func BenchmarkCallClosure(b *testing.B) {
12 for i := 0; i < b.N; i++ {
13 s += func(ii int) int { return 2 * ii }(i)
17 func BenchmarkCallClosure1(b *testing.B) {
18 for i := 0; i < b.N; i++ {
19 j := i
20 s += func(ii int) int { return 2*ii + j }(i)
24 var ss *int
26 func BenchmarkCallClosure2(b *testing.B) {
27 for i := 0; i < b.N; i++ {
28 j := i
29 s += func() int {
30 ss = &j
31 return 2
32 }()
36 func addr1(x int) *int {
37 return func() *int { return &x }()
40 func BenchmarkCallClosure3(b *testing.B) {
41 for i := 0; i < b.N; i++ {
42 ss = addr1(i)
46 func addr2() (x int, p *int) {
47 return 0, func() *int { return &x }()
50 func BenchmarkCallClosure4(b *testing.B) {
51 for i := 0; i < b.N; i++ {
52 _, ss = addr2()