summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/spec/relaxed-simd
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/wasm/spec/relaxed-simd')
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt1
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/directives.txt1
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/harness.js360
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/i16x8_relaxed_q15mulr_s.wast.js49
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js338
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/i8x16_relaxed_swizzle.wast.js90
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_dot_product.wast.js139
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_laneselect.wast.js163
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_madd_nmadd.wast.js325
-rw-r--r--js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_min_max.wast.js663
10 files changed, 2129 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt b/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt
new file mode 100644
index 0000000000..625758af79
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/directives.txt
@@ -0,0 +1 @@
+|jit-test| test-also=--wasm-compiler=optimizing; test-also=--wasm-compiler=baseline; test-also=--wasm-test-serialization; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemorySupported(); local-include:harness/harness.js; --wasm-relaxed-simd; skip-if: !wasmRelaxedSimdEnabled() \ No newline at end of file
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/directives.txt b/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/directives.txt
new file mode 100644
index 0000000000..d41243abbb
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/directives.txt
@@ -0,0 +1 @@
+|jit-test| skip-if: true \ No newline at end of file
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/harness.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/harness.js
new file mode 100644
index 0000000000..ba615e05dd
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/harness.js
@@ -0,0 +1,360 @@
+"use strict";
+
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+if (!wasmIsSupported()) {
+ quit();
+}
+
+function bytes(type, bytes) {
+ var typedBuffer = new Uint8Array(bytes);
+ return wasmGlobalFromArrayBuffer(type, typedBuffer.buffer);
+}
+function value(type, value) {
+ return new WebAssembly.Global({
+ value: type,
+ mutable: false,
+ }, value);
+}
+
+function i8x16(elements) {
+ let typedBuffer = new Uint8Array(elements);
+ return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
+}
+function i16x8(elements) {
+ let typedBuffer = new Uint16Array(elements);
+ return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
+}
+function i32x4(elements) {
+ let typedBuffer = new Uint32Array(elements);
+ return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
+}
+function i64x2(elements) {
+ let typedBuffer = new BigUint64Array(elements);
+ return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
+}
+function f32x4(elements) {
+ let typedBuffer = new Float32Array(elements);
+ return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
+}
+function f64x2(elements) {
+ let typedBuffer = new Float64Array(elements);
+ return wasmGlobalFromArrayBuffer("v128", typedBuffer.buffer);
+}
+
+function either(...arr) {
+ return new EitherVariants(arr);
+}
+
+class F32x4Pattern {
+ constructor(x, y, z, w) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ this.w = w;
+ }
+}
+
+class F64x2Pattern {
+ constructor(x, y) {
+ this.x = x;
+ this.y = y;
+ }
+}
+
+let externrefs = {};
+let externsym = Symbol("externref");
+function externref(s) {
+ if (!(s in externrefs)) externrefs[s] = { [externsym]: s };
+ return externrefs[s];
+}
+function is_externref(x) {
+ return (x !== null && externsym in x) ? 1 : 0;
+}
+function is_funcref(x) {
+ return typeof x === "function" ? 1 : 0;
+}
+function eq_externref(x, y) {
+ return x === y ? 1 : 0;
+}
+function eq_funcref(x, y) {
+ return x === y ? 1 : 0;
+}
+
+let spectest = {
+ externref: externref,
+ is_externref: is_externref,
+ is_funcref: is_funcref,
+ eq_externref: eq_externref,
+ eq_funcref: eq_funcref,
+ print: console.log.bind(console),
+ print_i32: console.log.bind(console),
+ print_i32_f32: console.log.bind(console),
+ print_f64_f64: console.log.bind(console),
+ print_f32: console.log.bind(console),
+ print_f64: console.log.bind(console),
+ global_i32: 666,
+ global_i64: 666n,
+ global_f32: 666,
+ global_f64: 666,
+ table: new WebAssembly.Table({
+ initial: 10,
+ maximum: 20,
+ element: "anyfunc",
+ }),
+ memory: new WebAssembly.Memory({ initial: 1, maximum: 2 }),
+};
+
+let linkage = {
+ spectest,
+};
+
+function getInstance(instanceish) {
+ if (typeof instanceish === "string") {
+ assertEq(
+ instanceish in linkage,
+ true,
+ `'${instanceish}'' must be registered`,
+ );
+ return linkage[instanceish];
+ }
+ return instanceish;
+}
+
+function instantiate(source) {
+ let bytecode = wasmTextToBinary(source);
+ let module = new WebAssembly.Module(bytecode);
+ let instance = new WebAssembly.Instance(module, linkage);
+ return instance.exports;
+}
+
+function register(instanceish, name) {
+ linkage[name] = getInstance(instanceish);
+}
+
+function invoke(instanceish, field, params) {
+ let func = getInstance(instanceish)[field];
+ assertEq(func instanceof Function, true, "expected a function");
+ return wasmLosslessInvoke(func, ...params);
+}
+
+function get(instanceish, field) {
+ let global = getInstance(instanceish)[field];
+ assertEq(
+ global instanceof WebAssembly.Global,
+ true,
+ "expected a WebAssembly.Global",
+ );
+ return global;
+}
+
+function assert_trap(thunk, message) {
+ try {
+ thunk();
+ assertEq("normal return", "trap");
+ } catch (err) {
+ assertEq(
+ err instanceof WebAssembly.RuntimeError,
+ true,
+ "expected trap",
+ );
+ }
+}
+
+let StackOverflow;
+try {
+ (function f() {
+ 1 + f();
+ })();
+} catch (e) {
+ StackOverflow = e.constructor;
+}
+function assert_exhaustion(thunk, message) {
+ try {
+ thunk();
+ assertEq("normal return", "exhaustion");
+ } catch (err) {
+ assertEq(
+ err instanceof StackOverflow,
+ true,
+ "expected exhaustion",
+ );
+ }
+}
+
+function assert_invalid(thunk, message) {
+ try {
+ thunk();
+ assertEq("valid module", "invalid module");
+ } catch (err) {
+ assertEq(
+ err instanceof WebAssembly.LinkError ||
+ err instanceof WebAssembly.CompileError,
+ true,
+ "expected an invalid module",
+ );
+ }
+}
+
+function assert_unlinkable(thunk, message) {
+ try {
+ thunk();
+ assertEq(true, false, "expected an unlinkable module");
+ } catch (err) {
+ assertEq(
+ err instanceof WebAssembly.LinkError ||
+ err instanceof WebAssembly.CompileError,
+ true,
+ "expected an unlinkable module",
+ );
+ }
+}
+
+function assert_malformed(thunk, message) {
+ try {
+ thunk();
+ assertEq("valid module", "malformed module");
+ } catch (err) {
+ assertEq(
+ err instanceof TypeError ||
+ err instanceof SyntaxError ||
+ err instanceof WebAssembly.CompileError ||
+ err instanceof WebAssembly.LinkError,
+ true,
+ `expected a malformed module`,
+ );
+ }
+}
+
+function assert_exception(thunk) {
+ let thrown = false;
+ try {
+ thunk();
+ } catch (err) {
+ thrown = true;
+ }
+ assertEq(thrown, true, "expected an exception to be thrown");
+}
+
+function assert_return(thunk, expected) {
+ let results = thunk();
+
+ if (results === undefined) {
+ results = [];
+ } else if (!Array.isArray(results)) {
+ results = [results];
+ }
+ if (!Array.isArray(expected)) {
+ expected = [expected];
+ }
+
+ if (!compareResults(results, expected)) {
+ let got = results.map((x) => formatResult(x)).join(", ");
+ let wanted = expected.map((x) => formatExpected(x)).join(", ");
+ assertEq(
+ `[${got}]`,
+ `[${wanted}]`,
+ );
+ assertEq(true, false, `${got} !== ${wanted}`);
+ }
+}
+
+function formatResult(result) {
+ if (typeof (result) === "object") {
+ return wasmGlobalToString(result);
+ } else {
+ return `${result}`;
+ }
+}
+
+function formatExpected(expected) {
+ if (
+ expected === `f32_canonical_nan` ||
+ expected === `f32_arithmetic_nan` ||
+ expected === `f64_canonical_nan` ||
+ expected === `f64_arithmetic_nan`
+ ) {
+ return expected;
+ } else if (expected instanceof F32x4Pattern) {
+ return `f32x4(${formatExpected(expected.x)}, ${
+ formatExpected(expected.y)
+ }, ${formatExpected(expected.z)}, ${formatExpected(expected.w)})`;
+ } else if (expected instanceof F64x2Pattern) {
+ return `f64x2(${formatExpected(expected.x)}, ${
+ formatExpected(expected.y)
+ })`;
+ } else if (expected instanceof EitherVariants) {
+ return expected.formatExpected();
+ } else if (typeof (expected) === "object") {
+ return wasmGlobalToString(expected);
+ } else {
+ throw new Error("unknown expected result");
+ }
+}
+
+class EitherVariants {
+ constructor(arr) {
+ this.arr = arr;
+ }
+ matches(v) {
+ return this.arr.some((e) => compareResult(v, e));
+ }
+ formatExpected() {
+ return `either(${this.arr.map(formatExpected).join(", ")})`;
+ }
+}
+
+function compareResults(results, expected) {
+ if (results.length !== expected.length) {
+ return false;
+ }
+ for (let i in results) {
+ if (expected[i] instanceof EitherVariants) {
+ return expected[i].matches(results[i]);
+ }
+ if (!compareResult(results[i], expected[i])) {
+ return false;
+ }
+ }
+ return true;
+}
+
+function compareResult(result, expected) {
+ if (
+ expected === `canonical_nan` ||
+ expected === `arithmetic_nan`
+ ) {
+ return wasmGlobalIsNaN(result, expected);
+ } else if (expected instanceof F32x4Pattern) {
+ return compareResult(
+ wasmGlobalExtractLane(result, "f32x4", 0),
+ expected.x,
+ ) &&
+ compareResult(wasmGlobalExtractLane(result, "f32x4", 1), expected.y) &&
+ compareResult(wasmGlobalExtractLane(result, "f32x4", 2), expected.z) &&
+ compareResult(wasmGlobalExtractLane(result, "f32x4", 3), expected.w);
+ } else if (expected instanceof F64x2Pattern) {
+ return compareResult(
+ wasmGlobalExtractLane(result, "f64x2", 0),
+ expected.x,
+ ) &&
+ compareResult(wasmGlobalExtractLane(result, "f64x2", 1), expected.y);
+ } else if (typeof (expected) === "object") {
+ return wasmGlobalsEqual(result, expected);
+ } else {
+ throw new Error("unknown expected result");
+ }
+}
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/i16x8_relaxed_q15mulr_s.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i16x8_relaxed_q15mulr_s.wast.js
new file mode 100644
index 0000000000..4bfd1d3308
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i16x8_relaxed_q15mulr_s.wast.js
@@ -0,0 +1,49 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/i16x8_relaxed_q15mulr_s.wast
+
+// ./test/core/relaxed-simd/i16x8_relaxed_q15mulr_s.wast:2
+let $0 = instantiate(`(module
+ (func (export "i16x8.relaxed_q15mulr_s") (param v128 v128) (result v128) (i16x8.relaxed_q15mulr_s (local.get 0) (local.get 1)))
+
+ (func (export "i16x8.relaxed_q15mulr_s_cmp") (param v128 v128) (result v128)
+ (i16x8.eq
+ (i16x8.relaxed_q15mulr_s (local.get 0) (local.get 1))
+ (i16x8.relaxed_q15mulr_s (local.get 0) (local.get 1))))
+)`);
+
+// ./test/core/relaxed-simd/i16x8_relaxed_q15mulr_s.wast:12
+assert_return(
+ () => invoke($0, `i16x8.relaxed_q15mulr_s`, [
+ i16x8([0x8000, 0x8001, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i16x8([0x8000, 0x8000, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [
+ either(
+ i16x8([0x8000, 0x7fff, 0x7ffe, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i16x8([0x7fff, 0x7fff, 0x7ffe, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i16x8_relaxed_q15mulr_s.wast:21
+assert_return(
+ () => invoke($0, `i16x8.relaxed_q15mulr_s_cmp`, [
+ i16x8([0x8000, 0x8001, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i16x8([0x8000, 0x8000, 0x7fff, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [i16x8([0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff])],
+);
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js
new file mode 100644
index 0000000000..96ff3bce44
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i32x4_relaxed_trunc.wast.js
@@ -0,0 +1,338 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:3
+let $0 = instantiate(`(module
+ (func (export "i32x4.relaxed_trunc_f32x4_s") (param v128) (result v128) (i32x4.relaxed_trunc_f32x4_s (local.get 0)))
+ (func (export "i32x4.relaxed_trunc_f32x4_u") (param v128) (result v128) (i32x4.relaxed_trunc_f32x4_u (local.get 0)))
+ (func (export "i32x4.relaxed_trunc_f64x2_s_zero") (param v128) (result v128) (i32x4.relaxed_trunc_f64x2_s_zero (local.get 0)))
+ (func (export "i32x4.relaxed_trunc_f64x2_u_zero") (param v128) (result v128) (i32x4.relaxed_trunc_f64x2_u_zero (local.get 0)))
+
+ (func (export "i32x4.relaxed_trunc_f32x4_s_cmp") (param v128) (result v128)
+ (i32x4.eq
+ (i32x4.relaxed_trunc_f32x4_s (local.get 0))
+ (i32x4.relaxed_trunc_f32x4_s (local.get 0))))
+ (func (export "i32x4.relaxed_trunc_f32x4_u_cmp") (param v128) (result v128)
+ (i32x4.eq
+ (i32x4.relaxed_trunc_f32x4_u (local.get 0))
+ (i32x4.relaxed_trunc_f32x4_u (local.get 0))))
+ (func (export "i32x4.relaxed_trunc_f64x2_s_zero_cmp") (param v128) (result v128)
+ (i32x4.eq
+ (i32x4.relaxed_trunc_f64x2_s_zero (local.get 0))
+ (i32x4.relaxed_trunc_f64x2_s_zero (local.get 0))))
+ (func (export "i32x4.relaxed_trunc_f64x2_u_zero_cmp") (param v128) (result v128)
+ (i32x4.eq
+ (i32x4.relaxed_trunc_f64x2_u_zero (local.get 0))
+ (i32x4.relaxed_trunc_f64x2_u_zero (local.get 0))))
+)`);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:35
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_s`, [
+ f32x4([-2147483600, -2147484000, 2, 2147484000]),
+ ]),
+ [
+ either(
+ i32x4([0x80000000, 0x80000000, 0x2, 0x7fffffff]),
+ i32x4([0x80000000, 0x80000000, 0x2, 0x80000000]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:42
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_s`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0x7f,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0xff,
+ ]),
+ ]),
+ [
+ either(
+ i32x4([0x0, 0x0, 0x0, 0x0]),
+ i32x4([0x80000000, 0x80000000, 0x80000000, 0x80000000]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:48
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_u`, [
+ f32x4([0, -1, 4294967000, 4294967300]),
+ ]),
+ [
+ either(
+ i32x4([0x0, 0x0, 0xffffff00, 0xffffffff]),
+ i32x4([0x0, 0xffffffff, 0xffffff00, 0xffffffff]),
+ i32x4([0x0, 0xffffffff, 0xffffff00, 0x0]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:55
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_u`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0x7f,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0xff,
+ ]),
+ ]),
+ [
+ either(
+ i32x4([0x0, 0x0, 0x0, 0x0]),
+ i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff]),
+ i32x4([0x80000000, 0x80000000, 0x80000000, 0x80000000]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:61
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_s_zero`, [
+ f64x2([-2147483904, 2147483904]),
+ ]),
+ [
+ either(
+ i32x4([0x80000000, 0x7fffffff, 0x0, 0x0]),
+ i32x4([0x80000000, 0x80000000, 0x0, 0x0]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:67
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_s_zero`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ ]),
+ ]),
+ [
+ either(i32x4([0x0, 0x0, 0x0, 0x0]), i32x4([0x80000000, 0x80000000, 0x0, 0x0])),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:72
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_u_zero`, [f64x2([-1, 4294967296])]),
+ [
+ either(
+ i32x4([0x0, 0xffffffff, 0x0, 0x0]),
+ i32x4([0xffffffff, 0xffffffff, 0x0, 0x0]),
+ i32x4([0xfffffffe, 0x0, 0x0, 0x0]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:78
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_u_zero`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ ]),
+ ]),
+ [
+ either(i32x4([0x0, 0x0, 0x0, 0x0]), i32x4([0x0, 0x0, 0xffffffff, 0xffffffff])),
+ ],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:85
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_s_cmp`, [
+ f32x4([-2147483600, -2147484000, 2147483600, 2147484000]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:91
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_s_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0x7f,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0xff,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:96
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_u_cmp`, [
+ f32x4([0, -1, 4294967000, 4294967300]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:102
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f32x4_u_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0x7f,
+ 0x44,
+ 0x44,
+ 0xc4,
+ 0xff,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:107
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_s_zero_cmp`, [
+ f64x2([-2147483904, 2147483904]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:112
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_s_zero_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:116
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_u_zero_cmp`, [f64x2([-1, 4294967296])]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/i32x4_relaxed_trunc.wast:121
+assert_return(
+ () => invoke($0, `i32x4.relaxed_trunc_f64x2_u_zero_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/i8x16_relaxed_swizzle.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i8x16_relaxed_swizzle.wast.js
new file mode 100644
index 0000000000..dd77c2b074
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/i8x16_relaxed_swizzle.wast.js
@@ -0,0 +1,90 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast:3
+let $0 = instantiate(`(module
+ (func (export "i8x16.relaxed_swizzle") (param v128 v128) (result v128) (i8x16.relaxed_swizzle (local.get 0) (local.get 1)))
+
+ (func (export "i8x16.relaxed_swizzle_cmp") (param v128 v128) (result v128)
+ (i8x16.eq
+ (i8x16.relaxed_swizzle (local.get 0) (local.get 1))
+ (i8x16.relaxed_swizzle (local.get 0) (local.get 1))))
+)`);
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast:12
+assert_return(
+ () => invoke($0, `i8x16.relaxed_swizzle`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ ]),
+ [
+ either(
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast:19
+assert_return(
+ () => invoke($0, `i8x16.relaxed_swizzle`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
+ ]),
+ [
+ either(
+ i8x16([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast:26
+assert_return(
+ () => invoke($0, `i8x16.relaxed_swizzle`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]),
+ ]),
+ [
+ either(
+ i8x16([0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast:35
+assert_return(
+ () => invoke($0, `i8x16.relaxed_swizzle_cmp`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
+ ]),
+ [
+ i8x16([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]),
+ ],
+);
+
+// ./test/core/relaxed-simd/i8x16_relaxed_swizzle.wast:41
+assert_return(
+ () => invoke($0, `i8x16.relaxed_swizzle_cmp`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]),
+ ]),
+ [
+ i8x16([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]),
+ ],
+);
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_dot_product.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_dot_product.wast.js
new file mode 100644
index 0000000000..1c10428515
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_dot_product.wast.js
@@ -0,0 +1,139 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:3
+let $0 = instantiate(`(module
+ (func (export "i16x8.relaxed_dot_i8x16_i7x16_s") (param v128 v128) (result v128) (i16x8.relaxed_dot_i8x16_i7x16_s (local.get 0) (local.get 1)))
+ (func (export "i32x4.relaxed_dot_i8x16_i7x16_add_s") (param v128 v128 v128) (result v128) (i32x4.relaxed_dot_i8x16_i7x16_add_s (local.get 0) (local.get 1) (local.get 2)))
+
+ (func (export "i16x8.relaxed_dot_i8x16_i7x16_s_cmp") (param v128 v128) (result v128)
+ (i16x8.eq
+ (i16x8.relaxed_dot_i8x16_i7x16_s (local.get 0) (local.get 1))
+ (i16x8.relaxed_dot_i8x16_i7x16_s (local.get 0) (local.get 1))))
+ (func (export "i32x4.relaxed_dot_i8x16_i7x16_add_s_cmp") (param v128 v128 v128) (result v128)
+ (i16x8.eq
+ (i32x4.relaxed_dot_i8x16_i7x16_add_s (local.get 0) (local.get 1) (local.get 2))
+ (i32x4.relaxed_dot_i8x16_i7x16_add_s (local.get 0) (local.get 1) (local.get 2))))
+)`);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:18
+assert_return(
+ () => invoke($0, `i16x8.relaxed_dot_i8x16_i7x16_s`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ ]),
+ [i16x8([0x1, 0xd, 0x29, 0x55, 0x91, 0xdd, 0x139, 0x1a5])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:24
+assert_return(
+ () => invoke($0, `i16x8.relaxed_dot_i8x16_i7x16_s`, [
+ i8x16([0x80, 0x80, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x7f, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [i16x8([0x8100, 0x7e02, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:32
+assert_return(
+ () => invoke($0, `i16x8.relaxed_dot_i8x16_i7x16_s`, [
+ i8x16([0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x81, 0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [
+ either(
+ i16x8([0x8000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i16x8([0x7f00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i16x8([0x8100, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:41
+assert_return(
+ () => invoke($0, `i32x4.relaxed_dot_i8x16_i7x16_add_s`, [
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i32x4([0x0, 0x1, 0x2, 0x3]),
+ ]),
+ [i32x4([0xe, 0x7f, 0x170, 0x2e1])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:49
+assert_return(
+ () => invoke($0, `i32x4.relaxed_dot_i8x16_i7x16_add_s`, [
+ i8x16([0x80, 0x80, 0x80, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i32x4([0x1, 0x2, 0x3, 0x4]),
+ ]),
+ [i32x4([0xffff0201, 0xfc06, 0x3, 0x4])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:62
+assert_return(
+ () => invoke($0, `i32x4.relaxed_dot_i8x16_i7x16_add_s`, [
+ i8x16([0x80, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x81, 0x81, 0x81, 0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i32x4([0x1, 0x2, 0x3, 0x4]),
+ ]),
+ [
+ either(
+ i32x4([0xfffefe01, 0x2, 0x3, 0x4]),
+ i32x4([0xffff0001, 0x2, 0x3, 0x4]),
+ i32x4([0xfe01, 0x2, 0x3, 0x4]),
+ i32x4([0x10201, 0x2, 0x3, 0x4]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:75
+assert_return(
+ () => invoke($0, `i16x8.relaxed_dot_i8x16_i7x16_s_cmp`, [
+ i8x16([0x80, 0x80, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x7f, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [i16x8([0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:81
+assert_return(
+ () => invoke($0, `i32x4.relaxed_dot_i8x16_i7x16_add_s_cmp`, [
+ i8x16([0x80, 0x80, 0x80, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i32x4([0x1, 0x2, 0x3, 0x4]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:91
+assert_return(
+ () => invoke($0, `i16x8.relaxed_dot_i8x16_i7x16_s_cmp`, [
+ i8x16([0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x81, 0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [i16x8([0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_dot_product.wast:102
+assert_return(
+ () => invoke($0, `i32x4.relaxed_dot_i8x16_i7x16_add_s_cmp`, [
+ i8x16([0x80, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i8x16([0x81, 0x81, 0x81, 0x81, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ i32x4([0x1, 0x2, 0x3, 0x4]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_laneselect.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_laneselect.wast.js
new file mode 100644
index 0000000000..2fa9b5fbae
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_laneselect.wast.js
@@ -0,0 +1,163 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:3
+let $0 = instantiate(`(module
+ (func (export "i8x16.relaxed_laneselect") (param v128 v128 v128) (result v128) (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
+ (func (export "i16x8.relaxed_laneselect") (param v128 v128 v128) (result v128) (i16x8.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
+ (func (export "i32x4.relaxed_laneselect") (param v128 v128 v128) (result v128) (i32x4.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
+ (func (export "i64x2.relaxed_laneselect") (param v128 v128 v128) (result v128) (i64x2.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2)))
+
+ (func (export "i8x16.relaxed_laneselect_cmp") (param v128 v128 v128) (result v128)
+ (i8x16.eq
+ (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))
+ (i8x16.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))))
+ (func (export "i16x8.relaxed_laneselect_cmp") (param v128 v128 v128) (result v128)
+ (i16x8.eq
+ (i16x8.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))
+ (i16x8.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))))
+ (func (export "i32x4.relaxed_laneselect_cmp") (param v128 v128 v128) (result v128)
+ (i32x4.eq
+ (i32x4.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))
+ (i32x4.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))))
+ (func (export "i64x2.relaxed_laneselect_cmp") (param v128 v128 v128) (result v128)
+ (i64x2.eq
+ (i64x2.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))
+ (i64x2.relaxed_laneselect (local.get 0) (local.get 1) (local.get 2))))
+)`);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:27
+assert_return(
+ () => invoke($0, `i8x16.relaxed_laneselect`, [
+ i8x16([0x0, 0x1, 0x12, 0x12, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x10, 0x11, 0x34, 0x34, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
+ i8x16([0xff, 0x0, 0xf0, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [
+ either(
+ i8x16([0x0, 0x11, 0x14, 0x32, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
+ i8x16([0x0, 0x11, 0x12, 0x34, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:34
+assert_return(
+ () => invoke($0, `i16x8.relaxed_laneselect`, [
+ i16x8([0x0, 0x1, 0x1234, 0x1234, 0x4, 0x5, 0x6, 0x7]),
+ i16x8([0x8, 0x9, 0x5678, 0x5678, 0xc, 0xd, 0xe, 0xf]),
+ i16x8([0xffff, 0x0, 0xff00, 0xff, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [
+ either(
+ i16x8([0x0, 0x9, 0x1278, 0x5634, 0xc, 0xd, 0xe, 0xf]),
+ i16x8([0x0, 0x9, 0x1234, 0x5678, 0xc, 0xd, 0xe, 0xf]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:41
+assert_return(
+ () => invoke($0, `i32x4.relaxed_laneselect`, [
+ i32x4([0x0, 0x1, 0x12341234, 0x12341234]),
+ i32x4([0x4, 0x5, 0x56785678, 0x56785678]),
+ i32x4([0xffffffff, 0x0, 0xffff0000, 0xffff]),
+ ]),
+ [
+ either(
+ i32x4([0x0, 0x5, 0x12345678, 0x56781234]),
+ i32x4([0x0, 0x5, 0x12341234, 0x56785678]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:48
+assert_return(
+ () => invoke($0, `i64x2.relaxed_laneselect`, [
+ i64x2([0x0n, 0x1n]),
+ i64x2([0x2n, 0x3n]),
+ i64x2([0xffffffffffffffffn, 0x0n]),
+ ]),
+ [either(i64x2([0x0n, 0x3n]), i64x2([0x0n, 0x3n]))],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:55
+assert_return(
+ () => invoke($0, `i64x2.relaxed_laneselect`, [
+ i64x2([0x1234123412341234n, 0x1234123412341234n]),
+ i64x2([0x5678567856785678n, 0x5678567856785678n]),
+ i64x2([0xffffffff00000000n, 0xffffffffn]),
+ ]),
+ [
+ either(
+ i64x2([0x1234123456785678n, 0x5678567812341234n]),
+ i64x2([0x1234123412341234n, 0x5678567856785678n]),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:64
+assert_return(
+ () => invoke($0, `i8x16.relaxed_laneselect_cmp`, [
+ i8x16([0x0, 0x1, 0x12, 0x12, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf]),
+ i8x16([0x10, 0x11, 0x34, 0x34, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]),
+ i8x16([0xff, 0x0, 0xf0, 0xf, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [
+ i8x16([0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:70
+assert_return(
+ () => invoke($0, `i16x8.relaxed_laneselect_cmp`, [
+ i16x8([0x0, 0x1, 0x1234, 0x1234, 0x4, 0x5, 0x6, 0x7]),
+ i16x8([0x8, 0x9, 0x5678, 0x5678, 0xc, 0xd, 0xe, 0xf]),
+ i16x8([0xffff, 0x0, 0xff00, 0xff, 0x0, 0x0, 0x0, 0x0]),
+ ]),
+ [i16x8([0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:76
+assert_return(
+ () => invoke($0, `i32x4.relaxed_laneselect_cmp`, [
+ i32x4([0x0, 0x1, 0x12341234, 0x12341234]),
+ i32x4([0x4, 0x5, 0x56785678, 0x56785678]),
+ i32x4([0xffffffff, 0x0, 0xffff0000, 0xffff]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:82
+assert_return(
+ () => invoke($0, `i64x2.relaxed_laneselect_cmp`, [
+ i64x2([0x0n, 0x1n]),
+ i64x2([0x2n, 0x3n]),
+ i64x2([0xffffffffffffffffn, 0x0n]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_laneselect.wast:88
+assert_return(
+ () => invoke($0, `i64x2.relaxed_laneselect_cmp`, [
+ i64x2([0x1234123412341234n, 0x1234123412341234n]),
+ i64x2([0x5678567856785678n, 0x5678567856785678n]),
+ i64x2([0xffffffff00000000n, 0xffffffffn]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_madd_nmadd.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_madd_nmadd.wast.js
new file mode 100644
index 0000000000..8e00698d52
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_madd_nmadd.wast.js
@@ -0,0 +1,325 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:3
+let $0 = instantiate(`(module
+ (func (export "f32x4.relaxed_madd") (param v128 v128 v128) (result v128) (f32x4.relaxed_madd (local.get 0) (local.get 1) (local.get 2)))
+ (func (export "f32x4.relaxed_nmadd") (param v128 v128 v128) (result v128) (f32x4.relaxed_nmadd (local.get 0) (local.get 1) (local.get 2)))
+ (func (export "f64x2.relaxed_nmadd") (param v128 v128 v128) (result v128) (f64x2.relaxed_nmadd (local.get 0) (local.get 1) (local.get 2)))
+ (func (export "f64x2.relaxed_madd") (param v128 v128 v128) (result v128) (f64x2.relaxed_madd (local.get 0) (local.get 1) (local.get 2)))
+
+ (func (export "f32x4.relaxed_madd_cmp") (param v128 v128 v128) (result v128)
+ (f32x4.eq
+ (f32x4.relaxed_madd (local.get 0) (local.get 1) (local.get 2))
+ (f32x4.relaxed_madd (local.get 0) (local.get 1) (local.get 2))))
+ (func (export "f32x4.relaxed_nmadd_cmp") (param v128 v128 v128) (result v128)
+ (f32x4.eq
+ (f32x4.relaxed_nmadd (local.get 0) (local.get 1) (local.get 2))
+ (f32x4.relaxed_nmadd (local.get 0) (local.get 1) (local.get 2))))
+ (func (export "f64x2.relaxed_nmadd_cmp") (param v128 v128 v128) (result v128)
+ (f64x2.eq
+ (f64x2.relaxed_nmadd (local.get 0) (local.get 1) (local.get 2))
+ (f64x2.relaxed_nmadd (local.get 0) (local.get 1) (local.get 2))))
+ (func (export "f64x2.relaxed_madd_cmp") (param v128 v128 v128) (result v128)
+ (f64x2.eq
+ (f64x2.relaxed_madd (local.get 0) (local.get 1) (local.get 2))
+ (f64x2.relaxed_madd (local.get 0) (local.get 1) (local.get 2))))
+)`);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:33
+assert_return(
+ () => invoke($0, `f32x4.relaxed_madd`, [
+ f32x4([
+ 340282350000000000000000000000000000000,
+ 340282350000000000000000000000000000000,
+ 340282350000000000000000000000000000000,
+ 340282350000000000000000000000000000000,
+ ]),
+ f32x4([2, 2, 2, 2]),
+ f32x4([
+ -340282350000000000000000000000000000000,
+ -340282350000000000000000000000000000000,
+ -340282350000000000000000000000000000000,
+ -340282350000000000000000000000000000000,
+ ]),
+ ]),
+ [
+ either(
+ new F32x4Pattern(
+ value("f32", 340282350000000000000000000000000000000),
+ value("f32", 340282350000000000000000000000000000000),
+ value("f32", 340282350000000000000000000000000000000),
+ value("f32", 340282350000000000000000000000000000000),
+ ),
+ new F32x4Pattern(
+ value("f32", Infinity),
+ value("f32", Infinity),
+ value("f32", Infinity),
+ value("f32", Infinity),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:49
+assert_return(
+ () => invoke($0, `f32x4.relaxed_madd`, [
+ f32x4([1.0000002, 1.0000002, 1.0000002, 1.0000002]),
+ f32x4([1.0000305, 1.0000305, 1.0000305, 1.0000305]),
+ f32x4([-1.0000308, -1.0000308, -1.0000308, -1.0000308]),
+ ]),
+ [
+ either(
+ new F32x4Pattern(
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:56
+assert_return(
+ () => invoke($0, `f32x4.relaxed_nmadd`, [
+ f32x4([-1.0000002, -1.0000002, -1.0000002, -1.0000002]),
+ f32x4([1.0000305, 1.0000305, 1.0000305, 1.0000305]),
+ f32x4([-1.0000308, -1.0000308, -1.0000308, -1.0000308]),
+ ]),
+ [
+ either(
+ new F32x4Pattern(
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:63
+assert_return(
+ () => invoke($0, `f32x4.relaxed_nmadd`, [
+ f32x4([1.0000002, 1.0000002, 1.0000002, 1.0000002]),
+ f32x4([-1.0000305, -1.0000305, -1.0000305, -1.0000305]),
+ f32x4([-1.0000308, -1.0000308, -1.0000308, -1.0000308]),
+ ]),
+ [
+ either(
+ new F32x4Pattern(
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ value("f32", 0.000000000007275958),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:76
+assert_return(
+ () => invoke($0, `f64x2.relaxed_madd`, [
+ f64x2([
+ 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ ]),
+ f64x2([2, 2]),
+ f64x2([
+ -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ ]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(
+ value("f64", 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000),
+ value("f64", 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000),
+ ),
+ new F64x2Pattern(value("f64", Infinity), value("f64", Infinity)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:92
+assert_return(
+ () => invoke($0, `f64x2.relaxed_madd`, [
+ f64x2([1.0000000009313226, 1.0000000009313226]),
+ f64x2([1.0000001192092896, 1.0000001192092896]),
+ f64x2([-1.0000001201406121, -1.0000001201406121]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(
+ value("f64", 0.00000000000000011102230246251565),
+ value("f64", 0.00000000000000011102230246251565),
+ ),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:99
+assert_return(
+ () => invoke($0, `f64x2.relaxed_nmadd`, [
+ f64x2([-1.0000000009313226, -1.0000000009313226]),
+ f64x2([1.0000001192092896, 1.0000001192092896]),
+ f64x2([-1.0000001201406121, -1.0000001201406121]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(
+ value("f64", 0.00000000000000011102230246251565),
+ value("f64", 0.00000000000000011102230246251565),
+ ),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:106
+assert_return(
+ () => invoke($0, `f64x2.relaxed_nmadd`, [
+ f64x2([1.0000000009313226, 1.0000000009313226]),
+ f64x2([-1.0000001192092896, -1.0000001192092896]),
+ f64x2([-1.0000001201406121, -1.0000001201406121]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(
+ value("f64", 0.00000000000000011102230246251565),
+ value("f64", 0.00000000000000011102230246251565),
+ ),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:120
+assert_return(
+ () => invoke($0, `f32x4.relaxed_madd_cmp`, [
+ f32x4([
+ 340282350000000000000000000000000000000,
+ 340282350000000000000000000000000000000,
+ 340282350000000000000000000000000000000,
+ 340282350000000000000000000000000000000,
+ ]),
+ f32x4([2, 2, 2, 2]),
+ f32x4([
+ -340282350000000000000000000000000000000,
+ -340282350000000000000000000000000000000,
+ -340282350000000000000000000000000000000,
+ -340282350000000000000000000000000000000,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:135
+assert_return(
+ () => invoke($0, `f32x4.relaxed_madd_cmp`, [
+ f32x4([1.0000002, 1.0000002, 1.0000002, 1.0000002]),
+ f32x4([1.0000305, 1.0000305, 1.0000305, 1.0000305]),
+ f32x4([-1.0000308, -1.0000308, -1.0000308, -1.0000308]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:141
+assert_return(
+ () => invoke($0, `f32x4.relaxed_nmadd_cmp`, [
+ f32x4([-1.0000002, -1.0000002, -1.0000002, -1.0000002]),
+ f32x4([1.0000305, 1.0000305, 1.0000305, 1.0000305]),
+ f32x4([-1.0000308, -1.0000308, -1.0000308, -1.0000308]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:147
+assert_return(
+ () => invoke($0, `f32x4.relaxed_nmadd_cmp`, [
+ f32x4([1.0000002, 1.0000002, 1.0000002, 1.0000002]),
+ f32x4([-1.0000305, -1.0000305, -1.0000305, -1.0000305]),
+ f32x4([-1.0000308, -1.0000308, -1.0000308, -1.0000308]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:159
+assert_return(
+ () => invoke($0, `f64x2.relaxed_madd_cmp`, [
+ f64x2([
+ 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ ]),
+ f64x2([2, 2]),
+ f64x2([
+ -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
+ ]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:174
+assert_return(
+ () => invoke($0, `f64x2.relaxed_madd_cmp`, [
+ f64x2([1.0000000009313226, 1.0000000009313226]),
+ f64x2([1.0000001192092896, 1.0000001192092896]),
+ f64x2([-1.0000001201406121, -1.0000001201406121]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:180
+assert_return(
+ () => invoke($0, `f64x2.relaxed_nmadd_cmp`, [
+ f64x2([-1.0000000009313226, -1.0000000009313226]),
+ f64x2([1.0000001192092896, 1.0000001192092896]),
+ f64x2([-1.0000001201406121, -1.0000001201406121]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_madd_nmadd.wast:186
+assert_return(
+ () => invoke($0, `f64x2.relaxed_nmadd_cmp`, [
+ f64x2([1.0000000009313226, 1.0000000009313226]),
+ f64x2([-1.0000001192092896, -1.0000001192092896]),
+ f64x2([-1.0000001201406121, -1.0000001201406121]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
diff --git a/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_min_max.wast.js b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_min_max.wast.js
new file mode 100644
index 0000000000..ea1e75862a
--- /dev/null
+++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_min_max.wast.js
@@ -0,0 +1,663 @@
+/* Copyright 2021 Mozilla Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:3
+let $0 = instantiate(`(module
+ (func (export "f32x4.relaxed_min") (param v128 v128) (result v128) (f32x4.relaxed_min (local.get 0) (local.get 1)))
+ (func (export "f32x4.relaxed_max") (param v128 v128) (result v128) (f32x4.relaxed_max (local.get 0) (local.get 1)))
+ (func (export "f64x2.relaxed_min") (param v128 v128) (result v128) (f64x2.relaxed_min (local.get 0) (local.get 1)))
+ (func (export "f64x2.relaxed_max") (param v128 v128) (result v128) (f64x2.relaxed_max (local.get 0) (local.get 1)))
+
+ (func (export "f32x4.relaxed_min_cmp") (param v128 v128) (result v128)
+ (i32x4.eq
+ (f32x4.relaxed_min (local.get 0) (local.get 1))
+ (f32x4.relaxed_min (local.get 0) (local.get 1))))
+ (func (export "f32x4.relaxed_max_cmp") (param v128 v128) (result v128)
+ (i32x4.eq
+ (f32x4.relaxed_max (local.get 0) (local.get 1))
+ (f32x4.relaxed_max (local.get 0) (local.get 1))))
+ (func (export "f64x2.relaxed_min_cmp") (param v128 v128) (result v128)
+ (i64x2.eq
+ (f64x2.relaxed_min (local.get 0) (local.get 1))
+ (f64x2.relaxed_min (local.get 0) (local.get 1))))
+ (func (export "f64x2.relaxed_max_cmp") (param v128 v128) (result v128)
+ (i64x2.eq
+ (f64x2.relaxed_max (local.get 0) (local.get 1))
+ (f64x2.relaxed_max (local.get 0) (local.get 1))))
+)`);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:27
+assert_return(
+ () => invoke($0, `f32x4.relaxed_min`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ ]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ ]),
+ ]),
+ [
+ either(
+ new F32x4Pattern(
+ `canonical_nan`,
+ `canonical_nan`,
+ `canonical_nan`,
+ `canonical_nan`,
+ ),
+ new F32x4Pattern(
+ `canonical_nan`,
+ `canonical_nan`,
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ `canonical_nan`,
+ `canonical_nan`,
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:35
+assert_return(
+ () => invoke($0, `f32x4.relaxed_min`, [f32x4([0, -0, 0, -0]), f32x4([-0, 0, 0, -0])]),
+ [
+ either(
+ new F32x4Pattern(
+ value("f32", -0),
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ new F32x4Pattern(
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ new F32x4Pattern(
+ value("f32", -0),
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:43
+assert_return(
+ () => invoke($0, `f32x4.relaxed_max`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ ]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ ]),
+ ]),
+ [
+ either(
+ new F32x4Pattern(
+ `canonical_nan`,
+ `canonical_nan`,
+ `canonical_nan`,
+ `canonical_nan`,
+ ),
+ new F32x4Pattern(
+ `canonical_nan`,
+ `canonical_nan`,
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ `canonical_nan`,
+ `canonical_nan`,
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:51
+assert_return(
+ () => invoke($0, `f32x4.relaxed_max`, [f32x4([0, -0, 0, -0]), f32x4([-0, 0, 0, -0])]),
+ [
+ either(
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ new F32x4Pattern(
+ value("f32", 0),
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ new F32x4Pattern(
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ new F32x4Pattern(
+ value("f32", -0),
+ value("f32", -0),
+ value("f32", 0),
+ value("f32", -0),
+ ),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:59
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ f64x2([0, 0]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:67
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min`, [
+ f64x2([0, 0]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:75
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min`, [f64x2([0, -0]), f64x2([-0, 0])]),
+ [
+ either(
+ new F64x2Pattern(value("f64", -0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", -0), value("f64", 0)),
+ new F64x2Pattern(value("f64", -0), value("f64", -0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:83
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min`, [f64x2([0, -0]), f64x2([0, -0])]),
+ [
+ either(
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:91
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ f64x2([0, 0]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:99
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max`, [
+ f64x2([0, 0]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ ]),
+ [
+ either(
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ new F64x2Pattern(`canonical_nan`, `canonical_nan`),
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:107
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max`, [f64x2([0, -0]), f64x2([-0, 0])]),
+ [
+ either(
+ new F64x2Pattern(value("f64", 0), value("f64", 0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", -0), value("f64", 0)),
+ new F64x2Pattern(value("f64", -0), value("f64", -0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:115
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max`, [f64x2([0, -0]), f64x2([0, -0])]),
+ [
+ either(
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ new F64x2Pattern(value("f64", 0), value("f64", -0)),
+ ),
+ ],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:125
+assert_return(
+ () => invoke($0, `f32x4.relaxed_min_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ ]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:130
+assert_return(
+ () => invoke($0, `f32x4.relaxed_min_cmp`, [
+ f32x4([0, -0, 0, -0]),
+ f32x4([-0, 0, 0, -0]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:135
+assert_return(
+ () => invoke($0, `f32x4.relaxed_max_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ ]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0xc0,
+ 0x7f,
+ ]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:140
+assert_return(
+ () => invoke($0, `f32x4.relaxed_max_cmp`, [
+ f32x4([0, -0, 0, -0]),
+ f32x4([-0, 0, 0, -0]),
+ ]),
+ [i32x4([0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:145
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ f64x2([0, 0]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:150
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min_cmp`, [
+ f64x2([0, 0]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:155
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min_cmp`, [f64x2([0, -0]), f64x2([-0, 0])]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:160
+assert_return(
+ () => invoke($0, `f64x2.relaxed_min_cmp`, [f64x2([0, -0]), f64x2([0, -0])]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:165
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max_cmp`, [
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ f64x2([0, 0]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:170
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max_cmp`, [
+ f64x2([0, 0]),
+ bytes('v128', [
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0xff,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0x0,
+ 0xf8,
+ 0x7f,
+ ]),
+ ]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:175
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max_cmp`, [f64x2([0, -0]), f64x2([-0, 0])]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);
+
+// ./test/core/relaxed-simd/relaxed_min_max.wast:180
+assert_return(
+ () => invoke($0, `f64x2.relaxed_max_cmp`, [f64x2([0, -0]), f64x2([0, -0])]),
+ [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])],
+);