Source file test/codegen/simd_tofrom_arm64.go
1 // asmcheck 2 3 // Copyright 2026 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // Verify that portable simd <-> archsimd conversions via ToArch and FromArch 8 // inline and fold away with zero overhead on arm64. 9 10 //go:build goexperiment.simd && arm64 11 12 package codegen 13 14 import ( 15 "simd" 16 "simd/archsimd" 17 ) 18 19 func toFromArchARM64(x simd.Int32s) simd.Int32s { 20 // arm64:-`CALL` -`CMP` -`BNE` -`BEQ` -`TBZ` -`TBNZ` 21 switch a := x.ToArch().(type) { 22 case archsimd.Int32x4: 23 // arm64:`VADD V[0-9]+\.S4, V[0-9]+\.S4, V[0-9]+\.S4` -`CALL` -`CMP` -`TBZ` -`TBNZ` 24 return simd.Int32sFromArch(a.Add(a)) 25 default: 26 return x.Add(x) 27 } 28 } 29