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 SIMD.Int16x8
data type is a 128-bit vector divided into 8 lanes storing 16-bit signed integer values.
Figure 1: SIMD.Int16x8 in a 128-bit SIMD register
SIMD.Int16x8(s0, s1, s2, s3, s4, s5, s6, s7);
s[0-7]
Optional
In addition to the simple creator functions, the SIMD API provides the following constructor functions.
SIMD.Int16x8.splat()
You can also convert from another SIMD data type to Int16x8.
Note: SIMD types don't work with new
, as SIMD values are no "boxed" objects (comparable to String(s)
vs. new String(s)
, which creates a String object).
var v = new SIMD.Int16x8(1, 2, 3, 4, 5, 6, 7, 8); // TypeError: SIMD.Int16x8 is not a constructor var w = new SIMD.Int16x8.splat(3); // TypeError: SIMD.Int16x8.splat is not a constructor
Instead, you just write:
var v = SIMD.Int16x8(1, 2, 3, 4, 5, 6, 7, 8); var w = SIMD.Int16x8.splat(3);
To actually do something with SIMD types, SIMD operations are needed that work on SIMD data types.
SIMD.Int16x8.check()
TypeError
otherwise.SIMD.Int16x8.extractLane()
SIMD.Int16x8.replaceLane()
SIMD.Int16x8.load()
SIMD.Int16x8.store()
SIMD.Int16x8.add()
a + b
).SIMD.Int16x8.addSaturate()
a + b
) and saturating behavior on overflow.SIMD.Int16x8.mul()
a * b
).SIMD.Int16x8.neg()
SIMD.Int16x8.sub()
a - b
).SIMD.Int16x8.subSaturate()
a - b
) and saturating behavior on overflow.SIMD.Int16x8.shuffle()
SIMD.Int16x8.swizzle()
SIMD.Int16x8.select()
SIMD.Int16x8.equal()
a == b
.SIMD.Int16x8.notEqual()
a != b
.SIMD.Int16x8.lessThan()
a < b
.SIMD.Int16x8.lessThanOrEqual()
a <= b
.SIMD.Int16x8.greaterThan()
a > b
.SIMD.Int16x8.greaterThanOrEqual()
a >= b
.SIMD.Int16x8.and()
a & b
).SIMD.Int16x8.or()
a | b
).SIMD.Int16x8.xor()
a ^ b
).SIMD.Int16x8.not()
~a
).SIMD.Int16x8.shiftLeftByScalar()
a << bits
).SIMD.Int16x8.shiftRightByScalar()
SIMD.Int16x8.fromFloat32x4Bits()
SIMD.Int16x8.fromFloat64x2Bits()
SIMD.Int16x8.fromInt32x4Bits()
SIMD.Int16x8.fromInt8x16Bits()
SIMD.Int16x8.fromUint32x4Bits()
SIMD.Int16x8.fromUint16x8Bits()
SIMD.Int16x8.fromUint8x16Bits()
The following methods and properties are installed on the SIMD.Int16x8.prototype
.
SIMD.Int16x8.prototype.constructor
SIMD.Int16x8.prototype.toLocaleString()
Object.prototype.toLocaleString()
method.SIMD.Int16x8.prototype.toString()
Object.prototype.toString()
method.SIMD.Int16x8.prototype.valueOf()
SIMD.Int16x8.prototype.toSource()
Object.prototype.toSource()
method.SIMD.Int16x8(1, 2, 3, 4, 5, 6, 7, 8); // Int16x8[1, 2, 3, 4, 5, 6, 7, 8] SIMD.Int16x8(1, 2); // Int16x8[1, 2, 0, 0, 0, 0, 0, 0] SIMD.Int16x8(); // Int16x8[0, 0, 0, 0, 0, 0, 0, 0]
Specification | Status | Comment |
---|---|---|
SIMD The definition of 'Int16x8' in that specification. | Obsolete | Initial definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | No support | Nightly build | Nightly build | No support | No support | No support |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | No support | No support | Nightly build | Nightly build | No support | No support | No support |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16x8