diff options
| author | Cherry Mui <cherryyz@google.com> | 2025-12-26 23:18:37 -0500 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-12-29 06:12:33 -0800 |
| commit | e790d5967424b4230978f63d16ecc5033269dd02 (patch) | |
| tree | 9ace76beadf202abc8e6a0ab29c10644a1de40ab /src/simd | |
| parent | f4cec7917cc53c8c7ef2ea456b4bf0474c41189a (diff) | |
| download | go-e790d5967424b4230978f63d16ecc5033269dd02.tar.xz | |
simd/archsimd: add tests for Truncate operations
For now, only include operations that input and output vectors
have the same number of elements.
Change-Id: I933c800ace515d8d51834d20c134090470950042
Reviewed-on: https://go-review.googlesource.com/c/go/+/732860
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Diffstat (limited to 'src/simd')
| -rw-r--r-- | src/simd/archsimd/internal/simd_test/unary_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/simd/archsimd/internal/simd_test/unary_test.go b/src/simd/archsimd/internal/simd_test/unary_test.go index 561709841d..088cab68fa 100644 --- a/src/simd/archsimd/internal/simd_test/unary_test.go +++ b/src/simd/archsimd/internal/simd_test/unary_test.go @@ -194,3 +194,23 @@ func TestExtend(t *testing.T) { testUint32x8ConvertToUint64(t, archsimd.Uint32x8.ExtendToUint64, map1[uint32](toUint64)) } } + +func TestTruncate(t *testing.T) { + if archsimd.X86.AVX512() { + testInt16x16ConvertToInt8(t, archsimd.Int16x16.TruncateToInt8, map1[int16](toInt8)) + testInt16x32ConvertToInt8(t, archsimd.Int16x32.TruncateToInt8, map1[int16](toInt8)) + testInt32x16ConvertToInt8(t, archsimd.Int32x16.TruncateToInt8, map1[int32](toInt8)) + testInt32x8ConvertToInt16(t, archsimd.Int32x8.TruncateToInt16, map1[int32](toInt16)) + testInt32x16ConvertToInt16(t, archsimd.Int32x16.TruncateToInt16, map1[int32](toInt16)) + testInt64x8ConvertToInt16(t, archsimd.Int64x8.TruncateToInt16, map1[int64](toInt16)) + testInt64x8ConvertToInt32(t, archsimd.Int64x8.TruncateToInt32, map1[int64](toInt32)) + + testUint16x16ConvertToUint8(t, archsimd.Uint16x16.TruncateToUint8, map1[uint16](toUint8)) + testUint16x32ConvertToUint8(t, archsimd.Uint16x32.TruncateToUint8, map1[uint16](toUint8)) + testUint32x16ConvertToUint8(t, archsimd.Uint32x16.TruncateToUint8, map1[uint32](toUint8)) + testUint32x8ConvertToUint16(t, archsimd.Uint32x8.TruncateToUint16, map1[uint32](toUint16)) + testUint32x16ConvertToUint16(t, archsimd.Uint32x16.TruncateToUint16, map1[uint32](toUint16)) + testUint64x8ConvertToUint16(t, archsimd.Uint64x8.TruncateToUint16, map1[uint64](toUint16)) + testUint64x8ConvertToUint32(t, archsimd.Uint64x8.TruncateToUint32, map1[uint64](toUint32)) + } +} |
