summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/SIMD/replacelane.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/SIMD/replacelane.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/SIMD/replacelane.js')
-rw-r--r--js/src/jit-test/tests/SIMD/replacelane.js181
1 files changed, 181 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/SIMD/replacelane.js b/js/src/jit-test/tests/SIMD/replacelane.js
new file mode 100644
index 000000000..c6b37ad5a
--- /dev/null
+++ b/js/src/jit-test/tests/SIMD/replacelane.js
@@ -0,0 +1,181 @@
+load(libdir + 'simd.js');
+
+setJitCompilerOption("ion.warmup.trigger", 50);
+
+function f() {
+ var f4 = SIMD.Float32x4(1, 2, 3, 4);
+ var i4 = SIMD.Int32x4(1, 2, 3, 4);
+ var b4 = SIMD.Bool32x4(true, false, true, false);
+
+ for (var i = 0; i < 150; i++) {
+ assertEqX4(SIMD.Int32x4.replaceLane(i4, 0, 42), [42, 2, 3, 4]);
+ assertEqX4(SIMD.Int32x4.replaceLane(i4, 1, 42), [1, 42, 3, 4]);
+ assertEqX4(SIMD.Int32x4.replaceLane(i4, 2, 42), [1, 2, 42, 4]);
+ assertEqX4(SIMD.Int32x4.replaceLane(i4, 3, 42), [1, 2, 3, 42]);
+
+ assertEqX4(SIMD.Float32x4.replaceLane(f4, 0, 42), [42, 2, 3, 4]);
+ assertEqX4(SIMD.Float32x4.replaceLane(f4, 1, 42), [1, 42, 3, 4]);
+ assertEqX4(SIMD.Float32x4.replaceLane(f4, 2, 42), [1, 2, 42, 4]);
+ assertEqX4(SIMD.Float32x4.replaceLane(f4, 3, 42), [1, 2, 3, 42]);
+
+ assertEqX4(SIMD.Bool32x4.replaceLane(b4, 0, false), [false, false, true, false]);
+ assertEqX4(SIMD.Bool32x4.replaceLane(b4, 1, true), [true, true, true, false]);
+ assertEqX4(SIMD.Bool32x4.replaceLane(b4, 2, false), [true, false, false, false]);
+ assertEqX4(SIMD.Bool32x4.replaceLane(b4, 3, true), [true, false, true, true]);
+ }
+}
+
+f();
+
+function e() {
+ var f4 = SIMD.Float32x4(1, 2, 3, 4);
+ var i4 = SIMD.Int32x4(1, 2, 3, 4);
+ var b4 = SIMD.Bool32x4(true, false, true, false);
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Int32x4.replaceLane(i < 149 ? i4 : f4, 0, 42);
+ } catch(e) {
+ assertEq(e instanceof TypeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Int32x4.replaceLane(i < 149 ? i4 : b4, 0, 42);
+ } catch(e) {
+ assertEq(e instanceof TypeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Int32x4.replaceLane(i4, i < 149 ? 0 : 4, 42);
+ } catch(e) {
+ assertEq(e instanceof RangeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Int32x4.replaceLane(i4, i < 149 ? 0 : 1.1, 42);
+ } catch(e) {
+ assertEq(e instanceof RangeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Float32x4.replaceLane(i < 149 ? f4 : i4, 0, 42);
+ } catch(e) {
+ assertEq(e instanceof TypeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Float32x4.replaceLane(i < 149 ? f4 : b4, 0, 42);
+ } catch(e) {
+ assertEq(e instanceof TypeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Float32x4.replaceLane(f4, i < 149 ? 0 : 4, 42);
+ } catch(e) {
+ assertEq(e instanceof RangeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Float32x4.replaceLane(f4, i < 149 ? 0 : 1.1, 42);
+ } catch(e) {
+ assertEq(e instanceof RangeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Bool32x4.replaceLane(i < 149 ? b4 : i4, 0, true);
+ } catch(e) {
+ assertEq(e instanceof TypeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Bool32x4.replaceLane(i < 149 ? b4 : f4, 0, true);
+ } catch(e) {
+ assertEq(e instanceof TypeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Bool32x4.replaceLane(b4, i < 149 ? 0 : 4, true);
+ } catch(e) {
+ assertEq(e instanceof RangeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+ for (let i = 0; i < 150; i++) {
+ let caught = false;
+ try {
+ let x = SIMD.Bool32x4.replaceLane(b4, i < 149 ? 0 : 1.1, true);
+ } catch(e) {
+ assertEq(e instanceof RangeError, true);
+ assertEq(i, 149);
+ caught = true;
+ }
+ assertEq(i < 149 || caught, true);
+ }
+
+}
+
+e();