Source file src/simd/archsimd/cpu_sve_arm64.go
1 // Copyright 2026 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. 4 5 //go:build goexperiment.simd && arm64 6 7 package archsimd 8 9 import "internal/cpu" 10 11 // vl reports the SVE hardware vector length in bytes. It is an intrinsic, 12 // lowered to the RDVL instruction. 13 func vl() int 14 15 // SVE returns whether the CPU supports the SVE extension with a hardware 16 // vector length of at most 256 bits. The scalable vector types require SVE. 17 // 18 // SVE is defined on all GOARCHes, but will only return true on 19 // GOARCH arm64. 20 func (ARM64Features) SVE() bool { 21 return cpu.ARM64.HasSVE && vl() <= 32 22 } 23 24 // SVE2 returns whether the CPU supports the SVE2 extension with a hardware 25 // vector length of at most 256 bits. 26 // 27 // SVE2 is defined on all GOARCHes, but will only return true on 28 // GOARCH arm64. 29 func (ARM64Features) SVE2() bool { 30 return cpu.ARM64.HasSVE2 && vl() <= 32 31 } 32