WebAssembly/simd

any_true instructions should be untyped

Maratyszcza opened this issue · 3 comments

any_true SIMD instruction returns 1 if any lane is non-zero and returns 0 otherwise. Notably, the result does not depend on whether we look at 8-bit, 16-bit, 32-bit, or 64-bit lanes: if the SIMD vector has any bit set, the result is 1; otherwise, the result is 0. Therefore, it would make sense to replace i8x16.any_true, i16x8.any_true, i32x4.any_true, and i64x2.any_true with a single v128.any_true instruction.

I more or less agree - in Firefox the any_true implementations boil away and uniformly become v128.any_bit_set. There's no clear reason to have multiple ops.

dtig commented

No objections to v128.any_true operation, V8 generates the same code for all the variants as well.

Was implemented in #423