MDN / any_true: Wasm SIMD bitwise instruction
MDN / any_true: Wasm SIMD bitwise instruction
The any_true SIMD bitwise instruction tests whether an v128 input value contains any non-zero bits.
(module
(import "console" "log" (func $log (param i32)))
(func $main
v128.const f32x4 0 0 0 1.2
v128.any_true
call $log ;; log the result
)
(start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
Syntax
v128.any_true
v128.any_true: The
v128.any_trueinstruction.
Type
[input] -> [output]
input: The input
v128value interpretation. This can be an integer type (for example,i16x8) or floating point type (for example,f32x4).
output: The output value. This is an
i32type equal to1if thev128input contains any non-zero bits, or0if all bits are0.
Binary encoding
InstructionBinary formatExample text => binaryv128.any_true0xfd 83:u32v128.any_true => 0xfd 0x53