MDN / all_true: Wasm SIMD bitwise instruction
MDN / all_true: Wasm SIMD bitwise instruction
The all_true SIMD bitwise instruction tests whether all lanes of a v128 input value are non-zero.
(module
(import "console" "log" (func $log (param i32)))
(func $main
v128.const i8x16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
i8x16.all_true
call $log ;; log the result
)
(start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
Syntax
value_type.all_true
value_type: The type of value the instruction is being run on. The following types support
all_true:i8x16i16x8i32x4i64x2
all_true: The
all_trueinstruction. Must always be included after thevalue_typeand a period (.).
Type
[input] -> [output]
input: The input
v128value interpretation.
output: The output value. This is an
i32type equal to1if thev128input contains all non-zero bits, or0if any of the bits are0.
Binary encoding
InstructionBinary formatExample text => binaryi8x16.all_true0xfd 99:u32i8x16.all_true => 0xfd 0x63i16x8.all_true0xfd 131:u32i16x8.all_true => 0xfd 0x83 0x01i32x4.all_true0xfd 163:u32i32x4.all_true => 0xfd 0xa3 0x01i64x2.all_true0xfd 195:u32i64x2.all_true => 0xfd 0xc3 0x01