diff --git a/src/impl/vamp/vector/interface.hh b/src/impl/vamp/vector/interface.hh index 48416bcb..402f07c6 100644 --- a/src/impl/vamp/vector/interface.hh +++ b/src/impl/vamp/vector/interface.hh @@ -394,6 +394,23 @@ namespace vamp return D(apply>(d()->data, broadcast_scalar(other))); } + template ::template check = true> + inline constexpr auto min(T o) const noexcept -> D + { + return min(o.data); + } + + template ::template check = true> + inline constexpr auto min(T other) const noexcept -> D + { + return D(apply>(d()->data, other)); + } + + inline constexpr auto min(typename S::ScalarT other) const noexcept -> D + { + return D(apply>(d()->data, broadcast_scalar(other))); + } + inline constexpr auto hsum() const noexcept -> typename S::ScalarT { return S::hsum(unpack::sum_(d()->data)); diff --git a/src/impl/vamp/vector/isa/avx.hh b/src/impl/vamp/vector/isa/avx.hh index 2e30e5db..6dfa3a8a 100644 --- a/src/impl/vamp/vector/isa/avx.hh +++ b/src/impl/vamp/vector/isa/avx.hh @@ -438,6 +438,12 @@ namespace vamp return _mm256_max_ps(v, other); } + template + inline static constexpr auto min(VectorT v, VectorT other) noexcept -> VectorT + { + return _mm256_min_ps(v, other); + } + template inline static constexpr auto hsum(VectorT v) noexcept -> ScalarT { diff --git a/src/impl/vamp/vector/isa/neon.hh b/src/impl/vamp/vector/isa/neon.hh index 49a19997..b0587123 100644 --- a/src/impl/vamp/vector/isa/neon.hh +++ b/src/impl/vamp/vector/isa/neon.hh @@ -528,6 +528,12 @@ namespace vamp return vmaxq_f32(v, other); } + template + inline static constexpr auto min(VectorT v, VectorT other) noexcept -> VectorT + { + return vminq_f32(v, other); + } + template inline static constexpr auto hsum(VectorT v) noexcept -> float { diff --git a/src/impl/vamp/vector/isa/wasm.hh b/src/impl/vamp/vector/isa/wasm.hh index 36504fc5..d82d603e 100644 --- a/src/impl/vamp/vector/isa/wasm.hh +++ b/src/impl/vamp/vector/isa/wasm.hh @@ -555,6 +555,12 @@ namespace vamp return {wasm_f32x4_max(v.v, other.v)}; } + template + inline static constexpr auto min(VectorT v, VectorT other) noexcept -> VectorT + { + return {wasm_f32x4_min(v.v, other.v)}; + } + template inline static constexpr auto hsum(VectorT v) noexcept -> float {