[dev.simd] simd: {Int,Uint}{8x{16,32},16x{8,16}} subvector loads/stores from slices.

Includes tests, which turned out to be necessary.

Change-Id: I13437f3c1b6a614481d4bef332666485dbee4c4e
Reviewed-on: https://go-review.googlesource.com/c/go/+/684839
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
David Chase 2025-06-26 17:41:40 -04:00
parent 2bb45cb8a5
commit 24f2b8ae2e
3 changed files with 598 additions and 1 deletions

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build goexperiment.simd
//go:build goexperiment.simd && amd64
package simd_test
@ -161,6 +161,30 @@ func checkInt8Slices(t *testing.T, a, b []int8) {
}
}
func checkUint8Slices(t *testing.T, a, b []uint8) {
for i := range b {
if a[i] != b[i] {
t.Errorf("a and b differ at index %d, a=%d, b=%d", i, a[i], b[i])
}
}
}
func checkInt16Slices(t *testing.T, a, b []int16) {
for i := range b {
if a[i] != b[i] {
t.Errorf("a and b differ at index %d, a=%d, b=%d", i, a[i], b[i])
}
}
}
func checkUint16Slices(t *testing.T, a, b []uint16) {
for i := range b {
if a[i] != b[i] {
t.Errorf("a and b differ at index %d, a=%d, b=%d", i, a[i], b[i])
}
}
}
func checkFloat32Slices(t *testing.T, a, b []float32) {
for i := range b {
if a[i] != b[i] {