diff --git a/include/xsimd/arch/xsimd_wasm.hpp b/include/xsimd/arch/xsimd_wasm.hpp index c544292c8..2a9f3477f 100644 --- a/include/xsimd/arch/xsimd_wasm.hpp +++ b/include/xsimd/arch/xsimd_wasm.hpp @@ -707,6 +707,45 @@ namespace xsimd return wasm_f64x2_mul(self, other); } + // neg + template ::value, void>::type> + inline batch neg(batch const& self, requires_arch) noexcept + { + XSIMD_IF_CONSTEXPR(sizeof(T) == 1) + { + return wasm_i8x16_neg(self); + } + else XSIMD_IF_CONSTEXPR(sizeof(T) == 2) + { + return wasm_i16x8_neg(self); + } + else XSIMD_IF_CONSTEXPR(sizeof(T) == 4) + { + return wasm_i32x4_neg(self); + } + else XSIMD_IF_CONSTEXPR(sizeof(T) == 8) + { + return wasm_i64x2_neg(self); + } + else + { + assert(false && "unsupported arch/op combination"); + return {}; + } + } + + template + inline batch neg(batch const& self, requires_arch) noexcept + { + return wasm_f32x4_neg(self); + } + + template + inline batch neg(batch const& self, requires_arch) noexcept + { + return wasm_f64x2_neg(self); + } + // neq template inline batch_bool neq(batch const& self, batch const& other, requires_arch) noexcept