Source file test/simd_inline.go

     1  // errorcheck -0 -m
     2  
     3  //go:build goexperiment.simd && amd64
     4  
     5  // Copyright 2025 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  package foo
    10  
    11  import "simd"
    12  
    13  func hasClosure(a, b, c, d simd.Int64x4) (w, x, y, z simd.Int64x4) {
    14  	shuf := func() { // ERROR "can inline hasClosure.func1"
    15  		w = z.RotateAllLeft(1).Xor(a)
    16  		x = w.RotateAllLeft(3).Xor(b)
    17  		y = x.RotateAllLeft(5).Xor(c)
    18  		z = y.RotateAllLeft(7).Xor(d)
    19  		a, b, c, d = b.RotateAllLeft(1).Xor(a.RotateAllLeft(23)), c.RotateAllLeft(1).Xor(b.RotateAllLeft(23)), d.RotateAllLeft(1).Xor(c.RotateAllLeft(23)), a.RotateAllLeft(1).Xor(d.RotateAllLeft(23))
    20  		w = z.RotateAllLeft(1).Xor(a)
    21  		x = w.RotateAllLeft(3).Xor(b)
    22  		y = x.RotateAllLeft(5).Xor(c)
    23  		z = y.RotateAllLeft(7).Xor(d)
    24  		a, b, c, d = b.RotateAllLeft(1).Xor(a.RotateAllLeft(23)), c.RotateAllLeft(1).Xor(b.RotateAllLeft(23)), d.RotateAllLeft(1).Xor(c.RotateAllLeft(23)), a.RotateAllLeft(1).Xor(d.RotateAllLeft(23))
    25  		w = z.RotateAllLeft(1).Xor(a)
    26  		x = w.RotateAllLeft(3).Xor(b)
    27  		y = x.RotateAllLeft(5).Xor(c)
    28  		z = y.RotateAllLeft(7).Xor(d)
    29  		a, b, c, d = b.RotateAllLeft(1).Xor(a.RotateAllLeft(23)), c.RotateAllLeft(1).Xor(b.RotateAllLeft(23)), d.RotateAllLeft(1).Xor(c.RotateAllLeft(23)), a.RotateAllLeft(1).Xor(d.RotateAllLeft(23))
    30  	}
    31  
    32  	shuf() // ERROR "inlining call to hasClosure.func1"
    33  	shuf() // ERROR "inlining call to hasClosure.func1"
    34  	shuf() // ERROR "inlining call to hasClosure.func1"
    35  	shuf() // ERROR "inlining call to hasClosure.func1"
    36  	shuf() // ERROR "inlining call to hasClosure.func1"
    37  	shuf() // ERROR "inlining call to hasClosure.func1"
    38  	shuf() // ERROR "inlining call to hasClosure.func1"
    39  	shuf() // ERROR "inlining call to hasClosure.func1"
    40  	shuf() // ERROR "inlining call to hasClosure.func1"
    41  	return
    42  }
    43  

View as plain text