diff --git a/include/xsimd/arch/xsimd_wasm.hpp b/include/xsimd/arch/xsimd_wasm.hpp index f8ed6f69e..b897fa0d9 100644 --- a/include/xsimd/arch/xsimd_wasm.hpp +++ b/include/xsimd/arch/xsimd_wasm.hpp @@ -175,6 +175,33 @@ namespace xsimd return wasm_v128_or(self, other); } + // bitwise_lshift + template ::value, void>::type> + inline batch bitwise_lshift(batch const& self, int32_t other, requires_arch) noexcept + { + XSIMD_IF_CONSTEXPR(sizeof(T) == 1) + { + return wasm_v128_and(wasm_i8x16_splat(0xFF << other), wasm_i32x4_shl(self, other)); + } + else XSIMD_IF_CONSTEXPR(sizeof(T) == 2) + { + return wasm_i16x8_shl(self, other); + } + else XSIMD_IF_CONSTEXPR(sizeof(T) == 4) + { + return wasm_i32x4_shl(self, other); + } + else XSIMD_IF_CONSTEXPR(sizeof(T) == 8) + { + return wasm_i64x2_shl(self, other); + } + else + { + assert(false && "unsupported arch/op combination"); + return {}; + } + } + // bitwise_xor template inline batch bitwise_xor(batch const& self, batch const& other, requires_arch) noexcept