diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /js/src/jit-test/tests/wasm/spec/relaxed-simd | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/wasm/spec/relaxed-simd')
10 files changed, 2233 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..a96781e8ed --- /dev/null +++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/harness/harness.js @@ -0,0 +1,448 @@ +"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; + } +} + +class RefWithType { + constructor(type) { + this.type = type; + } + + formatExpected() { + return `RefWithType(${this.type})`; + } + + test(refGlobal) { + try { + new WebAssembly.Global({value: this.type}, refGlobal.value); + return true; + } catch (err) { + assertEq(err instanceof TypeError, true, `wrong type of error when creating global: ${err}`); + assertEq(!!err.message.match(/can only pass/), true, `wrong type of error when creating global: ${err}`); + return false; + } + } +} + +// ref.extern values created by spec tests will be JS objects of the form +// { [externsym]: <number> }. Other externref values are possible to observe +// if extern.convert_any is used. +let externsym = Symbol("externref"); +function externref(s) { + return { [externsym]: 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; +} + +class ExternRefResult { + constructor(n) { + this.n = n; + } + + formatExpected() { + return `ref.extern ${this.n}`; + } + + test(global) { + // the global's value can either be an externref or just a plain old JS number + let result = global.value; + if (typeof global.value === "object" && externsym in global.value) { + result = global.value[externsym]; + } + return result === this.n; + } +} + +// ref.host values created by spectests will be whatever the JS API does to +// convert the given value to anyref. It should implicitly be like any.convert_extern. +function hostref(v) { + if (!wasmGcEnabled()) { + throw new Error("ref.host only works when wasm GC is enabled"); + } + + const { internalizeNum } = new WebAssembly.Instance( + new WebAssembly.Module(wasmTextToBinary(`(module + (func (import "test" "coerce") (param i32) (result anyref)) + (func (export "internalizeNum") (param i32) (result anyref) + (call 0 (local.get 0)) + ) + )`)), + { "test": { "coerce": x => x } }, + ).exports; + return internalizeNum(v); +} + +class HostRefResult { + constructor(n) { + this.n = n; + } + + formatExpected() { + return `ref.host ${this.n}`; + } + + test(externrefGlobal) { + assertEq(externsym in externrefGlobal.value, true, `HostRefResult only works with externref inputs`); + return externrefGlobal.value[externsym] === this.n; + } +} + +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(); + throw new Error("expected trap"); + } catch (err) { + if (err instanceof WebAssembly.RuntimeError) { + return; + } + throw err; + } +} + +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 (expected instanceof RefWithType) { + return expected.formatExpected(); + } else if (expected instanceof ExternRefResult) { + return expected.formatExpected(); + } else if (expected instanceof HostRefResult) { + 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 === null) { + return result.value === null; + } 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 (expected instanceof RefWithType) { + return expected.test(result); + } else if (expected instanceof ExternRefResult) { + return expected.test(result); + } else if (expected instanceof HostRefResult) { + return expected.test(result); + } 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..401f55986e --- /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:4 +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:14 +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:23 +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..542955765e --- /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:4 +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:36 +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:43 +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:49 +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:56 +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:62 +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:68 +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:73 +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:79 +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:86 +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:92 +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:97 +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:103 +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:108 +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:113 +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:117 +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:122 +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..09ed934c02 --- /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:4 +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:13 +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:20 +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:27 +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:36 +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:42 +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..b3b8776e01 --- /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:4 +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:19 +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:25 +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:33 +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:42 +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:50 +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:63 +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:76 +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:82 +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:92 +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:103 +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..e86d85e08b --- /dev/null +++ b/js/src/jit-test/tests/wasm/spec/relaxed-simd/relaxed_laneselect.wast.js @@ -0,0 +1,179 @@ +/* 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:4 +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:28 +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:35 +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:43 +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, 0x80, 0x0, 0x0, 0x0, 0x0]), + ]), + [ + either( + i16x8([0x0, 0x9, 0x1278, 0x5678, 0xc, 0xd, 0xe, 0xf]), + i16x8([0x0, 0x9, 0x1234, 0x5678, 0xc, 0xd, 0xe, 0xf]), + i16x8([0x0, 0x9, 0x1278, 0x5634, 0xc, 0xd, 0xe, 0xf]), + ), + ], +); + +// ./test/core/relaxed-simd/relaxed_laneselect.wast:52 +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:59 +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:66 +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:75 +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:81 +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:87 +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:93 +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:99 +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..6b3c8f912c --- /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:4 +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:34 +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:50 +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:57 +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:64 +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:77 +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:93 +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:100 +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:107 +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:121 +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:136 +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:142 +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:148 +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:160 +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:175 +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:181 +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:187 +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..9123d605d9 --- /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:4 +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:28 +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:36 +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:44 +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:52 +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:60 +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:68 +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:76 +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:84 +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:92 +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:100 +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:108 +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:116 +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:126 +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:131 +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:136 +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:141 +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:146 +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:151 +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:156 +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:161 +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:166 +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:171 +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:176 +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:181 +assert_return( + () => invoke($0, `f64x2.relaxed_max_cmp`, [f64x2([0, -0]), f64x2([0, -0])]), + [i64x2([0xffffffffffffffffn, 0xffffffffffffffffn])], +); |