GO-V.ORG
As seen in

trunc_sat_f64x2_s_zero: Wasm SIMD conversion instruction

The truncsatf64x2szero SIMD conversion instruction performs a saturating conversion of the lanes of a v128 f64x2 value interpretation into a signed i32x4 value interpretation, clamping the output to the range allowed by the value type. The two higher lanes of the result are initialized to zero.

The **`trunc_sat_f64x2_s_zero`** [SIMD conversion instruction](/docs/WebAssembly/Reference/SIMD/conversion) performs a [saturating](https://en.wikipedia.org/wiki/Saturation_arithmetic) conversion of the lanes of a [`v128`](/docs/WebAssembly/Reference/Value_types/v128) `f64x2` value interpretation into a signed `i32x4` value interpretation, clamping the output to the range allowed by the value type. The two higher lanes of the result are initialized to zero.

Saturation means that the output values are clamped to the upper and lower values allowed by the value interpretation. Allowed output values are `−2,147,483,648` to `2,147,483,647` (the full range of a signed 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 f64x2 1300.5 1345400000.9

i32x4.trunc_sat_f64x2_s_zero
i32x4.extract_lane 1
call $log ;; log the result
)
(start $main)
)
```

```js interactive-example
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });
```

## Syntax

```plain
value_type.trunc_sat_f64x2_s_zero
```

- `value_type`
- : The type of value the instruction is being run on. The following [`v128`](/docs/WebAssembly/Reference/Value_types/v128) value interpretations support `trunc_sat_f64x2_s_zero`:
- `i32x4`
- `trunc_sat_f64x2_s_zero`
- : The `trunc_sat_f64x2_s_zero` instruction. Must always be included after the `value_type` and a period (`.`).

### Type

```plain
[input] -> [output]
```

- `input`
- : The input `v128` `f64x2` value interpretation.
- `output`
- : The output `v128` `i32x4` value interpretation.

### Binary encoding

| Instruction | Binary format | Example text => binary |
| ------------------------------ | -------------- | -------------------------------------------------- |
| `i32x4.trunc_sat_f64x2_s_zero` | `0xfd 252:u32` | `i32x4.trunc_sat_f64x2_s_zero` => `0xfd 0xfc 0x01` |

## Specifications

## Browser compatibility

source: MDN Web Docs mirror · page

Cite this

"trunc_sat_f64x2_s_zero: Wasm SIMD conversion instruction". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/SIMD/conversion/trunc_sat_f64x2_s_zero

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·