trunc_sat_f32x4_u: Wasm SIMD conversion instruction
The truncsatf32x4u SIMD conversion instruction performs a saturating conversion of the lanes of a v128 f32x4 value interpretation into an unsigned i32x4 value interpretation, clamping the output to the range allowed by the value type.
The trunc_sat_f32x4_u SIMD conversion instruction performs a saturating conversion of the lanes of a v128 f32x4 value interpretation into an unsigned i32x4 value interpretation, clamping the output to the range allowed by the value type.
Saturation means that the output values are clamped to the upper and lower values allowed by the value interpretation. Allowed output values are 0 to 4,294,967,295 (the full range of an unsigned 32-bit integer). NaN values are converted to 0.
tabbed-taller
```wat interactive-example (module (import "console" "log" (func $log (param i32))) (func $main v128.const f32x4 1300.5 60.4 0.5 780000.4
i32x4.trunc_sat_f32x4_u
i32x4.extract_lane 3
call $log ;; log the result
) (start $main) )
```js interactive-example
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
Syntax
value_type.trunc_sat_f32x4_u
value_type- : The type of value the instruction is being run on. The following
v128value interpretations supporttrunc_sat_f32x4_u:i32x4
trunc_sat_f32x4_u- : The
trunc_sat_f32x4_uinstruction. Must always be included after thevalue_typeand a period (.).
Type
[input] -> [output]
input- : The input
v128f32x4value interpretation. output- : The output
v128i32x4value interpretation.
Binary encoding
| Instruction | Binary format | Example text => binary |
|---|---|---|
i32x4.trunc_sat_f32x4_u |
0xfd 249:u32 |
i32x4.trunc_sat_f32x4_u => 0xfd 0xf9 0x01 |