internal/asm/c64,c128: AMD64 AXPY 在有效对齐情况下出现故障,并超出了已用完的对齐尾部
func c64Aligned(t *testing.T, n int, mod uintptr) []complex64 { storage := new(struct { A [32]complex64 Pad float32 B [32]complex64 }) for _, v := range [][]complex64{storage.A[:], storage.B[:]} { for start := 0; start < 2; start++ { if uintptr(unsafe.Pointer(&v[start]))%16 == mod { return v[start : start+n] } } } t.Fatal("fixture alignment") return nil }
func TestUpstreamAXPY(t *testing.T) { t.Run("c64_alignment", func(t *testing.T) { y := c64Aligned(t, 8, 4) x := make([]complex64, 8) for i := range x { x[i], y[i] = 1, 2 } c64.AxpyUnitary(3, x, y) for _, v := range y { if v != 5 { t.Fatalf("got %v, want 5", v) } } }) t.Run("c64_empty_tail", func(t *testing.T) { y := c64Aligned(t, 1, 8) y[0] = 2 dst := make([]complex64, 1) c64.AxpyUnitaryTo(dst, 3, []complex64{1}, y) if dst[0] != 5 { …
内容来源: gonum/gonum