WebAssembly / simd

Branch of the spec repo scoped to discussion of SIMD in WebAssembly
Other
531 stars 43 forks source link

any_true instructions should be untyped #416

Closed Maratyszcza closed 3 years ago

Maratyszcza commented 3 years ago

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.

lars-t-hansen commented 3 years ago

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 3 years ago

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

Maratyszcza commented 3 years ago

Was implemented in #423