mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.simd] simd: reorganize internal tests so that simd does not import testing
Change-Id: Id68835fd8f93d2252a072132ff1b8ee39f197977 Reviewed-on: https://go-review.googlesource.com/c/go/+/721940 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
3fe246ae0f
commit
95b4ad525f
2 changed files with 192 additions and 127 deletions
64
src/simd/export_test.go
Normal file
64
src/simd/export_test.go
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
// Copyright 2025 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build goexperiment.simd && amd64
|
||||||
|
|
||||||
|
// This exposes some internal interfaces to simd_test.
|
||||||
|
|
||||||
|
package simd
|
||||||
|
|
||||||
|
func (x Int64x2) ExportTestConcatSelectedConstant(indices uint8, y Int64x2) Int64x2 {
|
||||||
|
return x.concatSelectedConstant(indices, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Float64x4) ExportTestConcatSelectedConstantGrouped(indices uint8, y Float64x4) Float64x4 {
|
||||||
|
return x.concatSelectedConstantGrouped(indices, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Float32x4) ExportTestConcatSelectedConstant(indices uint8, y Float32x4) Float32x4 {
|
||||||
|
return x.concatSelectedConstant(indices, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Int32x4) ExportTestConcatSelectedConstant(indices uint8, y Int32x4) Int32x4 {
|
||||||
|
return x.concatSelectedConstant(indices, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Uint32x8) ExportTestConcatSelectedConstantGrouped(indices uint8, y Uint32x8) Uint32x8 {
|
||||||
|
return x.concatSelectedConstantGrouped(indices, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Int32x8) ExportTestConcatSelectedConstantGrouped(indices uint8, y Int32x8) Int32x8 {
|
||||||
|
return x.concatSelectedConstantGrouped(indices, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Int32x8) ExportTestTern(table uint8, y Int32x8, z Int32x8) Int32x8 {
|
||||||
|
return x.tern(table, y, z)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x Int32x4) ExportTestTern(table uint8, y Int32x4, z Int32x4) Int32x4 {
|
||||||
|
return x.tern(table, y, z)
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExportTestCscImm4(a, b, c, d uint8) uint8 {
|
||||||
|
return cscimm4(a, b, c, d)
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
LLLL = _LLLL
|
||||||
|
HLLL = _HLLL
|
||||||
|
LHLL = _LHLL
|
||||||
|
HHLL = _HHLL
|
||||||
|
LLHL = _LLHL
|
||||||
|
HLHL = _HLHL
|
||||||
|
LHHL = _LHHL
|
||||||
|
HHHL = _HHHL
|
||||||
|
LLLH = _LLLH
|
||||||
|
HLLH = _HLLH
|
||||||
|
LHLH = _LHLH
|
||||||
|
HHLH = _HHLH
|
||||||
|
LLHH = _LLHH
|
||||||
|
HLHH = _HLHH
|
||||||
|
LHHH = _LHHH
|
||||||
|
HHHH = _HHHH
|
||||||
|
)
|
||||||
|
|
@ -4,58 +4,59 @@
|
||||||
|
|
||||||
//go:build goexperiment.simd && amd64
|
//go:build goexperiment.simd && amd64
|
||||||
|
|
||||||
package simd
|
package simd_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"simd"
|
||||||
"simd/internal/test_helpers"
|
"simd/internal/test_helpers"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestConcatSelectedConstant64(t *testing.T) {
|
func TestConcatSelectedConstant64(t *testing.T) {
|
||||||
a := make([]int64, 2)
|
a := make([]int64, 2)
|
||||||
x := LoadInt64x2Slice([]int64{4, 5})
|
x := simd.LoadInt64x2Slice([]int64{4, 5})
|
||||||
y := LoadInt64x2Slice([]int64{6, 7})
|
y := simd.LoadInt64x2Slice([]int64{6, 7})
|
||||||
z := x.concatSelectedConstant(0b10, y)
|
z := x.ExportTestConcatSelectedConstant(0b10, y)
|
||||||
z.StoreSlice(a)
|
z.StoreSlice(a)
|
||||||
test_helpers.CheckSlices[int64](t, a, []int64{4, 7})
|
test_helpers.CheckSlices[int64](t, a, []int64{4, 7})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConcatSelectedConstantGrouped64(t *testing.T) {
|
func TestConcatSelectedConstantGrouped64(t *testing.T) {
|
||||||
a := make([]float64, 4)
|
a := make([]float64, 4)
|
||||||
x := LoadFloat64x4Slice([]float64{4, 5, 8, 9})
|
x := simd.LoadFloat64x4Slice([]float64{4, 5, 8, 9})
|
||||||
y := LoadFloat64x4Slice([]float64{6, 7, 10, 11})
|
y := simd.LoadFloat64x4Slice([]float64{6, 7, 10, 11})
|
||||||
z := x.concatSelectedConstantGrouped(0b_11_10, y)
|
z := x.ExportTestConcatSelectedConstantGrouped(0b_11_10, y)
|
||||||
z.StoreSlice(a)
|
z.StoreSlice(a)
|
||||||
test_helpers.CheckSlices[float64](t, a, []float64{4, 7, 9, 11})
|
test_helpers.CheckSlices[float64](t, a, []float64{4, 7, 9, 11})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConcatSelectedConstant32(t *testing.T) {
|
func TestConcatSelectedConstant32(t *testing.T) {
|
||||||
a := make([]float32, 4)
|
a := make([]float32, 4)
|
||||||
x := LoadFloat32x4Slice([]float32{4, 5, 8, 9})
|
x := simd.LoadFloat32x4Slice([]float32{4, 5, 8, 9})
|
||||||
y := LoadFloat32x4Slice([]float32{6, 7, 10, 11})
|
y := simd.LoadFloat32x4Slice([]float32{6, 7, 10, 11})
|
||||||
z := x.concatSelectedConstant(0b_11_01_10_00, y)
|
z := x.ExportTestConcatSelectedConstant(0b_11_01_10_00, y)
|
||||||
z.StoreSlice(a)
|
z.StoreSlice(a)
|
||||||
test_helpers.CheckSlices[float32](t, a, []float32{4, 8, 7, 11})
|
test_helpers.CheckSlices[float32](t, a, []float32{4, 8, 7, 11})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConcatSelectedConstantGrouped32(t *testing.T) {
|
func TestConcatSelectedConstantGrouped32(t *testing.T) {
|
||||||
a := make([]uint32, 8)
|
a := make([]uint32, 8)
|
||||||
x := LoadUint32x8Slice([]uint32{0, 1, 2, 3, 8, 9, 10, 11})
|
x := simd.LoadUint32x8Slice([]uint32{0, 1, 2, 3, 8, 9, 10, 11})
|
||||||
y := LoadUint32x8Slice([]uint32{4, 5, 6, 7, 12, 13, 14, 15})
|
y := simd.LoadUint32x8Slice([]uint32{4, 5, 6, 7, 12, 13, 14, 15})
|
||||||
z := x.concatSelectedConstantGrouped(0b_11_01_00_10, y)
|
z := x.ExportTestConcatSelectedConstantGrouped(0b_11_01_00_10, y)
|
||||||
z.StoreSlice(a)
|
z.StoreSlice(a)
|
||||||
test_helpers.CheckSlices[uint32](t, a, []uint32{2, 0, 5, 7, 10, 8, 13, 15})
|
test_helpers.CheckSlices[uint32](t, a, []uint32{2, 0, 5, 7, 10, 8, 13, 15})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTern(t *testing.T) {
|
func TestTern(t *testing.T) {
|
||||||
if !X86.AVX512() {
|
if !simd.X86.AVX512() {
|
||||||
t.Skip("This test needs AVX512")
|
t.Skip("This test needs AVX512")
|
||||||
}
|
}
|
||||||
x := LoadInt32x8Slice([]int32{0, 0, 0, 0, 1, 1, 1, 1})
|
x := simd.LoadInt32x8Slice([]int32{0, 0, 0, 0, 1, 1, 1, 1})
|
||||||
y := LoadInt32x8Slice([]int32{0, 0, 1, 1, 0, 0, 1, 1})
|
y := simd.LoadInt32x8Slice([]int32{0, 0, 1, 1, 0, 0, 1, 1})
|
||||||
z := LoadInt32x8Slice([]int32{0, 1, 0, 1, 0, 1, 0, 1})
|
z := simd.LoadInt32x8Slice([]int32{0, 1, 0, 1, 0, 1, 0, 1})
|
||||||
|
|
||||||
foo := func(w Int32x8, k uint8) {
|
foo := func(w simd.Int32x8, k uint8) {
|
||||||
a := make([]int32, 8)
|
a := make([]int32, 8)
|
||||||
w.StoreSlice(a)
|
w.StoreSlice(a)
|
||||||
t.Logf("For k=%0b, w=%v", k, a)
|
t.Logf("For k=%0b, w=%v", k, a)
|
||||||
|
|
@ -67,9 +68,9 @@ func TestTern(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foo(x.tern(0b1111_0000, y, z), 0b1111_0000)
|
foo(x.ExportTestTern(0b1111_0000, y, z), 0b1111_0000)
|
||||||
foo(x.tern(0b1100_1100, y, z), 0b1100_1100)
|
foo(x.ExportTestTern(0b1100_1100, y, z), 0b1100_1100)
|
||||||
foo(x.tern(0b1010_1010, y, z), 0b1010_1010)
|
foo(x.ExportTestTern(0b1010_1010, y, z), 0b1010_1010)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSelect2x4x32(t *testing.T) {
|
func TestSelect2x4x32(t *testing.T) {
|
||||||
|
|
@ -77,8 +78,8 @@ func TestSelect2x4x32(t *testing.T) {
|
||||||
for b := range uint8(8) {
|
for b := range uint8(8) {
|
||||||
for c := range uint8(8) {
|
for c := range uint8(8) {
|
||||||
for d := range uint8(8) {
|
for d := range uint8(8) {
|
||||||
x := LoadInt32x4Slice([]int32{0, 1, 2, 3})
|
x := simd.LoadInt32x4Slice([]int32{0, 1, 2, 3})
|
||||||
y := LoadInt32x4Slice([]int32{4, 5, 6, 7})
|
y := simd.LoadInt32x4Slice([]int32{4, 5, 6, 7})
|
||||||
z := select2x4x32(x, a, b, c, d, y)
|
z := select2x4x32(x, a, b, c, d, y)
|
||||||
w := make([]int32, 4, 4)
|
w := make([]int32, 4, 4)
|
||||||
z.StoreSlice(w)
|
z.StoreSlice(w)
|
||||||
|
|
@ -97,8 +98,8 @@ func TestSelect2x8x32Grouped(t *testing.T) {
|
||||||
for b := range uint8(8) {
|
for b := range uint8(8) {
|
||||||
for c := range uint8(8) {
|
for c := range uint8(8) {
|
||||||
for d := range uint8(8) {
|
for d := range uint8(8) {
|
||||||
x := LoadInt32x8Slice([]int32{0, 1, 2, 3, 10, 11, 12, 13})
|
x := simd.LoadInt32x8Slice([]int32{0, 1, 2, 3, 10, 11, 12, 13})
|
||||||
y := LoadInt32x8Slice([]int32{4, 5, 6, 7, 14, 15, 16, 17})
|
y := simd.LoadInt32x8Slice([]int32{4, 5, 6, 7, 14, 15, 16, 17})
|
||||||
z := select2x8x32Grouped(x, a, b, c, d, y)
|
z := select2x8x32Grouped(x, a, b, c, d, y)
|
||||||
w := make([]int32, 8, 8)
|
w := make([]int32, 8, 8)
|
||||||
z.StoreSlice(w)
|
z.StoreSlice(w)
|
||||||
|
|
@ -117,60 +118,60 @@ func TestSelect2x8x32Grouped(t *testing.T) {
|
||||||
// select2x4x32 returns a selection of 4 elements in x and y, numbered
|
// select2x4x32 returns a selection of 4 elements in x and y, numbered
|
||||||
// 0-7, where 0-3 are the four elements of x and 4-7 are the four elements
|
// 0-7, where 0-3 are the four elements of x and 4-7 are the four elements
|
||||||
// of y.
|
// of y.
|
||||||
func select2x4x32(x Int32x4, a, b, c, d uint8, y Int32x4) Int32x4 {
|
func select2x4x32(x simd.Int32x4, a, b, c, d uint8, y simd.Int32x4) simd.Int32x4 {
|
||||||
pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
|
pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
|
||||||
|
|
||||||
a, b, c, d = a&3, b&3, c&3, d&3
|
a, b, c, d = a&3, b&3, c&3, d&3
|
||||||
|
|
||||||
switch pattern {
|
switch pattern {
|
||||||
case _LLLL:
|
case simd.LLLL:
|
||||||
return x.concatSelectedConstant(cscimm4(a, b, c, d), x)
|
return x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, c, d), x)
|
||||||
case _HHHH:
|
case simd.HHHH:
|
||||||
return y.concatSelectedConstant(cscimm4(a, b, c, d), y)
|
return y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, c, d), y)
|
||||||
case _LLHH:
|
case simd.LLHH:
|
||||||
return x.concatSelectedConstant(cscimm4(a, b, c, d), y)
|
return x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, c, d), y)
|
||||||
case _HHLL:
|
case simd.HHLL:
|
||||||
return y.concatSelectedConstant(cscimm4(a, b, c, d), x)
|
return y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, c, d), x)
|
||||||
|
|
||||||
case _HLLL:
|
case simd.HLLL:
|
||||||
z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
|
z := y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, a, b, b), x)
|
||||||
return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
|
return z.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(0, 2, c, d), x)
|
||||||
case _LHLL:
|
case simd.LHLL:
|
||||||
z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, a, b, b), y)
|
||||||
return z.concatSelectedConstant(cscimm4(0, 2, c, d), x)
|
return z.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(0, 2, c, d), x)
|
||||||
|
|
||||||
case _HLHH:
|
case simd.HLHH:
|
||||||
z := y.concatSelectedConstant(cscimm4(a, a, b, b), x)
|
z := y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, a, b, b), x)
|
||||||
return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
|
return z.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(0, 2, c, d), y)
|
||||||
case _LHHH:
|
case simd.LHHH:
|
||||||
z := x.concatSelectedConstant(cscimm4(a, a, b, b), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, a, b, b), y)
|
||||||
return z.concatSelectedConstant(cscimm4(0, 2, c, d), y)
|
return z.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(0, 2, c, d), y)
|
||||||
|
|
||||||
case _LLLH:
|
case simd.LLLH:
|
||||||
z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(c, c, d, d), y)
|
||||||
return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
|
return x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
case _LLHL:
|
case simd.LLHL:
|
||||||
z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
|
z := y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(c, c, d, d), x)
|
||||||
return x.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
|
return x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
case _HHLH:
|
case simd.HHLH:
|
||||||
z := x.concatSelectedConstant(cscimm4(c, c, d, d), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(c, c, d, d), y)
|
||||||
return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
|
return y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
case _HHHL:
|
case simd.HHHL:
|
||||||
z := y.concatSelectedConstant(cscimm4(c, c, d, d), x)
|
z := y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(c, c, d, d), x)
|
||||||
return y.concatSelectedConstant(cscimm4(a, b, 0, 2), z)
|
return y.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
|
|
||||||
case _LHLH:
|
case simd.LHLH:
|
||||||
z := x.concatSelectedConstant(cscimm4(a, c, b, d), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, c, b, d), y)
|
||||||
return z.concatSelectedConstant(0b11_01_10_00 /* =cscimm4(0, 2, 1, 3) */, z)
|
return z.ExportTestConcatSelectedConstant(0b11_01_10_00 /* =simd.ExportTestCscImm4(0, 2, 1, 3) */, z)
|
||||||
case _HLHL:
|
case simd.HLHL:
|
||||||
z := x.concatSelectedConstant(cscimm4(b, d, a, c), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(b, d, a, c), y)
|
||||||
return z.concatSelectedConstant(0b01_11_00_10 /* =cscimm4(2, 0, 3, 1) */, z)
|
return z.ExportTestConcatSelectedConstant(0b01_11_00_10 /* =simd.ExportTestCscImm4(2, 0, 3, 1) */, z)
|
||||||
case _HLLH:
|
case simd.HLLH:
|
||||||
z := x.concatSelectedConstant(cscimm4(b, c, a, d), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(b, c, a, d), y)
|
||||||
return z.concatSelectedConstant(0b11_01_00_10 /* =cscimm4(2, 0, 1, 3) */, z)
|
return z.ExportTestConcatSelectedConstant(0b11_01_00_10 /* =simd.ExportTestCscImm4(2, 0, 1, 3) */, z)
|
||||||
case _LHHL:
|
case simd.LHHL:
|
||||||
z := x.concatSelectedConstant(cscimm4(a, d, b, c), y)
|
z := x.ExportTestConcatSelectedConstant(simd.ExportTestCscImm4(a, d, b, c), y)
|
||||||
return z.concatSelectedConstant(0b01_11_10_00 /* =cscimm4(0, 2, 3, 1) */, z)
|
return z.ExportTestConcatSelectedConstant(0b01_11_10_00 /* =simd.ExportTestCscImm4(0, 2, 3, 1) */, z)
|
||||||
}
|
}
|
||||||
panic("missing case, switch should be exhaustive")
|
panic("missing case, switch should be exhaustive")
|
||||||
}
|
}
|
||||||
|
|
@ -179,79 +180,79 @@ func select2x4x32(x Int32x4, a, b, c, d uint8, y Int32x4) Int32x4 {
|
||||||
// numbered 0-7, where 0-3 are the four elements of x's two groups (lower and
|
// numbered 0-7, where 0-3 are the four elements of x's two groups (lower and
|
||||||
// upper 128 bits) and 4-7 are the four elements of y's two groups.
|
// upper 128 bits) and 4-7 are the four elements of y's two groups.
|
||||||
|
|
||||||
func select2x8x32Grouped(x Int32x8, a, b, c, d uint8, y Int32x8) Int32x8 {
|
func select2x8x32Grouped(x simd.Int32x8, a, b, c, d uint8, y simd.Int32x8) simd.Int32x8 {
|
||||||
// selections as being expressible in the concatSelectedConstant pattern,
|
// selections as being expressible in the ExportTestConcatSelectedConstant pattern,
|
||||||
// or not. Classification is by H and L, where H is a selection from 4-7
|
// or not. Classification is by H and L, where H is a selection from 4-7
|
||||||
// and L is a selection from 0-3.
|
// and L is a selection from 0-3.
|
||||||
// _LLHH -> CSC(x,y, a, b, c&3, d&3)
|
// simd.LLHH -> CSC(x,y, a, b, c&3, d&3)
|
||||||
// _HHLL -> CSC(y,x, a&3, b&3, c, d)
|
// simd.HHLL -> CSC(y,x, a&3, b&3, c, d)
|
||||||
// _LLLL -> CSC(x,x, a, b, c, d)
|
// simd.LLLL -> CSC(x,x, a, b, c, d)
|
||||||
// _HHHH -> CSC(y,y, a&3, b&3, c&3, d&3)
|
// simd.HHHH -> CSC(y,y, a&3, b&3, c&3, d&3)
|
||||||
|
|
||||||
// _LLLH -> z = CSC(x, y, c, c, d&3, d&3); CSC(x, z, a, b, 0, 2)
|
// simd.LLLH -> z = CSC(x, y, c, c, d&3, d&3); CSC(x, z, a, b, 0, 2)
|
||||||
// _LLHL -> z = CSC(x, y, c&3, c&3, d, d); CSC(x, z, a, b, 0, 2)
|
// simd.LLHL -> z = CSC(x, y, c&3, c&3, d, d); CSC(x, z, a, b, 0, 2)
|
||||||
// _HHLH -> z = CSC(x, y, c, c, d&3, d&3); CSC(y, z, a&3, b&3, 0, 2)
|
// simd.HHLH -> z = CSC(x, y, c, c, d&3, d&3); CSC(y, z, a&3, b&3, 0, 2)
|
||||||
// _HHHL -> z = CSC(x, y, c&3, c&3, d, d); CSC(y, z, a&3, b&3, 0, 2)
|
// simd.HHHL -> z = CSC(x, y, c&3, c&3, d, d); CSC(y, z, a&3, b&3, 0, 2)
|
||||||
|
|
||||||
// _LHLL -> z = CSC(x, y, a, a, b&3, b&3); CSC(z, x, 0, 2, c, d)
|
// simd.LHLL -> z = CSC(x, y, a, a, b&3, b&3); CSC(z, x, 0, 2, c, d)
|
||||||
// etc
|
// etc
|
||||||
|
|
||||||
// _LHLH -> z = CSC(x, y, a, c, b&3, d&3); CSC(z, z, 0, 2, 1, 3)
|
// simd.LHLH -> z = CSC(x, y, a, c, b&3, d&3); CSC(z, z, 0, 2, 1, 3)
|
||||||
// _HLHL -> z = CSC(x, y, b, d, a&3, c&3); CSC(z, z, 2, 0, 3, 1)
|
// simd.HLHL -> z = CSC(x, y, b, d, a&3, c&3); CSC(z, z, 2, 0, 3, 1)
|
||||||
|
|
||||||
pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
|
pattern := a>>2 + (b&4)>>1 + (c & 4) + (d&4)<<1
|
||||||
|
|
||||||
a, b, c, d = a&3, b&3, c&3, d&3
|
a, b, c, d = a&3, b&3, c&3, d&3
|
||||||
|
|
||||||
switch pattern {
|
switch pattern {
|
||||||
case _LLLL:
|
case simd.LLLL:
|
||||||
return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
|
return x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, c, d), x)
|
||||||
case _HHHH:
|
case simd.HHHH:
|
||||||
return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
|
return y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, c, d), y)
|
||||||
case _LLHH:
|
case simd.LLHH:
|
||||||
return x.concatSelectedConstantGrouped(cscimm4(a, b, c, d), y)
|
return x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, c, d), y)
|
||||||
case _HHLL:
|
case simd.HHLL:
|
||||||
return y.concatSelectedConstantGrouped(cscimm4(a, b, c, d), x)
|
return y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, c, d), x)
|
||||||
|
|
||||||
case _HLLL:
|
case simd.HLLL:
|
||||||
z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
|
z := y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, a, b, b), x)
|
||||||
return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
|
return z.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(0, 2, c, d), x)
|
||||||
case _LHLL:
|
case simd.LHLL:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, a, b, b), y)
|
||||||
return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), x)
|
return z.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(0, 2, c, d), x)
|
||||||
|
|
||||||
case _HLHH:
|
case simd.HLHH:
|
||||||
z := y.concatSelectedConstantGrouped(cscimm4(a, a, b, b), x)
|
z := y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, a, b, b), x)
|
||||||
return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
|
return z.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(0, 2, c, d), y)
|
||||||
case _LHHH:
|
case simd.LHHH:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(a, a, b, b), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, a, b, b), y)
|
||||||
return z.concatSelectedConstantGrouped(cscimm4(0, 2, c, d), y)
|
return z.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(0, 2, c, d), y)
|
||||||
|
|
||||||
case _LLLH:
|
case simd.LLLH:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(c, c, d, d), y)
|
||||||
return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
|
return x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
case _LLHL:
|
case simd.LLHL:
|
||||||
z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
|
z := y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(c, c, d, d), x)
|
||||||
return x.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
|
return x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
case _HHLH:
|
case simd.HHLH:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(c, c, d, d), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(c, c, d, d), y)
|
||||||
return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
|
return y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
case _HHHL:
|
case simd.HHHL:
|
||||||
z := y.concatSelectedConstantGrouped(cscimm4(c, c, d, d), x)
|
z := y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(c, c, d, d), x)
|
||||||
return y.concatSelectedConstantGrouped(cscimm4(a, b, 0, 2), z)
|
return y.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, b, 0, 2), z)
|
||||||
|
|
||||||
case _LHLH:
|
case simd.LHLH:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(a, c, b, d), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, c, b, d), y)
|
||||||
return z.concatSelectedConstantGrouped(0b11_01_10_00 /* =cscimm4(0, 2, 1, 3) */, z)
|
return z.ExportTestConcatSelectedConstantGrouped(0b11_01_10_00 /* =simd.ExportTestCscImm4(0, 2, 1, 3) */, z)
|
||||||
case _HLHL:
|
case simd.HLHL:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(b, d, a, c), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(b, d, a, c), y)
|
||||||
return z.concatSelectedConstantGrouped(0b01_11_00_10 /* =cscimm4(2, 0, 3, 1) */, z)
|
return z.ExportTestConcatSelectedConstantGrouped(0b01_11_00_10 /* =simd.ExportTestCscImm4(2, 0, 3, 1) */, z)
|
||||||
case _HLLH:
|
case simd.HLLH:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(b, c, a, d), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(b, c, a, d), y)
|
||||||
return z.concatSelectedConstantGrouped(0b11_01_00_10 /* =cscimm4(2, 0, 1, 3) */, z)
|
return z.ExportTestConcatSelectedConstantGrouped(0b11_01_00_10 /* =simd.ExportTestCscImm4(2, 0, 1, 3) */, z)
|
||||||
case _LHHL:
|
case simd.LHHL:
|
||||||
z := x.concatSelectedConstantGrouped(cscimm4(a, d, b, c), y)
|
z := x.ExportTestConcatSelectedConstantGrouped(simd.ExportTestCscImm4(a, d, b, c), y)
|
||||||
return z.concatSelectedConstantGrouped(0b01_11_10_00 /* =cscimm4(0, 2, 3, 1) */, z)
|
return z.ExportTestConcatSelectedConstantGrouped(0b01_11_10_00 /* =simd.ExportTestCscImm4(0, 2, 3, 1) */, z)
|
||||||
}
|
}
|
||||||
panic("missing case, switch should be exhaustive")
|
panic("missing case, switch should be exhaustive")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue