summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/SIMD/select.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/select.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/select.js')
-rw-r--r--js/src/jit-test/tests/SIMD/select.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/SIMD/select.js b/js/src/jit-test/tests/SIMD/select.js
new file mode 100644
index 000000000..3f0d783da
--- /dev/null
+++ b/js/src/jit-test/tests/SIMD/select.js
@@ -0,0 +1,35 @@
+load(libdir + 'simd.js');
+
+setJitCompilerOption("ion.warmup.trigger", 50);
+
+function select(type, mask, ifTrue, ifFalse) {
+ var arr = [];
+ for (var i = 0; i < 4; i++) {
+ var selector = SIMD.Bool32x4.extractLane(mask, i);
+ arr.push(type.extractLane(selector ? ifTrue : ifFalse, i));
+ }
+ return arr;
+}
+
+function f() {
+ var f1 = SIMD.Float32x4(1, 2, 3, 4);
+ var f2 = SIMD.Float32x4(NaN, Infinity, 3.14, -0);
+
+ var i1 = SIMD.Int32x4(2, 3, 5, 8);
+ var i2 = SIMD.Int32x4(13, 37, 24, 42);
+
+ var TTFT = SIMD.Bool32x4(true, true, false, true);
+ var TFTF = SIMD.Bool32x4(true, false, true, false);
+
+ var mask = SIMD.Int32x4(0xdeadbeef, 0xbaadf00d, 0x00ff1ce, 0xdeadc0de);
+
+ for (var i = 0; i < 150; i++) {
+ assertEqX4(SIMD.Float32x4.select(TTFT, f1, f2), select(SIMD.Float32x4, TTFT, f1, f2));
+ assertEqX4(SIMD.Float32x4.select(TFTF, f1, f2), select(SIMD.Float32x4, TFTF, f1, f2));
+
+ assertEqX4(SIMD.Int32x4.select(TFTF, i1, i2), select(SIMD.Int32x4, TFTF, i1, i2));
+ assertEqX4(SIMD.Int32x4.select(TTFT, i1, i2), select(SIMD.Int32x4, TTFT, i1, i2));
+ }
+}
+
+f();