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/archsimd"
    12  
    13  func hasClosure(a, b, c, d archsimd.Int64x4) (w, x, y, z archsimd.Int64x4) {
    14  	shuf := func() { // ERROR "can inline hasClosure.func1"
    15  		w = z.RotateAllLeft(1).Xor(a)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    16  		x = w.RotateAllLeft(3).Xor(b)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    17  		y = x.RotateAllLeft(5).Xor(c)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    18  		z = y.RotateAllLeft(7).Xor(d)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    19  		a, b, c, d = b.RotateAllLeft(1).Xor(a.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    20  			c.RotateAllLeft(1).Xor(b.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    21  			d.RotateAllLeft(1).Xor(c.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    22  			a.RotateAllLeft(1).Xor(d.RotateAllLeft(23)) // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    23  		w = z.RotateAllLeft(1).Xor(a)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    24  		x = w.RotateAllLeft(3).Xor(b)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    25  		y = x.RotateAllLeft(5).Xor(c)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    26  		z = y.RotateAllLeft(7).Xor(d)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    27  		a, b, c, d = b.RotateAllLeft(1).Xor(a.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    28  			c.RotateAllLeft(1).Xor(b.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    29  			d.RotateAllLeft(1).Xor(c.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    30  			a.RotateAllLeft(1).Xor(d.RotateAllLeft(23)) // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    31  		w = z.RotateAllLeft(1).Xor(a)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    32  		x = w.RotateAllLeft(3).Xor(b)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    33  		y = x.RotateAllLeft(5).Xor(c)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    34  		z = y.RotateAllLeft(7).Xor(d)                             // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    35  		a, b, c, d = b.RotateAllLeft(1).Xor(a.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    36  			c.RotateAllLeft(1).Xor(b.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    37  			d.RotateAllLeft(1).Xor(c.RotateAllLeft(23)), // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    38  			a.RotateAllLeft(1).Xor(d.RotateAllLeft(23)) // ERROR "inlining call to archsimd.Int64x4.RotateAllLeft"
    39  	}
    40  
    41  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    42  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    43  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    44  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    45  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    46  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    47  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    48  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    49  	shuf() // ERROR "inlining call to hasClosure.func1" "inlining call to archsimd.Int64x4.RotateAllLeft"
    50  	return
    51  }
    52  

View as plain text