SIMD.js has been taken out of active development in TC39 and removed from Stage 3. It is not being pursued by web browsers for implementation anymore. SIMD operations exposed to the web are under active development within WebAssembly, with operations based on the SIMD.js operations.

The static method creates a new integer SIMD data type with the lane values being a selection match from a selector mask.

Syntax, trueValue, falseValue), trueValue, falseValue), trueValue, falseValue), trueValue, falseValue), trueValue, falseValue), trueValue, falseValue), trueValue, falseValue), trueValue, falseValue)


An int32x4, int16x8 or int8x16 that is used as the selector mask.
If the selector mask lane is true, pick the corresponding lane value from here.
If the selector mask lane is false, pick the corresponding lane value from here.

Return value

A new SIMD data type.


The method selects lanes from a selection mask. Masking (or "branching") lanes is useful as you can't operate on a fraction of data in SIMD data types. However, with masks and the select function, you can branch and merge vectors to assemble the result vector you need.


Custom selection mask

This example uses the SIMD.Bool32x4 type to create a custom selection mask. With this mask, you are able to select the first and the last lane from the first Float32x4 data type. Thus, the select function selects the first and last lane from vector a and the second and third lane from vector b (or the sum vector in the second select).

var a = SIMD.Float32x4(1, 2, 3, 4);
var b = SIMD.Float32x4(5, 6, 7, 8);

var mask = SIMD.Bool32x4(true, false, false, true);, a, b);
// Float32x4[1, 6, 7, 4]

var sum = SIMD.Float32x4.add(a, b);, a, sum);
// Float32x4[1, 8, 10, 4]

Operations returning a selection mask

All SIMD comparison operations return a selection mask from which you have to select to actually get the result of the comparison:

var a = SIMD.Float32x4(0, 12, 3, 4);
var b = SIMD.Float32x4(0, 6, 7, 50);

var mask = SIMD.Float32x4.lessThan(a, b);
// Bool32x4[false, false, true, true]

var result =, a, b);
// Float32x4[0, 6, 3, 4]


Specification Status Comment
The definition of '' in that specification.
Obsolete Initial definition.

Browser compatibility

Experimental SIMD.js has been removed from browsers. It's still available in Firefox Nightly, but will be removed in favor of a SIMD implementation in WebAssembly. See also bug 1416723.

See also

Document Tags and Contributors

Contributors to this page: fscholz, nmve, eduardoboucas
Last updated by: fscholz,