| 1 |
// Copyright 2025 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
//go:build goexperiment.simd && amd64 |
| 6 |
|
| 7 |
package simd_test |
| 8 |
|
| 9 |
import ( |
| 10 |
"math" |
| 11 |
"simd/archsimd" |
| 12 |
"testing" |
| 13 |
) |
| 14 |
|
| 15 |
func TestCeil(t *testing.T) { |
| 16 |
testFloat32x4Unary(t, archsimd.Float32x4.Ceil, ceilSlice[float32]) |
| 17 |
testFloat32x8Unary(t, archsimd.Float32x8.Ceil, ceilSlice[float32]) |
| 18 |
testFloat64x2Unary(t, archsimd.Float64x2.Ceil, ceilSlice[float64]) |
| 19 |
testFloat64x4Unary(t, archsimd.Float64x4.Ceil, ceilSlice[float64]) |
| 20 |
if archsimd.X86.AVX512() { |
| 21 |
// testFloat32x16Unary(t, archsimd.Float32x16.Ceil, ceilSlice[float32]) // missing |
| 22 |
// testFloat64x8Unary(t, archsimd.Float64x8.Ceil, ceilSlice[float64]) // missing |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
func TestFloor(t *testing.T) { |
| 27 |
testFloat32x4Unary(t, archsimd.Float32x4.Floor, floorSlice[float32]) |
| 28 |
testFloat32x8Unary(t, archsimd.Float32x8.Floor, floorSlice[float32]) |
| 29 |
testFloat64x2Unary(t, archsimd.Float64x2.Floor, floorSlice[float64]) |
| 30 |
testFloat64x4Unary(t, archsimd.Float64x4.Floor, floorSlice[float64]) |
| 31 |
if archsimd.X86.AVX512() { |
| 32 |
// testFloat32x16Unary(t, archsimd.Float32x16.Floor, floorSlice[float32]) // missing |
| 33 |
// testFloat64x8Unary(t, archsimd.Float64x8.Floor, floorSlice[float64]) // missing |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
func TestTrunc(t *testing.T) { |
| 38 |
testFloat32x4Unary(t, archsimd.Float32x4.Trunc, truncSlice[float32]) |
| 39 |
testFloat32x8Unary(t, archsimd.Float32x8.Trunc, truncSlice[float32]) |
| 40 |
testFloat64x2Unary(t, archsimd.Float64x2.Trunc, truncSlice[float64]) |
| 41 |
testFloat64x4Unary(t, archsimd.Float64x4.Trunc, truncSlice[float64]) |
| 42 |
if archsimd.X86.AVX512() { |
| 43 |
// testFloat32x16Unary(t, archsimd.Float32x16.Trunc, truncSlice[float32]) // missing |
| 44 |
// testFloat64x8Unary(t, archsimd.Float64x8.Trunc, truncSlice[float64]) // missing |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
func TestRound(t *testing.T) { |
| 49 |
testFloat32x4Unary(t, archsimd.Float32x4.RoundToEven, roundSlice[float32]) |
| 50 |
testFloat32x8Unary(t, archsimd.Float32x8.RoundToEven, roundSlice[float32]) |
| 51 |
testFloat64x2Unary(t, archsimd.Float64x2.RoundToEven, roundSlice[float64]) |
| 52 |
testFloat64x4Unary(t, archsimd.Float64x4.RoundToEven, roundSlice[float64]) |
| 53 |
if archsimd.X86.AVX512() { |
| 54 |
// testFloat32x16Unary(t, archsimd.Float32x16.Round, roundSlice[float32]) // missing |
| 55 |
// testFloat64x8Unary(t, archsimd.Float64x8.Round, roundSlice[float64]) // missing |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
func TestSqrt(t *testing.T) { |
| 60 |
testFloat32x4Unary(t, archsimd.Float32x4.Sqrt, sqrtSlice[float32]) |
| 61 |
testFloat32x8Unary(t, archsimd.Float32x8.Sqrt, sqrtSlice[float32]) |
| 62 |
testFloat64x2Unary(t, archsimd.Float64x2.Sqrt, sqrtSlice[float64]) |
| 63 |
testFloat64x4Unary(t, archsimd.Float64x4.Sqrt, sqrtSlice[float64]) |
| 64 |
if archsimd.X86.AVX512() { |
| 65 |
testFloat32x16Unary(t, archsimd.Float32x16.Sqrt, sqrtSlice[float32]) |
| 66 |
testFloat64x8Unary(t, archsimd.Float64x8.Sqrt, sqrtSlice[float64]) |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
func TestNot(t *testing.T) { |
| 71 |
testInt8x16Unary(t, archsimd.Int8x16.Not, map1[int8](not)) |
| 72 |
testInt16x8Unary(t, archsimd.Int16x8.Not, map1[int16](not)) |
| 73 |
testInt32x4Unary(t, archsimd.Int32x4.Not, map1[int32](not)) |
| 74 |
|
| 75 |
if archsimd.X86.AVX2() { |
| 76 |
testInt8x32Unary(t, archsimd.Int8x32.Not, map1[int8](not)) |
| 77 |
testInt16x16Unary(t, archsimd.Int16x16.Not, map1[int16](not)) |
| 78 |
testInt32x8Unary(t, archsimd.Int32x8.Not, map1[int32](not)) |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
func TestAbsolute(t *testing.T) { |
| 83 |
testInt8x16Unary(t, archsimd.Int8x16.Abs, map1[int8](abs)) |
| 84 |
testInt16x8Unary(t, archsimd.Int16x8.Abs, map1[int16](abs)) |
| 85 |
testInt32x4Unary(t, archsimd.Int32x4.Abs, map1[int32](abs)) |
| 86 |
|
| 87 |
if archsimd.X86.AVX2() { |
| 88 |
testInt8x32Unary(t, archsimd.Int8x32.Abs, map1[int8](abs)) |
| 89 |
testInt16x16Unary(t, archsimd.Int16x16.Abs, map1[int16](abs)) |
| 90 |
testInt32x8Unary(t, archsimd.Int32x8.Abs, map1[int32](abs)) |
| 91 |
} |
| 92 |
if archsimd.X86.AVX512() { |
| 93 |
testInt8x64Unary(t, archsimd.Int8x64.Abs, map1[int8](abs)) |
| 94 |
testInt16x32Unary(t, archsimd.Int16x32.Abs, map1[int16](abs)) |
| 95 |
testInt32x16Unary(t, archsimd.Int32x16.Abs, map1[int32](abs)) |
| 96 |
testInt64x2Unary(t, archsimd.Int64x2.Abs, map1[int64](abs)) |
| 97 |
testInt64x4Unary(t, archsimd.Int64x4.Abs, map1[int64](abs)) |
| 98 |
testInt64x8Unary(t, archsimd.Int64x8.Abs, map1[int64](abs)) |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
func TestCeilScaledResidue(t *testing.T) { |
| 103 |
if !archsimd.X86.AVX512() { |
| 104 |
t.Skip("Needs AVX512") |
| 105 |
} |
| 106 |
testFloat64x8UnaryFlaky(t, |
| 107 |
func(x archsimd.Float64x8) archsimd.Float64x8 { return x.CeilScaledResidue(0) }, |
| 108 |
map1(ceilResidueForPrecision[float64](0)), |
| 109 |
0.001) |
| 110 |
testFloat64x8UnaryFlaky(t, |
| 111 |
func(x archsimd.Float64x8) archsimd.Float64x8 { return x.CeilScaledResidue(1) }, |
| 112 |
map1(ceilResidueForPrecision[float64](1)), |
| 113 |
0.001) |
| 114 |
testFloat64x8Unary(t, |
| 115 |
func(x archsimd.Float64x8) archsimd.Float64x8 { return x.Sub(x.CeilScaled(0)) }, |
| 116 |
map1[float64](func(x float64) float64 { return x - math.Ceil(x) })) |
| 117 |
} |
| 118 |
|
| 119 |
func TestConvert(t *testing.T) { |
| 120 |
testFloat64x2ConvertToFloat32(t, archsimd.Float64x2.ConvertToFloat32, map1n[float64](toFloat32, 4)) |
| 121 |
testFloat64x4ConvertToFloat32(t, archsimd.Float64x4.ConvertToFloat32, map1[float64](toFloat32)) |
| 122 |
testFloat32x4ConvertToFloat64(t, archsimd.Float32x4.ConvertToFloat64, map1[float32](toFloat64)) |
| 123 |
|
| 124 |
testFloat32x4ConvertToInt32(t, archsimd.Float32x4.ConvertToInt32, map1[float32](floatToInt32_x86)) |
| 125 |
testFloat32x8ConvertToInt32(t, archsimd.Float32x8.ConvertToInt32, map1[float32](floatToInt32_x86)) |
| 126 |
testFloat64x2ConvertToInt32(t, archsimd.Float64x2.ConvertToInt32, map1n[float64](floatToInt32_x86, 4)) |
| 127 |
testFloat64x4ConvertToInt32(t, archsimd.Float64x4.ConvertToInt32, map1[float64](floatToInt32_x86)) |
| 128 |
|
| 129 |
testInt32x4ConvertToFloat32(t, archsimd.Int32x4.ConvertToFloat32, map1[int32](toFloat32)) |
| 130 |
testInt32x8ConvertToFloat32(t, archsimd.Int32x8.ConvertToFloat32, map1[int32](toFloat32)) |
| 131 |
testInt32x4ConvertToFloat64(t, archsimd.Int32x4.ConvertToFloat64, map1[int32](toFloat64)) |
| 132 |
|
| 133 |
if archsimd.X86.AVX512() { |
| 134 |
testFloat32x8ConvertToFloat64(t, archsimd.Float32x8.ConvertToFloat64, map1[float32](toFloat64)) |
| 135 |
testFloat64x8ConvertToFloat32(t, archsimd.Float64x8.ConvertToFloat32, map1[float64](toFloat32)) |
| 136 |
|
| 137 |
testFloat32x16ConvertToInt32(t, archsimd.Float32x16.ConvertToInt32, map1[float32](floatToInt32_x86)) |
| 138 |
testFloat64x8ConvertToInt32(t, archsimd.Float64x8.ConvertToInt32, map1[float64](floatToInt32_x86)) |
| 139 |
testFloat32x4ConvertToInt64(t, archsimd.Float32x4.ConvertToInt64, map1[float32](floatToInt64_x86)) |
| 140 |
testFloat32x8ConvertToInt64(t, archsimd.Float32x8.ConvertToInt64, map1[float32](floatToInt64_x86)) |
| 141 |
testFloat64x2ConvertToInt64(t, archsimd.Float64x2.ConvertToInt64, map1[float64](floatToInt64_x86)) |
| 142 |
testFloat64x4ConvertToInt64(t, archsimd.Float64x4.ConvertToInt64, map1[float64](floatToInt64_x86)) |
| 143 |
testFloat64x8ConvertToInt64(t, archsimd.Float64x8.ConvertToInt64, map1[float64](floatToInt64_x86)) |
| 144 |
|
| 145 |
testFloat32x4ConvertToUint32(t, archsimd.Float32x4.ConvertToUint32, map1[float32](floatToUint32_x86)) |
| 146 |
testFloat32x8ConvertToUint32(t, archsimd.Float32x8.ConvertToUint32, map1[float32](floatToUint32_x86)) |
| 147 |
testFloat32x16ConvertToUint32(t, archsimd.Float32x16.ConvertToUint32, map1[float32](floatToUint32_x86)) |
| 148 |
testFloat64x2ConvertToUint32(t, archsimd.Float64x2.ConvertToUint32, map1n[float64](floatToUint32_x86, 4)) |
| 149 |
testFloat64x4ConvertToUint32(t, archsimd.Float64x4.ConvertToUint32, map1[float64](floatToUint32_x86)) |
| 150 |
testFloat64x8ConvertToUint32(t, archsimd.Float64x8.ConvertToUint32, map1[float64](floatToUint32_x86)) |
| 151 |
testFloat32x4ConvertToUint64(t, archsimd.Float32x4.ConvertToUint64, map1[float32](floatToUint64_x86)) |
| 152 |
testFloat32x8ConvertToUint64(t, archsimd.Float32x8.ConvertToUint64, map1[float32](floatToUint64_x86)) |
| 153 |
testFloat64x2ConvertToUint64(t, archsimd.Float64x2.ConvertToUint64, map1[float64](floatToUint64_x86)) |
| 154 |
testFloat64x4ConvertToUint64(t, archsimd.Float64x4.ConvertToUint64, map1[float64](floatToUint64_x86)) |
| 155 |
testFloat64x8ConvertToUint64(t, archsimd.Float64x8.ConvertToUint64, map1[float64](floatToUint64_x86)) |
| 156 |
|
| 157 |
testInt32x16ConvertToFloat32(t, archsimd.Int32x16.ConvertToFloat32, map1[int32](toFloat32)) |
| 158 |
testInt64x2ConvertToFloat32(t, archsimd.Int64x2.ConvertToFloat32, map1n[int64](toFloat32, 4)) |
| 159 |
testInt64x4ConvertToFloat32(t, archsimd.Int64x4.ConvertToFloat32, map1[int64](toFloat32)) |
| 160 |
testInt64x8ConvertToFloat32(t, archsimd.Int64x8.ConvertToFloat32, map1[int64](toFloat32)) |
| 161 |
testInt64x2ConvertToFloat64(t, archsimd.Int64x2.ConvertToFloat64, map1[int64](toFloat64)) |
| 162 |
testInt64x4ConvertToFloat64(t, archsimd.Int64x4.ConvertToFloat64, map1[int64](toFloat64)) |
| 163 |
testInt64x8ConvertToFloat64(t, archsimd.Int64x8.ConvertToFloat64, map1[int64](toFloat64)) |
| 164 |
|
| 165 |
testUint32x4ConvertToFloat32(t, archsimd.Uint32x4.ConvertToFloat32, map1[uint32](toFloat32)) |
| 166 |
testUint32x8ConvertToFloat32(t, archsimd.Uint32x8.ConvertToFloat32, map1[uint32](toFloat32)) |
| 167 |
testUint32x16ConvertToFloat32(t, archsimd.Uint32x16.ConvertToFloat32, map1[uint32](toFloat32)) |
| 168 |
testUint64x2ConvertToFloat32(t, archsimd.Uint64x2.ConvertToFloat32, map1n[uint64](toFloat32, 4)) |
| 169 |
testUint64x4ConvertToFloat32(t, archsimd.Uint64x4.ConvertToFloat32, map1[uint64](toFloat32)) |
| 170 |
testUint64x8ConvertToFloat32(t, archsimd.Uint64x8.ConvertToFloat32, map1[uint64](toFloat32)) |
| 171 |
testUint32x4ConvertToFloat64(t, archsimd.Uint32x4.ConvertToFloat64, map1[uint32](toFloat64)) |
| 172 |
testUint32x8ConvertToFloat64(t, archsimd.Uint32x8.ConvertToFloat64, map1[uint32](toFloat64)) |
| 173 |
testUint64x2ConvertToFloat64(t, archsimd.Uint64x2.ConvertToFloat64, map1[uint64](toFloat64)) |
| 174 |
testUint64x4ConvertToFloat64(t, archsimd.Uint64x4.ConvertToFloat64, map1[uint64](toFloat64)) |
| 175 |
testUint64x8ConvertToFloat64(t, archsimd.Uint64x8.ConvertToFloat64, map1[uint64](toFloat64)) |
| 176 |
} |
| 177 |
} |
| 178 |
|
| 179 |
func TestExtend(t *testing.T) { |
| 180 |
if archsimd.X86.AVX2() { |
| 181 |
testInt8x16ConvertToInt16(t, archsimd.Int8x16.ExtendToInt16, map1[int8](toInt16)) |
| 182 |
testInt16x8ConvertToInt32(t, archsimd.Int16x8.ExtendToInt32, map1[int16](toInt32)) |
| 183 |
testInt32x4ConvertToInt64(t, archsimd.Int32x4.ExtendToInt64, map1[int32](toInt64)) |
| 184 |
testUint8x16ConvertToUint16(t, archsimd.Uint8x16.ExtendToUint16, map1[uint8](toUint16)) |
| 185 |
testUint16x8ConvertToUint32(t, archsimd.Uint16x8.ExtendToUint32, map1[uint16](toUint32)) |
| 186 |
testUint32x4ConvertToUint64(t, archsimd.Uint32x4.ExtendToUint64, map1[uint32](toUint64)) |
| 187 |
} |
| 188 |
|
| 189 |
if archsimd.X86.AVX512() { |
| 190 |
testInt8x32ConvertToInt16(t, archsimd.Int8x32.ExtendToInt16, map1[int8](toInt16)) |
| 191 |
testInt8x16ConvertToInt32(t, archsimd.Int8x16.ExtendToInt32, map1[int8](toInt32)) |
| 192 |
testInt16x16ConvertToInt32(t, archsimd.Int16x16.ExtendToInt32, map1[int16](toInt32)) |
| 193 |
testInt16x8ConvertToInt64(t, archsimd.Int16x8.ExtendToInt64, map1[int16](toInt64)) |
| 194 |
testInt32x8ConvertToInt64(t, archsimd.Int32x8.ExtendToInt64, map1[int32](toInt64)) |
| 195 |
testUint8x32ConvertToUint16(t, archsimd.Uint8x32.ExtendToUint16, map1[uint8](toUint16)) |
| 196 |
testUint8x16ConvertToUint32(t, archsimd.Uint8x16.ExtendToUint32, map1[uint8](toUint32)) |
| 197 |
testUint16x16ConvertToUint32(t, archsimd.Uint16x16.ExtendToUint32, map1[uint16](toUint32)) |
| 198 |
testUint16x8ConvertToUint64(t, archsimd.Uint16x8.ExtendToUint64, map1[uint16](toUint64)) |
| 199 |
testUint32x8ConvertToUint64(t, archsimd.Uint32x8.ExtendToUint64, map1[uint32](toUint64)) |
| 200 |
} |
| 201 |
} |
| 202 |
|
| 203 |
func TestExtendLo(t *testing.T) { |
| 204 |
testInt8x16ConvertLoToInt64x2(t, archsimd.Int8x16.ExtendLo2ToInt64, map1n[int8](toInt64, 2)) |
| 205 |
testInt16x8ConvertLoToInt64x2(t, archsimd.Int16x8.ExtendLo2ToInt64, map1n[int16](toInt64, 2)) |
| 206 |
testInt32x4ConvertLoToInt64x2(t, archsimd.Int32x4.ExtendLo2ToInt64, map1n[int32](toInt64, 2)) |
| 207 |
testUint8x16ConvertLoToUint64x2(t, archsimd.Uint8x16.ExtendLo2ToUint64, map1n[uint8](toUint64, 2)) |
| 208 |
testUint16x8ConvertLoToUint64x2(t, archsimd.Uint16x8.ExtendLo2ToUint64, map1n[uint16](toUint64, 2)) |
| 209 |
testUint32x4ConvertLoToUint64x2(t, archsimd.Uint32x4.ExtendLo2ToUint64, map1n[uint32](toUint64, 2)) |
| 210 |
testInt8x16ConvertLoToInt32x4(t, archsimd.Int8x16.ExtendLo4ToInt32, map1n[int8](toInt32, 4)) |
| 211 |
testInt16x8ConvertLoToInt32x4(t, archsimd.Int16x8.ExtendLo4ToInt32, map1n[int16](toInt32, 4)) |
| 212 |
testUint8x16ConvertLoToUint32x4(t, archsimd.Uint8x16.ExtendLo4ToUint32, map1n[uint8](toUint32, 4)) |
| 213 |
testUint16x8ConvertLoToUint32x4(t, archsimd.Uint16x8.ExtendLo4ToUint32, map1n[uint16](toUint32, 4)) |
| 214 |
testInt8x16ConvertLoToInt16x8(t, archsimd.Int8x16.ExtendLo8ToInt16, map1n[int8](toInt16, 8)) |
| 215 |
testUint8x16ConvertLoToUint16x8(t, archsimd.Uint8x16.ExtendLo8ToUint16, map1n[uint8](toUint16, 8)) |
| 216 |
|
| 217 |
if archsimd.X86.AVX2() { |
| 218 |
testInt8x16ConvertLoToInt64x4(t, archsimd.Int8x16.ExtendLo4ToInt64, map1n[int8](toInt64, 4)) |
| 219 |
testInt16x8ConvertLoToInt64x4(t, archsimd.Int16x8.ExtendLo4ToInt64, map1n[int16](toInt64, 4)) |
| 220 |
testUint8x16ConvertLoToUint64x4(t, archsimd.Uint8x16.ExtendLo4ToUint64, map1n[uint8](toUint64, 4)) |
| 221 |
testUint16x8ConvertLoToUint64x4(t, archsimd.Uint16x8.ExtendLo4ToUint64, map1n[uint16](toUint64, 4)) |
| 222 |
testInt8x16ConvertLoToInt32x8(t, archsimd.Int8x16.ExtendLo8ToInt32, map1n[int8](toInt32, 8)) |
| 223 |
testUint8x16ConvertLoToUint32x8(t, archsimd.Uint8x16.ExtendLo8ToUint32, map1n[uint8](toUint32, 8)) |
| 224 |
} |
| 225 |
|
| 226 |
if archsimd.X86.AVX512() { |
| 227 |
testInt8x16ConvertToInt64(t, archsimd.Int8x16.ExtendLo8ToInt64, map1n[int8](toInt64, 8)) |
| 228 |
testUint8x16ConvertToUint64(t, archsimd.Uint8x16.ExtendLo8ToUint64, map1n[uint8](toUint64, 8)) |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
func TestTruncate(t *testing.T) { |
| 233 |
if archsimd.X86.AVX512() { |
| 234 |
testInt16x8ConvertToInt8(t, archsimd.Int16x8.TruncateToInt8, map1n[int16](toInt8, 16)) |
| 235 |
testInt16x16ConvertToInt8(t, archsimd.Int16x16.TruncateToInt8, map1[int16](toInt8)) |
| 236 |
testInt16x32ConvertToInt8(t, archsimd.Int16x32.TruncateToInt8, map1[int16](toInt8)) |
| 237 |
testInt32x4ConvertToInt8(t, archsimd.Int32x4.TruncateToInt8, map1n[int32](toInt8, 16)) |
| 238 |
testInt32x8ConvertToInt8(t, archsimd.Int32x8.TruncateToInt8, map1n[int32](toInt8, 16)) |
| 239 |
testInt32x16ConvertToInt8(t, archsimd.Int32x16.TruncateToInt8, map1[int32](toInt8)) |
| 240 |
testInt64x2ConvertToInt8(t, archsimd.Int64x2.TruncateToInt8, map1n[int64](toInt8, 16)) |
| 241 |
testInt64x4ConvertToInt8(t, archsimd.Int64x4.TruncateToInt8, map1n[int64](toInt8, 16)) |
| 242 |
testInt64x8ConvertToInt8(t, archsimd.Int64x8.TruncateToInt8, map1n[int64](toInt8, 16)) |
| 243 |
testInt32x4ConvertToInt16(t, archsimd.Int32x4.TruncateToInt16, map1n[int32](toInt16, 8)) |
| 244 |
testInt32x8ConvertToInt16(t, archsimd.Int32x8.TruncateToInt16, map1[int32](toInt16)) |
| 245 |
testInt32x16ConvertToInt16(t, archsimd.Int32x16.TruncateToInt16, map1[int32](toInt16)) |
| 246 |
testInt64x2ConvertToInt16(t, archsimd.Int64x2.TruncateToInt16, map1n[int64](toInt16, 8)) |
| 247 |
testInt64x4ConvertToInt16(t, archsimd.Int64x4.TruncateToInt16, map1n[int64](toInt16, 8)) |
| 248 |
testInt64x8ConvertToInt16(t, archsimd.Int64x8.TruncateToInt16, map1[int64](toInt16)) |
| 249 |
testInt64x2ConvertToInt32(t, archsimd.Int64x2.TruncateToInt32, map1n[int64](toInt32, 4)) |
| 250 |
testInt64x4ConvertToInt32(t, archsimd.Int64x4.TruncateToInt32, map1[int64](toInt32)) |
| 251 |
testInt64x8ConvertToInt32(t, archsimd.Int64x8.TruncateToInt32, map1[int64](toInt32)) |
| 252 |
|
| 253 |
testUint16x8ConvertToUint8(t, archsimd.Uint16x8.TruncateToUint8, map1n[uint16](toUint8, 16)) |
| 254 |
testUint16x16ConvertToUint8(t, archsimd.Uint16x16.TruncateToUint8, map1[uint16](toUint8)) |
| 255 |
testUint16x32ConvertToUint8(t, archsimd.Uint16x32.TruncateToUint8, map1[uint16](toUint8)) |
| 256 |
testUint32x4ConvertToUint8(t, archsimd.Uint32x4.TruncateToUint8, map1n[uint32](toUint8, 16)) |
| 257 |
testUint32x8ConvertToUint8(t, archsimd.Uint32x8.TruncateToUint8, map1n[uint32](toUint8, 16)) |
| 258 |
testUint32x16ConvertToUint8(t, archsimd.Uint32x16.TruncateToUint8, map1[uint32](toUint8)) |
| 259 |
testUint64x2ConvertToUint8(t, archsimd.Uint64x2.TruncateToUint8, map1n[uint64](toUint8, 16)) |
| 260 |
testUint64x4ConvertToUint8(t, archsimd.Uint64x4.TruncateToUint8, map1n[uint64](toUint8, 16)) |
| 261 |
testUint64x8ConvertToUint8(t, archsimd.Uint64x8.TruncateToUint8, map1n[uint64](toUint8, 16)) |
| 262 |
testUint32x4ConvertToUint16(t, archsimd.Uint32x4.TruncateToUint16, map1n[uint32](toUint16, 8)) |
| 263 |
testUint32x8ConvertToUint16(t, archsimd.Uint32x8.TruncateToUint16, map1[uint32](toUint16)) |
| 264 |
testUint32x16ConvertToUint16(t, archsimd.Uint32x16.TruncateToUint16, map1[uint32](toUint16)) |
| 265 |
testUint64x2ConvertToUint16(t, archsimd.Uint64x2.TruncateToUint16, map1n[uint64](toUint16, 8)) |
| 266 |
testUint64x4ConvertToUint16(t, archsimd.Uint64x4.TruncateToUint16, map1n[uint64](toUint16, 8)) |
| 267 |
testUint64x8ConvertToUint16(t, archsimd.Uint64x8.TruncateToUint16, map1[uint64](toUint16)) |
| 268 |
testUint64x2ConvertToUint32(t, archsimd.Uint64x2.TruncateToUint32, map1n[uint64](toUint32, 4)) |
| 269 |
testUint64x4ConvertToUint32(t, archsimd.Uint64x4.TruncateToUint32, map1[uint64](toUint32)) |
| 270 |
testUint64x8ConvertToUint32(t, archsimd.Uint64x8.TruncateToUint32, map1[uint64](toUint32)) |
| 271 |
} |
| 272 |
} |
| 273 |
|
| 274 |
func TestSaturate(t *testing.T) { |
| 275 |
if archsimd.X86.AVX512() { |
| 276 |
testInt16x8ConvertToInt8(t, archsimd.Int16x8.SaturateToInt8, map1n[int16](satToInt8, 16)) |
| 277 |
testInt16x16ConvertToInt8(t, archsimd.Int16x16.SaturateToInt8, map1[int16](satToInt8)) |
| 278 |
testInt16x32ConvertToInt8(t, archsimd.Int16x32.SaturateToInt8, map1[int16](satToInt8)) |
| 279 |
testInt32x4ConvertToInt8(t, archsimd.Int32x4.SaturateToInt8, map1n[int32](satToInt8, 16)) |
| 280 |
testInt32x8ConvertToInt8(t, archsimd.Int32x8.SaturateToInt8, map1n[int32](satToInt8, 16)) |
| 281 |
testInt32x16ConvertToInt8(t, archsimd.Int32x16.SaturateToInt8, map1[int32](satToInt8)) |
| 282 |
testInt64x2ConvertToInt8(t, archsimd.Int64x2.SaturateToInt8, map1n[int64](satToInt8, 16)) |
| 283 |
testInt64x4ConvertToInt8(t, archsimd.Int64x4.SaturateToInt8, map1n[int64](satToInt8, 16)) |
| 284 |
testInt64x8ConvertToInt8(t, archsimd.Int64x8.SaturateToInt8, map1n[int64](satToInt8, 16)) |
| 285 |
testInt32x4ConvertToInt16(t, archsimd.Int32x4.SaturateToInt16, map1n[int32](satToInt16, 8)) |
| 286 |
testInt32x8ConvertToInt16(t, archsimd.Int32x8.SaturateToInt16, map1[int32](satToInt16)) |
| 287 |
testInt32x16ConvertToInt16(t, archsimd.Int32x16.SaturateToInt16, map1[int32](satToInt16)) |
| 288 |
testInt64x2ConvertToInt16(t, archsimd.Int64x2.SaturateToInt16, map1n[int64](satToInt16, 8)) |
| 289 |
testInt64x4ConvertToInt16(t, archsimd.Int64x4.SaturateToInt16, map1n[int64](satToInt16, 8)) |
| 290 |
testInt64x8ConvertToInt16(t, archsimd.Int64x8.SaturateToInt16, map1[int64](satToInt16)) |
| 291 |
testInt64x2ConvertToInt32(t, archsimd.Int64x2.SaturateToInt32, map1n[int64](satToInt32, 4)) |
| 292 |
testInt64x4ConvertToInt32(t, archsimd.Int64x4.SaturateToInt32, map1[int64](satToInt32)) |
| 293 |
testInt64x8ConvertToInt32(t, archsimd.Int64x8.SaturateToInt32, map1[int64](satToInt32)) |
| 294 |
|
| 295 |
testUint16x8ConvertToUint8(t, archsimd.Uint16x8.SaturateToUint8, map1n[uint16](satToUint8, 16)) |
| 296 |
testUint16x16ConvertToUint8(t, archsimd.Uint16x16.SaturateToUint8, map1[uint16](satToUint8)) |
| 297 |
testUint16x32ConvertToUint8(t, archsimd.Uint16x32.SaturateToUint8, map1[uint16](satToUint8)) |
| 298 |
testUint32x4ConvertToUint8(t, archsimd.Uint32x4.SaturateToUint8, map1n[uint32](satToUint8, 16)) |
| 299 |
testUint32x8ConvertToUint8(t, archsimd.Uint32x8.SaturateToUint8, map1n[uint32](satToUint8, 16)) |
| 300 |
testUint32x16ConvertToUint8(t, archsimd.Uint32x16.SaturateToUint8, map1[uint32](satToUint8)) |
| 301 |
testUint64x2ConvertToUint8(t, archsimd.Uint64x2.SaturateToUint8, map1n[uint64](satToUint8, 16)) |
| 302 |
testUint64x4ConvertToUint8(t, archsimd.Uint64x4.SaturateToUint8, map1n[uint64](satToUint8, 16)) |
| 303 |
testUint64x8ConvertToUint8(t, archsimd.Uint64x8.SaturateToUint8, map1n[uint64](satToUint8, 16)) |
| 304 |
testUint32x4ConvertToUint16(t, archsimd.Uint32x4.SaturateToUint16, map1n[uint32](satToUint16, 8)) |
| 305 |
testUint32x8ConvertToUint16(t, archsimd.Uint32x8.SaturateToUint16, map1[uint32](satToUint16)) |
| 306 |
testUint32x16ConvertToUint16(t, archsimd.Uint32x16.SaturateToUint16, map1[uint32](satToUint16)) |
| 307 |
testUint64x2ConvertToUint16(t, archsimd.Uint64x2.SaturateToUint16, map1n[uint64](satToUint16, 8)) |
| 308 |
testUint64x4ConvertToUint16(t, archsimd.Uint64x4.SaturateToUint16, map1n[uint64](satToUint16, 8)) |
| 309 |
testUint64x8ConvertToUint16(t, archsimd.Uint64x8.SaturateToUint16, map1[uint64](satToUint16)) |
| 310 |
testUint64x2ConvertToUint32(t, archsimd.Uint64x2.SaturateToUint32, map1n[uint64](satToUint32, 4)) |
| 311 |
testUint64x4ConvertToUint32(t, archsimd.Uint64x4.SaturateToUint32, map1[uint64](satToUint32)) |
| 312 |
testUint64x8ConvertToUint32(t, archsimd.Uint64x8.SaturateToUint32, map1[uint64](satToUint32)) |
| 313 |
} |
| 314 |
} |