Source file src/simd/archsimd/consts_amd64.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.simdstable && amd64 6 7 package archsimd 8 9 // These constants represent the source pattern for the four parameters 10 // (a, b, c, d) passed to ConcatPermuteScalars and ConcatPermuteScalarsGrouped. 11 // L means the element comes from the 'x' vector (Low), and 12 // H means it comes from the 'y' vector (High). 13 // The order of the letters corresponds to elements a, b, c, d. 14 // The underlying integer value is a bitmask where: 15 // Bit 0: Source of element 'a' (0 for x, 1 for y) 16 // Bit 1: Source of element 'b' (0 for x, 1 for y) 17 // Bit 2: Source of element 'c' (0 for x, 1 for y) 18 // Bit 3: Source of element 'd' (0 for x, 1 for y) 19 // Note that the least-significant bit is on the LEFT in this encoding. 20 const ( 21 _LLLL = iota // a:x, b:x, c:x, d:x 22 _HLLL // a:y, b:x, c:x, d:x 23 _LHLL // a:x, b:y, c:x, d:x 24 _HHLL // a:y, b:y, c:x, d:x 25 _LLHL // a:x, b:x, c:y, d:x 26 _HLHL // a:y, b:x, c:y, d:x 27 _LHHL // a:x, b:y, c:y, d:x 28 _HHHL // a:y, b:y, c:y, d:x 29 _LLLH // a:x, b:x, c:x, d:y 30 _HLLH // a:y, b:x, c:x, d:y 31 _LHLH // a:x, b:y, c:x, d:y 32 _HHLH // a:y, b:y, c:x, d:y 33 _LLHH // a:x, b:x, c:y, d:y 34 _HLHH // a:y, b:x, c:y, d:y 35 _LHHH // a:x, b:y, c:y, d:y 36 _HHHH // a:y, b:y, c:y, d:y 37 ) 38 39 // cscimm4 converts the 4 vector element indices into a single 40 // uint8 for use as an immediate. 41 func cscimm4(a, b, c, d uint8) uint8 { 42 return uint8(a + b<<2 + c<<4 + d<<6) 43 } 44