blob: 54355387f73000448f673f7c284d3cee72d5b6e8 [file]
// Copyright 2026 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build goexperiment.simd && arm64
package archsimd
// ReduceSum returns the sum of all elements in x.
//
// Emulated
func (x Float32x4) ReduceSum() (z float32) {
x = x.ConcatAddPairs(x) // [x0+x1, x2+x3, x0+x1, x2+x3]
x = x.ConcatAddPairs(x) // [(x0+x1)+(x2+x3), ...]
return x.GetElem(0)
}