floor: Wasm SIMD conversion instruction

The floor SIMD conversion instruction rounds the value in each lane of a v128 value interpretation down to the nearest integer below.

Try it

(module
  (import "console" "log" (func $log (param f32)))
  (func $main
    v128.const f32x4 1.9 2.5 0.5 12.1

    f32x4.floor
    f32x4.extract_lane 3
    call $log ;; log the result
  )
  (start $main)
)
WebAssembly.instantiateStreaming(fetch("{%wasm-url%}"), { console });

Syntax

value_type.floor
value_type

The type of value the instruction is being run on. The following v128 value interpretations support floor:

  • f32x4
  • f64x2
floor

The floor instruction. Must always be included after the value_type and a period (.).

Type

[input] -> [output]
input

The input v128 value interpretation.

output

The output v128 value interpretation.

Binary encoding

Instruction Binary format Example text => binary
f32x4.floor 0xfd 104:u32 f32x4.floor => 0xfd 0x68
f64x2.floor 0xfd 117:u32 f64x2.floor => 0xfd 0x75

Specifications

This feature does not appear to be defined in any specification.

Browser compatibility

See also