// Code generated by 'simdgen -o godefs -goroot $GOROOT -arch sve -arm64Path $ARM64_ISA_PATH go_sve.yaml types.yaml categories.yaml'; DO NOT EDIT. //go:build goexperiment.simd && arm64 package archsimd // psve is a tag type that tells the compiler that this is an SVE predicate. type psve struct { _sve [0]func() // uncomparable } // v256 is a tag type that tells the compiler that this is really 256-bit SIMD type v256 struct { _256 [0]func() // uncomparable } // Float32s is a scalable SIMD vector of float32s. type Float32s struct { float32x8 v256 vals [8]float32 } // Len returns the number of elements in a Float32s. func (x Float32s) Len() int { return vl() / 4 } // LoadFloat32s loads a Float32s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadFloat32s(s []float32) Float32s { var z Float32s if len(s) < z.Len() { panic("simd: LoadFloat32s: slice shorter than the vector") } return loadFloat32s(s) } //go:noescape func loadFloat32s(s []float32) Float32s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Float32s) Store(s []float32) { if len(s) < x.Len() { panic("simd: Float32s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Float32s) store(s []float32) // LoadFloat32sPart loads a Float32s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadFloat32sPart(s []float32) (Float32s, int) { if len(s) == 0 { return Float32s{}, 0 } return loadFloat32sPart(s), min(len(s), Float32s{}.Len()) } //go:noescape func loadFloat32sPart(s []float32) Float32s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Float32s) StorePart(s []float32) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Float32s) storePart(s []float32) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Float32s) IfElse(mask Mask32s, y Float32s) Float32s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Float32s) Masked(mask Mask32s) Float32s { var zero Float32s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Float32s) String() string { var s [8]float32 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Float64s is a scalable SIMD vector of float64s. type Float64s struct { float64x4 v256 vals [4]float64 } // Len returns the number of elements in a Float64s. func (x Float64s) Len() int { return vl() / 8 } // LoadFloat64s loads a Float64s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadFloat64s(s []float64) Float64s { var z Float64s if len(s) < z.Len() { panic("simd: LoadFloat64s: slice shorter than the vector") } return loadFloat64s(s) } //go:noescape func loadFloat64s(s []float64) Float64s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Float64s) Store(s []float64) { if len(s) < x.Len() { panic("simd: Float64s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Float64s) store(s []float64) // LoadFloat64sPart loads a Float64s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadFloat64sPart(s []float64) (Float64s, int) { if len(s) == 0 { return Float64s{}, 0 } return loadFloat64sPart(s), min(len(s), Float64s{}.Len()) } //go:noescape func loadFloat64sPart(s []float64) Float64s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Float64s) StorePart(s []float64) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Float64s) storePart(s []float64) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Float64s) IfElse(mask Mask64s, y Float64s) Float64s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Float64s) Masked(mask Mask64s) Float64s { var zero Float64s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Float64s) String() string { var s [4]float64 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Int8s is a scalable SIMD vector of int8s. type Int8s struct { int8x32 v256 vals [32]int8 } // Len returns the number of elements in an Int8s. func (x Int8s) Len() int { return vl() } // LoadInt8s loads an Int8s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadInt8s(s []int8) Int8s { var z Int8s if len(s) < z.Len() { panic("simd: LoadInt8s: slice shorter than the vector") } return loadInt8s(s) } //go:noescape func loadInt8s(s []int8) Int8s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Int8s) Store(s []int8) { if len(s) < x.Len() { panic("simd: Int8s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Int8s) store(s []int8) // LoadInt8sPart loads an Int8s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadInt8sPart(s []int8) (Int8s, int) { if len(s) == 0 { return Int8s{}, 0 } return loadInt8sPart(s), min(len(s), Int8s{}.Len()) } //go:noescape func loadInt8sPart(s []int8) Int8s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Int8s) StorePart(s []int8) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Int8s) storePart(s []int8) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Int8s) IfElse(mask Mask8s, y Int8s) Int8s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Int8s) Masked(mask Mask8s) Int8s { var zero Int8s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Int8s) String() string { var s [32]int8 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Int16s is a scalable SIMD vector of int16s. type Int16s struct { int16x16 v256 vals [16]int16 } // Len returns the number of elements in an Int16s. func (x Int16s) Len() int { return vl() / 2 } // LoadInt16s loads an Int16s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadInt16s(s []int16) Int16s { var z Int16s if len(s) < z.Len() { panic("simd: LoadInt16s: slice shorter than the vector") } return loadInt16s(s) } //go:noescape func loadInt16s(s []int16) Int16s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Int16s) Store(s []int16) { if len(s) < x.Len() { panic("simd: Int16s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Int16s) store(s []int16) // LoadInt16sPart loads an Int16s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadInt16sPart(s []int16) (Int16s, int) { if len(s) == 0 { return Int16s{}, 0 } return loadInt16sPart(s), min(len(s), Int16s{}.Len()) } //go:noescape func loadInt16sPart(s []int16) Int16s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Int16s) StorePart(s []int16) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Int16s) storePart(s []int16) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Int16s) IfElse(mask Mask16s, y Int16s) Int16s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Int16s) Masked(mask Mask16s) Int16s { var zero Int16s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Int16s) String() string { var s [16]int16 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Int32s is a scalable SIMD vector of int32s. type Int32s struct { int32x8 v256 vals [8]int32 } // Len returns the number of elements in an Int32s. func (x Int32s) Len() int { return vl() / 4 } // LoadInt32s loads an Int32s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadInt32s(s []int32) Int32s { var z Int32s if len(s) < z.Len() { panic("simd: LoadInt32s: slice shorter than the vector") } return loadInt32s(s) } //go:noescape func loadInt32s(s []int32) Int32s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Int32s) Store(s []int32) { if len(s) < x.Len() { panic("simd: Int32s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Int32s) store(s []int32) // LoadInt32sPart loads an Int32s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadInt32sPart(s []int32) (Int32s, int) { if len(s) == 0 { return Int32s{}, 0 } return loadInt32sPart(s), min(len(s), Int32s{}.Len()) } //go:noescape func loadInt32sPart(s []int32) Int32s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Int32s) StorePart(s []int32) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Int32s) storePart(s []int32) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Int32s) IfElse(mask Mask32s, y Int32s) Int32s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Int32s) Masked(mask Mask32s) Int32s { var zero Int32s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Int32s) String() string { var s [8]int32 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Int64s is a scalable SIMD vector of int64s. type Int64s struct { int64x4 v256 vals [4]int64 } // Len returns the number of elements in an Int64s. func (x Int64s) Len() int { return vl() / 8 } // LoadInt64s loads an Int64s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadInt64s(s []int64) Int64s { var z Int64s if len(s) < z.Len() { panic("simd: LoadInt64s: slice shorter than the vector") } return loadInt64s(s) } //go:noescape func loadInt64s(s []int64) Int64s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Int64s) Store(s []int64) { if len(s) < x.Len() { panic("simd: Int64s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Int64s) store(s []int64) // LoadInt64sPart loads an Int64s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadInt64sPart(s []int64) (Int64s, int) { if len(s) == 0 { return Int64s{}, 0 } return loadInt64sPart(s), min(len(s), Int64s{}.Len()) } //go:noescape func loadInt64sPart(s []int64) Int64s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Int64s) StorePart(s []int64) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Int64s) storePart(s []int64) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Int64s) IfElse(mask Mask64s, y Int64s) Int64s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Int64s) Masked(mask Mask64s) Int64s { var zero Int64s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Int64s) String() string { var s [4]int64 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Uint8s is a scalable SIMD vector of uint8s. type Uint8s struct { uint8x32 v256 vals [32]uint8 } // Len returns the number of elements in a Uint8s. func (x Uint8s) Len() int { return vl() } // LoadUint8s loads a Uint8s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadUint8s(s []uint8) Uint8s { var z Uint8s if len(s) < z.Len() { panic("simd: LoadUint8s: slice shorter than the vector") } return loadUint8s(s) } //go:noescape func loadUint8s(s []uint8) Uint8s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Uint8s) Store(s []uint8) { if len(s) < x.Len() { panic("simd: Uint8s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Uint8s) store(s []uint8) // LoadUint8sPart loads a Uint8s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadUint8sPart(s []uint8) (Uint8s, int) { if len(s) == 0 { return Uint8s{}, 0 } return loadUint8sPart(s), min(len(s), Uint8s{}.Len()) } //go:noescape func loadUint8sPart(s []uint8) Uint8s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Uint8s) StorePart(s []uint8) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Uint8s) storePart(s []uint8) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Uint8s) IfElse(mask Mask8s, y Uint8s) Uint8s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Uint8s) Masked(mask Mask8s) Uint8s { var zero Uint8s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Uint8s) String() string { var s [32]uint8 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Uint16s is a scalable SIMD vector of uint16s. type Uint16s struct { uint16x16 v256 vals [16]uint16 } // Len returns the number of elements in a Uint16s. func (x Uint16s) Len() int { return vl() / 2 } // LoadUint16s loads a Uint16s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadUint16s(s []uint16) Uint16s { var z Uint16s if len(s) < z.Len() { panic("simd: LoadUint16s: slice shorter than the vector") } return loadUint16s(s) } //go:noescape func loadUint16s(s []uint16) Uint16s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Uint16s) Store(s []uint16) { if len(s) < x.Len() { panic("simd: Uint16s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Uint16s) store(s []uint16) // LoadUint16sPart loads a Uint16s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadUint16sPart(s []uint16) (Uint16s, int) { if len(s) == 0 { return Uint16s{}, 0 } return loadUint16sPart(s), min(len(s), Uint16s{}.Len()) } //go:noescape func loadUint16sPart(s []uint16) Uint16s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Uint16s) StorePart(s []uint16) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Uint16s) storePart(s []uint16) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Uint16s) IfElse(mask Mask16s, y Uint16s) Uint16s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Uint16s) Masked(mask Mask16s) Uint16s { var zero Uint16s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Uint16s) String() string { var s [16]uint16 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Uint32s is a scalable SIMD vector of uint32s. type Uint32s struct { uint32x8 v256 vals [8]uint32 } // Len returns the number of elements in a Uint32s. func (x Uint32s) Len() int { return vl() / 4 } // LoadUint32s loads a Uint32s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadUint32s(s []uint32) Uint32s { var z Uint32s if len(s) < z.Len() { panic("simd: LoadUint32s: slice shorter than the vector") } return loadUint32s(s) } //go:noescape func loadUint32s(s []uint32) Uint32s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Uint32s) Store(s []uint32) { if len(s) < x.Len() { panic("simd: Uint32s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Uint32s) store(s []uint32) // LoadUint32sPart loads a Uint32s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadUint32sPart(s []uint32) (Uint32s, int) { if len(s) == 0 { return Uint32s{}, 0 } return loadUint32sPart(s), min(len(s), Uint32s{}.Len()) } //go:noescape func loadUint32sPart(s []uint32) Uint32s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Uint32s) StorePart(s []uint32) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Uint32s) storePart(s []uint32) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Uint32s) IfElse(mask Mask32s, y Uint32s) Uint32s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Uint32s) Masked(mask Mask32s) Uint32s { var zero Uint32s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Uint32s) String() string { var s [8]uint32 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Uint64s is a scalable SIMD vector of uint64s. type Uint64s struct { uint64x4 v256 vals [4]uint64 } // Len returns the number of elements in a Uint64s. func (x Uint64s) Len() int { return vl() / 8 } // LoadUint64s loads a Uint64s from the first Len() elements of s. // It panics if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZLDR). func LoadUint64s(s []uint64) Uint64s { var z Uint64s if len(s) < z.Len() { panic("simd: LoadUint64s: slice shorter than the vector") } return loadUint64s(s) } //go:noescape func loadUint64s(s []uint64) Uint64s // Store stores x's Len() elements into the first Len() elements of s. It panics // if len(s) < Len(). // // Asm: Emulated (a length check that can panic, then ZSTR). func (x Uint64s) Store(s []uint64) { if len(s) < x.Len() { panic("simd: Uint64s.Store: slice shorter than the vector") } x.store(s) } //go:noescape func (x Uint64s) store(s []uint64) // LoadUint64sPart loads a Uint64s from s, reading n = min(len(s), // Len()) elements and returning the vector and n; the remaining elements are // zero. // // Asm: Emulated (predicate construction + LD1B). func LoadUint64sPart(s []uint64) (Uint64s, int) { if len(s) == 0 { return Uint64s{}, 0 } return loadUint64sPart(s), min(len(s), Uint64s{}.Len()) } //go:noescape func loadUint64sPart(s []uint64) Uint64s // StorePart stores the low n = min(len(s), Len()) elements of x into s and // returns n. // // Asm: Emulated (predicate construction + ST1B). func (x Uint64s) StorePart(s []uint64) int { if len(s) == 0 { return 0 } x.storePart(s) return min(len(s), x.Len()) } //go:noescape func (x Uint64s) storePart(s []uint64) // IfElse returns the elements of x where the corresponding element of mask is // true, and the elements of y where it is false. // // Asm: ZSEL func (x Uint64s) IfElse(mask Mask64s, y Uint64s) Uint64s // Masked returns the elements of x where the corresponding element of mask is // true, and zero where it is false. // // Asm: Emulated func (x Uint64s) Masked(mask Mask64s) Uint64s { var zero Uint64s return x.IfElse(mask, zero) } // String returns a string representation of SIMD vector x. Only the x.Len() // elements that exist at the runtime vector length are shown. func (x Uint64s) String() string { var s [4]uint64 n := x.Len() x.Store(s[:]) return sliceToString(s[:n]) } // Mask8s is a scalable mask for a SIMD vector of 8-bit elements. // // An SVE predicate holds one bit per byte of the vector it governs, so a // Mask8s carries one bit for each byte of the runtime vector length, and // lane i is governed by bit i. type Mask8s struct { mask8s psve vals uint32 } // LoadMask8s loads a Mask8s from the predicate bits packed into bits. // The bits are concatenated in little-endian order: bit i of bits[j] governs // vector byte 16*j+i, and so lane k is governed by bit k. // // One uint16 covers 16 bytes of vector, the length of the smallest vector SVE // defines, so bits must hold one uint16 per 16 bytes of the runtime vector // length. LoadMask8s panics if bits is shorter than that. // // Asm: Emulated (a length check that can panic, then PLDR (predicate)). func LoadMask8s(bits []uint16) Mask8s { if len(bits) < (vl()+15)/16 { panic("simd: LoadMask8s: bits is too short to hold the predicate") } return loadMask8s(bits) } //go:noescape func loadMask8s(bits []uint16) Mask8s // Store stores m's predicate bits into bits, concatenated in little-endian // order: bit i of bits[j] governs vector byte 16*j+i, and so lane k is // governed by bit k. // // bits must hold one uint16 per 16 bytes of the runtime vector length; Store // panics if it is shorter. // // Asm: Emulated (a length check that can panic, then PSTR (predicate)). func (m Mask8s) Store(bits []uint16) { if len(bits) < (vl()+15)/16 { panic("simd: Mask8s.Store: bits is too short to hold the predicate") } m.store(bits) } //go:noescape func (m Mask8s) store(bits []uint16) // String returns a string representation of SIMD mask m: 1 for an active lane, // 0 for an inactive one. Only the vl() lanes that exist at the runtime // vector length are shown. func (m Mask8s) String() string { var bits [2]uint16 m.Store(bits[:]) var s [32]int8 n := vl() for i := range n { if b := i; bits[b/16]>>(b%16)&1 != 0 { s[i] = 1 } } return sliceToString(s[:n]) } // Mask16s is a scalable mask for a SIMD vector of 16-bit elements. // // An SVE predicate holds one bit per byte of the vector it governs, so a // Mask16s carries one bit for each byte of the runtime vector length, and // lane i is governed by bit 2*i. The bits in between are ignored. type Mask16s struct { mask16s psve vals uint32 } // LoadMask16s loads a Mask16s from the predicate bits packed into bits. // The bits are concatenated in little-endian order: bit i of bits[j] governs // vector byte 16*j+i, and so lane k is governed by bit 2*k. // // One uint16 covers 16 bytes of vector, the length of the smallest vector SVE // defines, so bits must hold one uint16 per 16 bytes of the runtime vector // length. LoadMask16s panics if bits is shorter than that. // // Asm: Emulated (a length check that can panic, then PLDR (predicate)). func LoadMask16s(bits []uint16) Mask16s { if len(bits) < (vl()+15)/16 { panic("simd: LoadMask16s: bits is too short to hold the predicate") } return loadMask16s(bits) } //go:noescape func loadMask16s(bits []uint16) Mask16s // Store stores m's predicate bits into bits, concatenated in little-endian // order: bit i of bits[j] governs vector byte 16*j+i, and so lane k is // governed by bit 2*k. // // bits must hold one uint16 per 16 bytes of the runtime vector length; Store // panics if it is shorter. // // Asm: Emulated (a length check that can panic, then PSTR (predicate)). func (m Mask16s) Store(bits []uint16) { if len(bits) < (vl()+15)/16 { panic("simd: Mask16s.Store: bits is too short to hold the predicate") } m.store(bits) } //go:noescape func (m Mask16s) store(bits []uint16) // String returns a string representation of SIMD mask m: 1 for an active lane, // 0 for an inactive one. Only the vl() / 2 lanes that exist at the runtime // vector length are shown. func (m Mask16s) String() string { var bits [2]uint16 m.Store(bits[:]) var s [16]int16 n := vl() / 2 for i := range n { if b := i * 2; bits[b/16]>>(b%16)&1 != 0 { s[i] = 1 } } return sliceToString(s[:n]) } // Mask32s is a scalable mask for a SIMD vector of 32-bit elements. // // An SVE predicate holds one bit per byte of the vector it governs, so a // Mask32s carries one bit for each byte of the runtime vector length, and // lane i is governed by bit 4*i. The bits in between are ignored. type Mask32s struct { mask32s psve vals uint32 } // LoadMask32s loads a Mask32s from the predicate bits packed into bits. // The bits are concatenated in little-endian order: bit i of bits[j] governs // vector byte 16*j+i, and so lane k is governed by bit 4*k. // // One uint16 covers 16 bytes of vector, the length of the smallest vector SVE // defines, so bits must hold one uint16 per 16 bytes of the runtime vector // length. LoadMask32s panics if bits is shorter than that. // // Asm: Emulated (a length check that can panic, then PLDR (predicate)). func LoadMask32s(bits []uint16) Mask32s { if len(bits) < (vl()+15)/16 { panic("simd: LoadMask32s: bits is too short to hold the predicate") } return loadMask32s(bits) } //go:noescape func loadMask32s(bits []uint16) Mask32s // Store stores m's predicate bits into bits, concatenated in little-endian // order: bit i of bits[j] governs vector byte 16*j+i, and so lane k is // governed by bit 4*k. // // bits must hold one uint16 per 16 bytes of the runtime vector length; Store // panics if it is shorter. // // Asm: Emulated (a length check that can panic, then PSTR (predicate)). func (m Mask32s) Store(bits []uint16) { if len(bits) < (vl()+15)/16 { panic("simd: Mask32s.Store: bits is too short to hold the predicate") } m.store(bits) } //go:noescape func (m Mask32s) store(bits []uint16) // String returns a string representation of SIMD mask m: 1 for an active lane, // 0 for an inactive one. Only the vl() / 4 lanes that exist at the runtime // vector length are shown. func (m Mask32s) String() string { var bits [2]uint16 m.Store(bits[:]) var s [8]int32 n := vl() / 4 for i := range n { if b := i * 4; bits[b/16]>>(b%16)&1 != 0 { s[i] = 1 } } return sliceToString(s[:n]) } // Mask64s is a scalable mask for a SIMD vector of 64-bit elements. // // An SVE predicate holds one bit per byte of the vector it governs, so a // Mask64s carries one bit for each byte of the runtime vector length, and // lane i is governed by bit 8*i. The bits in between are ignored. type Mask64s struct { mask64s psve vals uint32 } // LoadMask64s loads a Mask64s from the predicate bits packed into bits. // The bits are concatenated in little-endian order: bit i of bits[j] governs // vector byte 16*j+i, and so lane k is governed by bit 8*k. // // One uint16 covers 16 bytes of vector, the length of the smallest vector SVE // defines, so bits must hold one uint16 per 16 bytes of the runtime vector // length. LoadMask64s panics if bits is shorter than that. // // Asm: Emulated (a length check that can panic, then PLDR (predicate)). func LoadMask64s(bits []uint16) Mask64s { if len(bits) < (vl()+15)/16 { panic("simd: LoadMask64s: bits is too short to hold the predicate") } return loadMask64s(bits) } //go:noescape func loadMask64s(bits []uint16) Mask64s // Store stores m's predicate bits into bits, concatenated in little-endian // order: bit i of bits[j] governs vector byte 16*j+i, and so lane k is // governed by bit 8*k. // // bits must hold one uint16 per 16 bytes of the runtime vector length; Store // panics if it is shorter. // // Asm: Emulated (a length check that can panic, then PSTR (predicate)). func (m Mask64s) Store(bits []uint16) { if len(bits) < (vl()+15)/16 { panic("simd: Mask64s.Store: bits is too short to hold the predicate") } m.store(bits) } //go:noescape func (m Mask64s) store(bits []uint16) // String returns a string representation of SIMD mask m: 1 for an active lane, // 0 for an inactive one. Only the vl() / 8 lanes that exist at the runtime // vector length are shown. func (m Mask64s) String() string { var bits [2]uint16 m.Store(bits[:]) var s [4]int64 n := vl() / 8 for i := range n { if b := i * 8; bits[b/16]>>(b%16)&1 != 0 { s[i] = 1 } } return sliceToString(s[:n]) }