Source file src/simd/archsimd/ops_other_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 6 7 package archsimd 8 9 // LoadInt8sPart loads an Int8s vector from memory pointed to by s and returns the number of 10 // loaded elements. 11 // Asm: Emulated, CPU Feature: SVE 12 func LoadInt8sPart(s []int8) (Int8s, int) { 13 return loadInt8sMasked(&s[0], Mask8sFromCount(len(s))), min(len(s), vl()) 14 } 15 16 // Asm: ZLD1B, 17 func loadInt8sMasked(s *int8, m Mask8s) Int8s 18 19 // StorePart stores x to memory pointed to by s and returns the number of 20 // stored elements. 21 // Asm: Emulated, CPU Feature: SVE 22 func (x Int8s) StorePart(s []int8) int { 23 x.storeMasked(&s[0], Mask8sFromCount(len(s))) 24 return min(len(s), vl()) 25 } 26 27 // Asm: ZST1B, CPU Feature: SVE 28 func (x Int8s) storeMasked(s *int8, m Mask8s) 29 30 // Mask8sFromCount creates a Mask8s that enables elements from index 0 up to x, exclusive. 31 // Asm: PWHILELT, CPU Feature: SVE 32 func Mask8sFromCount(x int) Mask8s 33 34 // Greater returns a mask whose elements indicate whether x > y. 35 // Asm: ZCMPGT, CPU Feature: SVE 36 func (x Int8s) Greater(y Int8s) Mask8s 37 38 // Masked returns the result vector of x masked by m, where m is active, 39 // or 0 otherwise. 40 // Asm: Emulated, CPU Feature: SVE 41 func (x Int8s) Masked(m Mask8s) Int8s { 42 var zero Int8s 43 return x.IfElse(zero, m) 44 } 45 46 // IfElse returns x but with elements set to y where mask is false. 47 // Asm: ZSEL, CPU Feature: SVE 48 func (x Int8s) IfElse(y Int8s, m Mask8s) Int8s 49 50 // Add adds two Int8s vectors element-wise. 51 // Asm: ZADD, CPU Feature: SVE 52 func (x Int8s) Add(y Int8s) Int8s 53