[dev.simd] simd/archsimd: add HasAVX2() guards to tests that need them
This may not be complete, because some 256-bit float operations
may be implemented with integer simd instead (in some cases there
is no float op). (And some tests may have just been overlooked.)
Fixes #76866.
diff --git a/src/simd/archsimd/internal/simd_test/binary_test.go b/src/simd/archsimd/internal/simd_test/binary_test.go
index fa2b951..28efdcb 100644
--- a/src/simd/archsimd/internal/simd_test/binary_test.go
+++ b/src/simd/archsimd/internal/simd_test/binary_test.go
@@ -17,23 +17,29 @@
testFloat64x2Binary(t, archsimd.Float64x2.Add, addSlice[float64])
testFloat64x4Binary(t, archsimd.Float64x4.Add, addSlice[float64])
- testInt16x16Binary(t, archsimd.Int16x16.Add, addSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.Add, addSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Add, addSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Add, addSlice[int32])
testInt64x2Binary(t, archsimd.Int64x2.Add, addSlice[int64])
- testInt64x4Binary(t, archsimd.Int64x4.Add, addSlice[int64])
testInt8x16Binary(t, archsimd.Int8x16.Add, addSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.Add, addSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.Add, addSlice[uint16])
- testUint16x8Binary(t, archsimd.Uint16x8.Add, addSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.Add, addSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.Add, addSlice[uint32])
testUint64x2Binary(t, archsimd.Uint64x2.Add, addSlice[uint64])
- testUint64x4Binary(t, archsimd.Uint64x4.Add, addSlice[uint64])
+ testUint16x8Binary(t, archsimd.Uint16x8.Add, addSlice[uint16])
testUint8x16Binary(t, archsimd.Uint8x16.Add, addSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.Add, addSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.Add, addSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.Add, addSlice[uint32])
+ testUint64x4Binary(t, archsimd.Uint64x4.Add, addSlice[uint64])
+ testUint8x32Binary(t, archsimd.Uint8x32.Add, addSlice[uint8])
+ }
+
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Add, addSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Add, addSlice[int32])
+ testInt64x4Binary(t, archsimd.Int64x4.Add, addSlice[int64])
+ testInt8x32Binary(t, archsimd.Int8x32.Add, addSlice[int8])
+ }
if archsimd.X86.AVX512() {
testFloat32x16Binary(t, archsimd.Float32x16.Add, addSlice[float32])
@@ -55,23 +61,29 @@
testFloat64x2Binary(t, archsimd.Float64x2.Sub, subSlice[float64])
testFloat64x4Binary(t, archsimd.Float64x4.Sub, subSlice[float64])
- testInt16x16Binary(t, archsimd.Int16x16.Sub, subSlice[int16])
- testInt16x8Binary(t, archsimd.Int16x8.Sub, subSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Sub, subSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Sub, subSlice[int32])
+ testInt16x8Binary(t, archsimd.Int16x8.Sub, subSlice[int16])
testInt64x2Binary(t, archsimd.Int64x2.Sub, subSlice[int64])
- testInt64x4Binary(t, archsimd.Int64x4.Sub, subSlice[int64])
testInt8x16Binary(t, archsimd.Int8x16.Sub, subSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.Sub, subSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.Sub, subSlice[uint16])
- testUint16x8Binary(t, archsimd.Uint16x8.Sub, subSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Sub, subSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Sub, subSlice[int32])
+ testInt64x4Binary(t, archsimd.Int64x4.Sub, subSlice[int64])
+ testInt8x32Binary(t, archsimd.Int8x32.Sub, subSlice[int8])
+ }
+
testUint32x4Binary(t, archsimd.Uint32x4.Sub, subSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.Sub, subSlice[uint32])
+ testUint16x8Binary(t, archsimd.Uint16x8.Sub, subSlice[uint16])
testUint64x2Binary(t, archsimd.Uint64x2.Sub, subSlice[uint64])
- testUint64x4Binary(t, archsimd.Uint64x4.Sub, subSlice[uint64])
testUint8x16Binary(t, archsimd.Uint8x16.Sub, subSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.Sub, subSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.Sub, subSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.Sub, subSlice[uint32])
+ testUint64x4Binary(t, archsimd.Uint64x4.Sub, subSlice[uint64])
+ testUint8x32Binary(t, archsimd.Uint8x32.Sub, subSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testFloat32x16Binary(t, archsimd.Float32x16.Sub, subSlice[float32])
@@ -93,10 +105,13 @@
// testFloat64x2Binary(t, archsimd.Float64x2.Max, maxSlice[float64]) // nan is wrong
// testFloat64x4Binary(t, archsimd.Float64x4.Max, maxSlice[float64]) // nan is wrong
- testInt16x16Binary(t, archsimd.Int16x16.Max, maxSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.Max, maxSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Max, maxSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Max, maxSlice[int32])
+
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Max, maxSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Max, maxSlice[int32])
+ }
if archsimd.X86.AVX512() {
testInt64x2Binary(t, archsimd.Int64x2.Max, maxSlice[int64])
@@ -104,12 +119,18 @@
}
testInt8x16Binary(t, archsimd.Int8x16.Max, maxSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.Max, maxSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.Max, maxSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt8x32Binary(t, archsimd.Int8x32.Max, maxSlice[int8])
+ }
+
testUint16x8Binary(t, archsimd.Uint16x8.Max, maxSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.Max, maxSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.Max, maxSlice[uint32])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.Max, maxSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.Max, maxSlice[uint32])
+ }
if archsimd.X86.AVX512() {
testUint64x2Binary(t, archsimd.Uint64x2.Max, maxSlice[uint64])
@@ -117,7 +138,10 @@
}
testUint8x16Binary(t, archsimd.Uint8x16.Max, maxSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.Max, maxSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint8x32Binary(t, archsimd.Uint8x32.Max, maxSlice[uint8])
+ }
if archsimd.X86.AVX512() {
// testFloat32x16Binary(t, archsimd.Float32x16.Max, maxSlice[float32]) // nan is wrong
@@ -139,10 +163,13 @@
// testFloat64x2Binary(t, archsimd.Float64x2.Min, minSlice[float64]) // nan is wrong
// testFloat64x4Binary(t, archsimd.Float64x4.Min, minSlice[float64]) // nan is wrong
- testInt16x16Binary(t, archsimd.Int16x16.Min, minSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.Min, minSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Min, minSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Min, minSlice[int32])
+
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Min, minSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Min, minSlice[int32])
+ }
if archsimd.X86.AVX512() {
testInt64x2Binary(t, archsimd.Int64x2.Min, minSlice[int64])
@@ -150,12 +177,18 @@
}
testInt8x16Binary(t, archsimd.Int8x16.Min, minSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.Min, minSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.Min, minSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt8x32Binary(t, archsimd.Int8x32.Min, minSlice[int8])
+ }
+
testUint16x8Binary(t, archsimd.Uint16x8.Min, minSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.Min, minSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.Min, minSlice[uint32])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.Min, minSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.Min, minSlice[uint32])
+ }
if archsimd.X86.AVX512() {
testUint64x2Binary(t, archsimd.Uint64x2.Min, minSlice[uint64])
@@ -163,7 +196,10 @@
}
testUint8x16Binary(t, archsimd.Uint8x16.Min, minSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.Min, minSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint8x32Binary(t, archsimd.Uint8x32.Min, minSlice[uint8])
+ }
if archsimd.X86.AVX512() {
// testFloat32x16Binary(t, archsimd.Float32x16.Min, minSlice[float32]) // nan is wrong
@@ -180,23 +216,29 @@
}
func TestAnd(t *testing.T) {
- testInt16x16Binary(t, archsimd.Int16x16.And, andSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.And, andSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.And, andSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.And, andSlice[int32])
testInt64x2Binary(t, archsimd.Int64x2.And, andSlice[int64])
- testInt64x4Binary(t, archsimd.Int64x4.And, andSlice[int64])
testInt8x16Binary(t, archsimd.Int8x16.And, andSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.And, andSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.And, andSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.And, andSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.And, andSlice[int32])
+ testInt64x4Binary(t, archsimd.Int64x4.And, andSlice[int64])
+ testInt8x32Binary(t, archsimd.Int8x32.And, andSlice[int8])
+ }
+
testUint16x8Binary(t, archsimd.Uint16x8.And, andSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.And, andSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.And, andSlice[uint32])
testUint64x2Binary(t, archsimd.Uint64x2.And, andSlice[uint64])
- testUint64x4Binary(t, archsimd.Uint64x4.And, andSlice[uint64])
testUint8x16Binary(t, archsimd.Uint8x16.And, andSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.And, andSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.And, andSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.And, andSlice[uint32])
+ testUint64x4Binary(t, archsimd.Uint64x4.And, andSlice[uint64])
+ testUint8x32Binary(t, archsimd.Uint8x32.And, andSlice[uint8])
+ }
if archsimd.X86.AVX512() {
// testInt8x64Binary(t, archsimd.Int8x64.And, andISlice[int8]) // missing
@@ -211,23 +253,29 @@
}
func TestAndNot(t *testing.T) {
- testInt16x16Binary(t, archsimd.Int16x16.AndNot, andNotSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.AndNot, andNotSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.AndNot, andNotSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.AndNot, andNotSlice[int32])
testInt64x2Binary(t, archsimd.Int64x2.AndNot, andNotSlice[int64])
- testInt64x4Binary(t, archsimd.Int64x4.AndNot, andNotSlice[int64])
testInt8x16Binary(t, archsimd.Int8x16.AndNot, andNotSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.AndNot, andNotSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.AndNot, andNotSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.AndNot, andNotSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.AndNot, andNotSlice[int32])
+ testInt64x4Binary(t, archsimd.Int64x4.AndNot, andNotSlice[int64])
+ testInt8x32Binary(t, archsimd.Int8x32.AndNot, andNotSlice[int8])
+ }
+
+ testUint8x16Binary(t, archsimd.Uint8x16.AndNot, andNotSlice[uint8])
testUint16x8Binary(t, archsimd.Uint16x8.AndNot, andNotSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.AndNot, andNotSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.AndNot, andNotSlice[uint32])
testUint64x2Binary(t, archsimd.Uint64x2.AndNot, andNotSlice[uint64])
- testUint64x4Binary(t, archsimd.Uint64x4.AndNot, andNotSlice[uint64])
- testUint8x16Binary(t, archsimd.Uint8x16.AndNot, andNotSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.AndNot, andNotSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.AndNot, andNotSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.AndNot, andNotSlice[uint32])
+ testUint64x4Binary(t, archsimd.Uint64x4.AndNot, andNotSlice[uint64])
+ testUint8x32Binary(t, archsimd.Uint8x32.AndNot, andNotSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testInt8x64Binary(t, archsimd.Int8x64.AndNot, andNotSlice[int8])
@@ -242,23 +290,29 @@
}
func TestXor(t *testing.T) {
- testInt16x16Binary(t, archsimd.Int16x16.Xor, xorSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.Xor, xorSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Xor, xorSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Xor, xorSlice[int32])
testInt64x2Binary(t, archsimd.Int64x2.Xor, xorSlice[int64])
- testInt64x4Binary(t, archsimd.Int64x4.Xor, xorSlice[int64])
testInt8x16Binary(t, archsimd.Int8x16.Xor, xorSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.Xor, xorSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.Xor, xorSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Xor, xorSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Xor, xorSlice[int32])
+ testInt64x4Binary(t, archsimd.Int64x4.Xor, xorSlice[int64])
+ testInt8x32Binary(t, archsimd.Int8x32.Xor, xorSlice[int8])
+ }
+
testUint16x8Binary(t, archsimd.Uint16x8.Xor, xorSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.Xor, xorSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.Xor, xorSlice[uint32])
testUint64x2Binary(t, archsimd.Uint64x2.Xor, xorSlice[uint64])
- testUint64x4Binary(t, archsimd.Uint64x4.Xor, xorSlice[uint64])
testUint8x16Binary(t, archsimd.Uint8x16.Xor, xorSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.Xor, xorSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.Xor, xorSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.Xor, xorSlice[uint32])
+ testUint64x4Binary(t, archsimd.Uint64x4.Xor, xorSlice[uint64])
+ testUint8x32Binary(t, archsimd.Uint8x32.Xor, xorSlice[uint8])
+ }
if archsimd.X86.AVX512() {
// testInt8x64Binary(t, archsimd.Int8x64.Xor, andISlice[int8]) // missing
@@ -273,23 +327,29 @@
}
func TestOr(t *testing.T) {
- testInt16x16Binary(t, archsimd.Int16x16.Or, orSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.Or, orSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Or, orSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Or, orSlice[int32])
testInt64x2Binary(t, archsimd.Int64x2.Or, orSlice[int64])
- testInt64x4Binary(t, archsimd.Int64x4.Or, orSlice[int64])
testInt8x16Binary(t, archsimd.Int8x16.Or, orSlice[int8])
- testInt8x32Binary(t, archsimd.Int8x32.Or, orSlice[int8])
- testUint16x16Binary(t, archsimd.Uint16x16.Or, orSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Or, orSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Or, orSlice[int32])
+ testInt64x4Binary(t, archsimd.Int64x4.Or, orSlice[int64])
+ testInt8x32Binary(t, archsimd.Int8x32.Or, orSlice[int8])
+ }
+
testUint16x8Binary(t, archsimd.Uint16x8.Or, orSlice[uint16])
testUint32x4Binary(t, archsimd.Uint32x4.Or, orSlice[uint32])
- testUint32x8Binary(t, archsimd.Uint32x8.Or, orSlice[uint32])
testUint64x2Binary(t, archsimd.Uint64x2.Or, orSlice[uint64])
- testUint64x4Binary(t, archsimd.Uint64x4.Or, orSlice[uint64])
testUint8x16Binary(t, archsimd.Uint8x16.Or, orSlice[uint8])
- testUint8x32Binary(t, archsimd.Uint8x32.Or, orSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Binary(t, archsimd.Uint16x16.Or, orSlice[uint16])
+ testUint32x8Binary(t, archsimd.Uint32x8.Or, orSlice[uint32])
+ testUint64x4Binary(t, archsimd.Uint64x4.Or, orSlice[uint64])
+ testUint8x32Binary(t, archsimd.Uint8x32.Or, orSlice[uint8])
+ }
if archsimd.X86.AVX512() {
// testInt8x64Binary(t, archsimd.Int8x64.Or, andISlice[int8]) // missing
@@ -309,10 +369,13 @@
testFloat64x2Binary(t, archsimd.Float64x2.Mul, mulSlice[float64])
testFloat64x4Binary(t, archsimd.Float64x4.Mul, mulSlice[float64])
- testInt16x16Binary(t, archsimd.Int16x16.Mul, mulSlice[int16])
testInt16x8Binary(t, archsimd.Int16x8.Mul, mulSlice[int16])
testInt32x4Binary(t, archsimd.Int32x4.Mul, mulSlice[int32])
- testInt32x8Binary(t, archsimd.Int32x8.Mul, mulSlice[int32])
+
+ if archsimd.X86.AVX2() {
+ testInt16x16Binary(t, archsimd.Int16x16.Mul, mulSlice[int16])
+ testInt32x8Binary(t, archsimd.Int32x8.Mul, mulSlice[int32])
+ }
// testInt8x16Binary(t, archsimd.Int8x16.Mul, mulSlice[int8]) // nope
// testInt8x32Binary(t, archsimd.Int8x32.Mul, mulSlice[int8])
diff --git a/src/simd/archsimd/internal/simd_test/compare_test.go b/src/simd/archsimd/internal/simd_test/compare_test.go
index 4485e9b..efafbfd 100644
--- a/src/simd/archsimd/internal/simd_test/compare_test.go
+++ b/src/simd/archsimd/internal/simd_test/compare_test.go
@@ -21,32 +21,39 @@
testFloat64x2Compare(t, archsimd.Float64x2.Less, lessSlice[float64])
testFloat64x4Compare(t, archsimd.Float64x4.Less, lessSlice[float64])
- testInt16x16Compare(t, archsimd.Int16x16.Less, lessSlice[int16])
testInt16x8Compare(t, archsimd.Int16x8.Less, lessSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.Less, lessSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.Less, lessSlice[int32])
testInt64x2Compare(t, archsimd.Int64x2.Less, lessSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.Less, lessSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.Less, lessSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.Less, lessSlice[int8])
- testInt16x16Compare(t, archsimd.Int16x16.Less, lessSlice[int16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Compare(t, archsimd.Int16x16.Less, lessSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.Less, lessSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.Less, lessSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.Less, lessSlice[int8])
+
+ testInt16x16Compare(t, archsimd.Int16x16.Less, lessSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.Less, lessSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.Less, lessSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.Less, lessSlice[int8])
+ }
+
testInt16x8Compare(t, archsimd.Int16x8.Less, lessSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.Less, lessSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.Less, lessSlice[int32])
testInt64x2Compare(t, archsimd.Int64x2.Less, lessSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.Less, lessSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.Less, lessSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.Less, lessSlice[int8])
- testUint16x16Compare(t, archsimd.Uint16x16.Less, lessSlice[uint16])
testUint16x8Compare(t, archsimd.Uint16x8.Less, lessSlice[uint16])
testUint32x4Compare(t, archsimd.Uint32x4.Less, lessSlice[uint32])
- testUint32x8Compare(t, archsimd.Uint32x8.Less, lessSlice[uint32])
testUint64x2Compare(t, archsimd.Uint64x2.Less, lessSlice[uint64])
- testUint64x4Compare(t, archsimd.Uint64x4.Less, lessSlice[uint64])
testUint8x16Compare(t, archsimd.Uint8x16.Less, lessSlice[uint8])
- testUint8x32Compare(t, archsimd.Uint8x32.Less, lessSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Compare(t, archsimd.Uint16x16.Less, lessSlice[uint16])
+ testUint32x8Compare(t, archsimd.Uint32x8.Less, lessSlice[uint32])
+ testUint64x4Compare(t, archsimd.Uint64x4.Less, lessSlice[uint64])
+ testUint8x32Compare(t, archsimd.Uint8x32.Less, lessSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testUint16x16Compare(t, archsimd.Uint16x16.Less, lessSlice[uint16])
@@ -77,23 +84,29 @@
testFloat64x2Compare(t, archsimd.Float64x2.LessEqual, lessEqualSlice[float64])
testFloat64x4Compare(t, archsimd.Float64x4.LessEqual, lessEqualSlice[float64])
- testInt16x16Compare(t, archsimd.Int16x16.LessEqual, lessEqualSlice[int16])
testInt16x8Compare(t, archsimd.Int16x8.LessEqual, lessEqualSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.LessEqual, lessEqualSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.LessEqual, lessEqualSlice[int32])
testInt64x2Compare(t, archsimd.Int64x2.LessEqual, lessEqualSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.LessEqual, lessEqualSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.LessEqual, lessEqualSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.LessEqual, lessEqualSlice[int8])
- testUint16x16Compare(t, archsimd.Uint16x16.LessEqual, lessEqualSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Compare(t, archsimd.Int16x16.LessEqual, lessEqualSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.LessEqual, lessEqualSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.LessEqual, lessEqualSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.LessEqual, lessEqualSlice[int8])
+ }
+
testUint16x8Compare(t, archsimd.Uint16x8.LessEqual, lessEqualSlice[uint16])
testUint32x4Compare(t, archsimd.Uint32x4.LessEqual, lessEqualSlice[uint32])
- testUint32x8Compare(t, archsimd.Uint32x8.LessEqual, lessEqualSlice[uint32])
testUint64x2Compare(t, archsimd.Uint64x2.LessEqual, lessEqualSlice[uint64])
- testUint64x4Compare(t, archsimd.Uint64x4.LessEqual, lessEqualSlice[uint64])
testUint8x16Compare(t, archsimd.Uint8x16.LessEqual, lessEqualSlice[uint8])
- testUint8x32Compare(t, archsimd.Uint8x32.LessEqual, lessEqualSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Compare(t, archsimd.Uint16x16.LessEqual, lessEqualSlice[uint16])
+ testUint32x8Compare(t, archsimd.Uint32x8.LessEqual, lessEqualSlice[uint32])
+ testUint64x4Compare(t, archsimd.Uint64x4.LessEqual, lessEqualSlice[uint64])
+ testUint8x32Compare(t, archsimd.Uint8x32.LessEqual, lessEqualSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testFloat32x16Compare(t, archsimd.Float32x16.LessEqual, lessEqualSlice[float32])
@@ -115,25 +128,29 @@
testFloat64x2Compare(t, archsimd.Float64x2.Greater, greaterSlice[float64])
testFloat64x4Compare(t, archsimd.Float64x4.Greater, greaterSlice[float64])
- testInt16x16Compare(t, archsimd.Int16x16.Greater, greaterSlice[int16])
testInt16x8Compare(t, archsimd.Int16x8.Greater, greaterSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.Greater, greaterSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.Greater, greaterSlice[int32])
-
testInt64x2Compare(t, archsimd.Int64x2.Greater, greaterSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.Greater, greaterSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.Greater, greaterSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.Greater, greaterSlice[int8])
- testUint16x16Compare(t, archsimd.Uint16x16.Greater, greaterSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Compare(t, archsimd.Int16x16.Greater, greaterSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.Greater, greaterSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.Greater, greaterSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.Greater, greaterSlice[int8])
+ }
+
testUint16x8Compare(t, archsimd.Uint16x8.Greater, greaterSlice[uint16])
testUint32x4Compare(t, archsimd.Uint32x4.Greater, greaterSlice[uint32])
- testUint32x8Compare(t, archsimd.Uint32x8.Greater, greaterSlice[uint32])
-
testUint64x2Compare(t, archsimd.Uint64x2.Greater, greaterSlice[uint64])
- testUint64x4Compare(t, archsimd.Uint64x4.Greater, greaterSlice[uint64])
testUint8x16Compare(t, archsimd.Uint8x16.Greater, greaterSlice[uint8])
- testUint8x32Compare(t, archsimd.Uint8x32.Greater, greaterSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Compare(t, archsimd.Uint16x16.Greater, greaterSlice[uint16])
+ testUint32x8Compare(t, archsimd.Uint32x8.Greater, greaterSlice[uint32])
+ testUint64x4Compare(t, archsimd.Uint64x4.Greater, greaterSlice[uint64])
+ testUint8x32Compare(t, archsimd.Uint8x32.Greater, greaterSlice[uint8])
+ }
if archsimd.X86.AVX512() {
@@ -156,23 +173,29 @@
testFloat64x2Compare(t, archsimd.Float64x2.GreaterEqual, greaterEqualSlice[float64])
testFloat64x4Compare(t, archsimd.Float64x4.GreaterEqual, greaterEqualSlice[float64])
- testInt16x16Compare(t, archsimd.Int16x16.GreaterEqual, greaterEqualSlice[int16])
testInt16x8Compare(t, archsimd.Int16x8.GreaterEqual, greaterEqualSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.GreaterEqual, greaterEqualSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.GreaterEqual, greaterEqualSlice[int32])
testInt64x2Compare(t, archsimd.Int64x2.GreaterEqual, greaterEqualSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.GreaterEqual, greaterEqualSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.GreaterEqual, greaterEqualSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.GreaterEqual, greaterEqualSlice[int8])
- testUint16x16Compare(t, archsimd.Uint16x16.GreaterEqual, greaterEqualSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Compare(t, archsimd.Int16x16.GreaterEqual, greaterEqualSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.GreaterEqual, greaterEqualSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.GreaterEqual, greaterEqualSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.GreaterEqual, greaterEqualSlice[int8])
+ }
+
testUint16x8Compare(t, archsimd.Uint16x8.GreaterEqual, greaterEqualSlice[uint16])
testUint32x4Compare(t, archsimd.Uint32x4.GreaterEqual, greaterEqualSlice[uint32])
- testUint32x8Compare(t, archsimd.Uint32x8.GreaterEqual, greaterEqualSlice[uint32])
testUint64x2Compare(t, archsimd.Uint64x2.GreaterEqual, greaterEqualSlice[uint64])
- testUint64x4Compare(t, archsimd.Uint64x4.GreaterEqual, greaterEqualSlice[uint64])
testUint8x16Compare(t, archsimd.Uint8x16.GreaterEqual, greaterEqualSlice[uint8])
- testUint8x32Compare(t, archsimd.Uint8x32.GreaterEqual, greaterEqualSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Compare(t, archsimd.Uint16x16.GreaterEqual, greaterEqualSlice[uint16])
+ testUint32x8Compare(t, archsimd.Uint32x8.GreaterEqual, greaterEqualSlice[uint32])
+ testUint64x4Compare(t, archsimd.Uint64x4.GreaterEqual, greaterEqualSlice[uint64])
+ testUint8x32Compare(t, archsimd.Uint8x32.GreaterEqual, greaterEqualSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testFloat32x16Compare(t, archsimd.Float32x16.GreaterEqual, greaterEqualSlice[float32])
@@ -194,23 +217,29 @@
testFloat64x2Compare(t, archsimd.Float64x2.Equal, equalSlice[float64])
testFloat64x4Compare(t, archsimd.Float64x4.Equal, equalSlice[float64])
- testInt16x16Compare(t, archsimd.Int16x16.Equal, equalSlice[int16])
testInt16x8Compare(t, archsimd.Int16x8.Equal, equalSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.Equal, equalSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.Equal, equalSlice[int32])
testInt64x2Compare(t, archsimd.Int64x2.Equal, equalSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.Equal, equalSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.Equal, equalSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.Equal, equalSlice[int8])
- testUint16x16Compare(t, archsimd.Uint16x16.Equal, equalSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Compare(t, archsimd.Int16x16.Equal, equalSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.Equal, equalSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.Equal, equalSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.Equal, equalSlice[int8])
+ }
+
testUint16x8Compare(t, archsimd.Uint16x8.Equal, equalSlice[uint16])
testUint32x4Compare(t, archsimd.Uint32x4.Equal, equalSlice[uint32])
- testUint32x8Compare(t, archsimd.Uint32x8.Equal, equalSlice[uint32])
testUint64x2Compare(t, archsimd.Uint64x2.Equal, equalSlice[uint64])
- testUint64x4Compare(t, archsimd.Uint64x4.Equal, equalSlice[uint64])
testUint8x16Compare(t, archsimd.Uint8x16.Equal, equalSlice[uint8])
- testUint8x32Compare(t, archsimd.Uint8x32.Equal, equalSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Compare(t, archsimd.Uint16x16.Equal, equalSlice[uint16])
+ testUint32x8Compare(t, archsimd.Uint32x8.Equal, equalSlice[uint32])
+ testUint64x4Compare(t, archsimd.Uint64x4.Equal, equalSlice[uint64])
+ testUint8x32Compare(t, archsimd.Uint8x32.Equal, equalSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testFloat32x16Compare(t, archsimd.Float32x16.Equal, equalSlice[float32])
@@ -232,23 +261,29 @@
testFloat64x2Compare(t, archsimd.Float64x2.NotEqual, notEqualSlice[float64])
testFloat64x4Compare(t, archsimd.Float64x4.NotEqual, notEqualSlice[float64])
- testInt16x16Compare(t, archsimd.Int16x16.NotEqual, notEqualSlice[int16])
testInt16x8Compare(t, archsimd.Int16x8.NotEqual, notEqualSlice[int16])
testInt32x4Compare(t, archsimd.Int32x4.NotEqual, notEqualSlice[int32])
- testInt32x8Compare(t, archsimd.Int32x8.NotEqual, notEqualSlice[int32])
testInt64x2Compare(t, archsimd.Int64x2.NotEqual, notEqualSlice[int64])
- testInt64x4Compare(t, archsimd.Int64x4.NotEqual, notEqualSlice[int64])
testInt8x16Compare(t, archsimd.Int8x16.NotEqual, notEqualSlice[int8])
- testInt8x32Compare(t, archsimd.Int8x32.NotEqual, notEqualSlice[int8])
- testUint16x16Compare(t, archsimd.Uint16x16.NotEqual, notEqualSlice[uint16])
+ if archsimd.X86.AVX2() {
+ testInt16x16Compare(t, archsimd.Int16x16.NotEqual, notEqualSlice[int16])
+ testInt32x8Compare(t, archsimd.Int32x8.NotEqual, notEqualSlice[int32])
+ testInt64x4Compare(t, archsimd.Int64x4.NotEqual, notEqualSlice[int64])
+ testInt8x32Compare(t, archsimd.Int8x32.NotEqual, notEqualSlice[int8])
+ }
+
testUint16x8Compare(t, archsimd.Uint16x8.NotEqual, notEqualSlice[uint16])
testUint32x4Compare(t, archsimd.Uint32x4.NotEqual, notEqualSlice[uint32])
- testUint32x8Compare(t, archsimd.Uint32x8.NotEqual, notEqualSlice[uint32])
testUint64x2Compare(t, archsimd.Uint64x2.NotEqual, notEqualSlice[uint64])
- testUint64x4Compare(t, archsimd.Uint64x4.NotEqual, notEqualSlice[uint64])
testUint8x16Compare(t, archsimd.Uint8x16.NotEqual, notEqualSlice[uint8])
- testUint8x32Compare(t, archsimd.Uint8x32.NotEqual, notEqualSlice[uint8])
+
+ if archsimd.X86.AVX2() {
+ testUint16x16Compare(t, archsimd.Uint16x16.NotEqual, notEqualSlice[uint16])
+ testUint32x8Compare(t, archsimd.Uint32x8.NotEqual, notEqualSlice[uint32])
+ testUint64x4Compare(t, archsimd.Uint64x4.NotEqual, notEqualSlice[uint64])
+ testUint8x32Compare(t, archsimd.Uint8x32.NotEqual, notEqualSlice[uint8])
+ }
if archsimd.X86.AVX512() {
testFloat32x16Compare(t, archsimd.Float32x16.NotEqual, notEqualSlice[float32])
diff --git a/src/simd/archsimd/internal/simd_test/simd_test.go b/src/simd/archsimd/internal/simd_test/simd_test.go
index 1f57f60..fa9391f 100644
--- a/src/simd/archsimd/internal/simd_test/simd_test.go
+++ b/src/simd/archsimd/internal/simd_test/simd_test.go
@@ -215,6 +215,10 @@
}
func TestSlicesInt8(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
a := []int8{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
v := archsimd.LoadInt8x32Slice(a)
@@ -248,6 +252,10 @@
}
func TestSlicesInt8TooShortLoad(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
defer func() {
if r := recover(); r != nil {
t.Logf("Saw EXPECTED panic %v", r)
@@ -264,6 +272,10 @@
}
func TestSlicesInt8TooShortStore(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
defer func() {
if r := recover(); r != nil {
t.Logf("Saw EXPECTED panic %v", r)
@@ -293,6 +305,10 @@
// TODO: try to reduce this test to be smaller.
func TestMergeLocals(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
testMergeLocalswrapper(t, archsimd.Int64x4.Add)
}
@@ -375,6 +391,10 @@
}
func TestMergeFloat(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
k := make([]int64, 4, 4)
s := make([]float64, 4, 4)
@@ -462,6 +482,10 @@
}
func TestBroadcastInt8x32(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
s := make([]int8, 32, 32)
archsimd.BroadcastInt8x32(-123).StoreSlice(s)
checkSlices(t, s, []int8{-123, -123, -123, -123, -123, -123, -123, -123,
@@ -1095,6 +1119,10 @@
}
func TestMaskedMerge(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := archsimd.LoadInt64x4Slice([]int64{1, 2, 3, 4})
y := archsimd.LoadInt64x4Slice([]int64{5, 6, 1, 1})
z := archsimd.LoadInt64x4Slice([]int64{-1, -2, -3, -4})
@@ -1156,6 +1184,10 @@
}
func TestPermuteScalarsGrouped(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := []int32{11, 12, 13, 14, 21, 22, 23, 24}
want := []int32{12, 13, 14, 11, 22, 23, 24, 21}
got := make([]int32, 8)
@@ -1180,6 +1212,10 @@
}
func TestPermuteScalarsHiGrouped(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := []int16{-1, -2, -3, -4, 11, 12, 13, 14, -11, -12, -13, -14, 111, 112, 113, 114}
want := []int16{-1, -2, -3, -4, 12, 13, 14, 11, -11, -12, -13, -14, 112, 113, 114, 111}
got := make([]int16, len(x))
@@ -1188,6 +1224,10 @@
}
func TestPermuteScalarsLoGrouped(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := []int16{11, 12, 13, 14, 4, 5, 6, 7, 111, 112, 113, 114, 14, 15, 16, 17}
want := []int16{12, 13, 14, 11, 4, 5, 6, 7, 112, 113, 114, 111, 14, 15, 16, 17}
got := make([]int16, len(x))
diff --git a/src/simd/archsimd/internal/simd_test/unary_test.go b/src/simd/archsimd/internal/simd_test/unary_test.go
index 6b53669..4a80860 100644
--- a/src/simd/archsimd/internal/simd_test/unary_test.go
+++ b/src/simd/archsimd/internal/simd_test/unary_test.go
@@ -69,20 +69,26 @@
func TestNot(t *testing.T) {
testInt8x16Unary(t, archsimd.Int8x16.Not, map1[int8](not))
- testInt8x32Unary(t, archsimd.Int8x32.Not, map1[int8](not))
testInt16x8Unary(t, archsimd.Int16x8.Not, map1[int16](not))
- testInt16x16Unary(t, archsimd.Int16x16.Not, map1[int16](not))
testInt32x4Unary(t, archsimd.Int32x4.Not, map1[int32](not))
- testInt32x8Unary(t, archsimd.Int32x8.Not, map1[int32](not))
+
+ if archsimd.X86.AVX2() {
+ testInt8x32Unary(t, archsimd.Int8x32.Not, map1[int8](not))
+ testInt16x16Unary(t, archsimd.Int16x16.Not, map1[int16](not))
+ testInt32x8Unary(t, archsimd.Int32x8.Not, map1[int32](not))
+ }
}
func TestAbsolute(t *testing.T) {
testInt8x16Unary(t, archsimd.Int8x16.Abs, map1[int8](abs))
- testInt8x32Unary(t, archsimd.Int8x32.Abs, map1[int8](abs))
testInt16x8Unary(t, archsimd.Int16x8.Abs, map1[int16](abs))
- testInt16x16Unary(t, archsimd.Int16x16.Abs, map1[int16](abs))
testInt32x4Unary(t, archsimd.Int32x4.Abs, map1[int32](abs))
- testInt32x8Unary(t, archsimd.Int32x8.Abs, map1[int32](abs))
+
+ if archsimd.X86.AVX2() {
+ testInt8x32Unary(t, archsimd.Int8x32.Abs, map1[int8](abs))
+ testInt16x16Unary(t, archsimd.Int16x16.Abs, map1[int16](abs))
+ testInt32x8Unary(t, archsimd.Int32x8.Abs, map1[int32](abs))
+ }
if archsimd.X86.AVX512() {
testInt8x64Unary(t, archsimd.Int8x64.Abs, map1[int8](abs))
testInt16x32Unary(t, archsimd.Int16x32.Abs, map1[int16](abs))
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
CPU: Intel(R) Core(TM) Ultra 7 258V
FYI, when cherrypick'd onto go1.26rc1 cl/730941/1 fails on:
x.DotProductQuadruple(y).Add(z).StoreSlice(res1)
ok simd/archsimd 0.035s
SIGILL: illegal instruction
PC=0x57bcbc m=2 sigcode=2
instruction bytes: 0x62 0xf2 0x75 0x8 0x50 0xd0 0x90 0x90 0x90 0xc5 0xfa 0x7f 0x54 0x24 0x60 0x31
goroutine 103 gp=0x3e03089a2780 m=2 mp=0x3e0308527008 [running]:
simd/archsimd/internal/simd_test_test.TestDotProductQuadruple(0x3e037324bb08)
/.../src/simd/archsimd/internal/simd_test/simd_test.go:1177 +0xfc fp=0x3e03085a3770 sp=0x3e03085a3688 pc=0x57bcbc
testing.tRunner(0x3e037324bb08, 0x614bc8)
/.../src/testing/testing.go:2036 +0xea fp=0x3e03085a37c0 sp=0x3e03085a3770 pc=0x503daa
testing.(*T).Run.gowrap1()
/.../src/testing/testing.go:2101 +0x1b fp=0x3e03085a37e0 sp=0x3e03085a37c0 pc=0x504f5b
runtime.goexit({})
/.../src/runtime/asm_amd64.s:1771 +0x1 fp=0x3e03085a37e8 sp=0x3e03085a37e0 pc=0x499381
created by testing.(*T).Run in goroutine 1
/.../src/testing/testing.go:2101 +0x4dd
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[dev.simd] simd/archsimd: add HasAVX2() guards to tests that need them
This may not be complete, because some 256-bit float operations
may be implemented with integer simd instead (in some cases there
is no float op). (And some tests may have just been overlooked.)
Fixes #76866.
index 5fd7407..2602093 100644
--- a/src/simd/archsimd/internal/simd_test/simd_test.go
+++ b/src/simd/archsimd/internal/simd_test/simd_test.go
@@ -225,6 +225,10 @@
}
func TestSlicesInt8(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
a := []int8{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}
v := archsimd.LoadInt8x32Slice(a)
@@ -258,6 +262,10 @@
}
func TestSlicesInt8TooShortLoad(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
defer func() {
if r := recover(); r != nil {
t.Logf("Saw EXPECTED panic %v", r)
@@ -274,6 +282,10 @@
}
func TestSlicesInt8TooShortStore(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
defer func() {
if r := recover(); r != nil {
t.Logf("Saw EXPECTED panic %v", r)
@@ -303,6 +315,10 @@
// TODO: try to reduce this test to be smaller.
func TestMergeLocals(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
testMergeLocalswrapper(t, archsimd.Int64x4.Add)
}
@@ -385,6 +401,10 @@
}
func TestMergeFloat(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
k := make([]int64, 4, 4)
s := make([]float64, 4, 4)
@@ -472,6 +492,10 @@
}
func TestBroadcastInt8x32(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
s := make([]int8, 32, 32)
archsimd.BroadcastInt8x32(-123).StoreSlice(s)
checkSlices(t, s, []int8{-123, -123, -123, -123, -123, -123, -123, -123,
@@ -1105,6 +1129,10 @@
}
func TestMaskedMerge(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := archsimd.LoadInt64x4Slice([]int64{1, 2, 3, 4})
y := archsimd.LoadInt64x4Slice([]int64{5, 6, 1, 1})
z := archsimd.LoadInt64x4Slice([]int64{-1, -2, -3, -4})
@@ -1170,6 +1198,10 @@
}
func TestPermuteScalarsGrouped(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := []int32{11, 12, 13, 14, 21, 22, 23, 24}
want := []int32{12, 13, 14, 11, 22, 23, 24, 21}
got := make([]int32, 8)
@@ -1194,6 +1226,10 @@
}
func TestPermuteScalarsHiGrouped(t *testing.T) {
+ if !archsimd.X86.AVX2() {
+ t.Skip("Test requires X86.AVX2, not available on this hardware")
+ return
+ }
x := []int16{-1, -2, -3, -4, 11, 12, 13, 14, -11, -12, -13, -14, 111, 112, 113, 114}
want := []int16{-1, -2, -3, -4, 12, 13, 14, 11, -11, -12, -13, -14, 112, 113, 114, 111}
got := make([]int16, len(x))
@@ -1202,6 +1238,10 @@| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +2 |
[dev.simd] simd/archsimd: add HasAVX2() guards to tests that need themRemove.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Cherrypicking with https://go.dev/cl/731240 (repair VNNI feature check) on top of go1.26rc1 still fails for me:
CPU: Intel(R) Core(TM) Ultra 7 258V
ok simd/archsimd 0.007s
SIGILL: illegal instruction
PC=0x57bd24 m=0 sigcode=2
instruction bytes: 0x62 0xf2 0x75 0x8 0x50 0xd0 0xc5 0xfa 0x6f 0x9c 0x24 0x90 0x0 0x0 0x0 0x62
goroutine 105 gp=0x14f6b23acb40 m=0 mp=0x7c7f20 [running]:
simd/archsimd/internal/simd_test_test.TestDotProductQuadruple(0x14f73104fd48)
/.../src/simd/archsimd/internal/simd_test/simd_test.go:1180 +0x164 fp=0x14f6b240c770 sp=0x14f6b240c688 pc=0x57bd24
testing.tRunner(0x14f73104fd48, 0x614bc8)
/.../src/testing/testing.go:2036 +0xea fp=0x14f6b240c7c0 sp=0x14f6b240c770 pc=0x503daa
testing.(*T).Run.gowrap1()
/.../src/testing/testing.go:2101 +0x1b fp=0x14f6b240c7e0 sp=0x14f6b240c7c0 pc=0x504f5b
runtime.goexit({})
/.../src/runtime/asm_amd64.s:1771 +0x1 fp=0x14f6b240c7e8 sp=0x14f6b240c7e0 pc=0x499381
created by testing.(*T).Run in goroutine 1
/.../src/testing/testing.go:2101 +0x4dd
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Cherrypicking with https://go.dev/cl/731240 (repair VNNI feature check) on top of go1.26rc1 still fails for me:
CPU: Intel(R) Core(TM) Ultra 7 258V
ok simd/archsimd 0.007s
SIGILL: illegal instruction
PC=0x57bd24 m=0 sigcode=2
instruction bytes: 0x62 0xf2 0x75 0x8 0x50 0xd0 0xc5 0xfa 0x6f 0x9c 0x24 0x90 0x0 0x0 0x0 0x62goroutine 105 gp=0x14f6b23acb40 m=0 mp=0x7c7f20 [running]:
simd/archsimd/internal/simd_test_test.TestDotProductQuadruple(0x14f73104fd48)
/.../src/simd/archsimd/internal/simd_test/simd_test.go:1180 +0x164 fp=0x14f6b240c770 sp=0x14f6b240c688 pc=0x57bd24
testing.tRunner(0x14f73104fd48, 0x614bc8)
/.../src/testing/testing.go:2036 +0xea fp=0x14f6b240c7c0 sp=0x14f6b240c770 pc=0x503daa
testing.(*T).Run.gowrap1()
/.../src/testing/testing.go:2101 +0x1b fp=0x14f6b240c7e0 sp=0x14f6b240c7c0 pc=0x504f5b
runtime.goexit({})
/.../src/runtime/asm_amd64.s:1771 +0x1 fp=0x14f6b240c7e8 sp=0x14f6b240c7e0 pc=0x499381
created by testing.(*T).Run in goroutine 1
/.../src/testing/testing.go:2101 +0x4dd
Could you try the master branch? TestDotProductQuadruple is now gone.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Commit-Queue | +1 |
Cherry MuiCherrypicking with https://go.dev/cl/731240 (repair VNNI feature check) on top of go1.26rc1 still fails for me:
CPU: Intel(R) Core(TM) Ultra 7 258V
ok simd/archsimd 0.007s
SIGILL: illegal instruction
PC=0x57bd24 m=0 sigcode=2
instruction bytes: 0x62 0xf2 0x75 0x8 0x50 0xd0 0xc5 0xfa 0x6f 0x9c 0x24 0x90 0x0 0x0 0x0 0x62goroutine 105 gp=0x14f6b23acb40 m=0 mp=0x7c7f20 [running]:
simd/archsimd/internal/simd_test_test.TestDotProductQuadruple(0x14f73104fd48)
/.../src/simd/archsimd/internal/simd_test/simd_test.go:1180 +0x164 fp=0x14f6b240c770 sp=0x14f6b240c688 pc=0x57bd24
testing.tRunner(0x14f73104fd48, 0x614bc8)
/.../src/testing/testing.go:2036 +0xea fp=0x14f6b240c7c0 sp=0x14f6b240c770 pc=0x503daa
testing.(*T).Run.gowrap1()
/.../src/testing/testing.go:2101 +0x1b fp=0x14f6b240c7e0 sp=0x14f6b240c7c0 pc=0x504f5b
runtime.goexit({})
/.../src/runtime/asm_amd64.s:1771 +0x1 fp=0x14f6b240c7e8 sp=0x14f6b240c7e0 pc=0x499381
created by testing.(*T).Run in goroutine 1
/.../src/testing/testing.go:2101 +0x4dd
Could you try the master branch? TestDotProductQuadruple is now gone.
Acknowledged
[dev.simd] simd/archsimd: add HasAVX2() guards to tests that need themDavid ChaseRemove.
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
simd/archsimd: add HasAVX2() guards to tests that need them
This may not be complete, because some 256-bit float operations
may be implemented with integer simd instead (in some cases there
is no float op). (And some tests may have just been overlooked.)
Fixes #76866.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Cherry MuiCherrypicking with https://go.dev/cl/731240 (repair VNNI feature check) on top of go1.26rc1 still fails for me:
CPU: Intel(R) Core(TM) Ultra 7 258V
ok simd/archsimd 0.007s
SIGILL: illegal instruction
PC=0x57bd24 m=0 sigcode=2
instruction bytes: 0x62 0xf2 0x75 0x8 0x50 0xd0 0xc5 0xfa 0x6f 0x9c 0x24 0x90 0x0 0x0 0x0 0x62goroutine 105 gp=0x14f6b23acb40 m=0 mp=0x7c7f20 [running]:
simd/archsimd/internal/simd_test_test.TestDotProductQuadruple(0x14f73104fd48)
/.../src/simd/archsimd/internal/simd_test/simd_test.go:1180 +0x164 fp=0x14f6b240c770 sp=0x14f6b240c688 pc=0x57bd24
testing.tRunner(0x14f73104fd48, 0x614bc8)
/.../src/testing/testing.go:2036 +0xea fp=0x14f6b240c7c0 sp=0x14f6b240c770 pc=0x503daa
testing.(*T).Run.gowrap1()
/.../src/testing/testing.go:2101 +0x1b fp=0x14f6b240c7e0 sp=0x14f6b240c7c0 pc=0x504f5b
runtime.goexit({})
/.../src/runtime/asm_amd64.s:1771 +0x1 fp=0x14f6b240c7e8 sp=0x14f6b240c7e0 pc=0x499381
created by testing.(*T).Run in goroutine 1
/.../src/testing/testing.go:2101 +0x4dd
David ChaseCould you try the master branch? TestDotProductQuadruple is now gone.
Acknowledged
Thanks, yes, master works at:
7ecb1f36 simd/archsimd: add HasAVX2() guards to tests that need them
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |