Source file test/decomposeaddrsimd.go

     1  // errorcheck -0 -d=ssa/decompose_addr/debug=1
     2  
     3  //go:build goexperiment.simd
     4  
     5  // Copyright 2026 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  // Test for variables that can be decomposed by the decomposeAddr pass.
    10  
    11  package main
    12  
    13  import "simd/archsimd"
    14  
    15  type SIMDPoint struct {
    16  	x, y archsimd.Int16x8
    17  }
    18  
    19  //go:noinline
    20  func simpleStructSIMD(c bool) archsimd.Int16x8 {
    21  	p := SIMDPoint{} // ERROR "promoted p"
    22  	ptr := &p
    23  	if c {
    24  		ptr.x = ptr.x.Add(ptr.y)
    25  	} else {
    26  		ptr.y = ptr.y.Sub(ptr.x)
    27  	}
    28  	return ptr.x.Add(ptr.y)
    29  }
    30  

View as plain text