diff --git a/js/src/jit-test/tests/SIMD/ToSource.js b/js/src/jit-test/tests/SIMD/ToSource.js index dbf1213ecaa..93eff61f2ad 100644 --- a/js/src/jit-test/tests/SIMD/ToSource.js +++ b/js/src/jit-test/tests/SIMD/ToSource.js @@ -1,10 +1,10 @@ if (typeof SIMD === "undefined") quit(); -var float32x4 = SIMD.float32x4; -var f = float32x4(11, 22, 33, 44); +var Float32x4 = SIMD.Float32x4; +var f = Float32x4(11, 22, 33, 44); assertEq(f.toSource(), "float32x4(11, 22, 33, 44)"); -var int32x4 = SIMD.int32x4; -var f = int32x4(11, 22, 33, 44); +var Int32x4 = SIMD.Int32x4; +var f = Int32x4(11, 22, 33, 44); assertEq(f.toSource(), "int32x4(11, 22, 33, 44)"); diff --git a/js/src/jit-test/tests/SIMD/binary-arith.js b/js/src/jit-test/tests/SIMD/binary-arith.js index 130aaa4b011..3fe70f1b0c9 100644 --- a/js/src/jit-test/tests/SIMD/binary-arith.js +++ b/js/src/jit-test/tests/SIMD/binary-arith.js @@ -3,20 +3,20 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function f() { - var i1 = SIMD.int32x4(1, 2, 3, 4); - var i2 = SIMD.int32x4(4, 3, 2, 1); + var i1 = SIMD.Int32x4(1, 2, 3, 4); + var i2 = SIMD.Int32x4(4, 3, 2, 1); - var f1 = SIMD.float32x4(1, 2, 3, 4); - var f2 = SIMD.float32x4(4, 3, 2, 1); + var f1 = SIMD.Float32x4(1, 2, 3, 4); + var f2 = SIMD.Float32x4(4, 3, 2, 1); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.float32x4.add(f1, f2), binaryX4((x, y) => x + y, f1, f2)); - assertEqX4(SIMD.float32x4.sub(f1, f2), binaryX4((x, y) => x - y, f1, f2)); - assertEqX4(SIMD.float32x4.mul(f1, f2), binaryX4((x, y) => x * y, f1, f2)); + assertEqX4(SIMD.Float32x4.add(f1, f2), binaryX4((x, y) => x + y, f1, f2)); + assertEqX4(SIMD.Float32x4.sub(f1, f2), binaryX4((x, y) => x - y, f1, f2)); + assertEqX4(SIMD.Float32x4.mul(f1, f2), binaryX4((x, y) => x * y, f1, f2)); - assertEqX4(SIMD.int32x4.add(i1, i2), binaryX4((x, y) => x + y, i1, i2)); - assertEqX4(SIMD.int32x4.sub(i1, i2), binaryX4((x, y) => x - y, i1, i2)); - assertEqX4(SIMD.int32x4.mul(i1, i2), binaryX4((x, y) => x * y, i1, i2)); + assertEqX4(SIMD.Int32x4.add(i1, i2), binaryX4((x, y) => x + y, i1, i2)); + assertEqX4(SIMD.Int32x4.sub(i1, i2), binaryX4((x, y) => x - y, i1, i2)); + assertEqX4(SIMD.Int32x4.mul(i1, i2), binaryX4((x, y) => x * y, i1, i2)); } } diff --git a/js/src/jit-test/tests/SIMD/bool.js b/js/src/jit-test/tests/SIMD/bool.js index f5394f0e438..6a696c09409 100644 --- a/js/src/jit-test/tests/SIMD/bool.js +++ b/js/src/jit-test/tests/SIMD/bool.js @@ -6,9 +6,9 @@ const T = -1, F = 0; function f() { for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.int32x4.bool(i + 1, true, 'hey', null), [T, T, T, F]); - assertEqX4(SIMD.int32x4.bool(undefined, '', {}, objectEmulatingUndefined()), [F, F, T, F]); - assertEqX4(SIMD.int32x4.bool(null, NaN, false, Infinity), [F, F, F, T]); + assertEqX4(SIMD.Int32x4.bool(i + 1, true, 'hey', null), [T, T, T, F]); + assertEqX4(SIMD.Int32x4.bool(undefined, '', {}, objectEmulatingUndefined()), [F, F, T, F]); + assertEqX4(SIMD.Int32x4.bool(null, NaN, false, Infinity), [F, F, F, T]); } } diff --git a/js/src/jit-test/tests/SIMD/bug1109911.js b/js/src/jit-test/tests/SIMD/bug1109911.js new file mode 100644 index 00000000000..23a5c5721d8 --- /dev/null +++ b/js/src/jit-test/tests/SIMD/bug1109911.js @@ -0,0 +1,11 @@ +if (typeof TypedObject === "undefined" || typeof SIMD === 'undefined') + quit(); + +var Int32x4 = SIMD.Int32x4; +var a = Int32x4((4294967295), 200, 300, 400); +addCase( new Array(Math.pow(2,12)) ); +for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) {} +addCase( a ); +function addCase(object) { + object.length +} diff --git a/js/src/jit-test/tests/SIMD/bug1121299.js b/js/src/jit-test/tests/SIMD/bug1121299.js index b99221ecc9d..17ca46e2ec0 100644 --- a/js/src/jit-test/tests/SIMD/bug1121299.js +++ b/js/src/jit-test/tests/SIMD/bug1121299.js @@ -7,20 +7,20 @@ setJitCompilerOption("ion.warmup.trigger", 30); function test_1(i) { if (i >= 40) return; - var a = SIMD.float32x4(1.1, 2.2, 3.3, 4.6); - SIMD.int32x4.fromFloat32x4(a); + var a = SIMD.Float32x4(1.1, 2.2, 3.3, 4.6); + SIMD.Int32x4.fromFloat32x4(a); test_1(i + 1); } test_1(0); -var float32x4 = SIMD.float32x4; +var Float32x4 = SIMD.Float32x4; function test_2() { - var Array = float32x4.array(3); + var Array = Float32x4.array(3); var array = new Array([ - float32x4(1, 2, 3, 4), - float32x4(5, 6, 7, 8), - float32x4(9, 10, 11, 12) + Float32x4(1, 2, 3, 4), + Float32x4(5, 6, 7, 8), + Float32x4(9, 10, 11, 12) ]); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/jit-test/tests/SIMD/bug1123631.js b/js/src/jit-test/tests/SIMD/bug1123631.js index 38309f6b15c..28c0e0aa157 100644 --- a/js/src/jit-test/tests/SIMD/bug1123631.js +++ b/js/src/jit-test/tests/SIMD/bug1123631.js @@ -1,9 +1,9 @@ if (!this.hasOwnProperty("SIMD")) quit(); -var float64x2 = SIMD.float64x2; +var Float64x2 = SIMD.Float64x2; function test() { - var a = float64x2(1, 2); + var a = Float64x2(1, 2); } test(); test(); diff --git a/js/src/jit-test/tests/SIMD/bug1130845.js b/js/src/jit-test/tests/SIMD/bug1130845.js index 7315a74c0b5..b0223a9bc63 100644 --- a/js/src/jit-test/tests/SIMD/bug1130845.js +++ b/js/src/jit-test/tests/SIMD/bug1130845.js @@ -1,11 +1,11 @@ if (!this.hasOwnProperty("SIMD")) quit(); -var int32x4 = SIMD.int32x4; +var Int32x4 = SIMD.Int32x4; function test() { - var a = int32x4(); - var b = int32x4(10, 20, 30, 40); - var c = SIMD.int32x4.and(a, b); + var a = Int32x4(); + var b = Int32x4(10, 20, 30, 40); + var c = SIMD.Int32x4.and(a, b); assertEq(c.x, 0); return 0; } diff --git a/js/src/jit-test/tests/SIMD/bug953108.js b/js/src/jit-test/tests/SIMD/bug953108.js new file mode 100644 index 00000000000..a8ae80e1709 --- /dev/null +++ b/js/src/jit-test/tests/SIMD/bug953108.js @@ -0,0 +1,10 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +if (!this.hasOwnProperty("TypedObject") || !this.hasOwnProperty("SIMD")) + quit(); + +var Float32x4 = SIMD.Float32x4; +Float32x4.array(1); diff --git a/js/src/jit-test/tests/SIMD/check.js b/js/src/jit-test/tests/SIMD/check.js index 059efc85c43..faff1a3703f 100644 --- a/js/src/jit-test/tests/SIMD/check.js +++ b/js/src/jit-test/tests/SIMD/check.js @@ -3,17 +3,15 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function f() { - var f1 = SIMD.float32x4(1, 2, 3, 4); - - var i1 = SIMD.int32x4(1, 2, -3, 4); - + var f1 = SIMD.Float32x4(1, 2, 3, 4); + var i1 = SIMD.Int32x4(1, 2, -3, 4); var i = 0; try { for (; i < 150; i++) { if (i > 148) i1 = f1; - assertEqVec(SIMD.int32x4.check(i1), i1); - assertEqVec(SIMD.float32x4.check(f1), f1); + assertEqVec(SIMD.Int32x4.check(i1), i1); + assertEqVec(SIMD.Float32x4.check(f1), f1); } } catch (ex) { assertEq(i, 149); diff --git a/js/src/jit-test/tests/SIMD/compare.js b/js/src/jit-test/tests/SIMD/compare.js index 684da97f883..9c533fed569 100644 --- a/js/src/jit-test/tests/SIMD/compare.js +++ b/js/src/jit-test/tests/SIMD/compare.js @@ -7,26 +7,26 @@ function bool(x) { } function f() { - var f1 = SIMD.float32x4(1, 2, 3, 4); - var f2 = SIMD.float32x4(NaN, Infinity, 3.14, -0); + var f1 = SIMD.Float32x4(1, 2, 3, 4); + var f2 = SIMD.Float32x4(NaN, Infinity, 3.14, -0); - var i1 = SIMD.int32x4(1, 2, -3, 4); - var i2 = SIMD.int32x4(1, -2, 3, 0); + var i1 = SIMD.Int32x4(1, 2, -3, 4); + var i2 = SIMD.Int32x4(1, -2, 3, 0); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.int32x4.lessThan(i1, i2), [0, 0, 1, 0].map(bool)); - assertEqX4(SIMD.int32x4.lessThanOrEqual(i1, i2), [1, 0, 1, 0].map(bool)); - assertEqX4(SIMD.int32x4.equal(i1, i2), [1, 0, 0, 0].map(bool)); - assertEqX4(SIMD.int32x4.notEqual(i1, i2), [0, 1, 1, 1].map(bool)); - assertEqX4(SIMD.int32x4.greaterThan(i1, i2), [0, 1, 0, 1].map(bool)); - assertEqX4(SIMD.int32x4.greaterThanOrEqual(i1, i2), [1, 1, 0, 1].map(bool)); + assertEqX4(SIMD.Int32x4.lessThan(i1, i2), [0, 0, 1, 0].map(bool)); + assertEqX4(SIMD.Int32x4.lessThanOrEqual(i1, i2), [1, 0, 1, 0].map(bool)); + assertEqX4(SIMD.Int32x4.equal(i1, i2), [1, 0, 0, 0].map(bool)); + assertEqX4(SIMD.Int32x4.notEqual(i1, i2), [0, 1, 1, 1].map(bool)); + assertEqX4(SIMD.Int32x4.greaterThan(i1, i2), [0, 1, 0, 1].map(bool)); + assertEqX4(SIMD.Int32x4.greaterThanOrEqual(i1, i2), [1, 1, 0, 1].map(bool)); - assertEqX4(SIMD.float32x4.lessThan(f1, f2), [0, 1, 1, 0].map(bool)); - assertEqX4(SIMD.float32x4.lessThanOrEqual(f1, f2), [0, 1, 1, 0].map(bool)); - assertEqX4(SIMD.float32x4.equal(f1, f2), [0, 0, 0, 0].map(bool)); - assertEqX4(SIMD.float32x4.notEqual(f1, f2), [1, 1, 1, 1].map(bool)); - assertEqX4(SIMD.float32x4.greaterThan(f1, f2), [0, 0, 0, 1].map(bool)); - assertEqX4(SIMD.float32x4.greaterThanOrEqual(f1, f2), [0, 0, 0, 1].map(bool)); + assertEqX4(SIMD.Float32x4.lessThan(f1, f2), [0, 1, 1, 0].map(bool)); + assertEqX4(SIMD.Float32x4.lessThanOrEqual(f1, f2), [0, 1, 1, 0].map(bool)); + assertEqX4(SIMD.Float32x4.equal(f1, f2), [0, 0, 0, 0].map(bool)); + assertEqX4(SIMD.Float32x4.notEqual(f1, f2), [1, 1, 1, 1].map(bool)); + assertEqX4(SIMD.Float32x4.greaterThan(f1, f2), [0, 0, 0, 1].map(bool)); + assertEqX4(SIMD.Float32x4.greaterThanOrEqual(f1, f2), [0, 0, 0, 1].map(bool)); } } diff --git a/js/src/jit-test/tests/SIMD/complex-4.js b/js/src/jit-test/tests/SIMD/complex-4.js index 98e4073040e..ca5e8b0f67b 100644 --- a/js/src/jit-test/tests/SIMD/complex-4.js +++ b/js/src/jit-test/tests/SIMD/complex-4.js @@ -8,7 +8,7 @@ setJitCompilerOption("ion.warmup.trigger", 90); var max = 100; // Make have the warm-up counter high enough to // consider inlining functions. -var f4 = SIMD.int32x4; // :TODO: Support float32x4 arith. +var f4 = SIMD.Int32x4; // :TODO: Support Float32x4 arith. var f4add = f4.add; var f4sub = f4.sub; var f4mul = f4.mul; diff --git a/js/src/jit-test/tests/SIMD/convert.js b/js/src/jit-test/tests/SIMD/convert.js index d127a60c1d8..b27a041e7f7 100644 --- a/js/src/jit-test/tests/SIMD/convert.js +++ b/js/src/jit-test/tests/SIMD/convert.js @@ -20,27 +20,26 @@ var cast = (function() { function f() { // No bailout here. - var f4 = SIMD.float32x4(1, 2, 3, 4); - var i4 = SIMD.int32x4(1, 2, 3, 4); + var f4 = SIMD.Float32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); var BitOrZero = (x) => x | 0; for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.float32x4.fromInt32x4(i4), unaryX4(BitOrZero, f4, Math.fround)); - assertEqX4(SIMD.float32x4.fromInt32x4Bits(i4), unaryX4(cast.fromInt32Bits, f4, Math.fround)); - assertEqX4(SIMD.int32x4.fromFloat32x4(f4), unaryX4(Math.fround, i4, BitOrZero)); - assertEqX4(SIMD.int32x4.fromFloat32x4Bits(f4), unaryX4(cast.fromFloat32Bits, i4, BitOrZero)); + assertEqX4(SIMD.Float32x4.fromInt32x4(i4), unaryX4(BitOrZero, f4, Math.fround)); + assertEqX4(SIMD.Float32x4.fromInt32x4Bits(i4), unaryX4(cast.fromInt32Bits, f4, Math.fround)); + assertEqX4(SIMD.Int32x4.fromFloat32x4(f4), unaryX4(Math.fround, i4, BitOrZero)); + assertEqX4(SIMD.Int32x4.fromFloat32x4Bits(f4), unaryX4(cast.fromFloat32Bits, i4, BitOrZero)); } } function uglyDuckling(val) { // We bail out when i == 149 because the conversion will return // 0x80000000 and the input actually wasn't in bounds. - print('entering uglyDuckling'); val = Math.fround(val); for (var i = 0; i < 150; i++) { var caught = false; try { - var v = SIMD.float32x4(i < 149 ? 0 : val, 0, 0, 0) - SIMD.int32x4.fromFloat32x4(v); + var v = SIMD.Float32x4(i < 149 ? 0 : val, 0, 0, 0) + SIMD.Int32x4.fromFloat32x4(v); } catch(e) { assertEq(e instanceof RangeError, true); assertEq(i, 149); @@ -51,12 +50,11 @@ function uglyDuckling(val) { } function dontBail() { - print('entering dontbail'); // On x86, the conversion will return 0x80000000, which will imply that we // check the input values. However, we shouldn't bail out in this case. for (var i = 0; i < 150; i++) { - var v = SIMD.float32x4(i < 149 ? 0 : -Math.pow(2, 31), 0, 0, 0) - SIMD.int32x4.fromFloat32x4(v); + var v = SIMD.Float32x4(i < 149 ? 0 : -Math.pow(2, 31), 0, 0, 0) + SIMD.Int32x4.fromFloat32x4(v); } } diff --git a/js/src/jit-test/tests/SIMD/float32x4-binary-arith.js b/js/src/jit-test/tests/SIMD/float32x4-binary-arith.js index 7d0bbd40cb7..e2febd314b5 100644 --- a/js/src/jit-test/tests/SIMD/float32x4-binary-arith.js +++ b/js/src/jit-test/tests/SIMD/float32x4-binary-arith.js @@ -19,14 +19,14 @@ function minNum(x, y) { } function f() { - var f1 = SIMD.float32x4(1, 2, 3, 4); - var f2 = SIMD.float32x4(4, 3, 2, 1); + var f1 = SIMD.Float32x4(1, 2, 3, 4); + var f2 = SIMD.Float32x4(4, 3, 2, 1); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.float32x4.div(f1, f2), binaryX4((x, y) => x / y, f1, f2)); - assertEqX4(SIMD.float32x4.min(f1, f2), binaryX4(Math.min, f1, f2)); - assertEqX4(SIMD.float32x4.max(f1, f2), binaryX4(Math.max, f1, f2)); - assertEqX4(SIMD.float32x4.minNum(f1, f2), binaryX4(minNum, f1, f2)); - assertEqX4(SIMD.float32x4.maxNum(f1, f2), binaryX4(maxNum, f1, f2)); + assertEqX4(SIMD.Float32x4.div(f1, f2), binaryX4((x, y) => x / y, f1, f2)); + assertEqX4(SIMD.Float32x4.min(f1, f2), binaryX4(Math.min, f1, f2)); + assertEqX4(SIMD.Float32x4.max(f1, f2), binaryX4(Math.max, f1, f2)); + assertEqX4(SIMD.Float32x4.minNum(f1, f2), binaryX4(minNum, f1, f2)); + assertEqX4(SIMD.Float32x4.maxNum(f1, f2), binaryX4(maxNum, f1, f2)); } } diff --git a/js/src/jit-test/tests/SIMD/float32x4-binary-bitwise.js b/js/src/jit-test/tests/SIMD/float32x4-binary-bitwise.js index e6fac5a8d59..666967187ae 100644 --- a/js/src/jit-test/tests/SIMD/float32x4-binary-bitwise.js +++ b/js/src/jit-test/tests/SIMD/float32x4-binary-bitwise.js @@ -28,12 +28,12 @@ var helpers = (function() { })(); function f() { - var f1 = SIMD.float32x4(1, 2, 3, 4); - var f2 = SIMD.float32x4(4, 3, 2, 1); + var f1 = SIMD.Float32x4(1, 2, 3, 4); + var f2 = SIMD.Float32x4(4, 3, 2, 1); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.float32x4.and(f1, f2), binaryX4(helpers.and, f1, f2)); - assertEqX4(SIMD.float32x4.or(f1, f2), binaryX4(helpers.or, f1, f2)); - assertEqX4(SIMD.float32x4.xor(f1, f2), binaryX4(helpers.xor, f1, f2)); + assertEqX4(SIMD.Float32x4.and(f1, f2), binaryX4(helpers.and, f1, f2)); + assertEqX4(SIMD.Float32x4.or(f1, f2), binaryX4(helpers.or, f1, f2)); + assertEqX4(SIMD.Float32x4.xor(f1, f2), binaryX4(helpers.xor, f1, f2)); } } diff --git a/js/src/jit-test/tests/SIMD/getters.js b/js/src/jit-test/tests/SIMD/getters.js index f327ff25706..ee30ec993fe 100644 --- a/js/src/jit-test/tests/SIMD/getters.js +++ b/js/src/jit-test/tests/SIMD/getters.js @@ -3,10 +3,10 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function f() { - var i4 = SIMD.int32x4(1, -2, 3, -4); + var i4 = SIMD.Int32x4(1, -2, 3, -4); var v = Math.fround(13.37); - var f4 = SIMD.float32x4(13.37, NaN, Infinity, -0); + var f4 = SIMD.Float32x4(13.37, NaN, Infinity, -0); for (var i = 0; i < 150; i++) { assertEq(i4.x, 1); diff --git a/js/src/jit-test/tests/SIMD/inline-missing-arguments.js b/js/src/jit-test/tests/SIMD/inline-missing-arguments.js index 4c0e3b38126..d9af7b72654 100644 --- a/js/src/jit-test/tests/SIMD/inline-missing-arguments.js +++ b/js/src/jit-test/tests/SIMD/inline-missing-arguments.js @@ -3,19 +3,19 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function test(i) { - assertEqX4(SIMD.int32x4(), [0, 0, 0, 0]); - assertEqX4(SIMD.int32x4(i), [i, 0, 0, 0]); - assertEqX4(SIMD.int32x4(i, 1), [i, 1, 0, 0]); - assertEqX4(SIMD.int32x4(i, 1, 2), [i, 1, 2, 0]); - assertEqX4(SIMD.int32x4(i, 1, 2, 3), [i, 1, 2, 3]); - assertEqX4(SIMD.int32x4(i, 1, 2, 3, 4), [i, 1, 2, 3]); + assertEqX4(SIMD.Int32x4(), [0, 0, 0, 0]); + assertEqX4(SIMD.Int32x4(i), [i, 0, 0, 0]); + assertEqX4(SIMD.Int32x4(i, 1), [i, 1, 0, 0]); + assertEqX4(SIMD.Int32x4(i, 1, 2), [i, 1, 2, 0]); + assertEqX4(SIMD.Int32x4(i, 1, 2, 3), [i, 1, 2, 3]); + assertEqX4(SIMD.Int32x4(i, 1, 2, 3, 4), [i, 1, 2, 3]); - assertEqX4(SIMD.float32x4(), [NaN, NaN, NaN, NaN]); - assertEqX4(SIMD.float32x4(i), [i, NaN, NaN, NaN]); - assertEqX4(SIMD.float32x4(i, 1), [i, 1, NaN, NaN]); - assertEqX4(SIMD.float32x4(i, 1, 2), [i, 1, 2, NaN]); - assertEqX4(SIMD.float32x4(i, 1, 2, 3), [i, 1, 2, 3 ]); - assertEqX4(SIMD.float32x4(i, 1, 2, 3, 4), [i, 1, 2, 3 ]); + assertEqX4(SIMD.Float32x4(), [NaN, NaN, NaN, NaN]); + assertEqX4(SIMD.Float32x4(i), [i, NaN, NaN, NaN]); + assertEqX4(SIMD.Float32x4(i, 1), [i, 1, NaN, NaN]); + assertEqX4(SIMD.Float32x4(i, 1, 2), [i, 1, 2, NaN]); + assertEqX4(SIMD.Float32x4(i, 1, 2, 3), [i, 1, 2, 3 ]); + assertEqX4(SIMD.Float32x4(i, 1, 2, 3, 4), [i, 1, 2, 3 ]); } for(var i=0; i<300; i++) { diff --git a/js/src/jit-test/tests/SIMD/load.js b/js/src/jit-test/tests/SIMD/load.js index cd987015601..5cdb8cce63d 100644 --- a/js/src/jit-test/tests/SIMD/load.js +++ b/js/src/jit-test/tests/SIMD/load.js @@ -16,75 +16,75 @@ function f() { var u8 = new Uint8Array(f32.buffer); function testLoad() { - assertEqX4(SIMD.float32x4.load(f64, 0), [1,2,3,4]); - assertEqX4(SIMD.float32x4.load(f32, 1), [2,3,4,5]); - assertEqX4(SIMD.float32x4.load(i32, 2), [3,4,5,6]); - assertEqX4(SIMD.float32x4.load(i16, 3 << 1), [4,5,6,7]); - assertEqX4(SIMD.float32x4.load(u16, 4 << 1), [5,6,7,8]); - assertEqX4(SIMD.float32x4.load(i8 , 5 << 2), [6,7,8,9]); - assertEqX4(SIMD.float32x4.load(u8 , 6 << 2), [7,8,9,10]); + assertEqX4(SIMD.Float32x4.load(f64, 0), [1,2,3,4]); + assertEqX4(SIMD.Float32x4.load(f32, 1), [2,3,4,5]); + assertEqX4(SIMD.Float32x4.load(i32, 2), [3,4,5,6]); + assertEqX4(SIMD.Float32x4.load(i16, 3 << 1), [4,5,6,7]); + assertEqX4(SIMD.Float32x4.load(u16, 4 << 1), [5,6,7,8]); + assertEqX4(SIMD.Float32x4.load(i8 , 5 << 2), [6,7,8,9]); + assertEqX4(SIMD.Float32x4.load(u8 , 6 << 2), [7,8,9,10]); - assertEqX4(SIMD.float32x4.load(f64, (16 >> 1) - (4 >> 1)), [13,14,15,16]); - assertEqX4(SIMD.float32x4.load(f32, 16 - 4), [13,14,15,16]); - assertEqX4(SIMD.float32x4.load(i32, 16 - 4), [13,14,15,16]); - assertEqX4(SIMD.float32x4.load(i16, (16 << 1) - (4 << 1)), [13,14,15,16]); - assertEqX4(SIMD.float32x4.load(u16, (16 << 1) - (4 << 1)), [13,14,15,16]); - assertEqX4(SIMD.float32x4.load(i8, (16 << 2) - (4 << 2)), [13,14,15,16]); - assertEqX4(SIMD.float32x4.load(u8, (16 << 2) - (4 << 2)), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(f64, (16 >> 1) - (4 >> 1)), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(f32, 16 - 4), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(i32, 16 - 4), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(i16, (16 << 1) - (4 << 1)), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(u16, (16 << 1) - (4 << 1)), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(i8, (16 << 2) - (4 << 2)), [13,14,15,16]); + assertEqX4(SIMD.Float32x4.load(u8, (16 << 2) - (4 << 2)), [13,14,15,16]); } function testLoad1() { - assertEqX4(SIMD.float32x4.load1(f64, 0), [1,0,0,0]); - assertEqX4(SIMD.float32x4.load1(f32, 1), [2,0,0,0]); - assertEqX4(SIMD.float32x4.load1(i32, 2), [3,0,0,0]); - assertEqX4(SIMD.float32x4.load1(i16, 3 << 1), [4,0,0,0]); - assertEqX4(SIMD.float32x4.load1(u16, 4 << 1), [5,0,0,0]); - assertEqX4(SIMD.float32x4.load1(i8 , 5 << 2), [6,0,0,0]); - assertEqX4(SIMD.float32x4.load1(u8 , 6 << 2), [7,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(f64, 0), [1,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(f32, 1), [2,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(i32, 2), [3,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(i16, 3 << 1), [4,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(u16, 4 << 1), [5,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(i8 , 5 << 2), [6,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(u8 , 6 << 2), [7,0,0,0]); - assertEqX4(SIMD.float32x4.load1(f64, (16 >> 1) - (4 >> 1)), [13,0,0,0]); - assertEqX4(SIMD.float32x4.load1(f32, 16 - 4), [13,0,0,0]); - assertEqX4(SIMD.float32x4.load1(i32, 16 - 4), [13,0,0,0]); - assertEqX4(SIMD.float32x4.load1(i16, (16 << 1) - (4 << 1)), [13,0,0,0]); - assertEqX4(SIMD.float32x4.load1(u16, (16 << 1) - (4 << 1)), [13,0,0,0]); - assertEqX4(SIMD.float32x4.load1(i8, (16 << 2) - (4 << 2)), [13,0,0,0]); - assertEqX4(SIMD.float32x4.load1(u8, (16 << 2) - (4 << 2)), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(f64, (16 >> 1) - (4 >> 1)), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(f32, 16 - 4), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(i32, 16 - 4), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(i16, (16 << 1) - (4 << 1)), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(u16, (16 << 1) - (4 << 1)), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(i8, (16 << 2) - (4 << 2)), [13,0,0,0]); + assertEqX4(SIMD.Float32x4.load1(u8, (16 << 2) - (4 << 2)), [13,0,0,0]); } function testLoad2() { - assertEqX4(SIMD.float32x4.load2(f64, 0), [1,2,0,0]); - assertEqX4(SIMD.float32x4.load2(f32, 1), [2,3,0,0]); - assertEqX4(SIMD.float32x4.load2(i32, 2), [3,4,0,0]); - assertEqX4(SIMD.float32x4.load2(i16, 3 << 1), [4,5,0,0]); - assertEqX4(SIMD.float32x4.load2(u16, 4 << 1), [5,6,0,0]); - assertEqX4(SIMD.float32x4.load2(i8 , 5 << 2), [6,7,0,0]); - assertEqX4(SIMD.float32x4.load2(u8 , 6 << 2), [7,8,0,0]); + assertEqX4(SIMD.Float32x4.load2(f64, 0), [1,2,0,0]); + assertEqX4(SIMD.Float32x4.load2(f32, 1), [2,3,0,0]); + assertEqX4(SIMD.Float32x4.load2(i32, 2), [3,4,0,0]); + assertEqX4(SIMD.Float32x4.load2(i16, 3 << 1), [4,5,0,0]); + assertEqX4(SIMD.Float32x4.load2(u16, 4 << 1), [5,6,0,0]); + assertEqX4(SIMD.Float32x4.load2(i8 , 5 << 2), [6,7,0,0]); + assertEqX4(SIMD.Float32x4.load2(u8 , 6 << 2), [7,8,0,0]); - assertEqX4(SIMD.float32x4.load2(f64, (16 >> 1) - (4 >> 1)), [13,14,0,0]); - assertEqX4(SIMD.float32x4.load2(f32, 16 - 4), [13,14,0,0]); - assertEqX4(SIMD.float32x4.load2(i32, 16 - 4), [13,14,0,0]); - assertEqX4(SIMD.float32x4.load2(i16, (16 << 1) - (4 << 1)), [13,14,0,0]); - assertEqX4(SIMD.float32x4.load2(u16, (16 << 1) - (4 << 1)), [13,14,0,0]); - assertEqX4(SIMD.float32x4.load2(i8, (16 << 2) - (4 << 2)), [13,14,0,0]); - assertEqX4(SIMD.float32x4.load2(u8, (16 << 2) - (4 << 2)), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(f64, (16 >> 1) - (4 >> 1)), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(f32, 16 - 4), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(i32, 16 - 4), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(i16, (16 << 1) - (4 << 1)), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(u16, (16 << 1) - (4 << 1)), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(i8, (16 << 2) - (4 << 2)), [13,14,0,0]); + assertEqX4(SIMD.Float32x4.load2(u8, (16 << 2) - (4 << 2)), [13,14,0,0]); } function testLoad3() { - assertEqX4(SIMD.float32x4.load3(f64, 0), [1,2,3,0]); - assertEqX4(SIMD.float32x4.load3(f32, 1), [2,3,4,0]); - assertEqX4(SIMD.float32x4.load3(i32, 2), [3,4,5,0]); - assertEqX4(SIMD.float32x4.load3(i16, 3 << 1), [4,5,6,0]); - assertEqX4(SIMD.float32x4.load3(u16, 4 << 1), [5,6,7,0]); - assertEqX4(SIMD.float32x4.load3(i8 , 5 << 2), [6,7,8,0]); - assertEqX4(SIMD.float32x4.load3(u8 , 6 << 2), [7,8,9,0]); + assertEqX4(SIMD.Float32x4.load3(f64, 0), [1,2,3,0]); + assertEqX4(SIMD.Float32x4.load3(f32, 1), [2,3,4,0]); + assertEqX4(SIMD.Float32x4.load3(i32, 2), [3,4,5,0]); + assertEqX4(SIMD.Float32x4.load3(i16, 3 << 1), [4,5,6,0]); + assertEqX4(SIMD.Float32x4.load3(u16, 4 << 1), [5,6,7,0]); + assertEqX4(SIMD.Float32x4.load3(i8 , 5 << 2), [6,7,8,0]); + assertEqX4(SIMD.Float32x4.load3(u8 , 6 << 2), [7,8,9,0]); - assertEqX4(SIMD.float32x4.load3(f64, (16 >> 1) - (4 >> 1)), [13,14,15,0]); - assertEqX4(SIMD.float32x4.load3(f32, 16 - 4), [13,14,15,0]); - assertEqX4(SIMD.float32x4.load3(i32, 16 - 4), [13,14,15,0]); - assertEqX4(SIMD.float32x4.load3(i16, (16 << 1) - (4 << 1)), [13,14,15,0]); - assertEqX4(SIMD.float32x4.load3(u16, (16 << 1) - (4 << 1)), [13,14,15,0]); - assertEqX4(SIMD.float32x4.load3(i8, (16 << 2) - (4 << 2)), [13,14,15,0]); - assertEqX4(SIMD.float32x4.load3(u8, (16 << 2) - (4 << 2)), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(f64, (16 >> 1) - (4 >> 1)), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(f32, 16 - 4), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(i32, 16 - 4), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(i16, (16 << 1) - (4 << 1)), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(u16, (16 << 1) - (4 << 1)), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(i8, (16 << 2) - (4 << 2)), [13,14,15,0]); + assertEqX4(SIMD.Float32x4.load3(u8, (16 << 2) - (4 << 2)), [13,14,15,0]); } for (var i = 0; i < 150; i++) { @@ -107,7 +107,7 @@ function testBailout(uglyDuckling) { for (var i = 0; i < 150; i++) { var caught = false; try { - SIMD.float32x4.load(i8, (i < 149) ? 0 : uglyDuckling); + SIMD.Float32x4.load(i8, (i < 149) ? 0 : uglyDuckling); } catch (e) { print(e); assertEq(e instanceof RangeError, true); diff --git a/js/src/jit-test/tests/SIMD/nursery-overflow.js b/js/src/jit-test/tests/SIMD/nursery-overflow.js index 1b16c301ce1..5aecff908bb 100644 --- a/js/src/jit-test/tests/SIMD/nursery-overflow.js +++ b/js/src/jit-test/tests/SIMD/nursery-overflow.js @@ -6,8 +6,8 @@ if (typeof SIMD === "undefined") setJitCompilerOption("baseline.warmup.trigger", 10); setJitCompilerOption("ion.warmup.trigger", 30); -var i4 = SIMD.int32x4; -var i4sub = SIMD.int32x4.sub; +var i4 = SIMD.Int32x4; +var i4sub = SIMD.Int32x4.sub; function simdbox(i) { return i4(i, i, i, i); diff --git a/js/src/jit-test/tests/SIMD/recover.js b/js/src/jit-test/tests/SIMD/recover.js index 6bd70429240..6da8b10446d 100644 --- a/js/src/jit-test/tests/SIMD/recover.js +++ b/js/src/jit-test/tests/SIMD/recover.js @@ -25,7 +25,7 @@ var uceFault = function (i) { // Check that we can correctly recover a boxed value. var uceFault_simdBox_i4 = eval(uneval(uceFault).replace('uceFault', 'uceFault_simdBox_i4')); function simdBox_i4(i) { - var a = SIMD.int32x4(i, i, i, i); + var a = SIMD.Int32x4(i, i, i, i); if (uceFault_simdBox_i4(i) || uceFault_simdBox_i4(i)) assertEqX4(a, [i, i, i, i]); assertRecoveredOnBailout(a, true); @@ -34,7 +34,7 @@ function simdBox_i4(i) { var uceFault_simdBox_f4 = eval(uneval(uceFault).replace('uceFault', 'uceFault_simdBox_f4')); function simdBox_f4(i) { - var a = SIMD.float32x4(i, i + 0.1, i + 0.2, i + 0.3); + var a = SIMD.Float32x4(i, i + 0.1, i + 0.2, i + 0.3); if (uceFault_simdBox_f4(i) || uceFault_simdBox_f4(i)) assertEqX4(a, [i, i + 0.1, i + 0.2, i + 0.3].map(Math.fround)); assertRecoveredOnBailout(a, true); diff --git a/js/src/jit-test/tests/SIMD/replacelane.js b/js/src/jit-test/tests/SIMD/replacelane.js index 178508eddeb..21dc7b109cf 100644 --- a/js/src/jit-test/tests/SIMD/replacelane.js +++ b/js/src/jit-test/tests/SIMD/replacelane.js @@ -3,33 +3,32 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function f() { - var f4 = SIMD.float32x4(1, 2, 3, 4); - var i4 = SIMD.int32x4(1, 2, 3, 4); + var f4 = SIMD.Float32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.int32x4.replaceLane(i4, 0, 42), [42, 2, 3, 4]); - assertEqX4(SIMD.int32x4.replaceLane(i4, 1, 42), [1, 42, 3, 4]); - assertEqX4(SIMD.int32x4.replaceLane(i4, 2, 42), [1, 2, 42, 4]); - assertEqX4(SIMD.int32x4.replaceLane(i4, 3, 42), [1, 2, 3, 42]); + assertEqX4(SIMD.Int32x4.replaceLane(i4, 0, 42), [42, 2, 3, 4]); + assertEqX4(SIMD.Int32x4.replaceLane(i4, 1, 42), [1, 42, 3, 4]); + assertEqX4(SIMD.Int32x4.replaceLane(i4, 2, 42), [1, 2, 42, 4]); + assertEqX4(SIMD.Int32x4.replaceLane(i4, 3, 42), [1, 2, 3, 42]); - assertEqX4(SIMD.float32x4.replaceLane(f4, 0, 42), [42, 2, 3, 4]); - assertEqX4(SIMD.float32x4.replaceLane(f4, 1, 42), [1, 42, 3, 4]); - assertEqX4(SIMD.float32x4.replaceLane(f4, 2, 42), [1, 2, 42, 4]); - assertEqX4(SIMD.float32x4.replaceLane(f4, 3, 42), [1, 2, 3, 42]); + assertEqX4(SIMD.Float32x4.replaceLane(f4, 0, 42), [42, 2, 3, 4]); + assertEqX4(SIMD.Float32x4.replaceLane(f4, 1, 42), [1, 42, 3, 4]); + assertEqX4(SIMD.Float32x4.replaceLane(f4, 2, 42), [1, 2, 42, 4]); + assertEqX4(SIMD.Float32x4.replaceLane(f4, 3, 42), [1, 2, 3, 42]); } } f(); - function e() { - var f4 = SIMD.float32x4(1, 2, 3, 4); - var i4 = SIMD.int32x4(1, 2, 3, 4); + var f4 = SIMD.Float32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); for (let i = 0; i < 150; i++) { let caught = false; try { - let x = SIMD.int32x4.replaceLane(i < 149 ? i4 : f4, 0, 42); + let x = SIMD.Int32x4.replaceLane(i < 149 ? i4 : f4, 0, 42); } catch(e) { assertEq(e instanceof TypeError, true); assertEq(i, 149); @@ -41,7 +40,7 @@ function e() { for (let i = 0; i < 150; i++) { let caught = false; try { - let x = SIMD.int32x4.replaceLane(i4, i < 149 ? 0 : 4, 42); + let x = SIMD.Int32x4.replaceLane(i4, i < 149 ? 0 : 4, 42); } catch(e) { assertEq(e instanceof TypeError, true); assertEq(i, 149); @@ -53,7 +52,7 @@ function e() { for (let i = 0; i < 150; i++) { let caught = false; try { - let x = SIMD.int32x4.replaceLane(i4, i < 149 ? 0 : 1.1, 42); + let x = SIMD.Int32x4.replaceLane(i4, i < 149 ? 0 : 1.1, 42); } catch(e) { assertEq(e instanceof TypeError, true); assertEq(i, 149); @@ -65,7 +64,7 @@ function e() { for (let i = 0; i < 150; i++) { let caught = false; try { - let x = SIMD.float32x4.replaceLane(i < 149 ? f4 : i4, 0, 42); + let x = SIMD.Float32x4.replaceLane(i < 149 ? f4 : i4, 0, 42); } catch(e) { assertEq(e instanceof TypeError, true); assertEq(i, 149); @@ -77,7 +76,7 @@ function e() { for (let i = 0; i < 150; i++) { let caught = false; try { - let x = SIMD.float32x4.replaceLane(f4, i < 149 ? 0 : 4, 42); + let x = SIMD.Float32x4.replaceLane(f4, i < 149 ? 0 : 4, 42); } catch(e) { assertEq(e instanceof TypeError, true); assertEq(i, 149); @@ -89,7 +88,7 @@ function e() { for (let i = 0; i < 150; i++) { let caught = false; try { - let x = SIMD.float32x4.replaceLane(f4, i < 149 ? 0 : 1.1, 42); + let x = SIMD.Float32x4.replaceLane(f4, i < 149 ? 0 : 1.1, 42); } catch(e) { assertEq(e instanceof TypeError, true); assertEq(i, 149); diff --git a/js/src/jit-test/tests/SIMD/select.js b/js/src/jit-test/tests/SIMD/select.js index 7eebf3212a3..c31e3309e86 100644 --- a/js/src/jit-test/tests/SIMD/select.js +++ b/js/src/jit-test/tests/SIMD/select.js @@ -2,45 +2,45 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); -function int32x4FromTypeBits(type, vec) { - if (type == SIMD.int32x4) +function Int32x4FromTypeBits(type, vec) { + if (type == SIMD.Int32x4) return vec; - if (type == SIMD.float32x4) - return SIMD.int32x4.fromFloat32x4Bits(vec); + if (type == SIMD.Float32x4) + return SIMD.Int32x4.fromFloat32x4Bits(vec); throw 'unimplemented'; } function bitselect(type, mask, ifTrue, ifFalse) { - var int32x4 = SIMD.int32x4; - var tv = int32x4FromTypeBits(type, ifTrue); - var fv = int32x4FromTypeBits(type, ifFalse); - var tr = int32x4.and(mask, tv); - var fr = int32x4.and(int32x4.not(mask), fv); - var orApplied = int32x4.or(tr, fr); - var converted = type == int32x4 ? orApplied : type.fromInt32x4Bits(orApplied); + var Int32x4 = SIMD.Int32x4; + var tv = Int32x4FromTypeBits(type, ifTrue); + var fv = Int32x4FromTypeBits(type, ifFalse); + var tr = Int32x4.and(mask, tv); + var fr = Int32x4.and(Int32x4.not(mask), fv); + var orApplied = Int32x4.or(tr, fr); + var converted = type == Int32x4 ? orApplied : type.fromInt32x4Bits(orApplied); return simdToArray(converted); } function f() { - var f1 = SIMD.float32x4(1, 2, 3, 4); - var f2 = SIMD.float32x4(NaN, Infinity, 3.14, -0); + var f1 = SIMD.Float32x4(1, 2, 3, 4); + var f2 = SIMD.Float32x4(NaN, Infinity, 3.14, -0); - var i1 = SIMD.int32x4(2, 3, 5, 8); - var i2 = SIMD.int32x4(13, 37, 24, 42); + var i1 = SIMD.Int32x4(2, 3, 5, 8); + var i2 = SIMD.Int32x4(13, 37, 24, 42); - var TTFT = SIMD.int32x4(-1, -1, 0, -1); - var TFTF = SIMD.int32x4(-1, 0, -1, 0); + var TTFT = SIMD.Int32x4(-1, -1, 0, -1); + var TFTF = SIMD.Int32x4(-1, 0, -1, 0); - var mask = SIMD.int32x4(0xdeadbeef, 0xbaadf00d, 0x00ff1ce, 0xdeadc0de); + var mask = SIMD.Int32x4(0xdeadbeef, 0xbaadf00d, 0x00ff1ce, 0xdeadc0de); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.float32x4.select(TTFT, f1, f2), [f1.x, f1.y, f2.z, f1.w]); - assertEqX4(SIMD.float32x4.select(TFTF, f1, f2), [f1.x, f2.y, f1.z, f2.w]); - assertEqX4(SIMD.int32x4.select(TFTF, i1, i2), [i1.x, i2.y, i1.z, i2.w]); - assertEqX4(SIMD.int32x4.select(TTFT, i1, i2), [i1.x, i1.y, i2.z, i1.w]); + assertEqX4(SIMD.Float32x4.select(TTFT, f1, f2), [f1.x, f1.y, f2.z, f1.w]); + assertEqX4(SIMD.Float32x4.select(TFTF, f1, f2), [f1.x, f2.y, f1.z, f2.w]); + assertEqX4(SIMD.Int32x4.select(TFTF, i1, i2), [i1.x, i2.y, i1.z, i2.w]); + assertEqX4(SIMD.Int32x4.select(TTFT, i1, i2), [i1.x, i1.y, i2.z, i1.w]); - assertEqX4(SIMD.float32x4.bitselect(mask, f1, f2), bitselect(SIMD.float32x4, mask, f1, f2)); - assertEqX4(SIMD.int32x4.bitselect(mask, i1, i2), bitselect(SIMD.int32x4, mask, i1, i2)); + assertEqX4(SIMD.Float32x4.bitselect(mask, f1, f2), bitselect(SIMD.Float32x4, mask, f1, f2)); + assertEqX4(SIMD.Int32x4.bitselect(mask, i1, i2), bitselect(SIMD.Int32x4, mask, i1, i2)); } } diff --git a/js/src/jit-test/tests/SIMD/shift.js b/js/src/jit-test/tests/SIMD/shift.js index 303a48e3a30..4f06b5a25a3 100644 --- a/js/src/jit-test/tests/SIMD/shift.js +++ b/js/src/jit-test/tests/SIMD/shift.js @@ -14,7 +14,7 @@ function binaryUrsh(count, v) { if (count>>>0 >= 32) return 0; return (v >>> cou function ursh(count) { return curry(binaryUrsh, count); } function f() { - var v = SIMD.int32x4(1, 2, -3, 4); + var v = SIMD.Int32x4(1, 2, -3, 4); var a = [1, 2, -3, 4]; var zeros = [0,0,0,0]; @@ -23,32 +23,32 @@ function f() { var r; for (var i = 0; i < 150; i++) { // Constant shift counts - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, -1), a.map(lsh(-1))); - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, 0), a.map(lsh(0))); - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, 1), a.map(lsh(1))); - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, 2), a.map(lsh(2))); - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, 31), a.map(lsh(31))); - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, 32), a.map(lsh(32))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, -1), a.map(lsh(-1))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, 0), a.map(lsh(0))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, 1), a.map(lsh(1))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, 2), a.map(lsh(2))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, 31), a.map(lsh(31))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, 32), a.map(lsh(32))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, -1), a.map(rsh(31))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, 0), a.map(rsh(0))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, 1), a.map(rsh(1))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, 2), a.map(rsh(2))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, 31), a.map(rsh(31))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, 32), a.map(rsh(31))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, -1), a.map(rsh(31))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, 0), a.map(rsh(0))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, 1), a.map(rsh(1))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, 2), a.map(rsh(2))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, 31), a.map(rsh(31))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, 32), a.map(rsh(31))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, -1), a.map(ursh(-1))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, 0), a.map(ursh(0))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, 1), a.map(ursh(1))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, 2), a.map(ursh(2))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, 31), a.map(ursh(31))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, 32), a.map(ursh(32))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, -1), a.map(ursh(-1))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, 0), a.map(ursh(0))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, 1), a.map(ursh(1))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, 2), a.map(ursh(2))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, 31), a.map(ursh(31))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, 32), a.map(ursh(32))); // Non constant shift counts var c = shifts[i % shifts.length]; - assertEqX4(SIMD.int32x4.shiftLeftByScalar(v, c), a.map(lsh(c))); - assertEqX4(SIMD.int32x4.shiftRightArithmeticByScalar(v, c), a.map(rsh(c))); - assertEqX4(SIMD.int32x4.shiftRightLogicalByScalar(v, c), a.map(ursh(c))); + assertEqX4(SIMD.Int32x4.shiftLeftByScalar(v, c), a.map(lsh(c))); + assertEqX4(SIMD.Int32x4.shiftRightArithmeticByScalar(v, c), a.map(rsh(c))); + assertEqX4(SIMD.Int32x4.shiftRightLogicalByScalar(v, c), a.map(ursh(c))); } return r; } diff --git a/js/src/jit-test/tests/SIMD/shuffle.js b/js/src/jit-test/tests/SIMD/shuffle.js index 33a09e68e8d..34ff2521397 100644 --- a/js/src/jit-test/tests/SIMD/shuffle.js +++ b/js/src/jit-test/tests/SIMD/shuffle.js @@ -6,12 +6,12 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function f() { - var i1 = SIMD.int32x4(1, 2, 3, 4); - var i2 = SIMD.int32x4(5, 6, 7, 8); + var i1 = SIMD.Int32x4(1, 2, 3, 4); + var i2 = SIMD.Int32x4(5, 6, 7, 8); var leet = Math.fround(13.37); - var f1 = SIMD.float32x4(-.5, -0, Infinity, leet); - var f2 = SIMD.float32x4(42, .5, 23, -10); + var f1 = SIMD.Float32x4(-.5, -0, Infinity, leet); + var f2 = SIMD.Float32x4(42, .5, 23, -10); // computes all rotations of a given array function *gen(arr) { @@ -35,31 +35,31 @@ function f() { for (var i = 0; i < 150; i++) { // Variable lanes - var r = SIMD.float32x4.shuffle(f1, f2, i % 8, (i + 1) % 8, (i + 2) % 8, (i + 3) % 8); + var r = SIMD.Float32x4.shuffle(f1, f2, i % 8, (i + 1) % 8, (i + 2) % 8, (i + 3) % 8); assertEqX4(r, compF[i % 8]); // Constant lanes - assertEqX4(SIMD.float32x4.shuffle(f1, f2, 3, 2, 4, 5), [leet, Infinity, 42, .5]); + assertEqX4(SIMD.Float32x4.shuffle(f1, f2, 3, 2, 4, 5), [leet, Infinity, 42, .5]); // Variable lanes - var r = SIMD.int32x4.shuffle(i1, i2, i % 8, (i + 1) % 8, (i + 2) % 8, (i + 3) % 8); + var r = SIMD.Int32x4.shuffle(i1, i2, i % 8, (i + 1) % 8, (i + 2) % 8, (i + 3) % 8); assertEqX4(r, compI[i % 8]); // Constant lanes - assertEqX4(SIMD.int32x4.shuffle(i1, i2, 3, 2, 4, 5), [4, 3, 5, 6]); + assertEqX4(SIMD.Int32x4.shuffle(i1, i2, 3, 2, 4, 5), [4, 3, 5, 6]); } } function testBailouts(uglyDuckling) { - var i1 = SIMD.int32x4(1, 2, 3, 4); - var i2 = SIMD.int32x4(5, 6, 7, 8); + var i1 = SIMD.Int32x4(1, 2, 3, 4); + var i2 = SIMD.Int32x4(5, 6, 7, 8); for (var i = 0; i < 150; i++) { // Test bailouts var value = i == 149 ? uglyDuckling : 3; var caught = false; try { - assertEqX4(SIMD.int32x4.shuffle(i1, i2, value, 2, 4, 5), [4, 3, 5, 6]); + assertEqX4(SIMD.Int32x4.shuffle(i1, i2, value, 2, 4, 5), [4, 3, 5, 6]); } catch(e) { print(e); caught = true; diff --git a/js/src/jit-test/tests/SIMD/splat.js b/js/src/jit-test/tests/SIMD/splat.js index 36c0103a75d..cdccfb570a2 100644 --- a/js/src/jit-test/tests/SIMD/splat.js +++ b/js/src/jit-test/tests/SIMD/splat.js @@ -4,8 +4,8 @@ setJitCompilerOption("ion.warmup.trigger", 50); function f() { for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.int32x4.splat(42), [42, 42, 42, 42]); - assertEqX4(SIMD.float32x4.splat(42), [42, 42, 42, 42]); + assertEqX4(SIMD.Int32x4.splat(42), [42, 42, 42, 42]); + assertEqX4(SIMD.Float32x4.splat(42), [42, 42, 42, 42]); } } diff --git a/js/src/jit-test/tests/SIMD/store.js b/js/src/jit-test/tests/SIMD/store.js index 47439ae969c..8cfa3542775 100644 --- a/js/src/jit-test/tests/SIMD/store.js +++ b/js/src/jit-test/tests/SIMD/store.js @@ -15,7 +15,7 @@ function f() { var i8 = new Int8Array(f32.buffer); var u8 = new Uint8Array(f32.buffer); - var f4 = SIMD.float32x4(42, 43, 44, 45); + var f4 = SIMD.Float32x4(42, 43, 44, 45); function check(n) { assertEq(f32[0], 42); @@ -30,78 +30,78 @@ function f() { } function testStore() { - SIMD.float32x4.store(f64, 0, f4); + SIMD.Float32x4.store(f64, 0, f4); check(4); - SIMD.float32x4.store(f32, 0, f4); + SIMD.Float32x4.store(f32, 0, f4); check(4); - SIMD.float32x4.store(i32, 0, f4); + SIMD.Float32x4.store(i32, 0, f4); check(4); - SIMD.float32x4.store(u32, 0, f4); + SIMD.Float32x4.store(u32, 0, f4); check(4); - SIMD.float32x4.store(i16, 0, f4); + SIMD.Float32x4.store(i16, 0, f4); check(4); - SIMD.float32x4.store(u16, 0, f4); + SIMD.Float32x4.store(u16, 0, f4); check(4); - SIMD.float32x4.store(i8, 0, f4); + SIMD.Float32x4.store(i8, 0, f4); check(4); - SIMD.float32x4.store(u8, 0, f4); + SIMD.Float32x4.store(u8, 0, f4); check(4); } function testStore1() { - SIMD.float32x4.store1(f64, 0, f4); + SIMD.Float32x4.store1(f64, 0, f4); check(1); - SIMD.float32x4.store1(f32, 0, f4); + SIMD.Float32x4.store1(f32, 0, f4); check(1); - SIMD.float32x4.store1(i32, 0, f4); + SIMD.Float32x4.store1(i32, 0, f4); check(1); - SIMD.float32x4.store1(u32, 0, f4); + SIMD.Float32x4.store1(u32, 0, f4); check(1); - SIMD.float32x4.store1(i16, 0, f4); + SIMD.Float32x4.store1(i16, 0, f4); check(1); - SIMD.float32x4.store1(u16, 0, f4); + SIMD.Float32x4.store1(u16, 0, f4); check(1); - SIMD.float32x4.store1(i8, 0, f4); + SIMD.Float32x4.store1(i8, 0, f4); check(1); - SIMD.float32x4.store1(u8, 0, f4); + SIMD.Float32x4.store1(u8, 0, f4); check(1); } function testStore2() { - SIMD.float32x4.store2(f64, 0, f4); + SIMD.Float32x4.store2(f64, 0, f4); check(2); - SIMD.float32x4.store2(f32, 0, f4); + SIMD.Float32x4.store2(f32, 0, f4); check(2); - SIMD.float32x4.store2(i32, 0, f4); + SIMD.Float32x4.store2(i32, 0, f4); check(2); - SIMD.float32x4.store2(u32, 0, f4); + SIMD.Float32x4.store2(u32, 0, f4); check(2); - SIMD.float32x4.store2(i16, 0, f4); + SIMD.Float32x4.store2(i16, 0, f4); check(2); - SIMD.float32x4.store2(u16, 0, f4); + SIMD.Float32x4.store2(u16, 0, f4); check(2); - SIMD.float32x4.store2(i8, 0, f4); + SIMD.Float32x4.store2(i8, 0, f4); check(2); - SIMD.float32x4.store2(u8, 0, f4); + SIMD.Float32x4.store2(u8, 0, f4); check(2); } function testStore3() { - SIMD.float32x4.store3(f64, 0, f4); + SIMD.Float32x4.store3(f64, 0, f4); check(3); - SIMD.float32x4.store3(f32, 0, f4); + SIMD.Float32x4.store3(f32, 0, f4); check(3); - SIMD.float32x4.store3(i32, 0, f4); + SIMD.Float32x4.store3(i32, 0, f4); check(3); - SIMD.float32x4.store3(u32, 0, f4); + SIMD.Float32x4.store3(u32, 0, f4); check(3); - SIMD.float32x4.store3(i16, 0, f4); + SIMD.Float32x4.store3(i16, 0, f4); check(3); - SIMD.float32x4.store3(u16, 0, f4); + SIMD.Float32x4.store3(u16, 0, f4); check(3); - SIMD.float32x4.store3(i8, 0, f4); + SIMD.Float32x4.store3(i8, 0, f4); check(3); - SIMD.float32x4.store3(u8, 0, f4); + SIMD.Float32x4.store3(u8, 0, f4); check(3); } @@ -122,12 +122,12 @@ function testBailout(uglyDuckling) { var i8 = new Int8Array(f32.buffer); - var f4 = SIMD.float32x4(42, 43, 44, 45); + var f4 = SIMD.Float32x4(42, 43, 44, 45); for (var i = 0; i < 150; i++) { var caught = false; try { - SIMD.float32x4.store(i8, (i < 149) ? 0 : (16 << 2) - (4 << 2) + 1, f4); + SIMD.Float32x4.store(i8, (i < 149) ? 0 : (16 << 2) - (4 << 2) + 1, f4); } catch (e) { print(e); assertEq(e instanceof RangeError, true); diff --git a/js/src/jit-test/tests/SIMD/swizzle.js b/js/src/jit-test/tests/SIMD/swizzle.js index 8ab1c17047d..3c0603092ba 100644 --- a/js/src/jit-test/tests/SIMD/swizzle.js +++ b/js/src/jit-test/tests/SIMD/swizzle.js @@ -6,10 +6,10 @@ load(libdir + 'simd.js'); setJitCompilerOption("ion.warmup.trigger", 50); function f() { - var i4 = SIMD.int32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); var leet = Math.fround(13.37); - var f4 = SIMD.float32x4(-.5, -0, Infinity, leet); + var f4 = SIMD.Float32x4(-.5, -0, Infinity, leet); var compI = [ [1,2,3,4], @@ -27,29 +27,29 @@ function f() { for (var i = 0; i < 150; i++) { // Variable lanes - var r = SIMD.float32x4.swizzle(f4, i % 4, (i + 1) % 4, (i + 2) % 4, (i + 3) % 4); + var r = SIMD.Float32x4.swizzle(f4, i % 4, (i + 1) % 4, (i + 2) % 4, (i + 3) % 4); assertEqX4(r, compF[i % 4]); // Constant lanes - assertEqX4(SIMD.float32x4.swizzle(f4, 3, 2, 1, 0), [leet, Infinity, -0, -.5]); + assertEqX4(SIMD.Float32x4.swizzle(f4, 3, 2, 1, 0), [leet, Infinity, -0, -.5]); // Variable lanes - var r = SIMD.int32x4.swizzle(i4, i % 4, (i + 1) % 4, (i + 2) % 4, (i + 3) % 4); + var r = SIMD.Int32x4.swizzle(i4, i % 4, (i + 1) % 4, (i + 2) % 4, (i + 3) % 4); assertEqX4(r, compI[i % 4]); // Constant lanes - assertEqX4(SIMD.int32x4.swizzle(i4, 3, 2, 1, 0), [4, 3, 2, 1]); + assertEqX4(SIMD.Int32x4.swizzle(i4, 3, 2, 1, 0), [4, 3, 2, 1]); } } function testBailouts(uglyDuckling) { - var i4 = SIMD.int32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); for (var i = 0; i < 150; i++) { // Test bailouts var value = i == 149 ? uglyDuckling : 0; var caught = false; try { - assertEqX4(SIMD.int32x4.swizzle(i4, value, 3, 2, 0), [1, 4, 3, 1]); + assertEqX4(SIMD.Int32x4.swizzle(i4, value, 3, 2, 0), [1, 4, 3, 1]); } catch(e) { print(e); caught = true; @@ -62,9 +62,9 @@ function testBailouts(uglyDuckling) { function testInt32x4SwizzleBailout() { // Test out-of-bounds non-constant indices. This is expected to throw. - var i4 = SIMD.int32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.int32x4.swizzle(i4, i, 3, 2, 0), [i + 1, 4, 3, 1]); + assertEqX4(SIMD.Int32x4.swizzle(i4, i, 3, 2, 0), [i + 1, 4, 3, 1]); } } diff --git a/js/src/jit-test/tests/SIMD/unary.js b/js/src/jit-test/tests/SIMD/unary.js index 8b2258eb78d..aebfedc0a71 100644 --- a/js/src/jit-test/tests/SIMD/unary.js +++ b/js/src/jit-test/tests/SIMD/unary.js @@ -13,20 +13,20 @@ var notf = (function() { })(); function f() { - var f4 = SIMD.float32x4(1, 2, 3, 4); - var i4 = SIMD.int32x4(1, 2, 3, 4); + var f4 = SIMD.Float32x4(1, 2, 3, 4); + var i4 = SIMD.Int32x4(1, 2, 3, 4); var BitOrZero = (x) => x | 0; for (var i = 0; i < 150; i++) { - assertEqX4(SIMD.float32x4.not(f4), unaryX4(notf, f4, Math.fround)); - assertEqX4(SIMD.float32x4.neg(f4), unaryX4((x) => -x, f4, Math.fround)); - assertEqX4(SIMD.float32x4.abs(f4), unaryX4(Math.abs, f4, Math.fround)); - assertEqX4(SIMD.float32x4.sqrt(f4), unaryX4(Math.sqrt, f4, Math.fround)); + assertEqX4(SIMD.Float32x4.not(f4), unaryX4(notf, f4, Math.fround)); + assertEqX4(SIMD.Float32x4.neg(f4), unaryX4((x) => -x, f4, Math.fround)); + assertEqX4(SIMD.Float32x4.abs(f4), unaryX4(Math.abs, f4, Math.fround)); + assertEqX4(SIMD.Float32x4.sqrt(f4), unaryX4(Math.sqrt, f4, Math.fround)); - assertEqX4(SIMD.float32x4.reciprocalApproximation(f4), unaryX4((x) => 1 / x, f4, Math.fround), assertNear); - assertEqX4(SIMD.float32x4.reciprocalSqrtApproximation(f4), unaryX4((x) => 1 / Math.sqrt(x), f4, Math.fround), assertNear); + assertEqX4(SIMD.Float32x4.reciprocalApproximation(f4), unaryX4((x) => 1 / x, f4, Math.fround), assertNear); + assertEqX4(SIMD.Float32x4.reciprocalSqrtApproximation(f4), unaryX4((x) => 1 / Math.sqrt(x), f4, Math.fround), assertNear); - assertEqX4(SIMD.int32x4.not(i4), unaryX4((x) => ~x, i4, BitOrZero)); - assertEqX4(SIMD.int32x4.neg(i4), unaryX4((x) => -x, i4, BitOrZero)); + assertEqX4(SIMD.Int32x4.not(i4), unaryX4((x) => ~x, i4, BitOrZero)); + assertEqX4(SIMD.Int32x4.neg(i4), unaryX4((x) => -x, i4, BitOrZero)); } } diff --git a/js/src/jit-test/tests/SIMD/unbox.js b/js/src/jit-test/tests/SIMD/unbox.js index a5e4babc17b..8d6a2035302 100644 --- a/js/src/jit-test/tests/SIMD/unbox.js +++ b/js/src/jit-test/tests/SIMD/unbox.js @@ -5,9 +5,9 @@ setJitCompilerOption("baseline.warmup.trigger", 10); setJitCompilerOption("ion.warmup.trigger", 30); var max = 40, pivot = 35; -var i32x4 = SIMD.int32x4; -var f32x4 = SIMD.float32x4; -var i32x4Add = SIMD.int32x4.add; +var i32x4 = SIMD.Int32x4; +var f32x4 = SIMD.Float32x4; +var i32x4Add = SIMD.Int32x4.add; var FakeSIMDType = function (o) { this.x = o.x; this.y = o.y; this.z = o.z; this.w = o.w; }; if (this.hasOwnProperty("TypedObject")) { @@ -111,16 +111,16 @@ for (i = 0; i < max; i++) { function add(i, v, w) { if (i % 2 == 0) { - SIMD.int32x4.add(v, w); + SIMD.Int32x4.add(v, w); } else { - SIMD.float32x4.add(v, w); + SIMD.Float32x4.add(v, w); } } var i = 0; var caught = false; - var f4 = SIMD.float32x4(1,2,3,4); - var i4 = SIMD.int32x4(1,2,3,4); + var f4 = SIMD.Float32x4(1,2,3,4); + var i4 = SIMD.Int32x4(1,2,3,4); try { for (; i < 200; i++) { if (i % 2 == 0) { diff --git a/js/src/jit-test/tests/TypedObject/bug1109911.js b/js/src/jit-test/tests/TypedObject/bug1109911.js deleted file mode 100644 index 6933b4cb29f..00000000000 --- a/js/src/jit-test/tests/TypedObject/bug1109911.js +++ /dev/null @@ -1,12 +0,0 @@ - -if (typeof TypedObject === "undefined") - quit(); - -var int32x4 = SIMD.int32x4; -var a = int32x4((4294967295), 200, 300, 400); -addCase( new Array(Math.pow(2,12)) ); -for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) {} -addCase( a ); -function addCase(object) { - object.length -} diff --git a/js/src/jit-test/tests/TypedObject/bug953108.js b/js/src/jit-test/tests/TypedObject/bug953108.js deleted file mode 100644 index e73ff458a99..00000000000 --- a/js/src/jit-test/tests/TypedObject/bug953108.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/licenses/publicdomain/ - */ - -if (!this.hasOwnProperty("TypedObject")) - quit(); - -var float32x4 = SIMD.float32x4; -float32x4.array(1); diff --git a/js/src/jit-test/tests/asm.js/bug1126251.js b/js/src/jit-test/tests/asm.js/bug1126251.js index 1573b9da701..b9053538ab6 100644 --- a/js/src/jit-test/tests/asm.js/bug1126251.js +++ b/js/src/jit-test/tests/asm.js/bug1126251.js @@ -21,10 +21,10 @@ if (!isSimdAvailable() || typeof SIMD === 'undefined') { var v = asmLink(asmCompile('global', ` "use asm"; var frd = global.Math.fround; - var float32x4 = global.SIMD.float32x4; - var splat = float32x4.splat; + var Float32x4 = global.SIMD.Float32x4; + var splat = Float32x4.splat; function e() { - var v = float32x4(0,0,0,0); + var v = Float32x4(0,0,0,0); var x = frd(0.); v = splat(.1e+71); x = v.x; @@ -40,8 +40,8 @@ assertEq(v, NaN); setJitCompilerOption("ion.gvn.enable", 0); var v = asmLink(asmCompile('global', ` "use asm"; - var float32x4 = global.SIMD.float32x4; - var splat = float32x4.splat; + var Float32x4 = global.SIMD.Float32x4; + var splat = Float32x4.splat; function e() { return +splat(.1e+71).x; } diff --git a/js/src/jit-test/tests/asm.js/simd-fbirds.js b/js/src/jit-test/tests/asm.js/simd-fbirds.js index 8dc9e7a21a5..bc3348eff55 100644 --- a/js/src/jit-test/tests/asm.js/simd-fbirds.js +++ b/js/src/jit-test/tests/asm.js/simd-fbirds.js @@ -56,8 +56,8 @@ var code = ` const getAccelDataSteps = imp.accelDataSteps | 0; var getActualBirds = imp.getActualBirds; - var i4 = global.SIMD.int32x4; - var f4 = global.SIMD.float32x4; + var i4 = global.SIMD.Int32x4; + var f4 = global.SIMD.Float32x4; var i4add = i4.add; var i4and = i4.and; var f4select = f4.select; diff --git a/js/src/jit-test/tests/asm.js/simd-mandelbrot.js b/js/src/jit-test/tests/asm.js/simd-mandelbrot.js index e742bfe5ecd..7fc03e1537b 100644 --- a/js/src/jit-test/tests/asm.js/simd-mandelbrot.js +++ b/js/src/jit-test/tests/asm.js/simd-mandelbrot.js @@ -28,9 +28,9 @@ var moduleCode = ` "use asm" var b8 = new global.Uint8Array(buffer); var toF = global.Math.fround; - var i4 = global.SIMD.int32x4; + var i4 = global.SIMD.Int32x4; var ci4 = i4.check; - var f4 = global.SIMD.float32x4; + var f4 = global.SIMD.Float32x4; var i4add = i4.add; var i4and = i4.and; var f4add = f4.add; diff --git a/js/src/jit-test/tests/asm.js/testBug1099216.js b/js/src/jit-test/tests/asm.js/testBug1099216.js index bf120723d64..f27bdb4dd94 100644 --- a/js/src/jit-test/tests/asm.js/testBug1099216.js +++ b/js/src/jit-test/tests/asm.js/testBug1099216.js @@ -6,7 +6,7 @@ if (typeof SIMD === 'undefined' || !isSimdAvailable()) { (function(global) { "use asm"; var frd = global.Math.fround; - var fx4 = global.SIMD.float32x4; + var fx4 = global.SIMD.Float32x4; var fsp = fx4.splat; function s(){} function d(x){x=fx4(x);} @@ -21,7 +21,7 @@ if (typeof SIMD === 'undefined' || !isSimdAvailable()) { (function(m) { "use asm" - var g = m.SIMD.int32x4 + var g = m.SIMD.Int32x4 var h = g.select function f() { var x = g(0, 0, 0, 0) @@ -34,7 +34,7 @@ if (typeof SIMD === 'undefined' || !isSimdAvailable()) { t = (function(global) { "use asm" var toF = global.Math.fround - var f4 = global.SIMD.float32x4 + var f4 = global.SIMD.Float32x4 function p(x, y, width, value, max_iterations) { x = x | 0 y = y | 0 diff --git a/js/src/jit-test/tests/asm.js/testResize.js b/js/src/jit-test/tests/asm.js/testResize.js index 4e0e2d9bf9b..157b0d1cd18 100644 --- a/js/src/jit-test/tests/asm.js/testResize.js +++ b/js/src/jit-test/tests/asm.js/testResize.js @@ -168,7 +168,7 @@ assertAsmTypeFail('glob', 'ffis', 'b', SETUP + 'function f() { var i = 0; i32[(( assertAsmTypeFail('glob', 'ffis', 'b', SETUP + 'function f() { var i = 0; i32[((i32[i>>2]|0) + (g()|0)) >> 2] = 0 } function g() { return 0 } return f'); assertAsmTypeFail('glob', 'ffis', 'b', SETUP + 'function f() { var i = 0; i32[i >> 2] = (i32[i>>2]|0) + (g()|0) } function g() { return 0 } return f'); if (isSimdAvailable() && typeof SIMD !== 'undefined') - asmCompile('glob', 'ffis', 'b', USE_ASM + IMPORT2 + 'var i4 = glob.SIMD.int32x4; var add = i4.add;' + CHANGE_FUN + 'function f(i) { i=i|0; i32[i4(i,1,2,i).x >> 2]; i32[add(i4(0,0,0,0),i4(1,1,1,1)).x >> 2]; } return f'); + asmCompile('glob', 'ffis', 'b', USE_ASM + IMPORT2 + 'var i4 = glob.SIMD.Int32x4; var add = i4.add;' + CHANGE_FUN + 'function f(i) { i=i|0; i32[i4(i,1,2,i).x >> 2]; i32[add(i4(0,0,0,0),i4(1,1,1,1)).x >> 2]; } return f'); // Tests for constant heap accesses when change-heap is used diff --git a/js/src/jit-test/tests/asm.js/testSIMD-load-store.js b/js/src/jit-test/tests/asm.js/testSIMD-load-store.js index cccf5771c2f..9d7a9271784 100644 --- a/js/src/jit-test/tests/asm.js/testSIMD-load-store.js +++ b/js/src/jit-test/tests/asm.js/testSIMD-load-store.js @@ -31,7 +31,7 @@ function assertEqX4(real, expected, assertFunc) { try { // Load / Store -var IMPORTS = USE_ASM + 'var H=new glob.Uint8Array(heap); var i4=glob.SIMD.int32x4; var ci4=i4.check; var load=i4.load; var store=i4.store;'; +var IMPORTS = USE_ASM + 'var H=new glob.Uint8Array(heap); var i4=glob.SIMD.Int32x4; var ci4=i4.check; var load=i4.load; var store=i4.store;'; // Bad number of args assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "function f(){load();} return f"); @@ -45,7 +45,7 @@ assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "function f(){var i=0.;load(H assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "var H2=new glob.Int32Array(heap); function f(){var i=0;load(H2, i)} return f"); assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "var H2=42; function f(){var i=0;load(H2, i)} return f"); assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "function f(){var i=0;load(H2, i)} return f"); -assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "var f4=glob.SIMD.float32x4; function f(){var i=0;var vec=f4(1,2,3,4); store(H, i, vec)} return f"); +assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "var f4=glob.SIMD.Float32x4; function f(){var i=0;var vec=f4(1,2,3,4); store(H, i, vec)} return f"); // Bad coercions of returned values assertAsmTypeFail('glob', 'ffi', 'heap', IMPORTS + "function f(){var i=0;return load(H, i)|0;} return f"); @@ -77,12 +77,12 @@ var loadStoreCode = ` var H = new glob.Uint8Array(heap); - var i4 = glob.SIMD.int32x4; + var i4 = glob.SIMD.Int32x4; var i4load = i4.load; var i4store = i4.store; var ci4 = i4.check; - var f4 = glob.SIMD.float32x4; + var f4 = glob.SIMD.Float32x4; var f4load = f4.load; var f4store = f4.store; var cf4 = f4.check; @@ -159,7 +159,7 @@ assertThrowsInstanceOf(() => f32l(SIZE - 3), RangeError); var code = ` "use asm"; - var f4 = glob.SIMD.float32x4; + var f4 = glob.SIMD.Float32x4; var f4l = f4.load; var u8 = new glob.Uint8Array(heap); @@ -183,8 +183,8 @@ assertThrowsInstanceOf(() => asmLink(asmCompile('glob', 'ffi', 'heap', code), th // Float32x4.store function f32s(n, v) { return m.f32s((n|0) << 2 | 0, v); }; -var vec = SIMD.float32x4(5,6,7,8); -var vec2 = SIMD.float32x4(0,1,2,3); +var vec = SIMD.Float32x4(5,6,7,8); +var vec2 = SIMD.Float32x4(0,1,2,3); reset(); f32s(0, vec); @@ -242,8 +242,8 @@ assertThrowsInstanceOf(() => i32(SIZE - 3), RangeError); // Int32x4.store function i32s(n, v) { return m.i32s((n|0) << 2 | 0, v); }; -var vec = SIMD.int32x4(5,6,7,8); -var vec2 = SIMD.int32x4(0,1,2,3); +var vec = SIMD.Int32x4(5,6,7,8); +var vec2 = SIMD.Int32x4(0,1,2,3); reset(); i32s(0, vec); @@ -488,26 +488,26 @@ function TestPartialStores(m, typedArray, typeName, x, y, z, w) { } var f32 = new Float32Array(SIZE); -var mfloat32x4 = asmLink(asmCompile('glob', 'ffi', 'heap', MakeCodeFor('float32x4')), this, null, f32.buffer); +var mFloat32x4 = asmLink(asmCompile('glob', 'ffi', 'heap', MakeCodeFor('Float32x4')), this, null, f32.buffer); -TestPartialLoads(mfloat32x4, f32, +TestPartialLoads(mFloat32x4, f32, (i) => i + 1, (i) => Math.fround(13.37), (i) => Math.fround(1/i), (i) => Math.fround(Math.sqrt(0x2000 - i))); -TestPartialStores(mfloat32x4, f32, 'float32x4', 42, -0, NaN, 0.1337); +TestPartialStores(mFloat32x4, f32, 'Float32x4', 42, -0, NaN, 0.1337); var i32 = new Int32Array(f32.buffer); -var mint32x4 = asmLink(asmCompile('glob', 'ffi', 'heap', MakeCodeFor('int32x4')), this, null, i32.buffer); +var mInt32x4 = asmLink(asmCompile('glob', 'ffi', 'heap', MakeCodeFor('Int32x4')), this, null, i32.buffer); -TestPartialLoads(mint32x4, i32, +TestPartialLoads(mInt32x4, i32, (i) => i + 1 | 0, (i) => -i | 0, (i) => i * 2 | 0, (i) => 42); -TestPartialStores(mint32x4, i32, 'int32x4', 42, -3, 13, 37); +TestPartialStores(mInt32x4, i32, 'Int32x4', 42, -3, 13, 37); })(); diff --git a/js/src/jit-test/tests/asm.js/testSIMD.js b/js/src/jit-test/tests/asm.js/testSIMD.js index 301ca294a83..6697f1484d8 100644 --- a/js/src/jit-test/tests/asm.js/testSIMD.js +++ b/js/src/jit-test/tests/asm.js/testSIMD.js @@ -10,12 +10,12 @@ if (!isSimdAvailable() || typeof SIMD === 'undefined') { quit(0); } -const I32 = 'var i4 = glob.SIMD.int32x4;' +const I32 = 'var i4 = glob.SIMD.Int32x4;' const CI32 = 'var ci4 = i4.check;' const I32A = 'var i4a = i4.add;' const I32S = 'var i4s = i4.sub;' const I32M = 'var i4m = i4.mul;' -const F32 = 'var f4 = glob.SIMD.float32x4;' +const F32 = 'var f4 = glob.SIMD.Float32x4;' const CF32 = 'var cf4 = f4.check;' const F32A = 'var f4a = f4.add;' const F32S = 'var f4s = f4.sub;' @@ -57,10 +57,10 @@ try { // 1. Constructors // 1.1 Compilation -assertAsmTypeFail('glob', USE_ASM + "var i4 = int32x4 ; return {}") ; -assertAsmTypeFail('glob', USE_ASM + "var i4 = glob.int32x4 ; return {}") ; -assertAsmTypeFail('glob', USE_ASM + "var i4 = glob.globglob.int32x4 ; return {}") ; -assertAsmTypeFail('glob', USE_ASM + "var i4 = glob.Math.int32x4 ; return {}") ; +assertAsmTypeFail('glob', USE_ASM + "var i4 = Int32x4 ; return {}") ; +assertAsmTypeFail('glob', USE_ASM + "var i4 = glob.Int32x4 ; return {}") ; +assertAsmTypeFail('glob', USE_ASM + "var i4 = glob.globglob.Int32x4 ; return {}") ; +assertAsmTypeFail('glob', USE_ASM + "var i4 = glob.Math.Int32x4 ; return {}") ; assertAsmTypeFail('glob', USE_ASM + "var herd = glob.SIMD.ponyX4 ; return {}") ; // 1.2 Linking @@ -68,22 +68,22 @@ assertAsmLinkAlwaysFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {}); assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: 42}); assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: Math.fround}); assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {int32x4: 42}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {int32x4: Math.fround}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {int32x4: new Array}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {int32x4: SIMD.float32x4}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {Int32x4: 42}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {Int32x4: Math.fround}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {Int32x4: new Array}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {Int32x4: SIMD.Float32x4}}); [Type, int32] = [TypedObject.StructType, TypedObject.int32]; var MyStruct = new Type({'x': int32, 'y': int32, 'z': int32, 'w': int32}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {int32x4: MyStruct}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {int32x4: new MyStruct}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {Int32x4: MyStruct}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + I32 + "return {}"), {SIMD: {Int32x4: new MyStruct}}); -assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + "function f() {} return f"), {SIMD:{int32x4: SIMD.int32x4}})(), undefined); +assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + "function f() {} return f"), {SIMD:{Int32x4: SIMD.Int32x4}})(), undefined); -assertAsmLinkFail(asmCompile('glob', USE_ASM + F32 + "return {}"), {SIMD: {float32x4: 42}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + F32 + "return {}"), {SIMD: {float32x4: Math.fround}}); -assertAsmLinkFail(asmCompile('glob', USE_ASM + F32 + "return {}"), {SIMD: {float32x4: new Array}}); -assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + "function f() {} return f"), {SIMD:{float32x4: SIMD.float32x4}})(), undefined); +assertAsmLinkFail(asmCompile('glob', USE_ASM + F32 + "return {}"), {SIMD: {Float32x4: 42}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + F32 + "return {}"), {SIMD: {Float32x4: Math.fround}}); +assertAsmLinkFail(asmCompile('glob', USE_ASM + F32 + "return {}"), {SIMD: {Float32x4: new Array}}); +assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + "function f() {} return f"), {SIMD:{Float32x4: SIMD.Float32x4}})(), undefined); // 1.3 Correctness // 1.3.1 Local variables declarations @@ -159,7 +159,7 @@ function CheckSignMask(innerBody, coerceBefore, coerceAfter, expected) { var lanes = ['x', 'y', 'z', 'w']; for (var i = 0; i < lanes.length; i++) { var lane = lanes[i]; - var laneCheckCode = `"use asm"; var i4=glob.SIMD.int32x4; var f4=glob.SIMD.float32x4; function f() {${innerBody}; return ${coerceBefore}x.${lane}${coerceAfter} } return f;`; + var laneCheckCode = `"use asm"; var i4=glob.SIMD.Int32x4; var f4=glob.SIMD.Float32x4; function f() {${innerBody}; return ${coerceBefore}x.${lane}${coerceAfter} } return f;`; assertEq(asmLink(asmCompile('glob', laneCheckCode), this)(), expected[i]); } } @@ -244,13 +244,13 @@ assertAsmTypeFail('glob', USE_ASM + F32 + I32 + "function f() {var x=f4(1,2,3,4) CheckF4('', 'var x=f4(1,2,3,4); var y=f4(4,3,2,1); x=3?y:x', [4, 3, 2, 1]); assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(x) {x=x|0; var v=f4(1,2,3,4); var w=f4(5,6,7,8); return cf4(x?w:v);} return f"), this)(1), [5,6,7,8]); -assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(v) {v=cf4(v); var w=f4(5,6,7,8); return cf4(4?w:v);} return f"), this)(SIMD.float32x4(1,2,3,4)), [5,6,7,8]); -assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(v, x) {v=cf4(v); x=x|0; var w=f4(5,6,7,8); return cf4(x?w:v);} return f"), this)(SIMD.float32x4(1,2,3,4), 0), [1,2,3,4]); +assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(v) {v=cf4(v); var w=f4(5,6,7,8); return cf4(4?w:v);} return f"), this)(SIMD.Float32x4(1,2,3,4)), [5,6,7,8]); +assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(v, x) {v=cf4(v); x=x|0; var w=f4(5,6,7,8); return cf4(x?w:v);} return f"), this)(SIMD.Float32x4(1,2,3,4), 0), [1,2,3,4]); CheckI4('', 'var x=i4(1,2,3,4); var y=i4(4,3,2,1); x=(x.x|0)?y:x', [4, 3, 2, 1]); assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(x) {x=x|0; var v=i4(1,2,3,4); var w=i4(5,6,7,8); return ci4(x?w:v);} return f"), this)(1), [5,6,7,8]); -assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(v) {v=ci4(v); var w=i4(5,6,7,8); return ci4(4?w:v);} return f"), this)(SIMD.int32x4(1,2,3,4)), [5,6,7,8]); -assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(v, x) {v=ci4(v); x=x|0; var w=i4(5,6,7,8); return ci4(x?w:v);} return f"), this)(SIMD.int32x4(1,2,3,4), 0), [1,2,3,4]); +assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(v) {v=ci4(v); var w=i4(5,6,7,8); return ci4(4?w:v);} return f"), this)(SIMD.Int32x4(1,2,3,4)), [5,6,7,8]); +assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(v, x) {v=ci4(v); x=x|0; var w=i4(5,6,7,8); return ci4(x?w:v);} return f"), this)(SIMD.Int32x4(1,2,3,4), 0), [1,2,3,4]); // 1.3.4 Return values assertAsmTypeFail('glob', USE_ASM + I32 + CI32 + "function f() {var x=1; return ci4(x)} return f"); @@ -271,7 +271,7 @@ assertAsmTypeFail('glob', USE_ASM + I32 + CI32 + FROUND + "function f() {ci4(f32 assertAsmTypeFail('glob', USE_ASM + I32 + CI32 + F32 + CF32 + "function f(x) {x=cf4(x); ci4(x);} return f"); assertAsmTypeFail('glob', USE_ASM + I32 + CI32 + "function f(x) {x=ci4(x); return 1 + ci4(x) | 0;} return f"); -var i32x4 = SIMD.int32x4(1, 3, 3, 7); +var i32x4 = SIMD.Int32x4(1, 3, 3, 7); assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(x) {x=ci4(x)} return f"), this)(i32x4), undefined); assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(x) {x=ci4(x); return ci4(x);} return f"), this)(i32x4), [1,3,3,7]); @@ -283,7 +283,7 @@ assertAsmTypeFail('glob', USE_ASM + F32 + CF32 + FROUND + "function f() {cf4(f32 assertAsmTypeFail('glob', USE_ASM + F32 + CF32 + F32 + CF32 + "function f(x) {x=cf4(x); cf4(x);} return f"); assertAsmTypeFail('glob', USE_ASM + F32 + CF32 + "function f(x) {x=cf4(x); return 1 + cf4(x) | 0;} return f"); -var f32x4 = SIMD.float32x4(13.37, 42.42, -0, NaN); +var f32x4 = SIMD.Float32x4(13.37, 42.42, -0, NaN); assertEq(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(x) {x=cf4(x)} return f"), this)(f32x4), undefined); assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + "function f(x) {x=cf4(x); return cf4(x);} return f"), this)(f32x4), [13.37, 42.42, -0, NaN].map(Math.fround)); @@ -318,14 +318,14 @@ assertCaught(f); assertCaught(f, 1); assertCaught(f, {}); assertCaught(f, "I sincerely am a SIMD typed object."); -assertCaught(f, SIMD.int32x4(1,2,3,4)); +assertCaught(f, SIMD.Int32x4(1,2,3,4)); var f = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + "function f(x) {x=ci4(x); return ci4(x);} return f"), this); assertCaught(f); assertCaught(f, 1); assertCaught(f, {}); assertCaught(f, "I sincerely am a SIMD typed object."); -assertCaught(f, SIMD.float32x4(4,3,2,1)); +assertCaught(f, SIMD.Float32x4(4,3,2,1)); // 1.3.6 Globals // 1.3.6.1 Local globals @@ -378,40 +378,40 @@ CheckF4('var x=f4(0,0,0,0); var y=42; var z=3.9; var w=13.37', 'x=f4(1,2,3,4); y // 1.3.6.2 Imported globals // Read -var int32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + I32 + CI32 + "var g=ci4(ffi.g); function f() {return ci4(g)} return f"), this, {g: SIMD.int32x4(1,2,3,4)})(); -assertEq(int32x4.x, 1); -assertEq(int32x4.y, 2); -assertEq(int32x4.z, 3); -assertEq(int32x4.w, 4); +var Int32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + I32 + CI32 + "var g=ci4(ffi.g); function f() {return ci4(g)} return f"), this, {g: SIMD.Int32x4(1,2,3,4)})(); +assertEq(Int32x4.x, 1); +assertEq(Int32x4.y, 2); +assertEq(Int32x4.z, 3); +assertEq(Int32x4.w, 4); -for (var v of [1, {}, "totally legit SIMD variable", SIMD.float32x4(1,2,3,4)]) +for (var v of [1, {}, "totally legit SIMD variable", SIMD.Float32x4(1,2,3,4)]) assertCaught(asmCompile('glob', 'ffi', USE_ASM + I32 + CI32 + "var g=ci4(ffi.g); function f() {return ci4(g)} return f"), this, {g: v}); -var float32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + F32 + CF32 + "var g=cf4(ffi.g); function f() {return cf4(g)} return f"), this, {g: SIMD.float32x4(1,2,3,4)})(); -assertEq(float32x4.x, 1); -assertEq(float32x4.y, 2); -assertEq(float32x4.z, 3); -assertEq(float32x4.w, 4); +var Float32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + F32 + CF32 + "var g=cf4(ffi.g); function f() {return cf4(g)} return f"), this, {g: SIMD.Float32x4(1,2,3,4)})(); +assertEq(Float32x4.x, 1); +assertEq(Float32x4.y, 2); +assertEq(Float32x4.z, 3); +assertEq(Float32x4.w, 4); -for (var v of [1, {}, "totally legit SIMD variable", SIMD.int32x4(1,2,3,4)]) +for (var v of [1, {}, "totally legit SIMD variable", SIMD.Int32x4(1,2,3,4)]) assertCaught(asmCompile('glob', 'ffi', USE_ASM + F32 + CF32 + "var g=cf4(ffi.g); function f() {return cf4(g)} return f"), this, {g: v}); // Write -var int32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + I32 + CI32 + "var g=ci4(ffi.g); function f() {g=i4(4,5,6,7); return ci4(g)} return f"), this, {g: SIMD.int32x4(1,2,3,4)})(); -assertEq(int32x4.x, 4); -assertEq(int32x4.y, 5); -assertEq(int32x4.z, 6); -assertEq(int32x4.w, 7); +var Int32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + I32 + CI32 + "var g=ci4(ffi.g); function f() {g=i4(4,5,6,7); return ci4(g)} return f"), this, {g: SIMD.Int32x4(1,2,3,4)})(); +assertEq(Int32x4.x, 4); +assertEq(Int32x4.y, 5); +assertEq(Int32x4.z, 6); +assertEq(Int32x4.w, 7); -var float32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + F32 + CF32 + "var g=cf4(ffi.g); function f() {g=f4(4.,5.,6.,7.); return cf4(g)} return f"), this, {g: SIMD.float32x4(1,2,3,4)})(); -assertEq(float32x4.x, 4); -assertEq(float32x4.y, 5); -assertEq(float32x4.z, 6); -assertEq(float32x4.w, 7); +var Float32x4 = asmLink(asmCompile('glob', 'ffi', USE_ASM + F32 + CF32 + "var g=cf4(ffi.g); function f() {g=f4(4.,5.,6.,7.); return cf4(g)} return f"), this, {g: SIMD.Float32x4(1,2,3,4)})(); +assertEq(Float32x4.x, 4); +assertEq(Float32x4.y, 5); +assertEq(Float32x4.z, 6); +assertEq(Float32x4.w, 7); // 2. SIMD operations // 2.1 Compilation -assertAsmTypeFail('glob', USE_ASM + "var add = int32x4.add; return {}"); +assertAsmTypeFail('glob', USE_ASM + "var add = Int32x4.add; return {}"); assertAsmTypeFail('glob', USE_ASM + I32A + I32 + "return {}"); assertAsmTypeFail('glob', USE_ASM + "var g = 3; var add = g.add; return {}"); assertAsmTypeFail('glob', USE_ASM + I32 + "var func = i4.doTheHarlemShake; return {}"); @@ -422,14 +422,14 @@ assertAsmTypeFail('glob', USE_ASM + "var f32 = glob.Math.fround; var i4a = f32.a assertAsmLinkAlwaysFail(asmCompile('glob', USE_ASM + I32 + I32A + "function f() {} return f"), {}); assertAsmLinkAlwaysFail(asmCompile('glob', USE_ASM + I32 + I32A + "function f() {} return f"), {SIMD: Math.fround}); -var oldInt32x4Add = SIMD.int32x4.add; +var oldInt32x4Add = SIMD.Int32x4.add; var code = asmCompile('glob', USE_ASM + I32 + I32A + "return {}"); -for (var v of [42, Math.fround, SIMD.float32x4.add, function(){}, SIMD.int32x4.mul]) { - SIMD.int32x4.add = v; - assertAsmLinkFail(code, {SIMD: {int32x4: SIMD.int32x4}}); +for (var v of [42, Math.fround, SIMD.Float32x4.add, function(){}, SIMD.Int32x4.mul]) { + SIMD.Int32x4.add = v; + assertAsmLinkFail(code, {SIMD: {Int32x4: SIMD.Int32x4}}); } -SIMD.int32x4.add = oldInt32x4Add; // finally replace the add function with the original one -assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + I32A + "function f() {} return f"), {SIMD: {int32x4: SIMD.int32x4}})(), undefined); +SIMD.Int32x4.add = oldInt32x4Add; // finally replace the add function with the original one +assertEq(asmLink(asmCompile('glob', USE_ASM + I32 + I32A + "function f() {} return f"), {SIMD: {Int32x4: SIMD.Int32x4}})(), undefined); // 2.3. Binary arithmetic operations // 2.3.1 Additions @@ -496,23 +496,23 @@ CheckF4(F32M, 'var x=f4(1,2,3,4); var y=f4(4,3,5,2); x=f4m(x,y)', [4,6,15,8]); CheckF4(F32M, 'var x=f4(13.37,2,3,4); var y=f4(4,3,5,2); x=f4m(x,y)', [Math.fround(13.37) * 4,6,15,8]); CheckF4(F32M, 'var x=f4(13.37,2,3,4); var y=f4(4,3,5,2); x=cf4(f4m(x,y))', [Math.fround(13.37) * 4,6,15,8]); -var f32x4 = SIMD.float32x4(0, NaN, -0, NaN); -var another = SIMD.float32x4(NaN, -1, -0, NaN); +var f32x4 = SIMD.Float32x4(0, NaN, -0, NaN); +var another = SIMD.Float32x4(NaN, -1, -0, NaN); assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32M + CF32 + "function f(x, y) {x=cf4(x); y=cf4(y); x=f4m(x,y); return cf4(x);} return f"), this)(f32x4, another), [NaN, NaN, 0, NaN]); CheckF4(F32D, 'var x=f4(1,2,3,4); x=f4d(x,x)', [1,1,1,1]); CheckF4(F32D, 'var x=f4(1,2,3,4); var y=f4(4,3,5,2); x=f4d(x,y)', [1/4,2/3,3/5,2]); CheckF4(F32D, 'var x=f4(13.37,1,1,4); var y=f4(4,0,-0.,2); x=f4d(x,y)', [Math.fround(13.37) / 4,+Infinity,-Infinity,2]); -var f32x4 = SIMD.float32x4(0, 0, -0, NaN); -var another = SIMD.float32x4(0, -0, 0, 0); +var f32x4 = SIMD.Float32x4(0, 0, -0, NaN); +var another = SIMD.Float32x4(0, -0, 0, 0); assertEqX4(asmLink(asmCompile('glob', USE_ASM + F32 + F32D + CF32 + "function f(x,y) {x=cf4(x); y=cf4(y); x=f4d(x,y); return cf4(x);} return f"), this)(f32x4, another), [NaN, NaN, NaN, NaN]); // Unary arithmetic operators function CheckUnaryF4(op, checkFunc, assertFunc) { var _ = asmLink(asmCompile('glob', USE_ASM + F32 + CF32 + 'var op=f4.' + op + '; function f(x){x=cf4(x); return cf4(op(x)); } return f'), this); return function(input) { - var simd = SIMD.float32x4(input[0], input[1], input[2], input[3]); + var simd = SIMD.Float32x4(input[0], input[1], input[2], input[3]); var exp = input.map(Math.fround).map(checkFunc).map(Math.fround); var obs = _(simd); @@ -523,7 +523,7 @@ function CheckUnaryF4(op, checkFunc, assertFunc) { function CheckUnaryI4(op, checkFunc) { var _ = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + 'var op=i4.' + op + '; function f(x){x=ci4(x); return ci4(op(x)); } return f'), this); return function(input) { - var simd = SIMD.int32x4(input[0], input[1], input[2], input[3]); + var simd = SIMD.Int32x4(input[0], input[1], input[2], input[3]); assertEqX4(_(simd), input.map(checkFunc).map(function(x) { return x | 0})); } } @@ -724,22 +724,22 @@ assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CVTIF + "function f() {var x=i4( assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CVTIF + "function f() {var x=f4(1,2,3,4); x=cvt(x);} return f"); var f = asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + CI32 + CVTIF + 'function f(x){x=ci4(x); var y=f4(0,0,0,0); y=cvt(x); return cf4(y);} return f'), this); -assertEqX4(f(SIMD.int32x4(1,2,3,4)), [1, 2, 3, 4]); -assertEqX4(f(SIMD.int32x4(0,INT32_MIN,INT32_MAX,-1)), [0, Math.fround(INT32_MIN), Math.fround(INT32_MAX), -1]); +assertEqX4(f(SIMD.Int32x4(1,2,3,4)), [1, 2, 3, 4]); +assertEqX4(f(SIMD.Int32x4(0,INT32_MIN,INT32_MAX,-1)), [0, Math.fround(INT32_MIN), Math.fround(INT32_MAX), -1]); var f = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + F32 + CF32 + CVTFI + 'function f(x){x=cf4(x); var y=i4(0,0,0,0); y=cvt(x); return ci4(y);} return f'), this); -assertEqX4(f(SIMD.float32x4(1,2,3,4)), [1, 2, 3, 4]); +assertEqX4(f(SIMD.Float32x4(1,2,3,4)), [1, 2, 3, 4]); // Test that INT32_MIN (exactly representable as an float32) and the first // integer representable as an float32 can be converted. -assertEqX4(f(SIMD.float32x4(INT32_MIN, INT32_MAX - 64, -0, 0)), [INT32_MIN, INT32_MAX - 64, 0, 0].map(Math.fround)); +assertEqX4(f(SIMD.Float32x4(INT32_MIN, INT32_MAX - 64, -0, 0)), [INT32_MIN, INT32_MAX - 64, 0, 0].map(Math.fround)); // Test boundaries: first integer less than INT32_MIN and representable as a float32 -assertThrowsInstanceOf(() => f(SIMD.float32x4(INT32_MIN - 129, 0, 0, 0)), RangeError); +assertThrowsInstanceOf(() => f(SIMD.Float32x4(INT32_MIN - 129, 0, 0, 0)), RangeError); // INT_MAX + 1 -assertThrowsInstanceOf(() => f(SIMD.float32x4(Math.pow(2, 31), 0, 0, 0)), RangeError); +assertThrowsInstanceOf(() => f(SIMD.Float32x4(Math.pow(2, 31), 0, 0, 0)), RangeError); // Special values -assertThrowsInstanceOf(() => f(SIMD.float32x4(NaN, 0, 0, 0)), RangeError); -assertThrowsInstanceOf(() => f(SIMD.float32x4(Infinity, 0, 0, 0)), RangeError); -assertThrowsInstanceOf(() => f(SIMD.float32x4(-Infinity, 0, 0, 0)), RangeError); +assertThrowsInstanceOf(() => f(SIMD.Float32x4(NaN, 0, 0, 0)), RangeError); +assertThrowsInstanceOf(() => f(SIMD.Float32x4(Infinity, 0, 0, 0)), RangeError); +assertThrowsInstanceOf(() => f(SIMD.Float32x4(-Infinity, 0, 0, 0)), RangeError); // Cast operators const CVTIFB = 'var cvt=f4.fromInt32x4Bits;'; @@ -771,20 +771,20 @@ assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CVTIFB + "function f() {var x=i4 assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CVTIFB + "function f() {var x=f4(1,2,3,4); x=cvt(x);} return f"); var f = asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CVTIFB + CF32 + CI32 + 'function f(x){x=ci4(x); var y=f4(0,0,0,0); y=cvt(x); return cf4(y);} return f'), this); -assertEqX4(f(SIMD.int32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromInt32Bits)); -assertEqX4(f(SIMD.int32x4(0,INT32_MIN,INT32_MAX,-1)), [0, INT32_MIN, INT32_MAX, -1].map(cast.fromInt32Bits)); +assertEqX4(f(SIMD.Int32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromInt32Bits)); +assertEqX4(f(SIMD.Int32x4(0,INT32_MIN,INT32_MAX,-1)), [0, INT32_MIN, INT32_MAX, -1].map(cast.fromInt32Bits)); var f = asmLink(asmCompile('glob', USE_ASM + I32 + F32 + F32A + CVTIFB + CF32 + CI32 + 'function f(x){x=ci4(x); var y=f4(0,0,0,0); var z=f4(1,1,1,1); y=cvt(x); y=f4a(y, z); return cf4(y)} return f'), this); -assertEqX4(f(SIMD.int32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromInt32Bits).map((x) => x+1)); -assertEqX4(f(SIMD.int32x4(0,INT32_MIN,INT32_MAX,-1)), [0, INT32_MIN, INT32_MAX, -1].map(cast.fromInt32Bits).map((x) => x+1)); +assertEqX4(f(SIMD.Int32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromInt32Bits).map((x) => x+1)); +assertEqX4(f(SIMD.Int32x4(0,INT32_MIN,INT32_MAX,-1)), [0, INT32_MIN, INT32_MAX, -1].map(cast.fromInt32Bits).map((x) => x+1)); var f = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + F32 + CF32 + CVTFIB + 'function f(x){x=cf4(x); var y=i4(0,0,0,0); y=cvt(x); return ci4(y);} return f'), this); -assertEqX4(f(SIMD.float32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromFloat32Bits)); -assertEqX4(f(SIMD.float32x4(-0,NaN,+Infinity,-Infinity)), [-0, NaN, +Infinity, -Infinity].map(cast.fromFloat32Bits)); +assertEqX4(f(SIMD.Float32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromFloat32Bits)); +assertEqX4(f(SIMD.Float32x4(-0,NaN,+Infinity,-Infinity)), [-0, NaN, +Infinity, -Infinity].map(cast.fromFloat32Bits)); var f = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + F32 + CF32 + I32A + CVTFIB + 'function f(x){x=cf4(x); var y=i4(0,0,0,0); var z=i4(1,1,1,1); y=cvt(x); y=i4a(y,z); return ci4(y);} return f'), this); -assertEqX4(f(SIMD.float32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromFloat32Bits).map((x) => x+1)); -assertEqX4(f(SIMD.float32x4(-0,NaN,+Infinity,-Infinity)), [-0, NaN, +Infinity, -Infinity].map(cast.fromFloat32Bits).map((x) => x+1)); +assertEqX4(f(SIMD.Float32x4(1,2,3,4)), [1, 2, 3, 4].map(cast.fromFloat32Bits).map((x) => x+1)); +assertEqX4(f(SIMD.Float32x4(-0,NaN,+Infinity,-Infinity)), [-0, NaN, +Infinity, -Infinity].map(cast.fromFloat32Bits).map((x) => x+1)); // Bitwise ops const ANDI32 = 'var andd=i4.and;'; @@ -908,37 +908,37 @@ assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32BSEL + "fu // Specific bitselect tests var masks = [ - SIMD.int32x4(1337, 0x1337, 0x42, 42), - SIMD.int32x4(0x00FF1CE, 0xBAADF00D, 0xDEADBEEF, 0xCAFED00D), - SIMD.int32x4(0xD15EA5E, 0xDEADC0DE, 0xFACEB00C, 0x4B1D4B1D) + SIMD.Int32x4(1337, 0x1337, 0x42, 42), + SIMD.Int32x4(0x00FF1CE, 0xBAADF00D, 0xDEADBEEF, 0xCAFED00D), + SIMD.Int32x4(0xD15EA5E, 0xDEADC0DE, 0xFACEB00C, 0x4B1D4B1D) ]; var simdToArray = (vec) => [vec.x, vec.y, vec.z, vec.w]; var inputs = [ - [SIMD.int32x4(0,4,9,16), SIMD.int32x4(1,2,3,4)], - [SIMD.int32x4(-1, 2, INT32_MAX, INT32_MIN), SIMD.int32x4(INT32_MAX, -4, INT32_MIN, 42)] + [SIMD.Int32x4(0,4,9,16), SIMD.Int32x4(1,2,3,4)], + [SIMD.Int32x4(-1, 2, INT32_MAX, INT32_MIN), SIMD.Int32x4(INT32_MAX, -4, INT32_MIN, 42)] ]; var i32bsel = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32BSEL + "function f(mask, ifTrue, ifFalse) {mask=ci4(mask); ifTrue=ci4(ifTrue); ifFalse=ci4(ifFalse); return ci4(i4sel(mask,ifTrue,ifFalse)); } return f"), this) for (var mask of masks) { for (var [x, y] of inputs) { - assertEqX4(i32bsel(mask, x, y), simdToArray(SIMD.int32x4.bitselect(mask, x, y))); + assertEqX4(i32bsel(mask, x, y), simdToArray(SIMD.Int32x4.bitselect(mask, x, y))); } } inputs = [ - [SIMD.float32x4(0.125,4.25,9.75,16.125), SIMD.float32x4(1.5,2.75,3.25,4.5)], - [SIMD.float32x4(-1.5,-0,NaN,-Infinity), SIMD.float32x4(1,-2,13.37,3.13)], - [SIMD.float32x4(1.5,2.75,NaN,Infinity), SIMD.float32x4(-NaN,-Infinity,9.75,16.125)] + [SIMD.Float32x4(0.125,4.25,9.75,16.125), SIMD.Float32x4(1.5,2.75,3.25,4.5)], + [SIMD.Float32x4(-1.5,-0,NaN,-Infinity), SIMD.Float32x4(1,-2,13.37,3.13)], + [SIMD.Float32x4(1.5,2.75,NaN,Infinity), SIMD.Float32x4(-NaN,-Infinity,9.75,16.125)] ]; var f32bsel = asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CI32 + CF32 + F32BSEL + "function f(mask, ifTrue, ifFalse) {mask=ci4(mask); ifTrue=cf4(ifTrue); ifFalse=cf4(ifFalse); return cf4(f4sel(mask,ifTrue,ifFalse)); } return f"), this) for (var mask of masks) for (var [x, y] of inputs) - assertEqX4(f32bsel(mask, x, y), simdToArray(SIMD.float32x4.bitselect(mask, x, y))); + assertEqX4(f32bsel(mask, x, y), simdToArray(SIMD.Float32x4.bitselect(mask, x, y))); // Splat const I32SPLAT = 'var splat=i4.splat;' @@ -1117,7 +1117,7 @@ var code = USE_ASM + I32 + CI32 + I32A + ` return f; `; -var v4 = SIMD.int32x4(1,2,3,4); +var v4 = SIMD.Int32x4(1,2,3,4); function check(x, y, z, w) { assertEq(x, 35); assertEq(y, 35); @@ -1168,7 +1168,7 @@ for (var i = 1; i < 10; ++i) { // Stress-test for register spilling code and stack depth checks var code = ` "use asm"; - var i4 = glob.SIMD.int32x4; + var i4 = glob.SIMD.Int32x4; var i4a = i4.add; var assertEq = ffi.assertEq; function g() { @@ -1188,7 +1188,7 @@ asmLink(asmCompile('glob', 'ffi', code), this, assertEqFFI)(); (function() { var code = ` "use asm"; - var i4 = glob.SIMD.int32x4; + var i4 = glob.SIMD.Int32x4; var i4a = i4.add; var assertEq = ffi.assertEq; var one = ffi.one; @@ -1230,7 +1230,7 @@ asmLink(asmCompile('glob', 'ffi', code), this, assertEqFFI)(); (function() { var code = ` "use asm"; - var i4 = glob.SIMD.int32x4; + var i4 = glob.SIMD.Int32x4; var ci4 = i4.check; function h( // In registers: @@ -1288,7 +1288,7 @@ asmLink(asmCompile('glob', 'ffi', code), this, assertEqFFI)(); var iters = 2000000; var code = ` "use asm"; - var i4 = glob.SIMD.int32x4; + var i4 = glob.SIMD.Int32x4; var i4a = i4.add; var ci4 = i4.check; function _() { diff --git a/js/src/jit-test/tests/asm.js/testZOOB.js b/js/src/jit-test/tests/asm.js/testZOOB.js index 870e0fc6dc2..c9187d5bb0c 100644 --- a/js/src/jit-test/tests/asm.js/testZOOB.js +++ b/js/src/jit-test/tests/asm.js/testZOOB.js @@ -209,10 +209,10 @@ function testSimdX4(ctor, shift, scale, disp, simdName, simdCtor) { } function testFloat32x4(ctor, shift, scale, disp) { - testSimdX4(ctor, shift, scale, disp, 'float32x4', SIMD.float32x4); + testSimdX4(ctor, shift, scale, disp, 'Float32x4', SIMD.Float32x4); } function testInt32x4(ctor, shift, scale, disp) { - testSimdX4(ctor, shift, scale, disp, 'int32x4', SIMD.int32x4); + testSimdX4(ctor, shift, scale, disp, 'Int32x4', SIMD.Int32x4); } function test(tester, ctor, shift) { diff --git a/js/src/tests/ecma_7/SIMD/binary-operations.js b/js/src/tests/ecma_7/SIMD/binary-operations.js index b6d6077618d..11febf4d310 100644 --- a/js/src/tests/ecma_7/SIMD/binary-operations.js +++ b/js/src/tests/ecma_7/SIMD/binary-operations.js @@ -1,9 +1,8 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; - +var Float32x4 = SIMD.Float32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function testFloat32x4add() { function addf(a, b) { @@ -17,7 +16,7 @@ function testFloat32x4add() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.add, addf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.add, addf); } } @@ -40,7 +39,7 @@ function testFloat32x4and() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.and, andf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.and, andf); } } @@ -56,7 +55,7 @@ function testFloat32x4div() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.div, divf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.div, divf); } } @@ -72,7 +71,7 @@ function testFloat32x4mul() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.mul, mulf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.mul, mulf); } } @@ -95,7 +94,7 @@ function testFloat32x4or() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.or, orf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.or, orf); } } @@ -111,7 +110,7 @@ function testFloat32x4sub() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.sub, subf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.sub, subf); } } @@ -134,7 +133,7 @@ function testFloat32x4xor() { ]; for (var [v,w] of vals) { - testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.xor, xorf); + testBinaryFunc(Float32x4(...v), Float32x4(...w), Float32x4.xor, xorf); } } @@ -151,7 +150,7 @@ function testInt8x16add() { } for (var [v,w] of i8x16vals) { - testBinaryFunc(int8x16(...v), int8x16(...w), int8x16.add, addi); + testBinaryFunc(Int8x16(...v), Int8x16(...w), Int8x16.add, addi); } } @@ -161,7 +160,7 @@ function testInt8x16and() { } for (var [v,w] of i8x16vals) { - testBinaryFunc(int8x16(...v), int8x16(...w), int8x16.and, andi); + testBinaryFunc(Int8x16(...v), Int8x16(...w), Int8x16.and, andi); } } @@ -171,7 +170,7 @@ function testInt8x16mul() { } for (var [v,w] of i8x16vals) { - testBinaryFunc(int8x16(...v), int8x16(...w), int8x16.mul, muli); + testBinaryFunc(Int8x16(...v), Int8x16(...w), Int8x16.mul, muli); } } @@ -181,7 +180,7 @@ function testInt8x16or() { } for (var [v,w] of i8x16vals) { - testBinaryFunc(int8x16(...v), int8x16(...w), int8x16.or, ori); + testBinaryFunc(Int8x16(...v), Int8x16(...w), Int8x16.or, ori); } } @@ -191,7 +190,7 @@ function testInt8x16sub() { } for (var [v,w] of i8x16vals) { - testBinaryFunc(int8x16(...v), int8x16(...w), int8x16.sub, subi); + testBinaryFunc(Int8x16(...v), Int8x16(...w), Int8x16.sub, subi); } } @@ -201,7 +200,7 @@ function testInt8x16xor() { } for (var [v,w] of i8x16vals) { - testBinaryFunc(int8x16(...v), int8x16(...w), int8x16.xor, xori); + testBinaryFunc(Int8x16(...v), Int8x16(...w), Int8x16.xor, xori); } } @@ -218,7 +217,7 @@ function testInt16x8add() { } for (var [v,w] of i16x8vals) { - testBinaryFunc(int16x8(...v), int16x8(...w), int16x8.add, addi); + testBinaryFunc(Int16x8(...v), Int16x8(...w), Int16x8.add, addi); } } @@ -228,7 +227,7 @@ function testInt16x8and() { } for (var [v,w] of i16x8vals) { - testBinaryFunc(int16x8(...v), int16x8(...w), int16x8.and, andi); + testBinaryFunc(Int16x8(...v), Int16x8(...w), Int16x8.and, andi); } } @@ -238,7 +237,7 @@ function testInt16x8mul() { } for (var [v,w] of i16x8vals) { - testBinaryFunc(int16x8(...v), int16x8(...w), int16x8.mul, muli); + testBinaryFunc(Int16x8(...v), Int16x8(...w), Int16x8.mul, muli); } } @@ -248,7 +247,7 @@ function testInt16x8or() { } for (var [v,w] of i16x8vals) { - testBinaryFunc(int16x8(...v), int16x8(...w), int16x8.or, ori); + testBinaryFunc(Int16x8(...v), Int16x8(...w), Int16x8.or, ori); } } @@ -258,7 +257,7 @@ function testInt16x8sub() { } for (var [v,w] of i16x8vals) { - testBinaryFunc(int16x8(...v), int16x8(...w), int16x8.sub, subi); + testBinaryFunc(Int16x8(...v), Int16x8(...w), Int16x8.sub, subi); } } @@ -268,7 +267,7 @@ function testInt16x8xor() { } for (var [v,w] of i16x8vals) { - testBinaryFunc(int16x8(...v), int16x8(...w), int16x8.xor, xori); + testBinaryFunc(Int16x8(...v), Int16x8(...w), Int16x8.xor, xori); } } @@ -283,7 +282,7 @@ function testInt32x4add() { ]; for (var [v,w] of valsExp) { - testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.add, addi); + testBinaryFunc(Int32x4(...v), Int32x4(...w), Int32x4.add, addi); } } @@ -298,7 +297,7 @@ function testInt32x4and() { ]; for (var [v,w] of valsExp) { - testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.and, andi); + testBinaryFunc(Int32x4(...v), Int32x4(...w), Int32x4.and, andi); } } @@ -313,7 +312,7 @@ function testInt32x4mul() { ]; for (var [v,w] of valsExp) { - testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.mul, muli); + testBinaryFunc(Int32x4(...v), Int32x4(...w), Int32x4.mul, muli); } } @@ -328,7 +327,7 @@ function testInt32x4or() { ]; for (var [v,w] of valsExp) { - testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.or, ori); + testBinaryFunc(Int32x4(...v), Int32x4(...w), Int32x4.or, ori); } } @@ -342,7 +341,7 @@ function testInt32x4sub() { ]; for (var [v,w] of valsExp) { - testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.sub, subi); + testBinaryFunc(Int32x4(...v), Int32x4(...w), Int32x4.sub, subi); } } @@ -357,7 +356,7 @@ function testInt32x4xor() { ]; for (var [v,w] of valsExp) { - testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.xor, xori); + testBinaryFunc(Int32x4(...v), Int32x4(...w), Int32x4.xor, xori); } } diff --git a/js/src/tests/ecma_7/SIMD/bug1023145.js b/js/src/tests/ecma_7/SIMD/bug1023145.js index 5cc945130d1..45f44afb5a6 100644 --- a/js/src/tests/ecma_7/SIMD/bug1023145.js +++ b/js/src/tests/ecma_7/SIMD/bug1023145.js @@ -5,13 +5,10 @@ * http://creativecommons.org/licenses/publicdomain/ */ -var BUGNUMBER = 1023145; -var summary = "Use the original getPrototypeOf in self-hosted code"; - delete Object.prototype.__proto__; -var int32x4 = SIMD.int32x4; -var ar = int32x4.array(1); -var array = new ar([int32x4(1, 2, 3, 4)]); +var Int32x4 = SIMD.Int32x4; +var ar = Int32x4.array(1); +var array = new ar([Int32x4(1, 2, 3, 4)]); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/bug953270.js b/js/src/tests/ecma_7/SIMD/bug953270.js index bc591a9fd08..40895afd3e6 100644 --- a/js/src/tests/ecma_7/SIMD/bug953270.js +++ b/js/src/tests/ecma_7/SIMD/bug953270.js @@ -5,23 +5,20 @@ * http://creativecommons.org/licenses/publicdomain/ */ -var BUGNUMBER = 953270; -var summary = 'Handles'; - // Check that NaN normalization is applied when extracting the x lane // out, after bit conversion has occurred. -var int32x4 = SIMD.int32x4; -var a = int32x4((4294967295), 200, 300, 400); -var c = SIMD.float32x4.fromInt32x4Bits(a); +var Int32x4 = SIMD.Int32x4; +var a = Int32x4((4294967295), 200, 300, 400); +var c = SIMD.Float32x4.fromInt32x4Bits(a); // NaN canonicalization occurs when extracting out x lane: assertEq(c.x, NaN); // but underlying bits are faithfully transmitted // (though reinterpreted as a signed integer): -var d = SIMD.int32x4.fromFloat32x4Bits(c); +var d = SIMD.Int32x4.fromFloat32x4Bits(c); assertEq(d.x, -1); -reportCompare(true, true); -print("Tests complete"); +if (typeof reportCompare === "function") + reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/check.js b/js/src/tests/ecma_7/SIMD/check.js index dce8464cd13..0d53f6d604f 100644 --- a/js/src/tests/ecma_7/SIMD/check.js +++ b/js/src/tests/ecma_7/SIMD/check.js @@ -2,56 +2,56 @@ function test() { - var i4 = SIMD.int32x4(1,2,3,4); - var i8 = SIMD.int16x8(1,2,3,4,5,6,7,8); - var i16 = SIMD.int8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); - var f4 = SIMD.float32x4(NaN, -0, Infinity, 13.37); - var f2 = SIMD.float64x2(-0, 13.37); + var i4 = SIMD.Int32x4(1,2,3,4); + var i8 = SIMD.Int16x8(1,2,3,4,5,6,7,8); + var i16 = SIMD.Int8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); + var f4 = SIMD.Float32x4(NaN, -0, Infinity, 13.37); + var f2 = SIMD.Float64x2(-0, 13.37); - var ci4 = SIMD.int32x4.check(i4); + var ci4 = SIMD.Int32x4.check(i4); assertEqX4(ci4, simdToArray(i4)); - assertThrowsInstanceOf(() => SIMD.int32x4.check(f4), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.check(f2), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.check(i8), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.check(i16), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.check("i swear i'm a vector"), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.check({}), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.check(f4), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.check(f2), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.check(i8), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.check(i16), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.check("i swear i'm a vector"), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.check({}), TypeError); - var ci8 = SIMD.int16x8.check(i8); + var ci8 = SIMD.Int16x8.check(i8); assertEqX8(ci8, simdToArray(i8)); - assertThrowsInstanceOf(() => SIMD.int16x8.check(i4), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.check(i16), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.check(f4), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.check(f2), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.check("i swear i'm a vector"), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.check({}), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.check(i4), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.check(i16), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.check(f4), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.check(f2), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.check("i swear i'm a vector"), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.check({}), TypeError); - var ci16 = SIMD.int8x16.check(i16); + var ci16 = SIMD.Int8x16.check(i16); assertEqX16(ci16, simdToArray(i16)); - assertThrowsInstanceOf(() => SIMD.int8x16.check(i4), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.check(i8), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.check(f4), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.check(f2), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.check("i swear i'm a vector"), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.check({}), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.check(i4), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.check(i8), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.check(f4), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.check(f2), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.check("i swear i'm a vector"), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.check({}), TypeError); - var cf4 = SIMD.float32x4.check(f4); + var cf4 = SIMD.Float32x4.check(f4); assertEqX4(cf4, simdToArray(f4)); - assertThrowsInstanceOf(() => SIMD.float32x4.check(i4), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.check(i8), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.check(i16), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.check(f2), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.check("i swear i'm a vector"), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.check({}), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.check(i4), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.check(i8), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.check(i16), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.check(f2), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.check("i swear i'm a vector"), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.check({}), TypeError); - var cf2 = SIMD.float64x2.check(f2); + var cf2 = SIMD.Float64x2.check(f2); assertEqX2(cf2, simdToArray(f2)); - assertThrowsInstanceOf(() => SIMD.float64x2.check(f4), TypeError); - assertThrowsInstanceOf(() => SIMD.float64x2.check(i4), TypeError); - assertThrowsInstanceOf(() => SIMD.float64x2.check(i8), TypeError); - assertThrowsInstanceOf(() => SIMD.float64x2.check(i16), TypeError); - assertThrowsInstanceOf(() => SIMD.float64x2.check("i swear i'm a vector"), TypeError); - assertThrowsInstanceOf(() => SIMD.float64x2.check({}), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.check(f4), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.check(i4), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.check(i8), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.check(i16), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.check("i swear i'm a vector"), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.check({}), TypeError); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/clamp.js b/js/src/tests/ecma_7/SIMD/clamp.js index 171a48e46a0..42726bdcb62 100644 --- a/js/src/tests/ecma_7/SIMD/clamp.js +++ b/js/src/tests/ecma_7/SIMD/clamp.js @@ -1,54 +1,53 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; - -var summary = 'float32x4/float64x2 clamp'; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; function test() { - // FIXME -- Bug 1068028: Amend to check for correctness of NaN/-0 border cases once the semantics are defined. + // FIXME -- Bug 1068028: Amend to check for correctness of NaN/-0 border + // cases once the semantics are defined. - var a = float32x4(-20, 10, 30, 0.5); - var lower = float32x4(2, 1, 50, 0); - var upper = float32x4(2.5, 5, 55, 1); - var c = SIMD.float32x4.clamp(a, lower, upper); + var a = Float32x4(-20, 10, 30, 0.5); + var lower = Float32x4(2, 1, 50, 0); + var upper = Float32x4(2.5, 5, 55, 1); + var c = SIMD.Float32x4.clamp(a, lower, upper); assertEq(c.x, 2); assertEq(c.y, 5); assertEq(c.z, 50); assertEq(c.w, 0.5); - var d = float32x4(-13.37, 10.46, 31.79, 0.54); - var lower1 = float32x4(2.1, 1.1, 50.13, 0.0); - var upper1 = float32x4(2.56, 5.55, 55.93, 1.1); - var f = SIMD.float32x4.clamp(d, lower1, upper1); + var d = Float32x4(-13.37, 10.46, 31.79, 0.54); + var lower1 = Float32x4(2.1, 1.1, 50.13, 0.0); + var upper1 = Float32x4(2.56, 5.55, 55.93, 1.1); + var f = SIMD.Float32x4.clamp(d, lower1, upper1); assertEq(f.x, Math.fround(2.1)); assertEq(f.y, Math.fround(5.55)); assertEq(f.z, Math.fround(50.13)); assertEq(f.w, Math.fround(0.54)); - var g = float32x4(4, -Infinity, 10, -10); - var lower2 = float32x4(5, -Infinity, -Infinity, -Infinity); - var upper2 = float32x4(Infinity, 5, Infinity, Infinity); - var i = SIMD.float32x4.clamp(g, lower2, upper2); + var g = Float32x4(4, -Infinity, 10, -10); + var lower2 = Float32x4(5, -Infinity, -Infinity, -Infinity); + var upper2 = Float32x4(Infinity, 5, Infinity, Infinity); + var i = SIMD.Float32x4.clamp(g, lower2, upper2); assertEq(i.x, 5); assertEq(i.y, -Infinity); assertEq(i.z, 10); assertEq(i.w, -10); - var j = float64x2(-20, 10); - var k = float64x2(2.125, 3); - var lower3 = float64x2(2, 1); - var upper3 = float64x2(2.5, 5); - var l = float64x2.clamp(j, lower3, upper3); + var j = Float64x2(-20, 10); + var k = Float64x2(2.125, 3); + var lower3 = Float64x2(2, 1); + var upper3 = Float64x2(2.5, 5); + var l = Float64x2.clamp(j, lower3, upper3); assertEq(l.x, 2); assertEq(l.y, 5); - var m = float64x2.clamp(k, lower3, upper3); + var m = Float64x2.clamp(k, lower3, upper3); assertEq(m.x, 2.125); assertEq(m.y, 3); - var n = float64x2(-5, 5); - var lower4 = float64x2(-Infinity, 0); - var upper4 = float64x2(+Infinity, +Infinity); - var p = float64x2.clamp(n, lower4, upper4); + var n = Float64x2(-5, 5); + var lower4 = Float64x2(-Infinity, 0); + var upper4 = Float64x2(+Infinity, +Infinity); + var p = Float64x2.clamp(n, lower4, upper4); assertEq(p.x, -5); assertEq(p.y, 5); diff --git a/js/src/tests/ecma_7/SIMD/comparisons.js b/js/src/tests/ecma_7/SIMD/comparisons.js index 9c79db18ea4..cb8ff4f3c9a 100644 --- a/js/src/tests/ecma_7/SIMD/comparisons.js +++ b/js/src/tests/ecma_7/SIMD/comparisons.js @@ -5,11 +5,11 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; var fround = Math.fround; @@ -18,114 +18,114 @@ function boolToSimdLogical(b) { } function testEqualFloat32x4(v, w) { - testBinaryCompare(v, w, float32x4.equal, (x, y) => boolToSimdLogical(fround(x) == fround(y)), int32x4); + testBinaryCompare(v, w, Float32x4.equal, (x, y) => boolToSimdLogical(fround(x) == fround(y)), Int32x4); } function testNotEqualFloat32x4(v, w) { - testBinaryCompare(v, w, float32x4.notEqual, (x, y) => boolToSimdLogical(fround(x) != fround(y)), int32x4); + testBinaryCompare(v, w, Float32x4.notEqual, (x, y) => boolToSimdLogical(fround(x) != fround(y)), Int32x4); } function testLessThanFloat32x4(v, w) { - testBinaryCompare(v, w, float32x4.lessThan, (x, y) => boolToSimdLogical(fround(x) < fround(y)), int32x4); + testBinaryCompare(v, w, Float32x4.lessThan, (x, y) => boolToSimdLogical(fround(x) < fround(y)), Int32x4); } function testLessThanOrEqualFloat32x4(v, w) { - testBinaryCompare(v, w, float32x4.lessThanOrEqual, (x, y) => boolToSimdLogical(fround(x) <= fround(y)), int32x4); + testBinaryCompare(v, w, Float32x4.lessThanOrEqual, (x, y) => boolToSimdLogical(fround(x) <= fround(y)), Int32x4); } function testGreaterThanFloat32x4(v, w) { - testBinaryCompare(v, w, float32x4.greaterThan, (x, y) => boolToSimdLogical(fround(x) > fround(y)), int32x4); + testBinaryCompare(v, w, Float32x4.greaterThan, (x, y) => boolToSimdLogical(fround(x) > fround(y)), Int32x4); } function testGreaterThanOrEqualFloat32x4(v, w) { - testBinaryCompare(v, w, float32x4.greaterThanOrEqual, (x, y) => boolToSimdLogical(fround(x) >= fround(y)), int32x4); + testBinaryCompare(v, w, Float32x4.greaterThanOrEqual, (x, y) => boolToSimdLogical(fround(x) >= fround(y)), Int32x4); } function testEqualFloat64x2(v, w) { - testBinaryCompare(v, w, float64x2.equal, (x, y) => boolToSimdLogical(x == y), int32x4); + testBinaryCompare(v, w, Float64x2.equal, (x, y) => boolToSimdLogical(x == y), Int32x4); } function testNotEqualFloat64x2(v, w) { - testBinaryCompare(v, w, float64x2.notEqual, (x, y) => boolToSimdLogical(x != y), int32x4); + testBinaryCompare(v, w, Float64x2.notEqual, (x, y) => boolToSimdLogical(x != y), Int32x4); } function testLessThanFloat64x2(v, w) { - testBinaryCompare(v, w, float64x2.lessThan, (x, y) => boolToSimdLogical(x < y), int32x4); + testBinaryCompare(v, w, Float64x2.lessThan, (x, y) => boolToSimdLogical(x < y), Int32x4); } function testLessThanOrEqualFloat64x2(v, w) { - testBinaryCompare(v, w, float64x2.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), int32x4); + testBinaryCompare(v, w, Float64x2.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), Int32x4); } function testGreaterThanFloat64x2(v, w) { - testBinaryCompare(v, w, float64x2.greaterThan, (x, y) => boolToSimdLogical(x > y), int32x4); + testBinaryCompare(v, w, Float64x2.greaterThan, (x, y) => boolToSimdLogical(x > y), Int32x4); } function testGreaterThanOrEqualFloat64x2(v, w) { - testBinaryCompare(v, w, float64x2.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), int32x4); + testBinaryCompare(v, w, Float64x2.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), Int32x4); } function testEqualInt8x16(v, w) { - testBinaryCompare(v, w, int8x16.equal, (x, y) => boolToSimdLogical(x == y), int8x16); + testBinaryCompare(v, w, Int8x16.equal, (x, y) => boolToSimdLogical(x == y), Int8x16); } function testNotEqualInt8x16(v, w) { - testBinaryCompare(v, w, int8x16.notEqual, (x, y) => boolToSimdLogical(x != y), int8x16); + testBinaryCompare(v, w, Int8x16.notEqual, (x, y) => boolToSimdLogical(x != y), Int8x16); } function testLessThanInt8x16(v, w) { - testBinaryCompare(v, w, int8x16.lessThan, (x, y) => boolToSimdLogical(x < y), int8x16); + testBinaryCompare(v, w, Int8x16.lessThan, (x, y) => boolToSimdLogical(x < y), Int8x16); } function testLessThanOrEqualInt8x16(v, w) { - testBinaryCompare(v, w, int8x16.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), int8x16); + testBinaryCompare(v, w, Int8x16.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), Int8x16); } function testGreaterThanInt8x16(v, w) { - testBinaryCompare(v, w, int8x16.greaterThan, (x, y) => boolToSimdLogical(x > y), int8x16); + testBinaryCompare(v, w, Int8x16.greaterThan, (x, y) => boolToSimdLogical(x > y), Int8x16); } function testGreaterThanOrEqualInt8x16(v, w) { - testBinaryCompare(v, w, int8x16.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), int8x16); + testBinaryCompare(v, w, Int8x16.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), Int8x16); } function testEqualInt16x8(v, w) { - testBinaryCompare(v, w, int16x8.equal, (x, y) => boolToSimdLogical(x == y), int16x8); + testBinaryCompare(v, w, Int16x8.equal, (x, y) => boolToSimdLogical(x == y), Int16x8); } function testNotEqualInt16x8(v, w) { - testBinaryCompare(v, w, int16x8.notEqual, (x, y) => boolToSimdLogical(x != y), int16x8); + testBinaryCompare(v, w, Int16x8.notEqual, (x, y) => boolToSimdLogical(x != y), Int16x8); } function testLessThanInt16x8(v, w) { - testBinaryCompare(v, w, int16x8.lessThan, (x, y) => boolToSimdLogical(x < y), int16x8); + testBinaryCompare(v, w, Int16x8.lessThan, (x, y) => boolToSimdLogical(x < y), Int16x8); } function testLessThanOrEqualInt16x8(v, w) { - testBinaryCompare(v, w, int16x8.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), int16x8); + testBinaryCompare(v, w, Int16x8.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), Int16x8); } function testGreaterThanInt16x8(v, w) { - testBinaryCompare(v, w, int16x8.greaterThan, (x, y) => boolToSimdLogical(x > y), int16x8); + testBinaryCompare(v, w, Int16x8.greaterThan, (x, y) => boolToSimdLogical(x > y), Int16x8); } function testGreaterThanOrEqualInt16x8(v, w) { - testBinaryCompare(v, w, int16x8.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), int16x8); + testBinaryCompare(v, w, Int16x8.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), Int16x8); } function testEqualInt32x4(v, w) { - testBinaryCompare(v, w, int32x4.equal, (x, y) => boolToSimdLogical(x == y), int32x4); + testBinaryCompare(v, w, Int32x4.equal, (x, y) => boolToSimdLogical(x == y), Int32x4); } function testNotEqualInt32x4(v, w) { - testBinaryCompare(v, w, int32x4.notEqual, (x, y) => boolToSimdLogical(x != y), int32x4); + testBinaryCompare(v, w, Int32x4.notEqual, (x, y) => boolToSimdLogical(x != y), Int32x4); } function testLessThanInt32x4(v, w) { - testBinaryCompare(v, w, int32x4.lessThan, (x, y) => boolToSimdLogical(x < y), int32x4); + testBinaryCompare(v, w, Int32x4.lessThan, (x, y) => boolToSimdLogical(x < y), Int32x4); } function testLessThanOrEqualInt32x4(v, w) { - testBinaryCompare(v, w, int32x4.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), int32x4); + testBinaryCompare(v, w, Int32x4.lessThanOrEqual, (x, y) => boolToSimdLogical(x <= y), Int32x4); } function testGreaterThanInt32x4(v, w) { - testBinaryCompare(v, w, int32x4.greaterThan, (x, y) => boolToSimdLogical(x > y), int32x4); + testBinaryCompare(v, w, Int32x4.greaterThan, (x, y) => boolToSimdLogical(x > y), Int32x4); } function testGreaterThanOrEqualInt32x4(v, w) { - testBinaryCompare(v, w, int32x4.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), int32x4); + testBinaryCompare(v, w, Int32x4.greaterThanOrEqual, (x, y) => boolToSimdLogical(x >= y), Int32x4); } function test() { - var float32x4val = [ - float32x4(1, 20, 30, 4), - float32x4(10, 2, 3, 40), - float32x4(9.999, 2.1234, 30.4443, 4), - float32x4(10, 2.1233, 30.4444, 4.0001), - float32x4(NaN, -Infinity, +Infinity, -0), - float32x4(+Infinity, NaN, -0, -Infinity), - float32x4(13.37, 42.42, NaN, 0) + var Float32x4val = [ + Float32x4(1, 20, 30, 4), + Float32x4(10, 2, 3, 40), + Float32x4(9.999, 2.1234, 30.4443, 4), + Float32x4(10, 2.1233, 30.4444, 4.0001), + Float32x4(NaN, -Infinity, +Infinity, -0), + Float32x4(+Infinity, NaN, -0, -Infinity), + Float32x4(13.37, 42.42, NaN, 0) ]; var v, w; - for (v of float32x4val) { - for (w of float32x4val) { + for (v of Float32x4val) { + for (w of Float32x4val) { testEqualFloat32x4(v, w); testNotEqualFloat32x4(v, w); testLessThanFloat32x4(v, w); @@ -135,23 +135,23 @@ function test() { } } - var float64x2val = [ - float64x2(1, 20), - float64x2(10, 2), - float64x2(9.999, 2.1234), - float64x2(10, 2.1233), - float64x2(30.4443, 4), - float64x2(30.4444, 4.0001), - float64x2(NaN, -Infinity), - float64x2(+Infinity, NaN), - float64x2(+Infinity, -0), - float64x2(-0, -Infinity), - float64x2(13.37, 42.42), - float64x2(NaN, 0) + var Float64x2val = [ + Float64x2(1, 20), + Float64x2(10, 2), + Float64x2(9.999, 2.1234), + Float64x2(10, 2.1233), + Float64x2(30.4443, 4), + Float64x2(30.4444, 4.0001), + Float64x2(NaN, -Infinity), + Float64x2(+Infinity, NaN), + Float64x2(+Infinity, -0), + Float64x2(-0, -Infinity), + Float64x2(13.37, 42.42), + Float64x2(NaN, 0) ]; - for (v of float64x2val) { - for (w of float64x2val) { + for (v of Float64x2val) { + for (w of Float64x2val) { testEqualFloat64x2(v, w); testNotEqualFloat64x2(v, w); testLessThanFloat64x2(v, w); @@ -161,17 +161,17 @@ function test() { } } - var int8x16val = [ - int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), - int8x16(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16), - int8x16(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16), - int8x16(1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16), - int8x16(INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN + 1, INT8_MAX - 1, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16), - int8x16(INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX - 1, INT8_MIN + 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16) + var Int8x16val = [ + Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), + Int8x16(-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16), + Int8x16(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16), + Int8x16(1, -2, 3, -4, 5, -6, 7, -8, 9, -10, 11, -12, 13, -14, 15, -16), + Int8x16(INT8_MAX, INT8_MAX, INT8_MIN, INT8_MIN, INT8_MIN + 1, INT8_MAX - 1, -7, -8, -9, -10, -11, -12, -13, -14, -15, -16), + Int8x16(INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX - 1, INT8_MIN + 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16) ]; - for (v of int8x16val) { - for (w of int8x16val) { + for (v of Int8x16val) { + for (w of Int8x16val) { testEqualInt8x16(v, w); testNotEqualInt8x16(v, w); testLessThanInt8x16(v, w); @@ -181,17 +181,17 @@ function test() { } } - var int16x8val = [ - int16x8(1, 2, 3, 4, 5, 6, 7, 8), - int16x8(-1, -2, -3, -4, -5, -6, -7, -8), - int16x8(-1, 2, -3, 4, -5, 6, -7, 8), - int16x8(1, -2, 3, -4, 5, -6, 7, -8), - int16x8(INT16_MAX, INT16_MAX, INT16_MIN, INT16_MIN, INT16_MIN + 1, INT16_MAX - 1, -7, -8), - int16x8(INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX - 1, INT16_MIN + 1, 7, -8) + var Int16x8val = [ + Int16x8(1, 2, 3, 4, 5, 6, 7, 8), + Int16x8(-1, -2, -3, -4, -5, -6, -7, -8), + Int16x8(-1, 2, -3, 4, -5, 6, -7, 8), + Int16x8(1, -2, 3, -4, 5, -6, 7, -8), + Int16x8(INT16_MAX, INT16_MAX, INT16_MIN, INT16_MIN, INT16_MIN + 1, INT16_MAX - 1, -7, -8), + Int16x8(INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX - 1, INT16_MIN + 1, 7, -8) ]; - for (v of int16x8val) { - for (w of int16x8val) { + for (v of Int16x8val) { + for (w of Int16x8val) { testEqualInt16x8(v, w); testNotEqualInt16x8(v, w); testLessThanInt16x8(v, w); @@ -201,17 +201,17 @@ function test() { } } - var int32x4val = [ - int32x4(1, 2, 3, 4), - int32x4(-1, -2, -3, -4), - int32x4(-1, 2, -3, 4), - int32x4(1, -2, 3, -4), - int32x4(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN), - int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN) + var Int32x4val = [ + Int32x4(1, 2, 3, 4), + Int32x4(-1, -2, -3, -4), + Int32x4(-1, 2, -3, 4), + Int32x4(1, -2, 3, -4), + Int32x4(INT32_MAX, INT32_MAX, INT32_MIN, INT32_MIN), + Int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN) ]; - for (v of int32x4val) { - for (w of int32x4val) { + for (v of Int32x4val) { + for (w of Int32x4val) { testEqualInt32x4(v, w); testNotEqualInt32x4(v, w); testLessThanInt32x4(v, w); diff --git a/js/src/tests/ecma_7/SIMD/constructors.js b/js/src/tests/ecma_7/SIMD/constructors.js index 4d75f2035ca..64f1f3ef032 100644 --- a/js/src/tests/ecma_7/SIMD/constructors.js +++ b/js/src/tests/ecma_7/SIMD/constructors.js @@ -1,79 +1,79 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float64x2 = SIMD.float64x2; -var float32x4 = SIMD.float32x4; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float64x2 = SIMD.Float64x2; +var Float32x4 = SIMD.Float32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function TestInt8x16Ctor() { // Constructors. - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), [1,2,3,4,5,6,7,8,9,10,11,12,13,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), [1,2,3,4,5,6,7,8,9,10,11,12,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [1,2,3,4,5,6,7,8,9,10,11,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), [1,2,3,4,5,6,7,8,9,10,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9), [1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8), [1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7), [1,2,3,4,5,6,7,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6), [1,2,3,4,5,6,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5), [1,2,3,4,5,0,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4), [1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3), [1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2), [1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1), [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(), [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); - assertEqX16(int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), [1,2,3,4,5,6,7,8,9,10,11,12,13,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12), [1,2,3,4,5,6,7,8,9,10,11,12,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11), [1,2,3,4,5,6,7,8,9,10,11,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), [1,2,3,4,5,6,7,8,9,10,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9), [1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8), [1,2,3,4,5,6,7,8,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7), [1,2,3,4,5,6,7,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6), [1,2,3,4,5,6,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5), [1,2,3,4,5,0,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4), [1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3), [1,2,3,0,0,0,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2), [1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1), [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(), [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); + assertEqX16(Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18), [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); } function TestInt16x8Ctor() { // Constructors. - assertEqX8(int16x8(1, 2, 3, 4, 5, 6, 7, 8), [1,2,3,4,5,6,7,8]); - assertEqX8(int16x8(1, 2, 3, 4, 5, 6, 7), [1,2,3,4,5,6,7,0]); - assertEqX8(int16x8(1, 2, 3, 4, 5, 6), [1,2,3,4,5,6,0,0]); - assertEqX8(int16x8(1, 2, 3, 4, 5), [1,2,3,4,5,0,0,0]); - assertEqX8(int16x8(1, 2, 3, 4), [1,2,3,4,0,0,0,0]); - assertEqX8(int16x8(1, 2, 3), [1,2,3,0,0,0,0,0]); - assertEqX8(int16x8(1, 2), [1,2,0,0,0,0,0,0]); - assertEqX8(int16x8(1), [1,0,0,0,0,0,0,0]); - assertEqX8(int16x8(), [0,0,0,0,0,0,0,0]); - assertEqX8(int16x8(1, 2, 3, 4, 5, 6, 7, 8, 9), [1,2,3,4,5,6,7,8]); - assertEqX8(int16x8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), [1,2,3,4,5,6,7,8]); + assertEqX8(Int16x8(1, 2, 3, 4, 5, 6, 7, 8), [1,2,3,4,5,6,7,8]); + assertEqX8(Int16x8(1, 2, 3, 4, 5, 6, 7), [1,2,3,4,5,6,7,0]); + assertEqX8(Int16x8(1, 2, 3, 4, 5, 6), [1,2,3,4,5,6,0,0]); + assertEqX8(Int16x8(1, 2, 3, 4, 5), [1,2,3,4,5,0,0,0]); + assertEqX8(Int16x8(1, 2, 3, 4), [1,2,3,4,0,0,0,0]); + assertEqX8(Int16x8(1, 2, 3), [1,2,3,0,0,0,0,0]); + assertEqX8(Int16x8(1, 2), [1,2,0,0,0,0,0,0]); + assertEqX8(Int16x8(1), [1,0,0,0,0,0,0,0]); + assertEqX8(Int16x8(), [0,0,0,0,0,0,0,0]); + assertEqX8(Int16x8(1, 2, 3, 4, 5, 6, 7, 8, 9), [1,2,3,4,5,6,7,8]); + assertEqX8(Int16x8(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), [1,2,3,4,5,6,7,8]); } function TestInt32x4Ctor() { // Constructors. - assertEqX4(int32x4(1, 2, 3, 4), [1,2,3,4]); - assertEqX4(int32x4(1, 2, 3), [1,2,3,0]); - assertEqX4(int32x4(1, 2), [1,2,0,0]); - assertEqX4(int32x4(1), [1,0,0,0]); - assertEqX4(int32x4(), [0,0,0,0]); - assertEqX4(int32x4(1, 2, 3, 4, 5), [1,2,3,4]); - assertEqX4(int32x4(1, 2, 3, 4, 5, 6), [1,2,3,4]); + assertEqX4(Int32x4(1, 2, 3, 4), [1,2,3,4]); + assertEqX4(Int32x4(1, 2, 3), [1,2,3,0]); + assertEqX4(Int32x4(1, 2), [1,2,0,0]); + assertEqX4(Int32x4(1), [1,0,0,0]); + assertEqX4(Int32x4(), [0,0,0,0]); + assertEqX4(Int32x4(1, 2, 3, 4, 5), [1,2,3,4]); + assertEqX4(Int32x4(1, 2, 3, 4, 5, 6), [1,2,3,4]); } function TestFloat32x4Ctor() { - assertEqX4(float32x4(1, 2, 3, 4), [1,2,3,4]); - assertEqX4(float32x4(1, 2, 3), [1,2,3,NaN]); - assertEqX4(float32x4(1, 2), [1,2,NaN,NaN]); - assertEqX4(float32x4(1), [1,NaN,NaN,NaN]); - assertEqX4(float32x4(), [NaN,NaN,NaN,NaN]); - assertEqX4(float32x4(1, 2, 3, 4, 5), [1,2,3,4]); - assertEqX4(float32x4(1, 2, 3, 4, 5, 6), [1,2,3,4]); + assertEqX4(Float32x4(1, 2, 3, 4), [1,2,3,4]); + assertEqX4(Float32x4(1, 2, 3), [1,2,3,NaN]); + assertEqX4(Float32x4(1, 2), [1,2,NaN,NaN]); + assertEqX4(Float32x4(1), [1,NaN,NaN,NaN]); + assertEqX4(Float32x4(), [NaN,NaN,NaN,NaN]); + assertEqX4(Float32x4(1, 2, 3, 4, 5), [1,2,3,4]); + assertEqX4(Float32x4(1, 2, 3, 4, 5, 6), [1,2,3,4]); } function TestFloat64x2Ctor() { - assertEqX2(float64x2(1, 2), [1,2]); - assertEqX2(float64x2(1), [1,NaN]); - assertEqX2(float64x2(), [NaN,NaN]); - assertEqX2(float64x2(1, 2, 3), [1,2]); - assertEqX2(float64x2(1, 2, 3, 4), [1,2]); - assertEqX2(float64x2(1, 2, 3, 4, 5), [1,2]); - assertEqX2(float64x2(1, 2, 3, 4, 5), [1,2]); - assertEqX2(float64x2(1, 2, 3, 4, 5, 6), [1,2]); + assertEqX2(Float64x2(1, 2), [1,2]); + assertEqX2(Float64x2(1), [1,NaN]); + assertEqX2(Float64x2(), [NaN,NaN]); + assertEqX2(Float64x2(1, 2, 3), [1,2]); + assertEqX2(Float64x2(1, 2, 3, 4), [1,2]); + assertEqX2(Float64x2(1, 2, 3, 4, 5), [1,2]); + assertEqX2(Float64x2(1, 2, 3, 4, 5), [1,2]); + assertEqX2(Float64x2(1, 2, 3, 4, 5, 6), [1,2]); } function test() { diff --git a/js/src/tests/ecma_7/SIMD/conversions.js b/js/src/tests/ecma_7/SIMD/conversions.js index 45a82b3ce72..8402feeeecc 100644 --- a/js/src/tests/ecma_7/SIMD/conversions.js +++ b/js/src/tests/ecma_7/SIMD/conversions.js @@ -1,9 +1,9 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function testFloat32x4FromFloat64x2() { function expected(v) { @@ -19,7 +19,7 @@ function testFloat32x4FromFloat64x2() { ]; for (var v of vals) { - assertEqX4(float32x4.fromFloat64x2(float64x2(...v)), expected(v)); + assertEqX4(Float32x4.fromFloat64x2(Float64x2(...v)), expected(v)); } // Test rounding to nearest, break tie with even @@ -36,8 +36,8 @@ function testFloat32x4FromFloat64x2() { var nextMid = makeDouble(0, 1023, 0x0000010000001); // mid is halfway between f1 and f2 => tie to even, which is f1 - var v = float64x2(mid, nextMid); - assertEqX4(float32x4.fromFloat64x2(v), [f1, f2, 0, 0]); + var v = Float64x2(mid, nextMid); + assertEqX4(Float32x4.fromFloat64x2(v), [f1, f2, 0, 0]); var f3 = makeFloat(0, 127, 2); var d = makeDouble(0, 1023, 0x0000040000000); @@ -48,8 +48,8 @@ function testFloat32x4FromFloat64x2() { // same here. tie to even, which is f3 here nextMid = makeDouble(0, 1023, 0x0000030000001); - var v = float64x2(mid, nextMid); - assertEqX4(float32x4.fromFloat64x2(v), [f3, f3, 0, 0]); + var v = Float64x2(mid, nextMid); + assertEqX4(Float32x4.fromFloat64x2(v), [f3, f3, 0, 0]); // Test boundaries var biggestFloat = makeFloat(0, 127 + 127, 0x7fffff); @@ -58,11 +58,11 @@ function testFloat32x4FromFloat64x2() { var lowestFloat = makeFloat(1, 127 + 127, 0x7fffff); assertEq(makeDouble(1, 1023 + 127, 0xfffffe0000000), lowestFloat); - var v = float64x2(lowestFloat, biggestFloat); - assertEqX4(float32x4.fromFloat64x2(v), [lowestFloat, biggestFloat, 0, 0]); + var v = Float64x2(lowestFloat, biggestFloat); + assertEqX4(Float32x4.fromFloat64x2(v), [lowestFloat, biggestFloat, 0, 0]); - var v = float64x2(makeDouble(0, 1023 + 127, 0xfffffe0000001), makeDouble(0, 1023 + 127, 0xffffff0000000)); - assertEqX4(float32x4.fromFloat64x2(v), [biggestFloat, Infinity, 0, 0]); + var v = Float64x2(makeDouble(0, 1023 + 127, 0xfffffe0000001), makeDouble(0, 1023 + 127, 0xffffff0000000)); + assertEqX4(Float32x4.fromFloat64x2(v), [biggestFloat, Infinity, 0, 0]); } function testFloat32x4FromFloat64x2Bits() { @@ -73,7 +73,7 @@ function testFloat32x4FromFloat64x2Bits() { ]; for (var [v,w] of valsExp) { - assertEqX4(float32x4.fromFloat64x2Bits(float64x2(...v)), w); + assertEqX4(Float32x4.fromFloat64x2Bits(Float64x2(...v)), w); } } @@ -104,8 +104,8 @@ function testFloat32x4FromInt8x16Bits() { [INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN]]; for (var v of vals) { - var i = int8x16(...v); - assertEqX4(float32x4.fromInt8x16Bits(i), expected(i)); + var i = Int8x16(...v); + assertEqX4(Float32x4.fromInt8x16Bits(i), expected(i)); } } @@ -127,8 +127,8 @@ function testFloat32x4FromInt16x8Bits() { var vals = [[1, 2, 3, 4, 5, 6, 7, 8], [INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX]]; for (var v of vals) { - var i = int16x8(...v); - assertEqX4(float32x4.fromInt16x8Bits(i), expected(i)); + var i = Int16x8(...v); + assertEqX4(Float32x4.fromInt16x8Bits(i), expected(i)); } } @@ -142,7 +142,7 @@ function testFloat32x4FromInt32x4() { ]; for (var v of vals) { - assertEqX4(float32x4.fromInt32x4(int32x4(...v)), expected(v)); + assertEqX4(Float32x4.fromInt32x4(Int32x4(...v)), expected(v)); } // Check that rounding to nearest, even is applied. @@ -151,7 +151,7 @@ function testFloat32x4FromInt32x4() { var next = makeFloat(0, 150 + 2, 1); assertEq(num + 4, next); - v = float32x4.fromInt32x4(int32x4(num, num + 1, num + 2, num + 3)); + v = Float32x4.fromInt32x4(Int32x4(num, num + 1, num + 2, num + 3)); assertEqX4(v, [num, num, /* even */ num, next]); } @@ -160,7 +160,7 @@ function testFloat32x4FromInt32x4() { var next = makeFloat(0, 150 + 2, 2); assertEq(num + 4, next); - v = float32x4.fromInt32x4(int32x4(num, num + 1, num + 2, num + 3)); + v = Float32x4.fromInt32x4(Int32x4(num, num + 1, num + 2, num + 3)); assertEqX4(v, [num, num, /* even */ next, next]); } @@ -172,7 +172,7 @@ function testFloat32x4FromInt32x4() { assertEq(last | 0, last, "it should be an integer, as exponent >= 150"); var diff = (Math.pow(2, 31) - 1) - last; - v = float32x4.fromInt32x4(int32x4(Math.pow(2, 31) - 1, + v = Float32x4.fromInt32x4(Int32x4(Math.pow(2, 31) - 1, Math.pow(2, 30) + 1, last + (diff / 2) | 0, // nearest is last last + (diff / 2) + 1 | 0 // nearest is Math.pow(2, 31) @@ -192,7 +192,7 @@ function testFloat32x4FromInt32x4Bits() { ]; for (var [v,w] of valsExp) { - assertEqX4(float32x4.fromInt32x4Bits(int32x4(...v)), w); + assertEqX4(Float32x4.fromInt32x4Bits(Int32x4(...v)), w); } } @@ -209,7 +209,7 @@ function testFloat64x2FromFloat32x4() { ]; for (var v of vals) { - assertEqX2(float64x2.fromFloat32x4(float32x4(...v)), expected(v)); + assertEqX2(Float64x2.fromFloat32x4(Float32x4(...v)), expected(v)); } } @@ -220,7 +220,7 @@ function testFloat64x2FromFloat32x4Bits() { ]; for (var [v,w] of valsExp) { - assertEqX2(float64x2.fromFloat32x4Bits(float32x4(...v)), w); + assertEqX2(Float64x2.fromFloat32x4Bits(Float32x4(...v)), w); } } @@ -252,8 +252,8 @@ function testFloat64x2FromInt8x16Bits() { INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN]]; for (var v of vals) { - var f = int8x16(...v); - assertEqX2(float64x2.fromInt8x16Bits(f), expected(f)); + var f = Int8x16(...v); + assertEqX2(Float64x2.fromInt8x16Bits(f), expected(f)); } } @@ -276,8 +276,8 @@ function testFloat64x2FromInt16x8Bits() { [INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX]]; for (var v of vals) { - var f = int16x8(...v); - assertEqX2(float64x2.fromInt16x8Bits(f), expected(f)); + var f = Int16x8(...v); + assertEqX2(Float64x2.fromInt16x8Bits(f), expected(f)); } } @@ -292,7 +292,7 @@ function testFloat64x2FromInt32x4() { ]; for (var v of vals) { - assertEqX2(float64x2.fromInt32x4(int32x4(...v)), expected(v)); + assertEqX2(Float64x2.fromInt32x4(Int32x4(...v)), expected(v)); } } @@ -303,40 +303,40 @@ function testFloat64x2FromInt32x4Bits() { ]; for (var [v,w] of valsExp) { - assertEqX2(float64x2.fromInt32x4Bits(int32x4(...v)), w); + assertEqX2(Float64x2.fromInt32x4Bits(Int32x4(...v)), w); } } function testInt32x4FromFloat32x4() { - var d = float32x4(1.1, 2.2, 3.3, 4.6); - assertEqX4(int32x4.fromFloat32x4(d), [1, 2, 3, 4]); + var d = Float32x4(1.1, 2.2, 3.3, 4.6); + assertEqX4(Int32x4.fromFloat32x4(d), [1, 2, 3, 4]); - var d = float32x4(NaN, 0, 0, 0); - assertThrowsInstanceOf(() => SIMD.int32x4.fromFloat32x4(d), RangeError); + var d = Float32x4(NaN, 0, 0, 0); + assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError); - var d = float32x4(Infinity, 0, 0, 0); - assertThrowsInstanceOf(() => SIMD.int32x4.fromFloat32x4(d), RangeError); + var d = Float32x4(Infinity, 0, 0, 0); + assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError); - var d = float32x4(-Infinity, 0, 0, 0); - assertThrowsInstanceOf(() => SIMD.int32x4.fromFloat32x4(d), RangeError); + var d = Float32x4(-Infinity, 0, 0, 0); + assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError); // Test high boundaries: float(0, 157, 0x7fffff) < INT32_MAX < float(0, 158, 0) - var d = float32x4(makeFloat(0, 127 + 31, 0), 0, 0, 0); - assertThrowsInstanceOf(() => SIMD.int32x4.fromFloat32x4(d), RangeError); + var d = Float32x4(makeFloat(0, 127 + 31, 0), 0, 0, 0); + assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError); var lastFloat = makeFloat(0, 127 + 30, 0x7FFFFF); - var d = float32x4(lastFloat, 0, 0, 0); - var e = SIMD.int32x4.fromFloat32x4(d); + var d = Float32x4(lastFloat, 0, 0, 0); + var e = SIMD.Int32x4.fromFloat32x4(d); assertEqX4(e, [lastFloat, 0, 0, 0]); // Test low boundaries assertEq(makeFloat(1, 127 + 31, 0), INT32_MIN); - var d = float32x4(makeFloat(1, 127 + 31, 0), 0, 0, 0); - var e = SIMD.int32x4.fromFloat32x4(d); + var d = Float32x4(makeFloat(1, 127 + 31, 0), 0, 0, 0); + var e = SIMD.Int32x4.fromFloat32x4(d); assertEqX4(e, [INT32_MIN, 0, 0, 0]); - var d = float32x4(makeFloat(1, 127 + 31, 1), 0, 0, 0); - assertThrowsInstanceOf(() => SIMD.int32x4.fromFloat32x4(d), RangeError); + var d = Float32x4(makeFloat(1, 127 + 31, 1), 0, 0, 0); + assertThrowsInstanceOf(() => SIMD.Int32x4.fromFloat32x4(d), RangeError); } function testInt32x4FromFloat32x4Bits() { @@ -346,21 +346,21 @@ function testInt32x4FromFloat32x4Bits() { ]; for (var [v,w] of valsExp) { - assertEqX4(int32x4.fromFloat32x4Bits(float32x4(...v)), w); + assertEqX4(Int32x4.fromFloat32x4Bits(Float32x4(...v)), w); } } function testInt32x4FromFloat64x2() { - assertEqX4(int32x4.fromFloat64x2(float64x2(1, 2.2)), [1, 2, 0, 0]); + assertEqX4(Int32x4.fromFloat64x2(Float64x2(1, 2.2)), [1, 2, 0, 0]); - var g = float64x2(Infinity, 0); - assertThrowsInstanceOf(() => int32x4.fromFloat64x2(g), RangeError); + var g = Float64x2(Infinity, 0); + assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError); - var g = float64x2(-Infinity, 0); - assertThrowsInstanceOf(() => int32x4.fromFloat64x2(g), RangeError); + var g = Float64x2(-Infinity, 0); + assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError); - var g = float64x2(NaN, 0); - assertThrowsInstanceOf(() => int32x4.fromFloat64x2(g), RangeError); + var g = Float64x2(NaN, 0); + assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError); // Testing high boundaries // double(0, 1023 + 30, 0) < INT32_MAX < double(0, 1023 + 31, 0), so the @@ -369,20 +369,20 @@ function testInt32x4FromFloat64x2() { assertEq(makeDouble(0, 1023 + 30, 0) + Math.pow(2, -22), makeDouble(0, 1023 + 30, 1)); assertEq(makeDouble(0, 1023 + 30, 0) + Math.pow(2, -23), makeDouble(0, 1023 + 30, 0)); - var g = float64x2(INT32_MAX, 0); - assertEqX4(int32x4.fromFloat64x2(g), [INT32_MAX, 0, 0, 0]); + var g = Float64x2(INT32_MAX, 0); + assertEqX4(Int32x4.fromFloat64x2(g), [INT32_MAX, 0, 0, 0]); - var g = float64x2(INT32_MAX + Math.pow(2, -22), 0); - assertThrowsInstanceOf(() => int32x4.fromFloat64x2(g), RangeError); + var g = Float64x2(INT32_MAX + Math.pow(2, -22), 0); + assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError); // Testing low boundaries assertEq(makeDouble(1, 1023 + 31, 0), INT32_MIN); - var g = float64x2(makeDouble(1, 1023 + 31, 0), 0); - assertEqX4(int32x4.fromFloat64x2(g), [INT32_MIN, 0, 0, 0]); + var g = Float64x2(makeDouble(1, 1023 + 31, 0), 0); + assertEqX4(Int32x4.fromFloat64x2(g), [INT32_MIN, 0, 0, 0]); - var g = float64x2(makeDouble(1, 1023 + 31, 1), 0); - assertThrowsInstanceOf(() => int32x4.fromFloat64x2(g), RangeError); + var g = Float64x2(makeDouble(1, 1023 + 31, 1), 0); + assertThrowsInstanceOf(() => Int32x4.fromFloat64x2(g), RangeError); } @@ -395,7 +395,7 @@ function testInt32x4FromFloat64x2Bits() { ]; for (var [v,w] of valsExp) { - assertEqX4(int32x4.fromFloat64x2Bits(float64x2(...v)), w); + assertEqX4(Int32x4.fromFloat64x2Bits(Float64x2(...v)), w); } } @@ -427,8 +427,8 @@ function testInt32x4FromInt8x16Bits() { INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN, INT8_MAX, INT8_MIN]]; for (var v of vals) { - var i = int8x16(...v); - assertEqX4(int32x4.fromInt8x16Bits(i), expected(i)); + var i = Int8x16(...v); + assertEqX4(Int32x4.fromInt8x16Bits(i), expected(i)); } } @@ -451,8 +451,8 @@ function testInt32x4FromInt16x8Bits() { [INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX, INT16_MIN, INT16_MAX]]; for (var v of vals) { - var i = int16x8(...v); - assertEqX4(int32x4.fromInt16x8Bits(i), expected(i)); + var i = Int16x8(...v); + assertEqX4(Int32x4.fromInt16x8Bits(i), expected(i)); } } @@ -471,8 +471,8 @@ function testInt8x16FromFloat32x4Bits() { var vals = [[1, -2, 3, -4], [Infinity, -Infinity, NaN, -0]]; for (var v of vals) { - var f = float32x4(...v); - assertEqX16(int8x16.fromFloat32x4Bits(f), expected(f)); + var f = Float32x4(...v); + assertEqX16(Int8x16.fromFloat32x4Bits(f), expected(f)); } } @@ -488,8 +488,8 @@ function testInt8x16FromFloat64x2Bits() { var vals = [[1, -2], [-3, 4], [Infinity, -Infinity], [NaN, -0]]; for (var v of vals) { - var f = float64x2(...v); - assertEqX16(int8x16.fromFloat64x2Bits(f), expected(f)); + var f = Float64x2(...v); + assertEqX16(Int8x16.fromFloat64x2Bits(f), expected(f)); } } @@ -511,8 +511,8 @@ function testInt8x16FromInt16x8Bits() { var vals = [[0, 1, -2, 3, INT8_MIN, INT8_MAX, INT16_MIN, INT16_MAX]]; for (var v of vals) { - var i = int16x8(...v); - assertEqX16(int8x16.fromInt16x8Bits(i), expected(i)); + var i = Int16x8(...v); + assertEqX16(Int8x16.fromInt16x8Bits(i), expected(i)); } } @@ -530,8 +530,8 @@ function testInt8x16FromInt32x4Bits() { var vals = [[0, 1, -2, 3], [INT8_MIN, INT8_MAX, INT32_MIN, INT32_MAX]]; for (var v of vals) { - var i = int32x4(...v); - assertEqX16(int8x16.fromInt32x4Bits(i), expected(i)); + var i = Int32x4(...v); + assertEqX16(Int8x16.fromInt32x4Bits(i), expected(i)); } } @@ -549,8 +549,8 @@ function testInt16x8FromFloat32x4Bits() { var vals = [[1, -2, 3, -4], [Infinity, -Infinity, NaN, -0]]; for (var v of vals) { - var f = float32x4(...v); - assertEqX8(int16x8.fromFloat32x4Bits(f), expected(f)); + var f = Float32x4(...v); + assertEqX8(Int16x8.fromFloat32x4Bits(f), expected(f)); } } @@ -566,8 +566,8 @@ function testInt16x8FromFloat64x2Bits() { var vals = [[1, -2], [-3, 4], [Infinity, -Infinity], [NaN, -0]]; for (var v of vals) { - var f = float64x2(...v); - assertEqX8(int16x8.fromFloat64x2Bits(f), expected(f)); + var f = Float64x2(...v); + assertEqX8(Int16x8.fromFloat64x2Bits(f), expected(f)); } } @@ -597,8 +597,8 @@ function testInt16x8FromInt8x16Bits() { var vals = [[0, 1, -2, 3, -4, 5, INT8_MIN, INT8_MAX, -6, 7, -8, 9, -10, 11, -12, 13]]; for (var v of vals) { - var i = int8x16(...v); - assertEqX8(int16x8.fromInt8x16Bits(i), expected(i)); + var i = Int8x16(...v); + assertEqX8(Int16x8.fromInt8x16Bits(i), expected(i)); } } @@ -616,8 +616,8 @@ function testInt16x8FromInt32x4Bits() { var vals = [[1, -2, -3, 4], [INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN]]; for (var v of vals) { - var i = int32x4(...v); - assertEqX8(int16x8.fromInt32x4Bits(i), expected(i)); + var i = Int32x4(...v); + assertEqX8(Int16x8.fromInt32x4Bits(i), expected(i)); } } diff --git a/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js b/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js index ec96359338f..17c51a9e0a1 100644 --- a/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js +++ b/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js @@ -1,8 +1,5 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var BUGNUMBER = 1031203; -var float64x2 = SIMD.float64x2; - -var summary = 'float64x2 arithmetic'; +var Float64x2 = SIMD.Float64x2; /* * Any copyright is dedicated to the Public Domain. @@ -18,42 +15,40 @@ function reciprocalApproximation(a) { return 1 / a; } function reciprocalSqrtApproximation(a) { return 1 / Math.sqrt(a); } function testAdd(v, w) { - return testBinaryFunc(v, w, float64x2.add, add); + return testBinaryFunc(v, w, Float64x2.add, add); } function testSub(v, w) { - return testBinaryFunc(v, w, float64x2.sub, sub); + return testBinaryFunc(v, w, Float64x2.sub, sub); } function testMul(v, w) { - return testBinaryFunc(v, w, float64x2.mul, mul); + return testBinaryFunc(v, w, Float64x2.mul, mul); } function testDiv(v, w) { - return testBinaryFunc(v, w, float64x2.div, div); + return testBinaryFunc(v, w, Float64x2.div, div); } function testAbs(v) { - return testUnaryFunc(v, float64x2.abs, Math.abs); + return testUnaryFunc(v, Float64x2.abs, Math.abs); } function testNeg(v) { - return testUnaryFunc(v, float64x2.neg, neg); + return testUnaryFunc(v, Float64x2.neg, neg); } function testReciprocalApproximation(v) { - return testUnaryFunc(v, float64x2.reciprocalApproximation, reciprocalApproximation); + return testUnaryFunc(v, Float64x2.reciprocalApproximation, reciprocalApproximation); } function testReciprocalSqrtApproximation(v) { - return testUnaryFunc(v, float64x2.reciprocalSqrtApproximation, reciprocalSqrtApproximation); + return testUnaryFunc(v, Float64x2.reciprocalSqrtApproximation, reciprocalSqrtApproximation); } function testSqrt(v) { - return testUnaryFunc(v, float64x2.sqrt, Math.sqrt); + return testUnaryFunc(v, Float64x2.sqrt, Math.sqrt); } function test() { - print(BUGNUMBER + ": " + summary); - var v, w; - for ([v, w] of [[float64x2(1, 2), float64x2(3, 4)], - [float64x2(1.894, 2.8909), float64x2(100.764, 200.987)], - [float64x2(-1, -2), float64x2(-14.54, 57)], - [float64x2(+Infinity, -Infinity), float64x2(NaN, -0)], - [float64x2(Math.pow(2, 31), Math.pow(2, -31)), float64x2(Math.pow(2, -1047), Math.pow(2, -149))]]) + for ([v, w] of [[Float64x2(1, 2), Float64x2(3, 4)], + [Float64x2(1.894, 2.8909), Float64x2(100.764, 200.987)], + [Float64x2(-1, -2), Float64x2(-14.54, 57)], + [Float64x2(+Infinity, -Infinity), Float64x2(NaN, -0)], + [Float64x2(Math.pow(2, 31), Math.pow(2, -31)), Float64x2(Math.pow(2, -1047), Math.pow(2, -149))]]) { testAdd(v, w); testSub(v, w); diff --git a/js/src/tests/ecma_7/SIMD/int16x8bool.js b/js/src/tests/ecma_7/SIMD/int16x8bool.js index af7c5930be2..5c5929034e9 100644 --- a/js/src/tests/ecma_7/SIMD/int16x8bool.js +++ b/js/src/tests/ecma_7/SIMD/int16x8bool.js @@ -1,5 +1,5 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var int16x8 = SIMD.int16x8; +var Int16x8 = SIMD.Int16x8; /* * Any copyright is dedicated to the Public Domain. @@ -7,7 +7,7 @@ var int16x8 = SIMD.int16x8; */ function test() { - var a = int16x8.bool(true, false, true, false, true, true, false, false); + var a = Int16x8.bool(true, false, true, false, true, true, false, false); assertEq(a.s0, -1); assertEq(a.s1, 0); assertEq(a.s2, -1); diff --git a/js/src/tests/ecma_7/SIMD/int32x4bool.js b/js/src/tests/ecma_7/SIMD/int32x4bool.js index dac5e83ac0e..f2062e4ec57 100644 --- a/js/src/tests/ecma_7/SIMD/int32x4bool.js +++ b/js/src/tests/ecma_7/SIMD/int32x4bool.js @@ -1,8 +1,5 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var BUGNUMBER = 1106428; -var int32x4 = SIMD.int32x4; - -var summary = 'int32x4 bool'; +var Int32x4 = SIMD.Int32x4; /* * Any copyright is dedicated to the Public Domain. @@ -16,69 +13,67 @@ function tryEmulateUndefined() { } function test() { - print(BUGNUMBER + ": " + summary); - - var a = int32x4.bool(true, false, true, false); + var a = Int32x4.bool(true, false, true, false); assertEq(a.x, -1); assertEq(a.y, 0); assertEq(a.z, -1); assertEq(a.w, 0); - var b = int32x4.bool(5, 0, 1, -2); + var b = Int32x4.bool(5, 0, 1, -2); assertEq(b.x, -1); assertEq(b.y, 0); assertEq(b.z, -1); assertEq(b.w, -1); - var c = int32x4.bool(1.23, 13.37, 42.99999999, 0.000001); + var c = Int32x4.bool(1.23, 13.37, 42.99999999, 0.000001); assertEq(c.x, -1); assertEq(c.y, -1); assertEq(c.z, -1); assertEq(c.w, -1); - var d = int32x4.bool("string", "", "1", "0"); + var d = Int32x4.bool("string", "", "1", "0"); assertEq(d.x, -1); assertEq(d.y, 0); assertEq(d.z, -1); assertEq(d.w, -1); - var e = int32x4.bool([], [1, 2, 3], SIMD.int32x4(1, 2, 3, 4), function() { return 0; }); + var e = Int32x4.bool([], [1, 2, 3], SIMD.Int32x4(1, 2, 3, 4), function() { return 0; }); assertEq(e.x, -1); assertEq(e.y, -1); assertEq(e.z, -1); assertEq(e.w, -1); - var f = int32x4.bool(undefined, null, {}, tryEmulateUndefined()); + var f = Int32x4.bool(undefined, null, {}, tryEmulateUndefined()); assertEq(f.x, 0); assertEq(f.y, 0); assertEq(f.z, -1); assertEq(f.w, 0); - var g = int32x4.bool(); + var g = Int32x4.bool(); assertEq(g.x, 0); assertEq(g.y, 0); assertEq(g.z, 0); assertEq(g.w, 0); - var h = int32x4.bool(true); + var h = Int32x4.bool(true); assertEq(h.x, -1); assertEq(h.y, 0); assertEq(h.z, 0); assertEq(h.w, 0); - var i = int32x4.bool(true, true); + var i = Int32x4.bool(true, true); assertEq(i.x, -1); assertEq(i.y, -1); assertEq(i.z, 0); assertEq(i.w, 0); - var j = int32x4.bool(true, true, true); + var j = Int32x4.bool(true, true, true); assertEq(j.x, -1); assertEq(j.y, -1); assertEq(j.z, -1); assertEq(j.w, 0); - var k = int32x4.bool(true, true, true, true, true); + var k = Int32x4.bool(true, true, true, true, true); assertEq(k.x, -1); assertEq(k.y, -1); assertEq(k.z, -1); diff --git a/js/src/tests/ecma_7/SIMD/int8x16bool.js b/js/src/tests/ecma_7/SIMD/int8x16bool.js index 3d0f4bd743d..de334613ea5 100644 --- a/js/src/tests/ecma_7/SIMD/int8x16bool.js +++ b/js/src/tests/ecma_7/SIMD/int8x16bool.js @@ -1,5 +1,5 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var int8x16 = SIMD.int8x16; +var Int8x16 = SIMD.Int8x16; /* * Any copyright is dedicated to the Public Domain. @@ -7,7 +7,7 @@ var int8x16 = SIMD.int8x16; */ function test() { - var a = int8x16.bool(true, false, true, false, true, true, false, false, true, true, true, false, false, false, true, true); + var a = Int8x16.bool(true, false, true, false, true, true, false, false, true, true, true, false, false, false, true, true); assertEq(a.s0, -1); assertEq(a.s1, 0); assertEq(a.s2, -1); diff --git a/js/src/tests/ecma_7/SIMD/load.js b/js/src/tests/ecma_7/SIMD/load.js index 26d4ed48b19..b443a870018 100644 --- a/js/src/tests/ecma_7/SIMD/load.js +++ b/js/src/tests/ecma_7/SIMD/load.js @@ -5,7 +5,7 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ -// Our array for int32x4 and float32x4 will have 16 elements +// Our array for Int32x4 and Float32x4 will have 16 elements const SIZE_8_ARRAY = 64; const SIZE_16_ARRAY = 32; const SIZE_32_ARRAY = 16; @@ -28,23 +28,23 @@ function MakeComparator(kind, arr, shared) { // Typed array constructor corresponding to the SIMD kind. var typedArrayCtor; switch (kind) { - case 'int8x16': + case 'Int8x16': sizeOfLaneElem = 1; typedArrayCtor = Int8Array; break; - case 'int16x8': + case 'Int16x8': sizeOfLaneElem = 2; typedArrayCtor = Int16Array; break; - case 'int32x4': + case 'Int32x4': sizeOfLaneElem = 4; typedArrayCtor = Int32Array; break; - case 'float32x4': + case 'Float32x4': sizeOfLaneElem = 4; typedArrayCtor = Float32Array; break; - case 'float64x2': + case 'Float64x2': sizeOfLaneElem = 8; typedArrayCtor = Float64Array; break; @@ -73,7 +73,7 @@ function MakeComparator(kind, arr, shared) { var type = SIMD[kind]; return { load1: function(index) { - if (lanes >= 8) // int8x16 and int16x8 only support load, no load1/load2/etc. + if (lanes >= 8) // Int8x16 and Int16x8 only support load, no load1/load2/etc. return var v = type.load1(arr, index); assertFunc(v, slice(index, 1)); @@ -202,7 +202,7 @@ function testSharedArrayBufferCompat() { new SharedFloat64Array(TA.buffer) ]) { - for (var kind of ['int32x4', 'float32x4', 'float64x2']) { + for (var kind of ['Int32x4', 'Float32x4', 'Float64x2']) { var comp = MakeComparator(kind, ta); comp.load(0); comp.load1(0); @@ -215,17 +215,17 @@ function testSharedArrayBufferCompat() { comp.load3(3); } - assertThrowsInstanceOf(() => SIMD.int32x4.load(ta, 1024), RangeError); - assertThrowsInstanceOf(() => SIMD.float32x4.load(ta, 1024), RangeError); - assertThrowsInstanceOf(() => SIMD.float64x2.load(ta, 1024), RangeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.load(ta, 1024), RangeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.load(ta, 1024), RangeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.load(ta, 1024), RangeError); } } -testLoad('float32x4', new Float32Array(SIZE_32_ARRAY)); -testLoad('float64x2', new Float64Array(SIZE_64_ARRAY)); -testLoad('int8x16', new Int8Array(SIZE_8_ARRAY)); -testLoad('int16x8', new Int16Array(SIZE_16_ARRAY)); -testLoad('int32x4', new Int32Array(SIZE_32_ARRAY)); +testLoad('Float32x4', new Float32Array(SIZE_32_ARRAY)); +testLoad('Float64x2', new Float64Array(SIZE_64_ARRAY)); +testLoad('Int8x16', new Int8Array(SIZE_8_ARRAY)); +testLoad('Int16x8', new Int16Array(SIZE_16_ARRAY)); +testLoad('Int32x4', new Int32Array(SIZE_32_ARRAY)); testSharedArrayBufferCompat(); if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_7/SIMD/minmax.js b/js/src/tests/ecma_7/SIMD/minmax.js index c21dcccf231..9742b70d1db 100644 --- a/js/src/tests/ecma_7/SIMD/minmax.js +++ b/js/src/tests/ecma_7/SIMD/minmax.js @@ -5,21 +5,21 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; function testMaxFloat32(v, w) { - return testBinaryFunc(v, w, float32x4.max, (x, y) => Math.fround(Math.max(x, y)), 4); + return testBinaryFunc(v, w, Float32x4.max, (x, y) => Math.fround(Math.max(x, y)), 4); } function testMinFloat32(v, w) { - return testBinaryFunc(v, w, float32x4.min, (x, y) => Math.fround(Math.min(x, y)), 4); + return testBinaryFunc(v, w, Float32x4.min, (x, y) => Math.fround(Math.min(x, y)), 4); } function testMaxFloat64(v, w) { - return testBinaryFunc(v, w, float64x2.max, (x, y) => Math.max(x, y), 2); + return testBinaryFunc(v, w, Float64x2.max, (x, y) => Math.max(x, y), 2); } function testMinFloat64(v, w) { - return testBinaryFunc(v, w, float64x2.min, (x, y) => Math.min(x, y), 2); + return testBinaryFunc(v, w, Float64x2.min, (x, y) => Math.min(x, y), 2); } function maxNum(x, y) { @@ -39,24 +39,24 @@ function minNum(x, y) { } function testMaxNumFloat32(v, w) { - return testBinaryFunc(v, w, float32x4.maxNum, maxNum, 4); + return testBinaryFunc(v, w, Float32x4.maxNum, maxNum, 4); } function testMinNumFloat32(v, w) { - return testBinaryFunc(v, w, float32x4.minNum, minNum, 4); + return testBinaryFunc(v, w, Float32x4.minNum, minNum, 4); } function testMaxNumFloat64(v, w) { - return testBinaryFunc(v, w, float64x2.maxNum, maxNum, 2); + return testBinaryFunc(v, w, Float64x2.maxNum, maxNum, 2); } function testMinNumFloat64(v, w) { - return testBinaryFunc(v, w, float64x2.minNum, minNum, 2); + return testBinaryFunc(v, w, Float64x2.minNum, minNum, 2); } function test() { var v, w; - for ([v, w] of [[float32x4(1, 20, 30, 4), float32x4(10, 2, 3, 40)], - [float32x4(9.999, 2.1234, 30.4443, 4), float32x4(10, 2.1233, 30.4444, 4.0001)], - [float32x4(NaN, -Infinity, +Infinity, -0), float32x4(13.37, 42.42, NaN, 0)]]) + for ([v, w] of [[Float32x4(1, 20, 30, 4), Float32x4(10, 2, 3, 40)], + [Float32x4(9.999, 2.1234, 30.4443, 4), Float32x4(10, 2.1233, 30.4444, 4.0001)], + [Float32x4(NaN, -Infinity, +Infinity, -0), Float32x4(13.37, 42.42, NaN, 0)]]) { testMinFloat32(v, w); testMaxFloat32(v, w); @@ -64,12 +64,12 @@ function test() { testMaxNumFloat32(v, w); } - for ([v, w] of [[float64x2(1, 20), float64x2(10, 2)], - [float64x2(30, 4), float64x2(3, 40)], - [float64x2(9.999, 2.1234), float64x2(10, 2.1233)], - [float64x2(30.4443, 4), float64x2(30.4444, 4.0001)], - [float64x2(NaN, -Infinity), float64x2(13.37, 42.42)], - [float64x2(+Infinity, -0), float64x2(NaN, 0)]]) + for ([v, w] of [[Float64x2(1, 20), Float64x2(10, 2)], + [Float64x2(30, 4), Float64x2(3, 40)], + [Float64x2(9.999, 2.1234), Float64x2(10, 2.1233)], + [Float64x2(30.4443, 4), Float64x2(30.4444, 4.0001)], + [Float64x2(NaN, -Infinity), Float64x2(13.37, 42.42)], + [Float64x2(+Infinity, -0), Float64x2(NaN, 0)]]) { testMinFloat64(v, w); testMaxFloat64(v, w); diff --git a/js/src/tests/ecma_7/SIMD/replaceLane.js b/js/src/tests/ecma_7/SIMD/replaceLane.js index fd02caa361a..6d147d0809b 100644 --- a/js/src/tests/ecma_7/SIMD/replaceLane.js +++ b/js/src/tests/ecma_7/SIMD/replaceLane.js @@ -1,9 +1,9 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; -var float64x2 = SIMD.float64x2; +var Float32x4 = SIMD.Float32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; +var Float64x2 = SIMD.Float64x2; function replaceLaneN(laneIndex, arr, value) { var copy = arr.slice(); @@ -70,66 +70,66 @@ function test() { var good = {valueOf: () => 42}; var bad = {valueOf: () => {throw new TestError(); }}; - var float32x4inputs = [ - [float32x4(1, 2, 3, 4), 5], - [float32x4(1.87, 2.08, 3.84, 4.17), Math.fround(13.37)], - [float32x4(NaN, -0, Infinity, -Infinity), 0] + var Float32x4inputs = [ + [Float32x4(1, 2, 3, 4), 5], + [Float32x4(1.87, 2.08, 3.84, 4.17), Math.fround(13.37)], + [Float32x4(NaN, -0, Infinity, -Infinity), 0] ]; - testType('float32x4', float32x4inputs); + testType('Float32x4', Float32x4inputs); - var v = float32x4inputs[1][0]; - assertEqX4(float32x4.replaceLane(v, 0), replaceLane0(simdToArray(v), NaN)); - assertEqX4(float32x4.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); - assertThrowsInstanceOf(() => float32x4.replaceLane(v, 0, bad), TestError); - assertThrowsInstanceOf(() => float32x4.replaceLane(v, 4, good), TypeError); - assertThrowsInstanceOf(() => float32x4.replaceLane(v, 1.1, good), TypeError); + var v = Float32x4inputs[1][0]; + assertEqX4(Float32x4.replaceLane(v, 0), replaceLane0(simdToArray(v), NaN)); + assertEqX4(Float32x4.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); + assertThrowsInstanceOf(() => Float32x4.replaceLane(v, 0, bad), TestError); + assertThrowsInstanceOf(() => Float32x4.replaceLane(v, 4, good), TypeError); + assertThrowsInstanceOf(() => Float32x4.replaceLane(v, 1.1, good), TypeError); - var float64x2inputs = [ - [float64x2(1, 2), 5], - [float64x2(1.87, 2.08), Math.fround(13.37)], - [float64x2(NaN, -0), 0] + var Float64x2inputs = [ + [Float64x2(1, 2), 5], + [Float64x2(1.87, 2.08), Math.fround(13.37)], + [Float64x2(NaN, -0), 0] ]; - testType('float64x2', float64x2inputs); + testType('Float64x2', Float64x2inputs); - var v = float64x2inputs[1][0]; - assertEqX4(float64x2.replaceLane(v, 0), replaceLane0(simdToArray(v), NaN)); - assertEqX4(float64x2.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); - assertThrowsInstanceOf(() => float64x2.replaceLane(v, 0, bad), TestError); - assertThrowsInstanceOf(() => float64x2.replaceLane(v, 2, good), TypeError); - assertThrowsInstanceOf(() => float64x2.replaceLane(v, 1.1, good), TypeError); + var v = Float64x2inputs[1][0]; + assertEqX4(Float64x2.replaceLane(v, 0), replaceLane0(simdToArray(v), NaN)); + assertEqX4(Float64x2.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); + assertThrowsInstanceOf(() => Float64x2.replaceLane(v, 0, bad), TestError); + assertThrowsInstanceOf(() => Float64x2.replaceLane(v, 2, good), TypeError); + assertThrowsInstanceOf(() => Float64x2.replaceLane(v, 1.1, good), TypeError); - var int8x16inputs = [[int8x16(0, 1, 2, 3, 4, 5, 6, 7, -1, -2, -3, -4, -5, -6, INT8_MIN, INT8_MAX), 17]]; - testType('int8x16', int8x16inputs); + var Int8x16inputs = [[Int8x16(0, 1, 2, 3, 4, 5, 6, 7, -1, -2, -3, -4, -5, -6, INT8_MIN, INT8_MAX), 17]]; + testType('Int8x16', Int8x16inputs); - var v = int8x16inputs[0][0]; - assertEqX16(int8x16.replaceLane(v, 0), replaceLane0(simdToArray(v), 0)); - assertEqX16(int8x16.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); - assertThrowsInstanceOf(() => int8x16.replaceLane(v, 0, bad), TestError); - assertThrowsInstanceOf(() => int8x16.replaceLane(v, 16, good), TypeError); - assertThrowsInstanceOf(() => int8x16.replaceLane(v, 1.1, good), TypeError); + var v = Int8x16inputs[0][0]; + assertEqX16(Int8x16.replaceLane(v, 0), replaceLane0(simdToArray(v), 0)); + assertEqX16(Int8x16.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); + assertThrowsInstanceOf(() => Int8x16.replaceLane(v, 0, bad), TestError); + assertThrowsInstanceOf(() => Int8x16.replaceLane(v, 16, good), TypeError); + assertThrowsInstanceOf(() => Int8x16.replaceLane(v, 1.1, good), TypeError); - var int16x8inputs = [[int16x8(0, 1, 2, 3, -1, -2, INT16_MIN, INT16_MAX), 9]]; - testType('int16x8', int16x8inputs); + var Int16x8inputs = [[Int16x8(0, 1, 2, 3, -1, -2, INT16_MIN, INT16_MAX), 9]]; + testType('Int16x8', Int16x8inputs); - var v = int16x8inputs[0][0]; - assertEqX8(int16x8.replaceLane(v, 0), replaceLane0(simdToArray(v), 0)); - assertEqX8(int16x8.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); - assertThrowsInstanceOf(() => int16x8.replaceLane(v, 0, bad), TestError); - assertThrowsInstanceOf(() => int16x8.replaceLane(v, 8, good), TypeError); - assertThrowsInstanceOf(() => int16x8.replaceLane(v, 1.1, good), TypeError); + var v = Int16x8inputs[0][0]; + assertEqX8(Int16x8.replaceLane(v, 0), replaceLane0(simdToArray(v), 0)); + assertEqX8(Int16x8.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); + assertThrowsInstanceOf(() => Int16x8.replaceLane(v, 0, bad), TestError); + assertThrowsInstanceOf(() => Int16x8.replaceLane(v, 8, good), TypeError); + assertThrowsInstanceOf(() => Int16x8.replaceLane(v, 1.1, good), TypeError); - var int32x4inputs = [ - [int32x4(1, 2, 3, 4), 5], - [int32x4(INT32_MIN, INT32_MAX, 3, 4), INT32_MIN], + var Int32x4inputs = [ + [Int32x4(1, 2, 3, 4), 5], + [Int32x4(INT32_MIN, INT32_MAX, 3, 4), INT32_MIN], ]; - testType('int32x4', int32x4inputs); + testType('Int32x4', Int32x4inputs); - var v = int32x4inputs[1][0]; - assertEqX4(int32x4.replaceLane(v, 0), replaceLane0(simdToArray(v), 0)); - assertEqX4(int32x4.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); - assertThrowsInstanceOf(() => int32x4.replaceLane(v, 0, bad), TestError); - assertThrowsInstanceOf(() => int32x4.replaceLane(v, 4, good), TypeError); - assertThrowsInstanceOf(() => int32x4.replaceLane(v, 1.1, good), TypeError); + var v = Int32x4inputs[1][0]; + assertEqX4(Int32x4.replaceLane(v, 0), replaceLane0(simdToArray(v), 0)); + assertEqX4(Int32x4.replaceLane(v, 0, good), replaceLane0(simdToArray(v), good | 0)); + assertThrowsInstanceOf(() => Int32x4.replaceLane(v, 0, bad), TestError); + assertThrowsInstanceOf(() => Int32x4.replaceLane(v, 4, good), TypeError); + assertThrowsInstanceOf(() => Int32x4.replaceLane(v, 1.1, good), TypeError); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/select-bitselect.js b/js/src/tests/ecma_7/SIMD/select-bitselect.js index 17ac04f0a90..1ee363d41c2 100644 --- a/js/src/tests/ecma_7/SIMD/select-bitselect.js +++ b/js/src/tests/ecma_7/SIMD/select-bitselect.js @@ -5,28 +5,28 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function getMask(i, maskLength) { var args = []; for (var j = 0; j < maskLength; j++) args.push(!!((i >> j) & 1)); if (maskLength == 4) - return int32x4.bool(...args); + return Int32x4.bool(...args); else if (maskLength == 8) - return int16x8.bool(...args); + return Int16x8.bool(...args); else if (maskLength == 16) - return int8x16.bool(...args); + return Int8x16.bool(...args); else throw new Error("Invalid mask length."); } function selectMaskType(type) { - if (type == int32x4 || type == float32x4 || type == float64x2) - return int32x4; + if (type == Int32x4 || type == Float32x4 || type == Float64x2) + return Int32x4; return type; } @@ -41,9 +41,9 @@ function select(mask, ifTrue, ifFalse) { /** * Tests type.select on all input pairs, for all possible masks. As the mask - * has 4 lanes (for int32x4) and 2 possible values (true or false), there are 16 possible - * masks. For int8x16, the mask has 16 lanes and 2 possible values, so there are 256 - * possible masks. For int16x8, the mask has 8 lanes and 2 possible values, so there + * has 4 lanes (for Int32x4) and 2 possible values (true or false), there are 16 possible + * masks. For Int8x16, the mask has 16 lanes and 2 possible values, so there are 256 + * possible masks. For Int16x8, the mask has 8 lanes and 2 possible values, so there * are 64 possible masks. */ function testSelect(type, inputs) { @@ -59,15 +59,15 @@ function testSelect(type, inputs) { function intFromTypeBits(type, vec) { switch (type) { - case float32x4: - return int32x4.fromFloat32x4Bits(vec); - case float64x2: - return int32x4.fromFloat64x2Bits(vec); - case int8x16: + case Float32x4: + return Int32x4.fromFloat32x4Bits(vec); + case Float64x2: + return Int32x4.fromFloat64x2Bits(vec); + case Int8x16: return vec; - case int16x8: + case Int16x8: return vec; - case int32x4: + case Int32x4: return vec; default: throw new TypeError("Unknown SIMD type."); @@ -87,11 +87,11 @@ function bitselect(type, mask, ifTrue, ifFalse) { function findCorrespondingScalarTypedArray(type) { switch (type) { - case int8x16: return Int8Array; - case int16x8: return Int16Array; - case int32x4: return Int32Array; - case float32x4: return Float32Array; - case float64x2: return Float64Array; + case Int8x16: return Int8Array; + case Int16x8: return Int16Array; + case Int32x4: return Int32Array; + case Float32x4: return Float32Array; + case Float64x2: return Float64Array; default: throw new Error("undefined scalar typed array"); } } @@ -118,24 +118,24 @@ function testBitSelectSimple(type, inputs) { */ function testBitSelectComplex(type, inputs) { var masks8 = [ - int8x16(0x42, 42, INT8_MAX, INT8_MIN, INT8_MAX + 1, INT8_MIN - 1, 13, 37, -42, 125, -125, -1, 1, 0xA, 0xB, 0xC) + Int8x16(0x42, 42, INT8_MAX, INT8_MIN, INT8_MAX + 1, INT8_MIN - 1, 13, 37, -42, 125, -125, -1, 1, 0xA, 0xB, 0xC) ] var masks16 = [ - int16x8(0x42, 42, INT16_MAX, INT16_MIN, INT16_MAX + 1, INT16_MIN - 1, 13, 37), - int16x8(-42, 125, -125, -1, 1, 0xA, 0xB, 0xC) + Int16x8(0x42, 42, INT16_MAX, INT16_MIN, INT16_MAX + 1, INT16_MIN - 1, 13, 37), + Int16x8(-42, 125, -125, -1, 1, 0xA, 0xB, 0xC) ] var masks32 = [ - int32x4(1337, 0x1337, 0x42, 42), - int32x4(0x00FF1CE, 0xBAADF00D, 0xDEADBEEF, 0xCAFED00D), - int32x4(0xD15EA5E, 0xDEADC0DE, 0xFACEB00C, 0x4B1D4B1D) + Int32x4(1337, 0x1337, 0x42, 42), + Int32x4(0x00FF1CE, 0xBAADF00D, 0xDEADBEEF, 0xCAFED00D), + Int32x4(0xD15EA5E, 0xDEADC0DE, 0xFACEB00C, 0x4B1D4B1D) ]; var masks = []; var maskType = selectMaskType(type); - if (maskType == SIMD.int8x16) + if (maskType == SIMD.Int8x16) masks = masks8; - else if (maskType == SIMD.int16x8) + else if (maskType == SIMD.Int16x8) masks = masks16; - else if (maskType == SIMD.int32x4) + else if (maskType == SIMD.Int32x4) masks = masks32; else throw new Error("Unknown mask type."); @@ -150,56 +150,56 @@ function testBitSelectComplex(type, inputs) { function test() { var inputs = [ - [int8x16(0,4,9,16,25,36,49,64,81,121,-4,-9,-16,-25,-36,-49), int8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)], - [int8x16(-1, 2, INT8_MAX, INT8_MIN, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), - int8x16(INT8_MAX, -4, INT8_MIN, 42, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)] + [Int8x16(0,4,9,16,25,36,49,64,81,121,-4,-9,-16,-25,-36,-49), Int8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)], + [Int8x16(-1, 2, INT8_MAX, INT8_MIN, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), + Int8x16(INT8_MAX, -4, INT8_MIN, 42, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)] ]; - testSelect(int8x16, inputs); - testBitSelectSimple(int8x16, inputs); - testBitSelectComplex(int8x16, inputs); + testSelect(Int8x16, inputs); + testBitSelectSimple(Int8x16, inputs); + testBitSelectComplex(Int8x16, inputs); inputs = [ - [int16x8(0,4,9,16,25,36,49,64), int16x8(1,2,3,4,5,6,7,8)], - [int16x8(-1, 2, INT16_MAX, INT16_MIN, 5, 6, 7, 8), - int16x8(INT16_MAX, -4, INT16_MIN, 42, 5, 6, 7, 8)] + [Int16x8(0,4,9,16,25,36,49,64), Int16x8(1,2,3,4,5,6,7,8)], + [Int16x8(-1, 2, INT16_MAX, INT16_MIN, 5, 6, 7, 8), + Int16x8(INT16_MAX, -4, INT16_MIN, 42, 5, 6, 7, 8)] ]; - testSelect(int16x8, inputs); - testBitSelectSimple(int16x8, inputs); - testBitSelectComplex(int16x8, inputs); + testSelect(Int16x8, inputs); + testBitSelectSimple(Int16x8, inputs); + testBitSelectComplex(Int16x8, inputs); inputs = [ - [int32x4(0,4,9,16), int32x4(1,2,3,4)], - [int32x4(-1, 2, INT32_MAX, INT32_MIN), int32x4(INT32_MAX, -4, INT32_MIN, 42)] + [Int32x4(0,4,9,16), Int32x4(1,2,3,4)], + [Int32x4(-1, 2, INT32_MAX, INT32_MIN), Int32x4(INT32_MAX, -4, INT32_MIN, 42)] ]; - testSelect(int32x4, inputs); - testBitSelectSimple(int32x4, inputs); - testBitSelectComplex(int32x4, inputs); + testSelect(Int32x4, inputs); + testBitSelectSimple(Int32x4, inputs); + testBitSelectComplex(Int32x4, inputs); inputs = [ - [float32x4(0.125,4.25,9.75,16.125), float32x4(1.5,2.75,3.25,4.5)], - [float32x4(-1.5,-0,NaN,-Infinity), float32x4(1,-2,13.37,3.13)], - [float32x4(1.5,2.75,NaN,Infinity), float32x4(-NaN,-Infinity,9.75,16.125)] + [Float32x4(0.125,4.25,9.75,16.125), Float32x4(1.5,2.75,3.25,4.5)], + [Float32x4(-1.5,-0,NaN,-Infinity), Float32x4(1,-2,13.37,3.13)], + [Float32x4(1.5,2.75,NaN,Infinity), Float32x4(-NaN,-Infinity,9.75,16.125)] ]; - testSelect(float32x4, inputs); - testBitSelectSimple(float32x4, inputs); - testBitSelectComplex(float32x4, inputs); + testSelect(Float32x4, inputs); + testBitSelectSimple(Float32x4, inputs); + testBitSelectComplex(Float32x4, inputs); inputs = [ - [float64x2(0.125,4.25), float64x2(9.75,16.125)], - [float64x2(1.5,2.75), float64x2(3.25,4.5)], - [float64x2(-1.5,-0), float64x2(NaN,-Infinity)], - [float64x2(1,-2), float64x2(13.37,3.13)], - [float64x2(1.5,2.75), float64x2(NaN,Infinity)], - [float64x2(-NaN,-Infinity), float64x2(9.75,16.125)] + [Float64x2(0.125,4.25), Float64x2(9.75,16.125)], + [Float64x2(1.5,2.75), Float64x2(3.25,4.5)], + [Float64x2(-1.5,-0), Float64x2(NaN,-Infinity)], + [Float64x2(1,-2), Float64x2(13.37,3.13)], + [Float64x2(1.5,2.75), Float64x2(NaN,Infinity)], + [Float64x2(-NaN,-Infinity), Float64x2(9.75,16.125)] ]; - testSelect(float64x2, inputs); - testBitSelectSimple(float64x2, inputs); - testBitSelectComplex(float64x2, inputs); + testSelect(Float64x2, inputs); + testBitSelectSimple(Float64x2, inputs); + testBitSelectComplex(Float64x2, inputs); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/shell.js b/js/src/tests/ecma_7/SIMD/shell.js index 495a6168e86..5bbc60276a3 100644 --- a/js/src/tests/ecma_7/SIMD/shell.js +++ b/js/src/tests/ecma_7/SIMD/shell.js @@ -93,13 +93,13 @@ function assertEqX16(v, arr) { function simdLength(v) { var pt = Object.getPrototypeOf(v); - if (pt == SIMD.int8x16.prototype) { + if (pt == SIMD.Int8x16.prototype) { return 16; - } else if (pt == SIMD.int16x8.prototype) { + } else if (pt == SIMD.Int16x8.prototype) { return 8; - } else if (pt === SIMD.int32x4.prototype || pt === SIMD.float32x4.prototype) { + } else if (pt === SIMD.Int32x4.prototype || pt === SIMD.Float32x4.prototype) { return 4; - } else if (pt === SIMD.float64x2.prototype) { + } else if (pt === SIMD.Float64x2.prototype) { return 2; } else { throw new TypeError("Unknown SIMD kind."); @@ -107,13 +107,13 @@ function simdLength(v) { } function simdLengthType(t) { - if (t == SIMD.int8x16) + if (t == SIMD.Int8x16) return 16; - else if (t == SIMD.int16x8) + else if (t == SIMD.Int16x8) return 8; - else if (t == SIMD.int32x4 || t == SIMD.float32x4) + else if (t == SIMD.Int32x4 || t == SIMD.Float32x4) return 4; - else if (t == SIMD.float64x2) + else if (t == SIMD.Float64x2) return 2; else throw new TypeError("Unknown SIMD kind."); diff --git a/js/src/tests/ecma_7/SIMD/shifts.js b/js/src/tests/ecma_7/SIMD/shifts.js index 76b9281a206..9c179b8e6b0 100644 --- a/js/src/tests/ecma_7/SIMD/shifts.js +++ b/js/src/tests/ecma_7/SIMD/shifts.js @@ -5,9 +5,9 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function lsh8(a, b) { return (b >>> 0) >= 8 ? 0 : (a << b) << 24 >> 24; @@ -46,65 +46,65 @@ function test() { var bad = {valueOf: () => {throw new TestError(); }}; for (var v of [ - int8x16(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16), - int8x16(INT8_MAX, INT8_MIN, INT8_MAX - 1, INT8_MIN + 1) + Int8x16(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, -13, 14, -15, 16), + Int8x16(INT8_MAX, INT8_MIN, INT8_MAX - 1, INT8_MIN + 1) ]) { for (var bits = -2; bits < 12; bits++) { - testBinaryScalarFunc(v, bits, int8x16.shiftLeftByScalar, lsh8); - testBinaryScalarFunc(v, bits, int8x16.shiftRightArithmeticByScalar, rsh8); - testBinaryScalarFunc(v, bits, int8x16.shiftRightLogicalByScalar, ursh8); + testBinaryScalarFunc(v, bits, Int8x16.shiftLeftByScalar, lsh8); + testBinaryScalarFunc(v, bits, Int8x16.shiftRightArithmeticByScalar, rsh8); + testBinaryScalarFunc(v, bits, Int8x16.shiftRightLogicalByScalar, ursh8); } // Test that the shift count is coerced to an int32. - testBinaryScalarFunc(v, undefined, int8x16.shiftLeftByScalar, lsh8); - testBinaryScalarFunc(v, 3.5, int8x16.shiftLeftByScalar, lsh8); - testBinaryScalarFunc(v, good, int8x16.shiftLeftByScalar, lsh8); + testBinaryScalarFunc(v, undefined, Int8x16.shiftLeftByScalar, lsh8); + testBinaryScalarFunc(v, 3.5, Int8x16.shiftLeftByScalar, lsh8); + testBinaryScalarFunc(v, good, Int8x16.shiftLeftByScalar, lsh8); } for (var v of [ - int16x8(-1, 2, -3, 4, -5, 6, -7, 8), - int16x8(INT16_MAX, INT16_MIN, INT16_MAX - 1, INT16_MIN + 1) + Int16x8(-1, 2, -3, 4, -5, 6, -7, 8), + Int16x8(INT16_MAX, INT16_MIN, INT16_MAX - 1, INT16_MIN + 1) ]) { for (var bits = -2; bits < 20; bits++) { - testBinaryScalarFunc(v, bits, int16x8.shiftLeftByScalar, lsh16); - testBinaryScalarFunc(v, bits, int16x8.shiftRightArithmeticByScalar, rsh16); - testBinaryScalarFunc(v, bits, int16x8.shiftRightLogicalByScalar, ursh16); + testBinaryScalarFunc(v, bits, Int16x8.shiftLeftByScalar, lsh16); + testBinaryScalarFunc(v, bits, Int16x8.shiftRightArithmeticByScalar, rsh16); + testBinaryScalarFunc(v, bits, Int16x8.shiftRightLogicalByScalar, ursh16); } // Test that the shift count is coerced to an int32. - testBinaryScalarFunc(v, undefined, int16x8.shiftLeftByScalar, lsh16); - testBinaryScalarFunc(v, 3.5, int16x8.shiftLeftByScalar, lsh16); - testBinaryScalarFunc(v, good, int16x8.shiftLeftByScalar, lsh16); + testBinaryScalarFunc(v, undefined, Int16x8.shiftLeftByScalar, lsh16); + testBinaryScalarFunc(v, 3.5, Int16x8.shiftLeftByScalar, lsh16); + testBinaryScalarFunc(v, good, Int16x8.shiftLeftByScalar, lsh16); } for (var v of [ - int32x4(-1, 2, -3, 4), - int32x4(INT32_MAX, INT32_MIN, INT32_MAX - 1, INT32_MIN + 1) + Int32x4(-1, 2, -3, 4), + Int32x4(INT32_MAX, INT32_MIN, INT32_MAX - 1, INT32_MIN + 1) ]) { for (var bits = -2; bits < 36; bits++) { - testBinaryScalarFunc(v, bits, int32x4.shiftLeftByScalar, lsh32); - testBinaryScalarFunc(v, bits, int32x4.shiftRightArithmeticByScalar, rsh32); - testBinaryScalarFunc(v, bits, int32x4.shiftRightLogicalByScalar, ursh32); + testBinaryScalarFunc(v, bits, Int32x4.shiftLeftByScalar, lsh32); + testBinaryScalarFunc(v, bits, Int32x4.shiftRightArithmeticByScalar, rsh32); + testBinaryScalarFunc(v, bits, Int32x4.shiftRightLogicalByScalar, ursh32); } // Test that the shift count is coerced to an int32. - testBinaryScalarFunc(v, undefined, int32x4.shiftLeftByScalar, lsh32); - testBinaryScalarFunc(v, 3.5, int32x4.shiftLeftByScalar, lsh32); - testBinaryScalarFunc(v, good, int32x4.shiftLeftByScalar, lsh32); + testBinaryScalarFunc(v, undefined, Int32x4.shiftLeftByScalar, lsh32); + testBinaryScalarFunc(v, 3.5, Int32x4.shiftLeftByScalar, lsh32); + testBinaryScalarFunc(v, good, Int32x4.shiftLeftByScalar, lsh32); } - var v = SIMD.int8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); - assertThrowsInstanceOf(() => SIMD.int8x16.shiftLeftByScalar(v, bad), TestError); - assertThrowsInstanceOf(() => SIMD.int8x16.shiftRightArithmeticByScalar(v, bad), TestError); - assertThrowsInstanceOf(() => SIMD.int8x16.shiftRightLogicalByScalar(v, bad), TestError); + var v = SIMD.Int8x16(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16); + assertThrowsInstanceOf(() => SIMD.Int8x16.shiftLeftByScalar(v, bad), TestError); + assertThrowsInstanceOf(() => SIMD.Int8x16.shiftRightArithmeticByScalar(v, bad), TestError); + assertThrowsInstanceOf(() => SIMD.Int8x16.shiftRightLogicalByScalar(v, bad), TestError); - var v = SIMD.int16x8(1,2,3,4,5,6,7,8); - assertThrowsInstanceOf(() => SIMD.int16x8.shiftLeftByScalar(v, bad), TestError); - assertThrowsInstanceOf(() => SIMD.int16x8.shiftRightArithmeticByScalar(v, bad), TestError); - assertThrowsInstanceOf(() => SIMD.int16x8.shiftRightLogicalByScalar(v, bad), TestError); + var v = SIMD.Int16x8(1,2,3,4,5,6,7,8); + assertThrowsInstanceOf(() => SIMD.Int16x8.shiftLeftByScalar(v, bad), TestError); + assertThrowsInstanceOf(() => SIMD.Int16x8.shiftRightArithmeticByScalar(v, bad), TestError); + assertThrowsInstanceOf(() => SIMD.Int16x8.shiftRightLogicalByScalar(v, bad), TestError); - var v = SIMD.int32x4(1,2,3,4); - assertThrowsInstanceOf(() => SIMD.int32x4.shiftLeftByScalar(v, bad), TestError); - assertThrowsInstanceOf(() => SIMD.int32x4.shiftRightArithmeticByScalar(v, bad), TestError); - assertThrowsInstanceOf(() => SIMD.int32x4.shiftRightLogicalByScalar(v, bad), TestError); + var v = SIMD.Int32x4(1,2,3,4); + assertThrowsInstanceOf(() => SIMD.Int32x4.shiftLeftByScalar(v, bad), TestError); + assertThrowsInstanceOf(() => SIMD.Int32x4.shiftRightArithmeticByScalar(v, bad), TestError); + assertThrowsInstanceOf(() => SIMD.Int32x4.shiftRightLogicalByScalar(v, bad), TestError); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/signmask.js b/js/src/tests/ecma_7/SIMD/signmask.js index 98541a5f34c..2953520d60a 100644 --- a/js/src/tests/ecma_7/SIMD/signmask.js +++ b/js/src/tests/ecma_7/SIMD/signmask.js @@ -1,15 +1,15 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float32x4 = SIMD.Float32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; -function test_float32x4() { +function test_Float32x4() { var v, w; - for ([v, w] of [[float32x4(-1, 20, 30, 4), 0b0001], - [float32x4(9.999, 2.1234, 30.4443, -4), 0b1000], - [float32x4(0, -Infinity, +Infinity, -0), 0b1010]]) + for ([v, w] of [[Float32x4(-1, 20, 30, 4), 0b0001], + [Float32x4(9.999, 2.1234, 30.4443, -4), 0b1000], + [Float32x4(0, -Infinity, +Infinity, -0), 0b1010]]) { assertEq(v.signMask, w); } @@ -18,11 +18,11 @@ function test_float32x4() { reportCompare(true, true); } -function test_int8x16() { +function test_Int8x16() { var v, w; - for ([v, w] of [[int8x16(-1, 20, 30, 4, -5, 6, 70, -80, 9, 100, -11, 12, 13, -14, 15, -16), 0b1010010010010001], - [int8x16(10, 2, 30.2, -4, -5.2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), 0b11000], - [int8x16(0, INT8_MIN, INT8_MAX, -0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), 0b10]]) + for ([v, w] of [[Int8x16(-1, 20, 30, 4, -5, 6, 70, -80, 9, 100, -11, 12, 13, -14, 15, -16), 0b1010010010010001], + [Int8x16(10, 2, 30.2, -4, -5.2, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), 0b11000], + [Int8x16(0, INT8_MIN, INT8_MAX, -0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), 0b10]]) { assertEq(v.signMask, w); } @@ -31,11 +31,11 @@ function test_int8x16() { reportCompare(true, true); } -function test_int16x8() { +function test_Int16x8() { var v, w; - for ([v, w] of [[int16x8(-1, 20, 30, 4, -5, 6, 70, -80), 0b10010001], - [int16x8(10, 2, 30.2, -4, -5.2, 6, 7, 8), 0b11000], - [int16x8(0, INT16_MIN, INT16_MAX, -0, 5, 6, 7, 8), 0b10]]) + for ([v, w] of [[Int16x8(-1, 20, 30, 4, -5, 6, 70, -80), 0b10010001], + [Int16x8(10, 2, 30.2, -4, -5.2, 6, 7, 8), 0b11000], + [Int16x8(0, INT16_MIN, INT16_MAX, -0, 5, 6, 7, 8), 0b10]]) { assertEq(v.signMask, w); } @@ -44,11 +44,11 @@ function test_int16x8() { reportCompare(true, true); } -function test_int32x4() { +function test_Int32x4() { var v, w; - for ([v, w] of [[int32x4(-1, 20, 30, 4), 0b0001], - [int32x4(10, 2, 30.2, -4), 0b1000], - [int32x4(0, 0x80000000, 0x7fffffff, -0), 0b0010]]) + for ([v, w] of [[Int32x4(-1, 20, 30, 4), 0b0001], + [Int32x4(10, 2, 30.2, -4), 0b1000], + [Int32x4(0, 0x80000000, 0x7fffffff, -0), 0b0010]]) { assertEq(v.signMask, w); } @@ -57,7 +57,7 @@ function test_int32x4() { reportCompare(true, true); } -test_float32x4(); -test_int8x16(); -test_int16x8(); -test_int32x4(); +test_Float32x4(); +test_Int8x16(); +test_Int16x8(); +test_Int32x4(); diff --git a/js/src/tests/ecma_7/SIMD/splat.js b/js/src/tests/ecma_7/SIMD/splat.js index 713a3e913e0..5c4f4a1a017 100644 --- a/js/src/tests/ecma_7/SIMD/splat.js +++ b/js/src/tests/ecma_7/SIMD/splat.js @@ -1,10 +1,10 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float64x2 = SIMD.float64x2; -var float32x4 = SIMD.float32x4; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float64x2 = SIMD.Float64x2; +var Float32x4 = SIMD.Float32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function TestSplatX16(type, inputs, coerceFunc) { for (var x of inputs) { @@ -36,25 +36,25 @@ function test() { var good = {valueOf: () => 19.89}; var bad = {valueOf: () => { throw new TestError(); }}; - TestSplatX16('int8x16', [0, 1, 2, -1, -2, 3, -3, 4, -4, 5, -5, 6, INT8_MIN, INT8_MAX, INT8_MIN - 1, INT8_MAX + 1], (x) => x << 24 >> 24); - assertEqX16(int8x16.splat(), [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); - assertThrowsInstanceOf(() => SIMD.int8x16.splat(bad), TestError); + TestSplatX16('Int8x16', [0, 1, 2, -1, -2, 3, -3, 4, -4, 5, -5, 6, INT8_MIN, INT8_MAX, INT8_MIN - 1, INT8_MAX + 1], (x) => x << 24 >> 24); + assertEqX16(Int8x16.splat(), [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); + assertThrowsInstanceOf(() => SIMD.Int8x16.splat(bad), TestError); - TestSplatX8('int16x8', [0, 1, 2, -1, INT16_MIN, INT16_MAX, INT16_MIN - 1, INT16_MAX + 1], (x) => x << 16 >> 16); - assertEqX8(int16x8.splat(), [0, 0, 0, 0, 0, 0, 0, 0]); - assertThrowsInstanceOf(() => SIMD.int16x8.splat(bad), TestError); + TestSplatX8('Int16x8', [0, 1, 2, -1, INT16_MIN, INT16_MAX, INT16_MIN - 1, INT16_MAX + 1], (x) => x << 16 >> 16); + assertEqX8(Int16x8.splat(), [0, 0, 0, 0, 0, 0, 0, 0]); + assertThrowsInstanceOf(() => SIMD.Int16x8.splat(bad), TestError); - TestSplatX4('int32x4', [0, undefined, 3.5, 42, -1337, INT32_MAX, INT32_MAX + 1, good], (x) => x | 0); - assertEqX4(SIMD.int32x4.splat(), [0, 0, 0, 0]); - assertThrowsInstanceOf(() => SIMD.int32x4.splat(bad), TestError); + TestSplatX4('Int32x4', [0, undefined, 3.5, 42, -1337, INT32_MAX, INT32_MAX + 1, good], (x) => x | 0); + assertEqX4(SIMD.Int32x4.splat(), [0, 0, 0, 0]); + assertThrowsInstanceOf(() => SIMD.Int32x4.splat(bad), TestError); - TestSplatX4('float32x4', [0, undefined, 3.5, 42, -13.37, Infinity, NaN, -0, good], (x) => Math.fround(x)); - assertEqX4(SIMD.float32x4.splat(), [NaN, NaN, NaN, NaN]); - assertThrowsInstanceOf(() => SIMD.float32x4.splat(bad), TestError); + TestSplatX4('Float32x4', [0, undefined, 3.5, 42, -13.37, Infinity, NaN, -0, good], (x) => Math.fround(x)); + assertEqX4(SIMD.Float32x4.splat(), [NaN, NaN, NaN, NaN]); + assertThrowsInstanceOf(() => SIMD.Float32x4.splat(bad), TestError); - TestSplatX2('float64x2', [0, undefined, 3.5, 42, -13.37, Infinity, NaN, -0, good], (x) => +x); - assertEqX4(SIMD.float64x2.splat(), [NaN, NaN]); - assertThrowsInstanceOf(() => SIMD.float64x2.splat(bad), TestError); + TestSplatX2('Float64x2', [0, undefined, 3.5, 42, -13.37, Infinity, NaN, -0, good], (x) => +x); + assertEqX4(SIMD.Float64x2.splat(), [NaN, NaN]); + assertThrowsInstanceOf(() => SIMD.Float64x2.splat(bad), TestError); if (typeof reportCompare === "function") reportCompare(true, true); diff --git a/js/src/tests/ecma_7/SIMD/store.js b/js/src/tests/ecma_7/SIMD/store.js index a1afbdbd501..d00d9c6b30a 100644 --- a/js/src/tests/ecma_7/SIMD/store.js +++ b/js/src/tests/ecma_7/SIMD/store.js @@ -32,7 +32,7 @@ function testStore(ta, kind, i, v) { assertChanged(ta, i, simdToArray(v)); var length = simdLength(v); - if (length >= 8) // int8x16 and int16x8 only support store, and not store1/store2/etc. + if (length >= 8) // Int8x16 and Int16x8 only support store, and not store1/store2/etc. return; reset(ta); @@ -52,86 +52,86 @@ function testStore(ta, kind, i, v) { function testStoreInt8x16() { var I8 = new Int8Array(32); - var v = SIMD.int8x16(0, 1, INT8_MAX, INT8_MIN, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); - testStore(I8, 'int8x16', 0, v); - testStore(I8, 'int8x16', 1, v); - testStore(I8, 'int8x16', 2, v); - testStore(I8, 'int8x16', 16, v); + var v = SIMD.Int8x16(0, 1, INT8_MAX, INT8_MIN, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + testStore(I8, 'Int8x16', 0, v); + testStore(I8, 'Int8x16', 1, v); + testStore(I8, 'Int8x16', 2, v); + testStore(I8, 'Int8x16', 16, v); - assertThrowsInstanceOf(() => SIMD.int8x16.store(I8), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.store(I8, 0), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.store(I8, 0, v), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.store(I8), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.store(I8, 0), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.store(I8, 0, v), TypeError); } function testStoreInt16x8() { var I16 = new Int16Array(32); - var v = SIMD.int16x8(0, 1, INT16_MAX, INT16_MIN, 4, 5, 6, 7); - testStore(I16, 'int16x8', 0, v); - testStore(I16, 'int16x8', 1, v); - testStore(I16, 'int16x8', 2, v); - testStore(I16, 'int16x8', 24, v); + var v = SIMD.Int16x8(0, 1, INT16_MAX, INT16_MIN, 4, 5, 6, 7); + testStore(I16, 'Int16x8', 0, v); + testStore(I16, 'Int16x8', 1, v); + testStore(I16, 'Int16x8', 2, v); + testStore(I16, 'Int16x8', 24, v); - assertThrowsInstanceOf(() => SIMD.int16x8.store(I16), TypeError); - assertThrowsInstanceOf(() => SIMD.int16x8.store(I16, 0), TypeError); - assertThrowsInstanceOf(() => SIMD.int8x16.store(I16, 0, v), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.store(I16), TypeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.store(I16, 0), TypeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.store(I16, 0, v), TypeError); } function testStoreInt32x4() { var I32 = new Int32Array(16); - var v = SIMD.int32x4(0, 1, Math.pow(2,31) - 1, -Math.pow(2, 31)); - testStore(I32, 'int32x4', 0, v); - testStore(I32, 'int32x4', 1, v); - testStore(I32, 'int32x4', 2, v); - testStore(I32, 'int32x4', 12, v); + var v = SIMD.Int32x4(0, 1, Math.pow(2,31) - 1, -Math.pow(2, 31)); + testStore(I32, 'Int32x4', 0, v); + testStore(I32, 'Int32x4', 1, v); + testStore(I32, 'Int32x4', 2, v); + testStore(I32, 'Int32x4', 12, v); - assertThrowsInstanceOf(() => SIMD.int32x4.store(I32), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.store(I32, 0), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.store(I32, 0, v), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.store(I32), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.store(I32, 0), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.store(I32, 0, v), TypeError); } function testStoreFloat32x4() { var F32 = new Float32Array(16); - var v = SIMD.float32x4(1,2,3,4); - testStore(F32, 'float32x4', 0, v); - testStore(F32, 'float32x4', 1, v); - testStore(F32, 'float32x4', 2, v); - testStore(F32, 'float32x4', 12, v); + var v = SIMD.Float32x4(1,2,3,4); + testStore(F32, 'Float32x4', 0, v); + testStore(F32, 'Float32x4', 1, v); + testStore(F32, 'Float32x4', 2, v); + testStore(F32, 'Float32x4', 12, v); - var v = SIMD.float32x4(NaN, -0, -Infinity, 5e-324); - testStore(F32, 'float32x4', 0, v); - testStore(F32, 'float32x4', 1, v); - testStore(F32, 'float32x4', 2, v); - testStore(F32, 'float32x4', 12, v); + var v = SIMD.Float32x4(NaN, -0, -Infinity, 5e-324); + testStore(F32, 'Float32x4', 0, v); + testStore(F32, 'Float32x4', 1, v); + testStore(F32, 'Float32x4', 2, v); + testStore(F32, 'Float32x4', 12, v); - assertThrowsInstanceOf(() => SIMD.float32x4.store(F32), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.store(F32, 0), TypeError); - assertThrowsInstanceOf(() => SIMD.int32x4.store(F32, 0, v), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.store(F32), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.store(F32, 0), TypeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.store(F32, 0, v), TypeError); } function testStoreFloat64x2() { var F64 = new Float64Array(16); - var v = SIMD.float64x2(1, 2); - testStore(F64, 'float64x2', 0, v); - testStore(F64, 'float64x2', 1, v); - testStore(F64, 'float64x2', 14, v); + var v = SIMD.Float64x2(1, 2); + testStore(F64, 'Float64x2', 0, v); + testStore(F64, 'Float64x2', 1, v); + testStore(F64, 'Float64x2', 14, v); - var v = SIMD.float64x2(NaN, -0); - testStore(F64, 'float64x2', 0, v); - testStore(F64, 'float64x2', 1, v); - testStore(F64, 'float64x2', 14, v); + var v = SIMD.Float64x2(NaN, -0); + testStore(F64, 'Float64x2', 0, v); + testStore(F64, 'Float64x2', 1, v); + testStore(F64, 'Float64x2', 14, v); - var v = SIMD.float64x2(-Infinity, +Infinity); - testStore(F64, 'float64x2', 0, v); - testStore(F64, 'float64x2', 1, v); - testStore(F64, 'float64x2', 14, v); + var v = SIMD.Float64x2(-Infinity, +Infinity); + testStore(F64, 'Float64x2', 0, v); + testStore(F64, 'Float64x2', 1, v); + testStore(F64, 'Float64x2', 14, v); - assertThrowsInstanceOf(() => SIMD.float64x2.store(F64), TypeError); - assertThrowsInstanceOf(() => SIMD.float64x2.store(F64, 0), TypeError); - assertThrowsInstanceOf(() => SIMD.float32x4.store(F64, 0, v), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.store(F64), TypeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.store(F64, 0), TypeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.store(F64, 0, v), TypeError); } function testSharedArrayBufferCompat() { @@ -146,11 +146,11 @@ function testSharedArrayBufferCompat() { var F32 = new SharedFloat32Array(TA.buffer); var F64 = new SharedFloat64Array(TA.buffer); - var int8x16 = SIMD.int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - var int16x8 = SIMD.int16x8(1, 2, 3, 4, 5, 6, 7, 8); - var int32x4 = SIMD.int32x4(1, 2, 3, 4); - var float32x4 = SIMD.float32x4(1, 2, 3, 4); - var float64x2 = SIMD.float64x2(1, 2); + var Int8x16 = SIMD.Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + var Int16x8 = SIMD.Int16x8(1, 2, 3, 4, 5, 6, 7, 8); + var Int32x4 = SIMD.Int32x4(1, 2, 3, 4); + var Float32x4 = SIMD.Float32x4(1, 2, 3, 4); + var Float64x2 = SIMD.Float64x2(1, 2); for (var ta of [ new SharedUint8Array(TA.buffer), @@ -163,26 +163,26 @@ function testSharedArrayBufferCompat() { new SharedFloat64Array(TA.buffer) ]) { - SIMD.int8x16.store(ta, 0, int8x16); + SIMD.Int8x16.store(ta, 0, Int8x16); for (var i = 0; i < 16; i++) assertEq(I8[i], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16][i]); - SIMD.int16x8.store(ta, 0, int16x8); + SIMD.Int16x8.store(ta, 0, Int16x8); for (var i = 0; i < 8; i++) assertEq(I16[i], [1, 2, 3, 4, 5, 6, 7, 8][i]); - SIMD.int32x4.store(ta, 0, int32x4); + SIMD.Int32x4.store(ta, 0, Int32x4); for (var i = 0; i < 4; i++) assertEq(I32[i], [1, 2, 3, 4][i]); - SIMD.float32x4.store(ta, 0, float32x4); + SIMD.Float32x4.store(ta, 0, Float32x4); for (var i = 0; i < 4; i++) assertEq(F32[i], [1, 2, 3, 4][i]); - SIMD.float64x2.store(ta, 0, float64x2); + SIMD.Float64x2.store(ta, 0, Float64x2); for (var i = 0; i < 2; i++) assertEq(F64[i], [1, 2][i]); - assertThrowsInstanceOf(() => SIMD.int8x16.store(ta, 1024, int8x16), RangeError); - assertThrowsInstanceOf(() => SIMD.int16x8.store(ta, 1024, int16x8), RangeError); - assertThrowsInstanceOf(() => SIMD.int32x4.store(ta, 1024, int32x4), RangeError); - assertThrowsInstanceOf(() => SIMD.float32x4.store(ta, 1024, float32x4), RangeError); - assertThrowsInstanceOf(() => SIMD.float64x2.store(ta, 1024, float64x2), RangeError); + assertThrowsInstanceOf(() => SIMD.Int8x16.store(ta, 1024, Int8x16), RangeError); + assertThrowsInstanceOf(() => SIMD.Int16x8.store(ta, 1024, Int16x8), RangeError); + assertThrowsInstanceOf(() => SIMD.Int32x4.store(ta, 1024, Int32x4), RangeError); + assertThrowsInstanceOf(() => SIMD.Float32x4.store(ta, 1024, Float32x4), RangeError); + assertThrowsInstanceOf(() => SIMD.Float64x2.store(ta, 1024, Float64x2), RangeError); } } diff --git a/js/src/tests/ecma_7/SIMD/swizzle-shuffle.js b/js/src/tests/ecma_7/SIMD/swizzle-shuffle.js index ad7f2791002..69071eafeb4 100644 --- a/js/src/tests/ecma_7/SIMD/swizzle-shuffle.js +++ b/js/src/tests/ecma_7/SIMD/swizzle-shuffle.js @@ -5,11 +5,11 @@ * https://creativecommons.org/publicdomain/zero/1.0/ */ -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function swizzle2(arr, x, y) { return [arr[x], arr[y]]; @@ -31,14 +31,14 @@ function swizzle16(arr, s0, s1, s2, s3, s4, s5, s6, s7, function getNumberOfLanesFromType(type) { switch (type) { - case int8x16: + case Int8x16: return 16; - case int16x8: + case Int16x8: return 8; - case float32x4: - case int32x4: + case Float32x4: + case Int32x4: return 4; - case float64x2: + case Float64x2: return 2; } throw new TypeError("Unknown SIMD type."); @@ -154,53 +154,53 @@ function testSwizzleForType(type) { } function testSwizzleInt8x16() { - var v = int16x8(1, 2, 3, 4, 5, 6, 7, 8); + var v = Int16x8(1, 2, 3, 4, 5, 6, 7, 8); assertThrowsInstanceOf(function() { - int8x16.swizzle(v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + Int8x16.swizzle(v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); }, TypeError); - testSwizzleForType(int8x16); + testSwizzleForType(Int8x16); } function testSwizzleInt16x8() { - var v = int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + var v = Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); assertThrowsInstanceOf(function() { - int16x8.swizzle(v, 0, 0, 0, 0, 0, 0, 0, 0); + Int16x8.swizzle(v, 0, 0, 0, 0, 0, 0, 0, 0); }, TypeError); - testSwizzleForType(int16x8); + testSwizzleForType(Int16x8); } function testSwizzleInt32x4() { - var v = int32x4(1, 2, 3, 4); + var v = Int32x4(1, 2, 3, 4); assertThrowsInstanceOf(function() { - float32x4.swizzle(v, 0, 0, 0, 0); + Float32x4.swizzle(v, 0, 0, 0, 0); }, TypeError); - testSwizzleForType(int32x4); + testSwizzleForType(Int32x4); } function testSwizzleFloat32x4() { - var v = float32x4(1, 2, 3, 4); + var v = Float32x4(1, 2, 3, 4); assertThrowsInstanceOf(function() { - int32x4.swizzle(v, 0, 0, 0, 0); + Int32x4.swizzle(v, 0, 0, 0, 0); }, TypeError); - testSwizzleForType(float32x4); + testSwizzleForType(Float32x4); } function testSwizzleFloat64x2() { - var v = float64x2(1, 2); + var v = Float64x2(1, 2); assertThrowsInstanceOf(function() { - float32x4.swizzle(v, 0, 0, 0, 0); + Float32x4.swizzle(v, 0, 0, 0, 0); }, TypeError); - testSwizzleForType(float64x2); + testSwizzleForType(Float64x2); } function shuffle2(lhsa, rhsa, x, y) { @@ -367,53 +367,53 @@ function testShuffleForType(type) { } function testShuffleInt8x16() { - var v = int16x8(1, 2, 3, 4, 5, 6, 7, 8); + var v = Int16x8(1, 2, 3, 4, 5, 6, 7, 8); assertThrowsInstanceOf(function() { - int8x16.shuffle(v, v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + Int8x16.shuffle(v, v, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); }, TypeError); - testShuffleForType(int8x16); + testShuffleForType(Int8x16); } function testShuffleInt16x8() { - var v = int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + var v = Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); assertThrowsInstanceOf(function() { - int16x8.shuffle(v, v, 0, 0, 0, 0, 0, 0, 0, 0); + Int16x8.shuffle(v, v, 0, 0, 0, 0, 0, 0, 0, 0); }, TypeError); - testShuffleForType(int16x8); + testShuffleForType(Int16x8); } function testShuffleInt32x4() { - var v = int32x4(1, 2, 3, 4); + var v = Int32x4(1, 2, 3, 4); assertThrowsInstanceOf(function() { - float32x4.shuffle(v, v, 0, 0, 0, 0); + Float32x4.shuffle(v, v, 0, 0, 0, 0); }, TypeError); - testShuffleForType(int32x4); + testShuffleForType(Int32x4); } function testShuffleFloat32x4() { - var v = float32x4(1, 2, 3, 4); + var v = Float32x4(1, 2, 3, 4); assertThrowsInstanceOf(function() { - int32x4.shuffle(v, v, 0, 0, 0, 0); + Int32x4.shuffle(v, v, 0, 0, 0, 0); }, TypeError); - testShuffleForType(float32x4); + testShuffleForType(Float32x4); } function testShuffleFloat64x2() { - var v = float64x2(1, 2); + var v = Float64x2(1, 2); assertThrowsInstanceOf(function() { - float32x4.shuffle(v, v, 0, 0, 0, 0); + Float32x4.shuffle(v, v, 0, 0, 0, 0); }, TypeError); - testShuffleForType(float64x2); + testShuffleForType(Float64x2); } testSwizzleInt8x16(); diff --git a/js/src/tests/ecma_7/SIMD/typedobjects.js b/js/src/tests/ecma_7/SIMD/typedobjects.js index 8e58d532a59..0861ff741d8 100644 --- a/js/src/tests/ecma_7/SIMD/typedobjects.js +++ b/js/src/tests/ecma_7/SIMD/typedobjects.js @@ -1,26 +1,26 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var float64x2 = SIMD.float64x2; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; +var Float32x4 = SIMD.Float32x4; +var Float64x2 = SIMD.Float64x2; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; var {StructType, Handle} = TypedObject; var {float32, float64, int8, int16, int32, uint8} = TypedObject; function testFloat32x4Alignment() { - assertEq(float32x4.byteLength, 16); - assertEq(float32x4.byteAlignment, 16); + assertEq(Float32x4.byteLength, 16); + assertEq(Float32x4.byteAlignment, 16); - var Compound = new StructType({c: uint8, d: uint8, f: float32x4}); + var Compound = new StructType({c: uint8, d: uint8, f: Float32x4}); assertEq(Compound.fieldOffsets.c, 0); assertEq(Compound.fieldOffsets.d, 1); assertEq(Compound.fieldOffsets.f, 16); } function testFloat32x4Getters() { - // Create a float32x4 and check that the getters work: - var f = float32x4(11, 22, 33, 44); + // Create a Float32x4 and check that the getters work: + var f = Float32x4(11, 22, 33, 44); assertEq(f.x, 11); assertEq(f.y, 22); assertEq(f.z, 33); @@ -46,19 +46,19 @@ function testFloat32x4Getters() { g.call(v); }, TypeError, "Getter applicable to structs"); assertThrowsInstanceOf(function() { - var t = new int32x4(1, 2, 3, 4); + var t = new Int32x4(1, 2, 3, 4); g.call(t); - }, TypeError, "Getter applicable to int32x4"); + }, TypeError, "Getter applicable to Int32x4"); } function testFloat32x4Handles() { - var Array = float32x4.array(3); - var array = new Array([float32x4(1, 2, 3, 4), - float32x4(5, 6, 7, 8), - float32x4(9, 10, 11, 12)]); + var Array = Float32x4.array(3); + var array = new Array([Float32x4(1, 2, 3, 4), + Float32x4(5, 6, 7, 8), + Float32x4(9, 10, 11, 12)]); // Test that trying to create handle into the interior of a - // float32x4 fails. + // Float32x4 fails. assertThrowsInstanceOf(function() { var h = float32.handle(array, 1, "w"); @@ -80,61 +80,61 @@ function testFloat32x4Handles() { } function testFloat32x4Reify() { - var Array = float32x4.array(3); - var array = new Array([float32x4(1, 2, 3, 4), - float32x4(5, 6, 7, 8), - float32x4(9, 10, 11, 12)]); + var Array = Float32x4.array(3); + var array = new Array([Float32x4(1, 2, 3, 4), + Float32x4(5, 6, 7, 8), + Float32x4(9, 10, 11, 12)]); - // Test that reading array[1] produces a *copy* of float32x4, not an + // Test that reading array[1] produces a *copy* of Float32x4, not an // alias into the array. var f = array[1]; assertEq(f.w, 8); assertEq(array[1].w, 8); - array[1] = float32x4(15, 16, 17, 18); + array[1] = Float32x4(15, 16, 17, 18); assertEq(f.w, 8); assertEq(array[1].w, 18); } function testFloat32x4Setters() { - var Array = float32x4.array(3); - var array = new Array([float32x4(1, 2, 3, 4), - float32x4(5, 6, 7, 8), - float32x4(9, 10, 11, 12)]); + var Array = Float32x4.array(3); + var array = new Array([Float32x4(1, 2, 3, 4), + Float32x4(5, 6, 7, 8), + Float32x4(9, 10, 11, 12)]); assertEq(array[1].w, 8); - // Test that we are allowed to write float32x4 values into array, + // Test that we are allowed to write Float32x4 values into array, // but not other things. - array[1] = float32x4(15, 16, 17, 18); + array[1] = Float32x4(15, 16, 17, 18); assertEq(array[1].w, 18); assertThrowsInstanceOf(function() { array[1] = {x: 15, y: 16, z: 17, w: 18}; - }, TypeError, "Setting float32x4 from an object"); + }, TypeError, "Setting Float32x4 from an object"); assertThrowsInstanceOf(function() { array[1] = [15, 16, 17, 18]; - }, TypeError, "Setting float32x4 from an array"); + }, TypeError, "Setting Float32x4 from an array"); assertThrowsInstanceOf(function() { array[1] = 22; - }, TypeError, "Setting float32x4 from a number"); + }, TypeError, "Setting Float32x4 from a number"); } function testFloat64x2Alignment() { - assertEq(float64x2.byteLength, 16); - assertEq(float64x2.byteAlignment, 16); + assertEq(Float64x2.byteLength, 16); + assertEq(Float64x2.byteAlignment, 16); - var Compound = new StructType({c: uint8, d: uint8, f: float64x2}); + var Compound = new StructType({c: uint8, d: uint8, f: Float64x2}); assertEq(Compound.fieldOffsets.c, 0); assertEq(Compound.fieldOffsets.d, 1); assertEq(Compound.fieldOffsets.f, 16); } function testFloat64x2Getters() { - // Create a float64x2 and check that the getters work: - var f = float64x2(11, 22); + // Create a Float64x2 and check that the getters work: + var f = Float64x2(11, 22); assertEq(f.x, 11); assertEq(f.y, 22); @@ -156,19 +156,19 @@ function testFloat64x2Getters() { g.call(v); }, TypeError, "Getter applicable to structs"); assertThrowsInstanceOf(function() { - var t = new int32x4(1, 2, 3, 4); + var t = new Int32x4(1, 2, 3, 4); g.call(t); - }, TypeError, "Getter applicable to int32x4"); + }, TypeError, "Getter applicable to Int32x4"); } function testFloat64x2Handles() { - var Array = float64x2.array(3); - var array = new Array([float64x2(1, 2), - float64x2(3, 4), - float64x2(5, 6)]); + var Array = Float64x2.array(3); + var array = new Array([Float64x2(1, 2), + Float64x2(3, 4), + Float64x2(5, 6)]); // Test that trying to create handle into the interior of a - // float64x2 fails. + // Float64x2 fails. assertThrowsInstanceOf(function() { var h = float64.handle(array, 1, "w"); @@ -190,61 +190,61 @@ function testFloat64x2Handles() { } function testFloat64x2Reify() { - var Array = float64x2.array(3); - var array = new Array([float64x2(1, 2), - float64x2(3, 4), - float64x2(5, 6)]); + var Array = Float64x2.array(3); + var array = new Array([Float64x2(1, 2), + Float64x2(3, 4), + Float64x2(5, 6)]); - // Test that reading array[1] produces a *copy* of float64x2, not an + // Test that reading array[1] produces a *copy* of Float64x2, not an // alias into the array. var f = array[1]; assertEq(f.y, 4); assertEq(array[1].y, 4); - array[1] = float64x2(7, 8); + array[1] = Float64x2(7, 8); assertEq(f.y, 4); assertEq(array[1].y, 8); } function testFloat64x2Setters() { - var Array = float64x2.array(3); - var array = new Array([float64x2(1, 2), - float64x2(3, 4), - float64x2(5, 6)]); + var Array = Float64x2.array(3); + var array = new Array([Float64x2(1, 2), + Float64x2(3, 4), + Float64x2(5, 6)]); assertEq(array[1].y, 4); - // Test that we are allowed to write float64x2 values into array, + // Test that we are allowed to write Float64x2 values into array, // but not other things. - array[1] = float64x2(7, 8); + array[1] = Float64x2(7, 8); assertEq(array[1].y, 8); assertThrowsInstanceOf(function() { array[1] = {x: 7, y: 8 }; - }, TypeError, "Setting float64x2 from an object"); + }, TypeError, "Setting Float64x2 from an object"); assertThrowsInstanceOf(function() { array[1] = [ 7, 8 ]; - }, TypeError, "Setting float64x2 from an array"); + }, TypeError, "Setting Float64x2 from an array"); assertThrowsInstanceOf(function() { array[1] = 9; - }, TypeError, "Setting float64x2 from a number"); + }, TypeError, "Setting Float64x2 from a number"); } function testInt8x16Alignment() { - assertEq(int8x16.byteLength, 16); - assertEq(int8x16.byteAlignment, 16); + assertEq(Int8x16.byteLength, 16); + assertEq(Int8x16.byteAlignment, 16); - var Compound = new StructType({c: uint8, d: uint8, f: int8x16}); + var Compound = new StructType({c: uint8, d: uint8, f: Int8x16}); assertEq(Compound.fieldOffsets.c, 0); assertEq(Compound.fieldOffsets.d, 1); assertEq(Compound.fieldOffsets.f, 16); } function testInt8x16Getters() { - // Create a int8x16 and check that the getters work: - var f = int8x16(11, 22, 33, 44, 55, 66, 77, 88, 99, 10, 20, 30, 40, 50, 60, 70); + // Create a Int8x16 and check that the getters work: + var f = Int8x16(11, 22, 33, 44, 55, 66, 77, 88, 99, 10, 20, 30, 40, 50, 60, 70); assertEq(f.s0, 11); assertEq(f.s1, 22); assertEq(f.s2, 33); @@ -281,19 +281,19 @@ function testInt8x16Getters() { g.call(v) }, TypeError, "Getter applicable to structs"); assertThrowsInstanceOf(function() { - var t = new int16x8(1, 2, 3, 4, 5, 6, 7, 8); + var t = new Int16x8(1, 2, 3, 4, 5, 6, 7, 8); g.call(t) - }, TypeError, "Getter applicable to int16x8"); + }, TypeError, "Getter applicable to Int16x8"); } function testInt8x16Handles() { - var Array = int8x16.array(3); - var array = new Array([int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), - int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32), - int8x16(33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48)]); + var Array = Int8x16.array(3); + var array = new Array([Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), + Int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32), + Int8x16(33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48)]); // Test that trying to create handle into the interior of a - // int8x16 fails. + // Int8x16 fails. assertThrowsInstanceOf(function() { var h = int8.handle(array, 1, "s3"); @@ -315,62 +315,62 @@ function testInt8x16Handles() { } function testInt8x16Reify() { - var Array = int8x16.array(3); - var array = new Array([int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), - int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32), - int8x16(33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48)]); + var Array = Int8x16.array(3); + var array = new Array([Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), + Int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32), + Int8x16(33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48)]); - // Test that reading array[1] produces a *copy* of int8x16, not an + // Test that reading array[1] produces a *copy* of Int8x16, not an // alias into the array. var f = array[1]; assertEq(f.s3, 20); assertEq(array[1].s3, 20); - array[1] = int8x16(49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64); + array[1] = Int8x16(49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64); assertEq(f.s3, 20); assertEq(array[1].s3, 52); } function testInt8x16Setters() { - var Array = int8x16.array(3); - var array = new Array([int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), - int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32), - int8x16(33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48)]); + var Array = Int8x16.array(3); + var array = new Array([Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16), + Int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32), + Int8x16(33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48)]); assertEq(array[1].s3, 20); - // Test that we are allowed to write int8x16 values into array, + // Test that we are allowed to write Int8x16 values into array, // but not other things. - array[1] = int8x16(49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64); + array[1] = Int8x16(49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64); assertEq(array[1].s3, 52); assertThrowsInstanceOf(function() { array[1] = {s0: 49, s1: 50, s2: 51, s3: 52, s4: 53, s5: 54, s6: 55, s7: 56, s8: 57, s9: 58, s10: 59, s11: 60, s12: 61, s13: 62, s14: 63, s15: 64}; - }, TypeError, "Setting int8x16 from an object"); + }, TypeError, "Setting Int8x16 from an object"); assertThrowsInstanceOf(function() { array[1] = [49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64]; - }, TypeError, "Setting int8x16 from an array"); + }, TypeError, "Setting Int8x16 from an array"); assertThrowsInstanceOf(function() { array[1] = 52; - }, TypeError, "Setting int8x16 from a number"); + }, TypeError, "Setting Int8x16 from a number"); } function testInt16x8Alignment() { - assertEq(int16x8.byteLength, 16); - assertEq(int16x8.byteAlignment, 16); + assertEq(Int16x8.byteLength, 16); + assertEq(Int16x8.byteAlignment, 16); - var Compound = new StructType({c: uint8, d: uint8, f: int16x8}); + var Compound = new StructType({c: uint8, d: uint8, f: Int16x8}); assertEq(Compound.fieldOffsets.c, 0); assertEq(Compound.fieldOffsets.d, 1); assertEq(Compound.fieldOffsets.f, 16); } function testInt16x8Getters() { - // Create a int16x8 and check that the getters work: - var f = int16x8(11, 22, 33, 44, 55, 66, 77, 88); + // Create a Int16x8 and check that the getters work: + var f = Int16x8(11, 22, 33, 44, 55, 66, 77, 88); assertEq(f.s0, 11); assertEq(f.s1, 22); assertEq(f.s2, 33); @@ -397,19 +397,19 @@ function testInt16x8Getters() { g.call(v) }, TypeError, "Getter applicable to structs"); assertThrowsInstanceOf(function() { - var t = new int16x8(1, 2, 3, 4, 5, 6, 7, 8); + var t = new Int16x8(1, 2, 3, 4, 5, 6, 7, 8); g.call(t) - }, TypeError, "Getter applicable to int16x8"); + }, TypeError, "Getter applicable to Int16x8"); } function testInt16x8Handles() { - var Array = int16x8.array(3); - var array = new Array([int16x8(1, 2, 3, 4, 5, 6, 7, 8), - int16x8(9, 10, 11, 12, 13, 14, 15, 16), - int16x8(17, 18, 19, 20, 21, 22, 23, 24)]); + var Array = Int16x8.array(3); + var array = new Array([Int16x8(1, 2, 3, 4, 5, 6, 7, 8), + Int16x8(9, 10, 11, 12, 13, 14, 15, 16), + Int16x8(17, 18, 19, 20, 21, 22, 23, 24)]); // Test that trying to create handle into the interior of a - // int16x8 fails. + // Int16x8 fails. assertThrowsInstanceOf(function() { var h = int16.handle(array, 1, "s3"); @@ -431,61 +431,61 @@ function testInt16x8Handles() { } function testInt16x8Reify() { - var Array = int16x8.array(3); - var array = new Array([int16x8(1, 2, 3, 4, 5, 6, 7, 8), - int16x8(9, 10, 11, 12, 13, 14, 15, 16), - int16x8(17, 18, 19, 20, 21, 22, 23, 24)]); + var Array = Int16x8.array(3); + var array = new Array([Int16x8(1, 2, 3, 4, 5, 6, 7, 8), + Int16x8(9, 10, 11, 12, 13, 14, 15, 16), + Int16x8(17, 18, 19, 20, 21, 22, 23, 24)]); - // Test that reading array[1] produces a *copy* of int16x8, not an + // Test that reading array[1] produces a *copy* of Int16x8, not an // alias into the array. var f = array[1]; assertEq(f.s3, 12); assertEq(array[1].s3, 12); - array[1] = int16x8(25, 26, 27, 28, 29, 30, 31, 32); + array[1] = Int16x8(25, 26, 27, 28, 29, 30, 31, 32); assertEq(f.s3, 12); assertEq(array[1].s3, 28); } function testInt16x8Setters() { - var Array = int16x8.array(3); - var array = new Array([int16x8(1, 2, 3, 4, 5, 6, 7, 8), - int16x8(9, 10, 11, 12, 13, 14, 15, 16), - int16x8(17, 18, 19, 20, 21, 22, 23, 24)]); + var Array = Int16x8.array(3); + var array = new Array([Int16x8(1, 2, 3, 4, 5, 6, 7, 8), + Int16x8(9, 10, 11, 12, 13, 14, 15, 16), + Int16x8(17, 18, 19, 20, 21, 22, 23, 24)]); assertEq(array[1].s3, 12); - // Test that we are allowed to write int16x8 values into array, + // Test that we are allowed to write Int16x8 values into array, // but not other things. - array[1] = int16x8(25, 26, 27, 28, 29, 30, 31, 32); + array[1] = Int16x8(25, 26, 27, 28, 29, 30, 31, 32); assertEq(array[1].s3, 28); assertThrowsInstanceOf(function() { array[1] = {s0: 25, s1: 26, s2: 27, s3: 28, s4: 29, s5: 30, s6: 31, s7: 32}; - }, TypeError, "Setting int16x8 from an object"); + }, TypeError, "Setting Int16x8 from an object"); assertThrowsInstanceOf(function() { array[1] = [25, 26, 27, 28, 29, 30, 31, 32]; - }, TypeError, "Setting int16x8 from an array"); + }, TypeError, "Setting Int16x8 from an array"); assertThrowsInstanceOf(function() { array[1] = 28; - }, TypeError, "Setting int16x8 from a number"); + }, TypeError, "Setting Int16x8 from a number"); } function testInt32x4Alignment() { - assertEq(int32x4.byteLength, 16); - assertEq(int32x4.byteAlignment, 16); + assertEq(Int32x4.byteLength, 16); + assertEq(Int32x4.byteAlignment, 16); - var Compound = new StructType({c: uint8, d: uint8, f: int32x4}); + var Compound = new StructType({c: uint8, d: uint8, f: Int32x4}); assertEq(Compound.fieldOffsets.c, 0); assertEq(Compound.fieldOffsets.d, 1); assertEq(Compound.fieldOffsets.f, 16); } function testInt32x4Getters() { - // Create a int32x4 and check that the getters work: - var f = int32x4(11, 22, 33, 44); + // Create a Int32x4 and check that the getters work: + var f = Int32x4(11, 22, 33, 44); assertEq(f.x, 11); assertEq(f.y, 22); assertEq(f.z, 33); @@ -508,19 +508,19 @@ function testInt32x4Getters() { g.call(v); }, TypeError, "Getter applicable to structs"); assertThrowsInstanceOf(function() { - var t = new float32x4(1, 2, 3, 4); + var t = new Float32x4(1, 2, 3, 4); g.call(t); - }, TypeError, "Getter applicable to float32x4"); + }, TypeError, "Getter applicable to Float32x4"); } function testInt32x4Handles() { - var Array = int32x4.array(3); - var array = new Array([int32x4(1, 2, 3, 4), - int32x4(5, 6, 7, 8), - int32x4(9, 10, 11, 12)]); + var Array = Int32x4.array(3); + var array = new Array([Int32x4(1, 2, 3, 4), + Int32x4(5, 6, 7, 8), + Int32x4(9, 10, 11, 12)]); // Test that trying to create handle into the interior of a - // int32x4 fails. + // Int32x4 fails. assertThrowsInstanceOf(function() { var h = int32.handle(array, 1, "w"); @@ -542,46 +542,46 @@ function testInt32x4Handles() { } function testInt32x4Reify() { - var Array = int32x4.array(3); - var array = new Array([int32x4(1, 2, 3, 4), - int32x4(5, 6, 7, 8), - int32x4(9, 10, 11, 12)]); + var Array = Int32x4.array(3); + var array = new Array([Int32x4(1, 2, 3, 4), + Int32x4(5, 6, 7, 8), + Int32x4(9, 10, 11, 12)]); - // Test that reading array[1] produces a *copy* of int32x4, not an + // Test that reading array[1] produces a *copy* of Int32x4, not an // alias into the array. var f = array[1]; assertEq(f.w, 8); assertEq(array[1].w, 8); - array[1] = int32x4(15, 16, 17, 18); + array[1] = Int32x4(15, 16, 17, 18); assertEq(f.w, 8); assertEq(array[1].w, 18); } function testInt32x4Setters() { - var Array = int32x4.array(3); - var array = new Array([int32x4(1, 2, 3, 4), - int32x4(5, 6, 7, 8), - int32x4(9, 10, 11, 12)]); + var Array = Int32x4.array(3); + var array = new Array([Int32x4(1, 2, 3, 4), + Int32x4(5, 6, 7, 8), + Int32x4(9, 10, 11, 12)]); assertEq(array[1].w, 8); - // Test that we are allowed to write int32x4 values into array, + // Test that we are allowed to write Int32x4 values into array, // but not other things. - array[1] = int32x4(15, 16, 17, 18); + array[1] = Int32x4(15, 16, 17, 18); assertEq(array[1].w, 18); assertThrowsInstanceOf(function() { array[1] = {x: 15, y: 16, z: 17, w: 18}; - }, TypeError, "Setting int32x4 from an object"); + }, TypeError, "Setting Int32x4 from an object"); assertThrowsInstanceOf(function() { array[1] = [15, 16, 17, 18]; - }, TypeError, "Setting int32x4 from an array"); + }, TypeError, "Setting Int32x4 from an array"); assertThrowsInstanceOf(function() { array[1] = 22; - }, TypeError, "Setting int32x4 from a number"); + }, TypeError, "Setting Int32x4 from a number"); } function test() { diff --git a/js/src/tests/ecma_7/SIMD/unary-operations.js b/js/src/tests/ecma_7/SIMD/unary-operations.js index a3e48fc8576..082c227fce8 100644 --- a/js/src/tests/ecma_7/SIMD/unary-operations.js +++ b/js/src/tests/ecma_7/SIMD/unary-operations.js @@ -1,9 +1,8 @@ // |reftest| skip-if(!this.hasOwnProperty("SIMD")) -var float32x4 = SIMD.float32x4; -var int8x16 = SIMD.int8x16; -var int16x8 = SIMD.int16x8; -var int32x4 = SIMD.int32x4; - +var Float32x4 = SIMD.Float32x4; +var Int8x16 = SIMD.Int8x16; +var Int16x8 = SIMD.Int16x8; +var Int32x4 = SIMD.Int32x4; function testFloat32x4abs() { function absf(a) { @@ -16,7 +15,7 @@ function testFloat32x4abs() { [NaN, -0, Infinity, -Infinity] ]; for (var v of vals) { - assertEqX4(float32x4.abs(float32x4(...v)), v.map(absf)); + assertEqX4(Float32x4.abs(Float32x4(...v)), v.map(absf)); } } @@ -31,7 +30,7 @@ function testFloat32x4neg() { [NaN, -0, Infinity, -Infinity] ]; for (var v of vals) { - assertEqX4(float32x4.neg(float32x4(...v)), v.map(negf)); + assertEqX4(Float32x4.neg(Float32x4(...v)), v.map(negf)); } } @@ -47,7 +46,7 @@ function testFloat32x4reciprocalApproximation() { ]; for (var [v,w] of vals) { - assertEqX4(float32x4.reciprocalApproximation(float32x4(...v)), w); + assertEqX4(Float32x4.reciprocalApproximation(Float32x4(...v)), w); } } @@ -66,7 +65,7 @@ function testFloat32x4reciprocalSqrtApproximation() { ]; for (var [v,w] of vals) { - assertEqX4(float32x4.reciprocalSqrtApproximation(float32x4(...v)), w); + assertEqX4(Float32x4.reciprocalSqrtApproximation(Float32x4(...v)), w); } } @@ -82,7 +81,7 @@ function testFloat32x4sqrt() { ]; for (var [v,w] of vals) { - assertEqX4(float32x4.sqrt(float32x4(...v)), w); + assertEqX4(Float32x4.sqrt(Float32x4(...v)), w); } } @@ -104,7 +103,7 @@ function testFloat32x4not() { ]; for (var v of vals) { - assertEqX4(float32x4.not(float32x4(...v)), v.map(notf)); + assertEqX4(Float32x4.not(Float32x4(...v)), v.map(notf)); } } @@ -114,7 +113,7 @@ function testInt8x16neg() { [-1, -2, -3, -4, -5, -6, -7, -8, 1, 2, 3, 4, 5, -INT8_MAX, INT8_MIN, 0]] ]; for (var [v,w] of vals) { - assertEqX16(int8x16.neg(int8x16(...v)), w); + assertEqX16(Int8x16.neg(Int8x16(...v)), w); } } @@ -124,7 +123,7 @@ function testInt8x16not() { [1, 2, 3, 4, 5, 6, 7, -1, -2, -3, -4, -5, -6, 0, INT8_MIN, INT8_MAX].map((x) => ~x << 24 >> 24)] ]; for (var [v,w] of vals) { - assertEqX16(int8x16.not(int8x16(...v)), w); + assertEqX16(Int8x16.not(Int8x16(...v)), w); } } @@ -134,7 +133,7 @@ function testInt16x8neg() { [-1, -2, -3, 1, 2, 0, INT16_MIN, -INT16_MAX]] ]; for (var [v,w] of vals) { - assertEqX8(int16x8.neg(int16x8(...v)), w); + assertEqX8(Int16x8.neg(Int16x8(...v)), w); } } @@ -144,7 +143,7 @@ function testInt16x8not() { [1, 2, 3, -1, -2, 0, INT16_MIN, INT16_MAX].map((x) => ~x << 16 >> 16)] ]; for (var [v,w] of vals) { - assertEqX8(int16x8.not(int16x8(...v)), w); + assertEqX8(Int16x8.not(Int16x8(...v)), w); } } @@ -154,7 +153,7 @@ function testInt32x4neg() { [[INT32_MAX, INT32_MIN, -0, 0], [-INT32_MAX | 0, -INT32_MIN | 0, 0, 0]] ]; for (var [v,w] of valsExp) { - assertEqX4(int32x4.neg(int32x4(...v)), w); + assertEqX4(Int32x4.neg(Int32x4(...v)), w); } } @@ -164,7 +163,7 @@ function testInt32x4not() { [[INT32_MAX, INT32_MIN, 0, 0], [~INT32_MAX | 0, ~INT32_MIN | 0, ~0 | 0, ~0 | 0]] ]; for (var [v,w] of valsExp) { - assertEqX4(int32x4.not(int32x4(...v)), w); + assertEqX4(Int32x4.not(Int32x4(...v)), w); } } diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h index 1ff4c9ba4ff..61c5f991957 100644 --- a/js/src/vm/CommonPropertyNames.h +++ b/js/src/vm/CommonPropertyNames.h @@ -84,9 +84,9 @@ macro(fix, fix, "fix") \ macro(flags, flags, "flags") \ macro(float32, float32, "float32") \ - macro(float32x4, float32x4, "float32x4") \ + macro(float32x4, float32x4, "Float32x4") \ macro(float64, float64, "float64") \ - macro(float64x2, float64x2, "float64x2") \ + macro(float64x2, float64x2, "Float64x2") \ macro(forceInterpreter, forceInterpreter, "forceInterpreter") \ macro(forEach, forEach, "forEach") \ macro(format, format, "format") \ @@ -110,9 +110,9 @@ macro(InitializeNumberFormat, InitializeNumberFormat, "InitializeNumberFormat") \ macro(innermost, innermost, "innermost") \ macro(input, input, "input") \ - macro(int8x16, int8x16, "int8x16") \ - macro(int16x8, int16x8, "int16x8") \ - macro(int32x4, int32x4, "int32x4") \ + macro(int8x16, int8x16, "Int8x16") \ + macro(int16x8, int16x8, "Int16x8") \ + macro(int32x4, int32x4, "Int32x4") \ macro(isFinite, isFinite, "isFinite") \ macro(isNaN, isNaN, "isNaN") \ macro(isPrototypeOf, isPrototypeOf, "isPrototypeOf") \