This is inspired by a recently filed Rust issue noting poor codegen for vector masks (https://github.com/rust-lang/portable-simd/issues/351). I'm new to wasm, so I simply followed the reported issue and the wasm spec.
I'm not sure who to add to review this, so feel free to add others or remove yourself.