diff --git a/src/benchmarks/transpose4x4.js b/src/benchmarks/transpose4x4.js index 327d615..74d5d59 100644 --- a/src/benchmarks/transpose4x4.js +++ b/src/benchmarks/transpose4x4.js @@ -21,7 +21,7 @@ var dst = new Float32Array(16); var tsrc = new Float32Array(16); - var sel_ttff = SIMD.Int32x4.bool(true, true, false, false); + var sel_ttff = SIMD.Bool32x4(true, true, false, false); function initMatrix(matrix, matrixTransposed) { for (var r = 0; r < 4; ++r) { diff --git a/src/ecmascript_simd.js b/src/ecmascript_simd.js index 30d847b..7564ee0 100644 --- a/src/ecmascript_simd.js +++ b/src/ecmascript_simd.js @@ -26,7 +26,6 @@ // Many of the operations in SIMD.js have semantics which correspond to scalar // operations in JS, however there are a few differences: -// - The conversion of integers to booleans uses <0 rather than !=0. // - Vector shifts don't mask the shift count. // - Conversions from float to int32 throw on error. // - Load and store operations throw when out of bounds. @@ -96,14 +95,6 @@ function maxNum(x, y) { Math.max(x, y); } -function toBool(x) { - return x < 0; -} - -function fromBool(x) { - return !x - 1; -} - function int32FromFloat(x) { if (x > -2147483649.0 && x < 2147483648.0) return x|0; @@ -127,6 +118,46 @@ var check32 = checkLaneIndex(32); // Save/Restore utilities for implementing bitwise conversions. +function saveBool32x4(x) { + x = SIMD.Bool32x4.check(x); + _i32x4[0] = SIMD.Bool32x4.extractLane(x, 0); + _i32x4[1] = SIMD.Bool32x4.extractLane(x, 1); + _i32x4[2] = SIMD.Bool32x4.extractLane(x, 2); + _i32x4[3] = SIMD.Bool32x4.extractLane(x, 3); +} + +function saveBool16x8(x) { + x = SIMD.Bool16x8.check(x); + _i16x8[0] = SIMD.Bool16x8.extractLane(x, 0); + _i16x8[1] = SIMD.Bool16x8.extractLane(x, 1); + _i16x8[2] = SIMD.Bool16x8.extractLane(x, 2); + _i16x8[3] = SIMD.Bool16x8.extractLane(x, 3); + _i16x8[4] = SIMD.Bool16x8.extractLane(x, 4); + _i16x8[5] = SIMD.Bool16x8.extractLane(x, 5); + _i16x8[6] = SIMD.Bool16x8.extractLane(x, 6); + _i16x8[7] = SIMD.Bool16x8.extractLane(x, 7); +} + +function saveBool8x16(x) { + x = SIMD.Bool8x16.check(x); + _i8x16[0] = SIMD.Bool8x16.extractLane(x, 0); + _i8x16[1] = SIMD.Bool8x16.extractLane(x, 1); + _i8x16[2] = SIMD.Bool8x16.extractLane(x, 2); + _i8x16[3] = SIMD.Bool8x16.extractLane(x, 3); + _i8x16[4] = SIMD.Bool8x16.extractLane(x, 4); + _i8x16[5] = SIMD.Bool8x16.extractLane(x, 5); + _i8x16[6] = SIMD.Bool8x16.extractLane(x, 6); + _i8x16[7] = SIMD.Bool8x16.extractLane(x, 7); + _i8x16[8] = SIMD.Bool8x16.extractLane(x, 8); + _i8x16[9] = SIMD.Bool8x16.extractLane(x, 9); + _i8x16[10] = SIMD.Bool8x16.extractLane(x, 10); + _i8x16[11] = SIMD.Bool8x16.extractLane(x, 11); + _i8x16[12] = SIMD.Bool8x16.extractLane(x, 12); + _i8x16[13] = SIMD.Bool8x16.extractLane(x, 13); + _i8x16[14] = SIMD.Bool8x16.extractLane(x, 14); + _i8x16[15] = SIMD.Bool8x16.extractLane(x, 15); +} + function saveFloat64x2(x) { x = SIMD.Float64x2.check(x); _f64x2[0] = SIMD.Float64x2.extractLane(x, 0); @@ -181,6 +212,25 @@ function saveInt8x16(x) { _i8x16[15] = SIMD.Int8x16.extractLane(x, 15); } +function restoreBool32x4() { + var alias = _i32x4; + return SIMD.Bool32x4(alias[0], alias[1], alias[2], alias[3]); +} + +function restoreBool16x8() { + var alias = _i16x8; + return SIMD.Bool16x8(alias[0], alias[1], alias[2], alias[3], + alias[4], alias[5], alias[6], alias[7]); +} + +function restoreBool8x16() { + var alias = _i8x16; + return SIMD.Bool8x16(alias[0], alias[1], alias[2], alias[3], + alias[4], alias[5], alias[6], alias[7], + alias[8], alias[9], alias[10], alias[11], + alias[12], alias[13], alias[14], alias[15]); +} + function restoreFloat64x2() { var alias = _f64x2; return SIMD.Float64x2(alias[0], alias[1]); @@ -210,6 +260,1047 @@ function restoreInt8x16() { alias[12], alias[13], alias[14], alias[15]); } +if (typeof SIMD.Bool64x2 === "undefined") { + /** + * Construct a new instance of bool64x2 number. + * @constructor + */ + SIMD.Bool64x2 = function(x, y) { + if (!(this instanceof SIMD.Bool64x2)) { + return new SIMD.Bool64x2(x, y); + } + + this.x_ = !!x; + this.y_ = !!y; + } +} + +if (typeof SIMD.Bool64x2.check === "undefined") { + /** + * Check whether the argument is a bool64x2. + * @param {bool64x2} v An instance of bool64x2. + * @return {bool64x2} The bool64x2 instance. + */ + SIMD.Bool64x2.check = function(v) { + if (!(v instanceof SIMD.Bool64x2)) { + throw new TypeError("argument is not a bool64x2."); + } + return v; + } +} + +if (typeof SIMD.Bool64x2.splat === "undefined") { + /** + * Construct a new instance of bool64x2 with the same value + * in all lanes. + * @param {double} value used for all lanes. + * @constructor + */ + SIMD.Bool64x2.splat = function(s) { + return SIMD.Bool64x2(s, s); + } +} + +if (typeof SIMD.Bool64x2.extractLane === "undefined") { + /** + * @param {bool64x2} v An instance of bool64x2. + * @param {integer} i Index in concatenation of v for lane i + * @return {Boolean} The value in lane i of v. + */ + SIMD.Bool64x2.extractLane = function(v, i) { + v = SIMD.Bool64x2.check(v); + check2(i); + switch(i) { + case 0: return v.x_; + case 1: return v.y_; + } + } +} + +if (typeof SIMD.Bool64x2.replaceLane === "undefined") { + /** + * @param {bool64x2} v An instance of bool64x2. + * @param {integer} i Index in concatenation of v for lane i + * @param {double} value used for lane i. + * @return {bool64x2} New instance of bool64x2 with the values in v and + * lane i replaced with {s}. + */ + SIMD.Bool64x2.replaceLane = function(v, i, s) { + v = SIMD.Bool64x2.check(v); + check2(i); + // Other replaceLane implementations do the replacement in memory, but + // this is awkward for bool64x2 without something like Int64Array. + return i == 0 ? + SIMD.Bool64x2(s, SIMD.Bool64x2.extractLane(v, 1)) : + SIMD.Bool64x2(SIMD.Bool64x2.extractLane(v, 0), s); + } +} + +if (typeof SIMD.Bool64x2.allTrue === "undefined") { + /** + * Check if all 2 lanes hold a true value + * @param {bool64x2} v An instance of bool64x2. + * @return {Boolean} All 2 lanes hold a true value + */ + SIMD.Bool64x2.allTrue = function(v) { + v = SIMD.Bool64x2.check(v); + return SIMD.Bool64x2.extractLane(v, 0) && + SIMD.Bool64x2.extractLane(v, 1); + } +} + +if (typeof SIMD.Bool64x2.anyTrue === "undefined") { + /** + * Check if any of the 2 lanes hold a true value + * @param {bool64x2} v An instance of bool64x2. + * @return {Boolean} Any of the 2 lanes holds a true value + */ + SIMD.Bool64x2.anyTrue = function(v) { + v = SIMD.Bool64x2.check(v); + return SIMD.Bool64x2.extractLane(v, 0) || + SIMD.Bool64x2.extractLane(v, 1); + } +} + +if (typeof SIMD.Bool64x2.and === "undefined") { + /** + * @param {bool64x2} a An instance of bool64x2. + * @param {bool64x2} b An instance of bool64x2. + * @return {bool64x2} New instance of bool64x2 with values of a & b. + */ + SIMD.Bool64x2.and = function(a, b) { + a = SIMD.Bool64x2.check(a); + b = SIMD.Bool64x2.check(b); + return SIMD.Bool64x2(SIMD.Bool64x2.extractLane(a, 0) & SIMD.Bool64x2.extractLane(b, 0), + SIMD.Bool64x2.extractLane(a, 1) & SIMD.Bool64x2.extractLane(b, 1)); + } +} + +if (typeof SIMD.Bool64x2.or === "undefined") { + /** + * @param {bool64x2} a An instance of bool64x2. + * @param {bool64x2} b An instance of bool64x2. + * @return {bool64x2} New instance of bool64x2 with values of a | b. + */ + SIMD.Bool64x2.or = function(a, b) { + a = SIMD.Bool64x2.check(a); + b = SIMD.Bool64x2.check(b); + return SIMD.Bool64x2(SIMD.Bool64x2.extractLane(a, 0) | SIMD.Bool64x2.extractLane(b, 0), + SIMD.Bool64x2.extractLane(a, 1) | SIMD.Bool64x2.extractLane(b, 1)); + } +} + +if (typeof SIMD.Bool64x2.xor === "undefined") { + /** + * @param {bool64x2} a An instance of bool64x2. + * @param {bool64x2} b An instance of bool64x2. + * @return {bool64x2} New instance of bool64x2 with values of a ^ b. + */ + SIMD.Bool64x2.xor = function(a, b) { + a = SIMD.Bool64x2.check(a); + b = SIMD.Bool64x2.check(b); + return SIMD.Bool64x2(SIMD.Bool64x2.extractLane(a, 0) ^ SIMD.Bool64x2.extractLane(b, 0), + SIMD.Bool64x2.extractLane(a, 1) ^ SIMD.Bool64x2.extractLane(b, 1)); + } +} + +if (typeof SIMD.Bool64x2.not === "undefined") { + /** + * @param {bool64x2} a An instance of bool64x2. + * @return {bool64x2} New instance of bool64x2 with values of !a + */ + SIMD.Bool64x2.not = function(a) { + a = SIMD.Bool64x2.check(a); + return SIMD.Bool64x2(!SIMD.Bool64x2.extractLane(a, 0), + !SIMD.Bool64x2.extractLane(a, 1)); + } +} + +if (typeof SIMD.Bool64x2.equal === "undefined") { + /** + * @param {bool64x2} a An instance of bool64x2. + * @param {bool64x2} b An instance of bool64x2. + * @return {bool64x2} true or false in each lane depending on + * the result of a == b. + */ + SIMD.Bool64x2.equal = function(a, b) { + a = SIMD.Bool64x2.check(a); + b = SIMD.Bool64x2.check(b); + return SIMD.Bool64x2(SIMD.Bool64x2.extractLane(a, 0) == SIMD.Bool64x2.extractLane(b, 0), + SIMD.Bool64x2.extractLane(a, 1) == SIMD.Bool64x2.extractLane(b, 1)); + } +} + +if (typeof SIMD.Bool64x2.notEqual === "undefined") { + /** + * @param {bool64x2} a An instance of bool64x2. + * @param {bool64x2} b An instance of bool64x2. + * @return {bool64x2} true or false in each lane depending on + * the result of a != b. + */ + SIMD.Bool64x2.notEqual = function(a, b) { + a = SIMD.Bool64x2.check(a); + b = SIMD.Bool64x2.check(b); + return SIMD.Bool64x2(SIMD.Bool64x2.extractLane(a, 0) != SIMD.Bool64x2.extractLane(b, 0), + SIMD.Bool64x2.extractLane(a, 1) != SIMD.Bool64x2.extractLane(b, 1)); + } +} + +if (typeof SIMD.Bool64x2.select === "undefined") { + /** + * @param {bool64x2} mask Selector mask. An instance of bool64x2 + * @param {bool64x2} trueValue Pick lane from here if corresponding + * selector lane is 1 + * @param {bool64x2} falseValue Pick lane from here if corresponding + * selector lane is 0 + * @return {bool64x2} Mix of lanes from trueValue or falseValue as + * indicated + */ + SIMD.Bool64x2.select = function(mask, trueValue, falseValue) { + mask = SIMD.Bool64x2.check(mask); + trueValue = SIMD.Bool64x2.check(trueValue); + falseValue = SIMD.Bool64x2.check(falseValue); + var tr = SIMD.Bool64x2.and(mask, trueValue); + var fr = SIMD.Bool64x2.and(SIMD.Bool64x2.not(mask), falseValue); + return SIMD.Bool64x2.or(tr, fr); + } +} + +if (typeof SIMD.Bool32x4 === "undefined") { + /** + * Construct a new instance of Bool32x4 number. + * @constructor + */ + SIMD.Bool32x4 = function(x, y, z, w) { + if (!(this instanceof SIMD.Bool32x4)) { + return new SIMD.Bool32x4(x, y, z, w); + } + + this.x_ = !!x; + this.y_ = !!y; + this.z_ = !!z; + this.w_ = !!w; + } +} + +if (typeof SIMD.Bool32x4.check === "undefined") { + /** + * Check whether the argument is a Bool32x4. + * @param {Bool32x4} v An instance of Bool32x4. + * @return {Bool32x4} The Bool32x4 instance. + */ + SIMD.Bool32x4.check = function(v) { + if (!(v instanceof SIMD.Bool32x4)) { + throw new TypeError("argument is not a Bool32x4."); + } + return v; + } +} + +if (typeof SIMD.Bool32x4.splat === "undefined") { + /** + * Construct a new instance of Bool32x4 with the same value + * in all lanes. + * @param {double} value used for all lanes. + * @constructor + */ + SIMD.Bool32x4.splat = function(s) { + return SIMD.Bool32x4(s, s, s, s); + } +} + +if (typeof SIMD.Bool32x4.extractLane === "undefined") { + /** + * @param {Bool32x4} v An instance of Bool32x4. + * @param {integer} i Index in concatenation of v for lane i + * @return {Boolean} The value in lane i of v. + */ + SIMD.Bool32x4.extractLane = function(v, i) { + v = SIMD.Bool32x4.check(v); + check4(i); + switch(i) { + case 0: return v.x_; + case 1: return v.y_; + case 2: return v.z_; + case 3: return v.w_; + } + } +} + +if (typeof SIMD.Bool32x4.replaceLane === "undefined") { + /** + * @param {Bool32x4} v An instance of Bool32x4. + * @param {integer} i Index in concatenation of v for lane i + * @param {double} value used for lane i. + * @return {Bool32x4} New instance of Bool32x4 with the values in v and + * lane i replaced with {s}. + */ + SIMD.Bool32x4.replaceLane = function(v, i, s) { + v = SIMD.Bool32x4.check(v); + check4(i); + saveBool32x4(v); + _i32x4[i] = s; + return restoreBool32x4(); + } +} + +if (typeof SIMD.Bool32x4.allTrue === "undefined") { + /** + * Check if all 4 lanes hold a true value + * @param {Bool32x4} v An instance of Bool32x4. + * @return {Boolean} All 4 lanes holds a true value + */ + SIMD.Bool32x4.allTrue = function(v) { + v = SIMD.Bool32x4.check(v); + return SIMD.Bool32x4.extractLane(v, 0) && + SIMD.Bool32x4.extractLane(v, 1) && + SIMD.Bool32x4.extractLane(v, 2) && + SIMD.Bool32x4.extractLane(v, 3); + } +} + +if (typeof SIMD.Bool32x4.anyTrue === "undefined") { + /** + * Check if any of the 4 lanes hold a true value + * @param {Bool32x4} v An instance of Bool32x4. + * @return {Boolean} Any of the 4 lanes holds a true value + */ + SIMD.Bool32x4.anyTrue = function(v) { + v = SIMD.Bool32x4.check(v); + return SIMD.Bool32x4.extractLane(v, 0) || + SIMD.Bool32x4.extractLane(v, 1) || + SIMD.Bool32x4.extractLane(v, 2) || + SIMD.Bool32x4.extractLane(v, 3); + } +} + +if (typeof SIMD.Bool32x4.and === "undefined") { + /** + * @param {Bool32x4} a An instance of Bool32x4. + * @param {Bool32x4} b An instance of Bool32x4. + * @return {Bool32x4} New instance of Bool32x4 with values of a & b. + */ + SIMD.Bool32x4.and = function(a, b) { + a = SIMD.Bool32x4.check(a); + b = SIMD.Bool32x4.check(b); + return SIMD.Bool32x4(SIMD.Bool32x4.extractLane(a, 0) & SIMD.Bool32x4.extractLane(b, 0), + SIMD.Bool32x4.extractLane(a, 1) & SIMD.Bool32x4.extractLane(b, 1), + SIMD.Bool32x4.extractLane(a, 2) & SIMD.Bool32x4.extractLane(b, 2), + SIMD.Bool32x4.extractLane(a, 3) & SIMD.Bool32x4.extractLane(b, 3)); + } +} + +if (typeof SIMD.Bool32x4.or === "undefined") { + /** + * @param {Bool32x4} a An instance of Bool32x4. + * @param {Bool32x4} b An instance of Bool32x4. + * @return {Bool32x4} New instance of Bool32x4 with values of a | b. + */ + SIMD.Bool32x4.or = function(a, b) { + a = SIMD.Bool32x4.check(a); + b = SIMD.Bool32x4.check(b); + return SIMD.Bool32x4(SIMD.Bool32x4.extractLane(a, 0) | SIMD.Bool32x4.extractLane(b, 0), + SIMD.Bool32x4.extractLane(a, 1) | SIMD.Bool32x4.extractLane(b, 1), + SIMD.Bool32x4.extractLane(a, 2) | SIMD.Bool32x4.extractLane(b, 2), + SIMD.Bool32x4.extractLane(a, 3) | SIMD.Bool32x4.extractLane(b, 3)); + } +} + +if (typeof SIMD.Bool32x4.xor === "undefined") { + /** + * @param {Bool32x4} a An instance of Bool32x4. + * @param {Bool32x4} b An instance of Bool32x4. + * @return {Bool32x4} New instance of Bool32x4 with values of a ^ b. + */ + SIMD.Bool32x4.xor = function(a, b) { + a = SIMD.Bool32x4.check(a); + b = SIMD.Bool32x4.check(b); + return SIMD.Bool32x4(SIMD.Bool32x4.extractLane(a, 0) ^ SIMD.Bool32x4.extractLane(b, 0), + SIMD.Bool32x4.extractLane(a, 1) ^ SIMD.Bool32x4.extractLane(b, 1), + SIMD.Bool32x4.extractLane(a, 2) ^ SIMD.Bool32x4.extractLane(b, 2), + SIMD.Bool32x4.extractLane(a, 3) ^ SIMD.Bool32x4.extractLane(b, 3)); + } +} + +if (typeof SIMD.Bool32x4.not === "undefined") { + /** + * @param {Bool32x4} a An instance of Bool32x4. + * @return {Bool32x4} New instance of Bool32x4 with values of !a + */ + SIMD.Bool32x4.not = function(a) { + a = SIMD.Bool32x4.check(a); + return SIMD.Bool32x4(!SIMD.Bool32x4.extractLane(a, 0), + !SIMD.Bool32x4.extractLane(a, 1), + !SIMD.Bool32x4.extractLane(a, 2), + !SIMD.Bool32x4.extractLane(a, 3)); + } +} + +if (typeof SIMD.Bool32x4.equal === "undefined") { + /** + * @param {Bool32x4} a An instance of Bool32x4. + * @param {Bool32x4} b An instance of Bool32x4. + * @return {Bool32x4} true or false in each lane depending on + * the result of a == b. + */ + SIMD.Bool32x4.equal = function(a, b) { + a = SIMD.Bool32x4.check(a); + b = SIMD.Bool32x4.check(b); + return SIMD.Bool32x4(SIMD.Bool32x4.extractLane(a, 0) == SIMD.Bool32x4.extractLane(b, 0), + SIMD.Bool32x4.extractLane(a, 1) == SIMD.Bool32x4.extractLane(b, 1), + SIMD.Bool32x4.extractLane(a, 2) == SIMD.Bool32x4.extractLane(b, 2), + SIMD.Bool32x4.extractLane(a, 3) == SIMD.Bool32x4.extractLane(b, 3)); + } +} + +if (typeof SIMD.Bool32x4.notEqual === "undefined") { + /** + * @param {Bool32x4} a An instance of Bool32x4. + * @param {Bool32x4} b An instance of Bool32x4. + * @return {Bool32x4} true or false in each lane depending on + * the result of a != b. + */ + SIMD.Bool32x4.notEqual = function(a, b) { + a = SIMD.Bool32x4.check(a); + b = SIMD.Bool32x4.check(b); + return SIMD.Bool32x4(SIMD.Bool32x4.extractLane(a, 0) != SIMD.Bool32x4.extractLane(b, 0), + SIMD.Bool32x4.extractLane(a, 1) != SIMD.Bool32x4.extractLane(b, 1), + SIMD.Bool32x4.extractLane(a, 2) != SIMD.Bool32x4.extractLane(b, 2), + SIMD.Bool32x4.extractLane(a, 3) != SIMD.Bool32x4.extractLane(b, 3)); + } +} + +if (typeof SIMD.Bool32x4.select === "undefined") { + /** + * @param {Bool32x4} mask Selector mask. An instance of Bool32x4 + * @param {Bool32x4} trueValue Pick lane from here if corresponding + * selector lane is 1 + * @param {Bool32x4} falseValue Pick lane from here if corresponding + * selector lane is 0 + * @return {Bool32x4} Mix of lanes from trueValue or falseValue as + * indicated + */ + SIMD.Bool32x4.select = function(mask, trueValue, falseValue) { + mask = SIMD.Bool32x4.check(mask); + trueValue = SIMD.Bool32x4.check(trueValue); + falseValue = SIMD.Bool32x4.check(falseValue); + var tr = SIMD.Bool32x4.and(mask, trueValue); + var fr = SIMD.Bool32x4.and(SIMD.Bool32x4.not(mask), falseValue); + return SIMD.Bool32x4.or(tr, fr); + } +} + +if (typeof SIMD.Bool16x8 === "undefined") { + /** + * Construct a new instance of Bool16x8 number. + * @constructor + */ + SIMD.Bool16x8 = function(s0, s1, s2, s3, s4, s5, s6, s7) { + if (!(this instanceof SIMD.Bool16x8)) { + return new SIMD.Bool16x8(s0, s1, s2, s3, s4, s5, s6, s7); + } + + this.s0_ = !!s0; + this.s1_ = !!s1; + this.s2_ = !!s2; + this.s3_ = !!s3; + this.s4_ = !!s4; + this.s5_ = !!s5; + this.s6_ = !!s6; + this.s7_ = !!s7; + } +} + +if (typeof SIMD.Bool16x8.check === "undefined") { + /** + * Check whether the argument is a Bool16x8. + * @param {Bool16x8} v An instance of Bool16x8. + * @return {Bool16x8} The Bool16x8 instance. + */ + SIMD.Bool16x8.check = function(v) { + if (!(v instanceof SIMD.Bool16x8)) { + throw new TypeError("argument is not a Bool16x8."); + } + return v; + } +} + +if (typeof SIMD.Bool16x8.splat === "undefined") { + /** + * Construct a new instance of Bool16x8 with the same value + * in all lanes. + * @param {double} value used for all lanes. + * @constructor + */ + SIMD.Bool16x8.splat = function(s) { + return SIMD.Bool16x8(s, s, s, s, s, s, s, s); + } +} + +if (typeof SIMD.Bool16x8.extractLane === "undefined") { + /** + * @param {Bool16x8} v An instance of Bool16x8. + * @param {integer} i Index in concatenation of v for lane i + * @return {Boolean} The value in lane i of v. + */ + SIMD.Bool16x8.extractLane = function(v, i) { + v = SIMD.Bool16x8.check(v); + check8(i); + switch(i) { + case 0: return v.s0_; + case 1: return v.s1_; + case 2: return v.s2_; + case 3: return v.s3_; + case 4: return v.s4_; + case 5: return v.s5_; + case 6: return v.s6_; + case 7: return v.s7_; + } + } +} + +if (typeof SIMD.Bool16x8.replaceLane === "undefined") { + /** + * @param {Bool16x8} v An instance of Bool16x8. + * @param {integer} i Index in concatenation of v for lane i + * @param {double} value used for lane i. + * @return {Bool16x8} New instance of Bool16x8 with the values in v and + * lane i replaced with {s}. + */ + SIMD.Bool16x8.replaceLane = function(v, i, s) { + v = SIMD.Bool16x8.check(v); + check8(i); + saveBool16x8(v); + _i16x8[i] = s; + return restoreBool16x8(); + } +} + +if (typeof SIMD.Bool16x8.allTrue === "undefined") { + /** + * Check if all 8 lanes hold a true value + * @param {Bool16x8} v An instance of Bool16x8. + * @return {Boolean} All 8 lanes holds a true value + */ + SIMD.Bool16x8.allTrue = function(v) { + v = SIMD.Bool16x8.check(v); + return SIMD.Bool16x8.extractLane(v, 0) && + SIMD.Bool16x8.extractLane(v, 1) && + SIMD.Bool16x8.extractLane(v, 2) && + SIMD.Bool16x8.extractLane(v, 3) && + SIMD.Bool16x8.extractLane(v, 4) && + SIMD.Bool16x8.extractLane(v, 5) && + SIMD.Bool16x8.extractLane(v, 6) && + SIMD.Bool16x8.extractLane(v, 7); + } +} + +if (typeof SIMD.Bool16x8.anyTrue === "undefined") { + /** + * Check if any of the 8 lanes hold a true value + * @param {Bool16x8} v An instance of Int16x8. + * @return {Boolean} Any of the 8 lanes holds a true value + */ + SIMD.Bool16x8.anyTrue = function(v) { + v = SIMD.Bool16x8.check(v); + return SIMD.Bool16x8.extractLane(v, 0) || + SIMD.Bool16x8.extractLane(v, 1) || + SIMD.Bool16x8.extractLane(v, 2) || + SIMD.Bool16x8.extractLane(v, 3) || + SIMD.Bool16x8.extractLane(v, 4) || + SIMD.Bool16x8.extractLane(v, 5) || + SIMD.Bool16x8.extractLane(v, 6) || + SIMD.Bool16x8.extractLane(v, 7); + } +} + +if (typeof SIMD.Bool16x8.and === "undefined") { + /** + * @param {Bool16x8} a An instance of Bool16x8. + * @param {Bool16x8} b An instance of Bool16x8. + * @return {Bool16x8} New instance of Bool16x8 with values of a & b. + */ + SIMD.Bool16x8.and = function(a, b) { + a = SIMD.Bool16x8.check(a); + b = SIMD.Bool16x8.check(b); + return SIMD.Bool16x8(SIMD.Bool16x8.extractLane(a, 0) & SIMD.Bool16x8.extractLane(b, 0), + SIMD.Bool16x8.extractLane(a, 1) & SIMD.Bool16x8.extractLane(b, 1), + SIMD.Bool16x8.extractLane(a, 2) & SIMD.Bool16x8.extractLane(b, 2), + SIMD.Bool16x8.extractLane(a, 3) & SIMD.Bool16x8.extractLane(b, 3), + SIMD.Bool16x8.extractLane(a, 4) & SIMD.Bool16x8.extractLane(b, 4), + SIMD.Bool16x8.extractLane(a, 5) & SIMD.Bool16x8.extractLane(b, 5), + SIMD.Bool16x8.extractLane(a, 6) & SIMD.Bool16x8.extractLane(b, 6), + SIMD.Bool16x8.extractLane(a, 7) & SIMD.Bool16x8.extractLane(b, 7)); + } +} + +if (typeof SIMD.Bool16x8.or === "undefined") { + /** + * @param {Bool16x8} a An instance of Bool16x8. + * @param {Bool16x8} b An instance of Bool16x8. + * @return {Bool16x8} New instance of Bool16x8 with values of a | b. + */ + SIMD.Bool16x8.or = function(a, b) { + a = SIMD.Bool16x8.check(a); + b = SIMD.Bool16x8.check(b); + return SIMD.Bool16x8(SIMD.Bool16x8.extractLane(a, 0) | SIMD.Bool16x8.extractLane(b, 0), + SIMD.Bool16x8.extractLane(a, 1) | SIMD.Bool16x8.extractLane(b, 1), + SIMD.Bool16x8.extractLane(a, 2) | SIMD.Bool16x8.extractLane(b, 2), + SIMD.Bool16x8.extractLane(a, 3) | SIMD.Bool16x8.extractLane(b, 3), + SIMD.Bool16x8.extractLane(a, 4) | SIMD.Bool16x8.extractLane(b, 4), + SIMD.Bool16x8.extractLane(a, 5) | SIMD.Bool16x8.extractLane(b, 5), + SIMD.Bool16x8.extractLane(a, 6) | SIMD.Bool16x8.extractLane(b, 6), + SIMD.Bool16x8.extractLane(a, 7) | SIMD.Bool16x8.extractLane(b, 7)); + } +} + +if (typeof SIMD.Bool16x8.xor === "undefined") { + /** + * @param {Bool16x8} a An instance of Bool16x8. + * @param {Bool16x8} b An instance of Bool16x8. + * @return {Bool16x8} New instance of Bool16x8 with values of a ^ b. + */ + SIMD.Bool16x8.xor = function(a, b) { + a = SIMD.Bool16x8.check(a); + b = SIMD.Bool16x8.check(b); + return SIMD.Bool16x8(SIMD.Bool16x8.extractLane(a, 0) ^ SIMD.Bool16x8.extractLane(b, 0), + SIMD.Bool16x8.extractLane(a, 1) ^ SIMD.Bool16x8.extractLane(b, 1), + SIMD.Bool16x8.extractLane(a, 2) ^ SIMD.Bool16x8.extractLane(b, 2), + SIMD.Bool16x8.extractLane(a, 3) ^ SIMD.Bool16x8.extractLane(b, 3), + SIMD.Bool16x8.extractLane(a, 4) ^ SIMD.Bool16x8.extractLane(b, 4), + SIMD.Bool16x8.extractLane(a, 5) ^ SIMD.Bool16x8.extractLane(b, 5), + SIMD.Bool16x8.extractLane(a, 6) ^ SIMD.Bool16x8.extractLane(b, 6), + SIMD.Bool16x8.extractLane(a, 7) ^ SIMD.Bool16x8.extractLane(b, 7)); + } +} + +if (typeof SIMD.Bool16x8.not === "undefined") { + /** + * @param {Bool16x8} a An instance of Bool16x8. + * @return {Bool16x8} New instance of Bool16x8 with values of !a + */ + SIMD.Bool16x8.not = function(a) { + a = SIMD.Bool16x8.check(a); + return SIMD.Bool16x8(!SIMD.Bool16x8.extractLane(a, 0), + !SIMD.Bool16x8.extractLane(a, 1), + !SIMD.Bool16x8.extractLane(a, 2), + !SIMD.Bool16x8.extractLane(a, 3), + !SIMD.Bool16x8.extractLane(a, 4), + !SIMD.Bool16x8.extractLane(a, 5), + !SIMD.Bool16x8.extractLane(a, 6), + !SIMD.Bool16x8.extractLane(a, 7)); + } +} + +if (typeof SIMD.Bool16x8.equal === "undefined") { + /** + * @param {Bool16x8} a An instance of Bool16x8. + * @param {Bool16x8} b An instance of Bool16x8. + * @return {Bool16x8} true or false in each lane depending on + * the result of a == b. + */ + SIMD.Bool16x8.equal = function(a, b) { + a = SIMD.Bool16x8.check(a); + b = SIMD.Bool16x8.check(b); + return SIMD.Bool16x8(SIMD.Bool16x8.extractLane(a, 0) == SIMD.Bool16x8.extractLane(b, 0), + SIMD.Bool16x8.extractLane(a, 1) == SIMD.Bool16x8.extractLane(b, 1), + SIMD.Bool16x8.extractLane(a, 2) == SIMD.Bool16x8.extractLane(b, 2), + SIMD.Bool16x8.extractLane(a, 3) == SIMD.Bool16x8.extractLane(b, 3), + SIMD.Bool16x8.extractLane(a, 4) == SIMD.Bool16x8.extractLane(b, 4), + SIMD.Bool16x8.extractLane(a, 5) == SIMD.Bool16x8.extractLane(b, 5), + SIMD.Bool16x8.extractLane(a, 6) == SIMD.Bool16x8.extractLane(b, 6), + SIMD.Bool16x8.extractLane(a, 7) == SIMD.Bool16x8.extractLane(b, 7)); + } +} + +if (typeof SIMD.Bool16x8.notEqual === "undefined") { + /** + * @param {Bool16x8} a An instance of Bool16x8. + * @param {Bool16x8} b An instance of Bool16x8. + * @return {Bool16x8} true or false in each lane depending on + * the result of a != b. + */ + SIMD.Bool16x8.notEqual = function(a, b) { + a = SIMD.Bool16x8.check(a); + b = SIMD.Bool16x8.check(b); + return SIMD.Bool16x8(SIMD.Bool16x8.extractLane(a, 0) != SIMD.Bool16x8.extractLane(b, 0), + SIMD.Bool16x8.extractLane(a, 1) != SIMD.Bool16x8.extractLane(b, 1), + SIMD.Bool16x8.extractLane(a, 2) != SIMD.Bool16x8.extractLane(b, 2), + SIMD.Bool16x8.extractLane(a, 3) != SIMD.Bool16x8.extractLane(b, 3), + SIMD.Bool16x8.extractLane(a, 4) != SIMD.Bool16x8.extractLane(b, 4), + SIMD.Bool16x8.extractLane(a, 5) != SIMD.Bool16x8.extractLane(b, 5), + SIMD.Bool16x8.extractLane(a, 6) != SIMD.Bool16x8.extractLane(b, 6), + SIMD.Bool16x8.extractLane(a, 7) != SIMD.Bool16x8.extractLane(b, 7)); + } +} + +if (typeof SIMD.Bool16x8.select === "undefined") { + /** + * @param {Bool16x8} mask Selector mask. An instance of Bool16x8 + * @param {Bool16x8} trueValue Pick lane from here if corresponding + * selector lane is 1 + * @param {Bool16x8} falseValue Pick lane from here if corresponding + * selector lane is 0 + * @return {Bool16x8} Mix of lanes from trueValue or falseValue as + * indicated + */ + SIMD.Bool16x8.select = function(mask, trueValue, falseValue) { + mask = SIMD.Bool16x8.check(mask); + trueValue = SIMD.Bool16x8.check(trueValue); + falseValue = SIMD.Bool16x8.check(falseValue); + var tr = SIMD.Bool16x8.and(mask, trueValue); + var fr = SIMD.Bool16x8.and(SIMD.Bool16x8.not(mask), falseValue); + return SIMD.Bool16x8.or(tr, fr); + } +} + +if (typeof SIMD.Bool8x16 === "undefined") { + /** + * Construct a new instance of Bool8x16 number. + * @constructor + */ + SIMD.Bool8x16 = function(s0, s1, s2, s3, s4, s5, s6, s7, + s8, s9, s10, s11, s12, s13, s14, s15) { + if (!(this instanceof SIMD.Bool8x16)) { + return new SIMD.Bool8x16(s0, s1, s2, s3, s4, s5, s6, s7, + s8, s9, s10, s11, s12, s13, s14, s15); + } + + this.s0_ = !!s0; + this.s1_ = !!s1; + this.s2_ = !!s2; + this.s3_ = !!s3; + this.s4_ = !!s4; + this.s5_ = !!s5; + this.s6_ = !!s6; + this.s7_ = !!s7; + this.s8_ = !!s8; + this.s9_ = !!s9; + this.s10_ = !!s10; + this.s11_ = !!s11; + this.s12_ = !!s12; + this.s13_ = !!s13; + this.s14_ = !!s14; + this.s15_ = !!s15; + } +} + +if (typeof SIMD.Bool8x16.check === "undefined") { + /** + * Check whether the argument is a Bool8x16. + * @param {Bool8x16} v An instance of Bool8x16. + * @return {Bool8x16} The Bool8x16 instance. + */ + SIMD.Bool8x16.check = function(v) { + if (!(v instanceof SIMD.Bool8x16)) { + throw new TypeError("argument is not a Bool8x16."); + } + return v; + } +} + +if (typeof SIMD.Bool8x16.splat === "undefined") { + /** + * Construct a new instance of Bool8x16 with the same value + * in all lanes. + * @param {double} value used for all lanes. + * @constructor + */ + SIMD.Bool8x16.splat = function(s) { + return SIMD.Bool8x16(s, s, s, s, s, s, s, s, + s, s, s, s, s, s, s, s); + } +} + +if (typeof SIMD.Bool8x16.extractLane === "undefined") { + /** + * @param {Bool8x16} v An instance of Bool8x16. + * @param {integer} i Index in concatenation of v for lane i + * @return {Boolean} The value in lane i of v. + */ + SIMD.Bool8x16.extractLane = function(v, i) { + v = SIMD.Bool8x16.check(v); + check16(i); + switch(i) { + case 0: return v.s0_; + case 1: return v.s1_; + case 2: return v.s2_; + case 3: return v.s3_; + case 4: return v.s4_; + case 5: return v.s5_; + case 6: return v.s6_; + case 7: return v.s7_; + case 8: return v.s8_; + case 9: return v.s9_; + case 10: return v.s10_; + case 11: return v.s11_; + case 12: return v.s12_; + case 13: return v.s13_; + case 14: return v.s14_; + case 15: return v.s15_; + } + } +} + +if (typeof SIMD.Bool8x16.replaceLane === "undefined") { + /** + * @param {Bool8x16} v An instance of Bool8x16. + * @param {integer} i Index in concatenation of v for lane i + * @param {double} value used for lane i. + * @return {Bool8x16} New instance of Bool8x16 with the values in v and + * lane i replaced with {s}. + */ + SIMD.Bool8x16.replaceLane = function(v, i, s) { + v = SIMD.Bool8x16.check(v); + check16(i); + saveBool8x16(v); + _i8x16[i] = s; + return restoreBool8x16(); + } +} + +if (typeof SIMD.Bool8x16.allTrue === "undefined") { + /** + * Check if all 16 lanes hold a true value + * @param {Bool8x16} v An instance of Bool8x16. + * @return {Boolean} All 16 lanes holds a true value + */ + SIMD.Bool8x16.allTrue = function(v) { + v = SIMD.Bool8x16.check(v); + return SIMD.Bool8x16.extractLane(v, 0) && + SIMD.Bool8x16.extractLane(v, 1) && + SIMD.Bool8x16.extractLane(v, 2) && + SIMD.Bool8x16.extractLane(v, 3) && + SIMD.Bool8x16.extractLane(v, 4) && + SIMD.Bool8x16.extractLane(v, 5) && + SIMD.Bool8x16.extractLane(v, 6) && + SIMD.Bool8x16.extractLane(v, 7) && + SIMD.Bool8x16.extractLane(v, 8) && + SIMD.Bool8x16.extractLane(v, 9) && + SIMD.Bool8x16.extractLane(v, 10) && + SIMD.Bool8x16.extractLane(v, 11) && + SIMD.Bool8x16.extractLane(v, 12) && + SIMD.Bool8x16.extractLane(v, 13) && + SIMD.Bool8x16.extractLane(v, 14) && + SIMD.Bool8x16.extractLane(v, 15); + } +} + +if (typeof SIMD.Bool8x16.anyTrue === "undefined") { + /** + * Check if any of the 16 lanes hold a true value + * @param {Bool8x16} v An instance of Bool16x8. + * @return {Boolean} Any of the 16 lanes holds a true value + */ + SIMD.Bool8x16.anyTrue = function(v) { + v = SIMD.Bool8x16.check(v); + return SIMD.Bool8x16.extractLane(v, 0) || + SIMD.Bool8x16.extractLane(v, 1) || + SIMD.Bool8x16.extractLane(v, 2) || + SIMD.Bool8x16.extractLane(v, 3) || + SIMD.Bool8x16.extractLane(v, 4) || + SIMD.Bool8x16.extractLane(v, 5) || + SIMD.Bool8x16.extractLane(v, 6) || + SIMD.Bool8x16.extractLane(v, 7) || + SIMD.Bool8x16.extractLane(v, 8) || + SIMD.Bool8x16.extractLane(v, 9) || + SIMD.Bool8x16.extractLane(v, 10) || + SIMD.Bool8x16.extractLane(v, 11) || + SIMD.Bool8x16.extractLane(v, 12) || + SIMD.Bool8x16.extractLane(v, 13) || + SIMD.Bool8x16.extractLane(v, 14) || + SIMD.Bool8x16.extractLane(v, 15); + } +} + +if (typeof SIMD.Bool8x16.and === "undefined") { + /** + * @param {Bool8x16} a An instance of Bool8x16. + * @param {Bool8x16} b An instance of Bool8x16. + * @return {Bool8x16} New instance of Bool8x16 with values of a & b. + */ + SIMD.Bool8x16.and = function(a, b) { + a = SIMD.Bool8x16.check(a); + b = SIMD.Bool8x16.check(b); + return SIMD.Bool8x16(SIMD.Bool8x16.extractLane(a, 0) & SIMD.Bool8x16.extractLane(b, 0), + SIMD.Bool8x16.extractLane(a, 1) & SIMD.Bool8x16.extractLane(b, 1), + SIMD.Bool8x16.extractLane(a, 2) & SIMD.Bool8x16.extractLane(b, 2), + SIMD.Bool8x16.extractLane(a, 3) & SIMD.Bool8x16.extractLane(b, 3), + SIMD.Bool8x16.extractLane(a, 4) & SIMD.Bool8x16.extractLane(b, 4), + SIMD.Bool8x16.extractLane(a, 5) & SIMD.Bool8x16.extractLane(b, 5), + SIMD.Bool8x16.extractLane(a, 6) & SIMD.Bool8x16.extractLane(b, 6), + SIMD.Bool8x16.extractLane(a, 7) & SIMD.Bool8x16.extractLane(b, 7), + SIMD.Bool8x16.extractLane(a, 8) & SIMD.Bool8x16.extractLane(b, 8), + SIMD.Bool8x16.extractLane(a, 9) & SIMD.Bool8x16.extractLane(b, 9), + SIMD.Bool8x16.extractLane(a, 10) & SIMD.Bool8x16.extractLane(b, 10), + SIMD.Bool8x16.extractLane(a, 11) & SIMD.Bool8x16.extractLane(b, 11), + SIMD.Bool8x16.extractLane(a, 12) & SIMD.Bool8x16.extractLane(b, 12), + SIMD.Bool8x16.extractLane(a, 13) & SIMD.Bool8x16.extractLane(b, 13), + SIMD.Bool8x16.extractLane(a, 14) & SIMD.Bool8x16.extractLane(b, 14), + SIMD.Bool8x16.extractLane(a, 15) & SIMD.Bool8x16.extractLane(b, 15)); + } +} + +if (typeof SIMD.Bool8x16.or === "undefined") { + /** + * @param {Bool8x16} a An instance of Bool8x16. + * @param {Bool8x16} b An instance of Bool8x16. + * @return {Bool8x16} New instance of Bool8x16 with values of a | b. + */ + SIMD.Bool8x16.or = function(a, b) { + a = SIMD.Bool8x16.check(a); + b = SIMD.Bool8x16.check(b); + return SIMD.Bool8x16(SIMD.Bool8x16.extractLane(a, 0) | SIMD.Bool8x16.extractLane(b, 0), + SIMD.Bool8x16.extractLane(a, 1) | SIMD.Bool8x16.extractLane(b, 1), + SIMD.Bool8x16.extractLane(a, 2) | SIMD.Bool8x16.extractLane(b, 2), + SIMD.Bool8x16.extractLane(a, 3) | SIMD.Bool8x16.extractLane(b, 3), + SIMD.Bool8x16.extractLane(a, 4) | SIMD.Bool8x16.extractLane(b, 4), + SIMD.Bool8x16.extractLane(a, 5) | SIMD.Bool8x16.extractLane(b, 5), + SIMD.Bool8x16.extractLane(a, 6) | SIMD.Bool8x16.extractLane(b, 6), + SIMD.Bool8x16.extractLane(a, 7) | SIMD.Bool8x16.extractLane(b, 7), + SIMD.Bool8x16.extractLane(a, 8) | SIMD.Bool8x16.extractLane(b, 8), + SIMD.Bool8x16.extractLane(a, 9) | SIMD.Bool8x16.extractLane(b, 9), + SIMD.Bool8x16.extractLane(a, 10) | SIMD.Bool8x16.extractLane(b, 10), + SIMD.Bool8x16.extractLane(a, 11) | SIMD.Bool8x16.extractLane(b, 11), + SIMD.Bool8x16.extractLane(a, 12) | SIMD.Bool8x16.extractLane(b, 12), + SIMD.Bool8x16.extractLane(a, 13) | SIMD.Bool8x16.extractLane(b, 13), + SIMD.Bool8x16.extractLane(a, 14) | SIMD.Bool8x16.extractLane(b, 14), + SIMD.Bool8x16.extractLane(a, 15) | SIMD.Bool8x16.extractLane(b, 15)); + } +} + +if (typeof SIMD.Bool8x16.xor === "undefined") { + /** + * @param {Bool8x16} a An instance of Bool8x16. + * @param {Bool8x16} b An instance of Bool8x16. + * @return {Bool8x16} New instance of Bool8x16 with values of a ^ b. + */ + SIMD.Bool8x16.xor = function(a, b) { + a = SIMD.Bool8x16.check(a); + b = SIMD.Bool8x16.check(b); + return SIMD.Bool8x16(SIMD.Bool8x16.extractLane(a, 0) ^ SIMD.Bool8x16.extractLane(b, 0), + SIMD.Bool8x16.extractLane(a, 1) ^ SIMD.Bool8x16.extractLane(b, 1), + SIMD.Bool8x16.extractLane(a, 2) ^ SIMD.Bool8x16.extractLane(b, 2), + SIMD.Bool8x16.extractLane(a, 3) ^ SIMD.Bool8x16.extractLane(b, 3), + SIMD.Bool8x16.extractLane(a, 4) ^ SIMD.Bool8x16.extractLane(b, 4), + SIMD.Bool8x16.extractLane(a, 5) ^ SIMD.Bool8x16.extractLane(b, 5), + SIMD.Bool8x16.extractLane(a, 6) ^ SIMD.Bool8x16.extractLane(b, 6), + SIMD.Bool8x16.extractLane(a, 7) ^ SIMD.Bool8x16.extractLane(b, 7), + SIMD.Bool8x16.extractLane(a, 8) ^ SIMD.Bool8x16.extractLane(b, 8), + SIMD.Bool8x16.extractLane(a, 9) ^ SIMD.Bool8x16.extractLane(b, 9), + SIMD.Bool8x16.extractLane(a, 10) ^ SIMD.Bool8x16.extractLane(b, 10), + SIMD.Bool8x16.extractLane(a, 11) ^ SIMD.Bool8x16.extractLane(b, 11), + SIMD.Bool8x16.extractLane(a, 12) ^ SIMD.Bool8x16.extractLane(b, 12), + SIMD.Bool8x16.extractLane(a, 13) ^ SIMD.Bool8x16.extractLane(b, 13), + SIMD.Bool8x16.extractLane(a, 14) ^ SIMD.Bool8x16.extractLane(b, 14), + SIMD.Bool8x16.extractLane(a, 15) ^ SIMD.Bool8x16.extractLane(b, 15)); + } +} + +if (typeof SIMD.Bool8x16.not === "undefined") { + /** + * @param {Bool8x16} a An instance of Bool8x16. + * @return {Bool8x16} New instance of Bool8x16 with values of !a + */ + SIMD.Bool8x16.not = function(a) { + a = SIMD.Bool8x16.check(a); + return SIMD.Bool8x16(!SIMD.Bool8x16.extractLane(a, 0), + !SIMD.Bool8x16.extractLane(a, 1), + !SIMD.Bool8x16.extractLane(a, 2), + !SIMD.Bool8x16.extractLane(a, 3), + !SIMD.Bool8x16.extractLane(a, 4), + !SIMD.Bool8x16.extractLane(a, 5), + !SIMD.Bool8x16.extractLane(a, 6), + !SIMD.Bool8x16.extractLane(a, 7), + !SIMD.Bool8x16.extractLane(a, 8), + !SIMD.Bool8x16.extractLane(a, 9), + !SIMD.Bool8x16.extractLane(a, 10), + !SIMD.Bool8x16.extractLane(a, 11), + !SIMD.Bool8x16.extractLane(a, 12), + !SIMD.Bool8x16.extractLane(a, 13), + !SIMD.Bool8x16.extractLane(a, 14), + !SIMD.Bool8x16.extractLane(a, 15)); + } +} + +if (typeof SIMD.Bool8x16.equal === "undefined") { + /** + * @param {Bool8x16} a An instance of Bool8x16. + * @param {Bool8x16} b An instance of Bool8x16. + * @return {Bool8x16} true or false in each lane depending on + * the result of a == b. + */ + SIMD.Bool8x16.equal = function(a, b) { + a = SIMD.Bool8x16.check(a); + b = SIMD.Bool8x16.check(b); + return SIMD.Bool8x16(SIMD.Bool8x16.extractLane(a, 0) == SIMD.Bool8x16.extractLane(b, 0), + SIMD.Bool8x16.extractLane(a, 1) == SIMD.Bool8x16.extractLane(b, 1), + SIMD.Bool8x16.extractLane(a, 2) == SIMD.Bool8x16.extractLane(b, 2), + SIMD.Bool8x16.extractLane(a, 3) == SIMD.Bool8x16.extractLane(b, 3), + SIMD.Bool8x16.extractLane(a, 4) == SIMD.Bool8x16.extractLane(b, 4), + SIMD.Bool8x16.extractLane(a, 5) == SIMD.Bool8x16.extractLane(b, 5), + SIMD.Bool8x16.extractLane(a, 6) == SIMD.Bool8x16.extractLane(b, 6), + SIMD.Bool8x16.extractLane(a, 7) == SIMD.Bool8x16.extractLane(b, 7), + SIMD.Bool8x16.extractLane(a, 8) == SIMD.Bool8x16.extractLane(b, 8), + SIMD.Bool8x16.extractLane(a, 9) == SIMD.Bool8x16.extractLane(b, 9), + SIMD.Bool8x16.extractLane(a, 10) == SIMD.Bool8x16.extractLane(b, 10), + SIMD.Bool8x16.extractLane(a, 11) == SIMD.Bool8x16.extractLane(b, 11), + SIMD.Bool8x16.extractLane(a, 12) == SIMD.Bool8x16.extractLane(b, 12), + SIMD.Bool8x16.extractLane(a, 13) == SIMD.Bool8x16.extractLane(b, 13), + SIMD.Bool8x16.extractLane(a, 14) == SIMD.Bool8x16.extractLane(b, 14), + SIMD.Bool8x16.extractLane(a, 15) == SIMD.Bool8x16.extractLane(b, 15)); + } +} + +if (typeof SIMD.Bool8x16.notEqual === "undefined") { + /** + * @param {Bool8x16} a An instance of Bool8x16. + * @param {Bool8x16} b An instance of Bool8x16. + * @return {Bool8x16} true or false in each lane depending on + * the result of a != b. + */ + SIMD.Bool8x16.notEqual = function(a, b) { + a = SIMD.Bool8x16.check(a); + b = SIMD.Bool8x16.check(b); + return SIMD.Bool8x16(SIMD.Bool8x16.extractLane(a, 0) != SIMD.Bool8x16.extractLane(b, 0), + SIMD.Bool8x16.extractLane(a, 1) != SIMD.Bool8x16.extractLane(b, 1), + SIMD.Bool8x16.extractLane(a, 2) != SIMD.Bool8x16.extractLane(b, 2), + SIMD.Bool8x16.extractLane(a, 3) != SIMD.Bool8x16.extractLane(b, 3), + SIMD.Bool8x16.extractLane(a, 4) != SIMD.Bool8x16.extractLane(b, 4), + SIMD.Bool8x16.extractLane(a, 5) != SIMD.Bool8x16.extractLane(b, 5), + SIMD.Bool8x16.extractLane(a, 6) != SIMD.Bool8x16.extractLane(b, 6), + SIMD.Bool8x16.extractLane(a, 7) != SIMD.Bool8x16.extractLane(b, 7), + SIMD.Bool8x16.extractLane(a, 8) != SIMD.Bool8x16.extractLane(b, 8), + SIMD.Bool8x16.extractLane(a, 9) != SIMD.Bool8x16.extractLane(b, 9), + SIMD.Bool8x16.extractLane(a, 10) != SIMD.Bool8x16.extractLane(b, 10), + SIMD.Bool8x16.extractLane(a, 11) != SIMD.Bool8x16.extractLane(b, 11), + SIMD.Bool8x16.extractLane(a, 12) != SIMD.Bool8x16.extractLane(b, 12), + SIMD.Bool8x16.extractLane(a, 13) != SIMD.Bool8x16.extractLane(b, 13), + SIMD.Bool8x16.extractLane(a, 14) != SIMD.Bool8x16.extractLane(b, 14), + SIMD.Bool8x16.extractLane(a, 15) != SIMD.Bool8x16.extractLane(b, 15)); + } +} + +if (typeof SIMD.Bool8x16.select === "undefined") { + /** + * @param {Bool8x16} mask Selector mask. An instance of Bool8x16 + * @param {Bool8x16} trueValue Pick lane from here if corresponding + * selector lane is 1 + * @param {Bool8x16} falseValue Pick lane from here if corresponding + * selector lane is 0 + * @return {Bool8x16} Mix of lanes from trueValue or falseValue as + * indicated + */ + SIMD.Bool8x16.select = function(mask, trueValue, falseValue) { + mask = SIMD.Bool8x16.check(mask); + trueValue = SIMD.Bool8x16.check(trueValue); + falseValue = SIMD.Bool8x16.check(falseValue); + var tr = SIMD.Bool8x16.and(mask, trueValue); + var fr = SIMD.Bool8x16.and(SIMD.Bool8x16.not(mask), falseValue); + return SIMD.Bool8x16.or(tr, fr); + } +} + if (typeof SIMD.Float32x4 === "undefined") { /** * Construct a new instance of Float32x4 number. @@ -282,7 +1373,7 @@ if (typeof SIMD.Float32x4.check === "undefined") { if (typeof SIMD.Float32x4.splat === "undefined") { /** - * Construct a new instance of Float32x4 number with the same value + * Construct a new instance of Float32x4 with the same value * in all lanes. * @param {double} value used for all lanes. * @constructor @@ -461,7 +1552,7 @@ if (typeof SIMD.Float64x2.check === "undefined") { if (typeof SIMD.Float64x2.splat === "undefined") { /** - * Construct a new instance of Float64x2 number with the same value + * Construct a new instance of Float64x2 with the same value * in all lanes. * @param {double} value used for all lanes. * @constructor @@ -506,16 +1597,6 @@ if (typeof SIMD.Float64x2.fromFloat32x4Bits === "undefined") { } } -if (typeof SIMD.Float64x2.fromInt64x2Bits === "undefined") { - /** - * @param {Int64x2} t An instance of Int64x2. - * @return {Float64x2} a bit-wise copy of t as a Float64x2. - */ - SIMD.Float64x2.fromInt64x2Bits = function(t) { - return SIMD.Float64x2.fromInt32x4Bits(t.int32x4_); - } -} - if (typeof SIMD.Float64x2.fromInt32x4Bits === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. @@ -617,17 +1698,6 @@ if (typeof SIMD.Int32x4.extractLane === "undefined") { } } -if (typeof SIMD.Int32x4.extractLaneAsBool === "undefined") { - /** - * @param {Int32x4} t An instance of Int32x4. - * @param {integer} i Index in concatenation of t for lane i - * @return {Boolean} The value in lane i of t as a boolean. - */ - SIMD.Int32x4.extractLaneAsBool = function(t, i) { - return toBool(SIMD.Int32x4.extractLane(t, i)); - } -} - if (typeof SIMD.Int32x4.replaceLane === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. @@ -645,40 +1715,6 @@ if (typeof SIMD.Int32x4.replaceLane === "undefined") { } } -if (typeof SIMD.Int32x4.allTrue === "undefined") { - /** - * Check if all 4 lanes hold a true value (bit 31 == 1) - * @param {Int32x4} v An instance of Int32x4. - * @return {Boolean} All 4 lanes holds a true value - */ - SIMD.Int32x4.allTrue = function(v) { - if (!(v instanceof SIMD.Int32x4)) { - throw new TypeError("argument is not a Int32x4."); - } - return SIMD.Int32x4.extractLaneAsBool(v, 0) && - SIMD.Int32x4.extractLaneAsBool(v, 1) && - SIMD.Int32x4.extractLaneAsBool(v, 2) && - SIMD.Int32x4.extractLaneAsBool(v, 3); - } -} - -if (typeof SIMD.Int32x4.anyTrue === "undefined") { - /** - * Check if any of the 4 lanes hold a true value (bit 31 == 1) - * @param {Int32x4} v An instance of Int32x4. - * @return {Boolean} Any of the 4 lanes holds a true value - */ - SIMD.Int32x4.anyTrue = function(v) { - if (!(v instanceof SIMD.Int32x4)) { - throw new TypeError("argument is not a Int32x4."); - } - return SIMD.Int32x4.extractLaneAsBool(v, 0) || - SIMD.Int32x4.extractLaneAsBool(v, 1) || - SIMD.Int32x4.extractLaneAsBool(v, 2) || - SIMD.Int32x4.extractLaneAsBool(v, 3); - } -} - if (typeof SIMD.Int32x4.check === "undefined") { /** * Check whether the argument is a Int32x4. @@ -693,27 +1729,9 @@ if (typeof SIMD.Int32x4.check === "undefined") { } } -if (typeof SIMD.Int32x4.bool === "undefined") { - /** - * Construct a new instance of Int32x4 number with either true or false in - * each lane, depending on the truth values in x, y, z, and w. - * @param {boolean} flag used for x lane. - * @param {boolean} flag used for y lane. - * @param {boolean} flag used for z lane. - * @param {boolean} flag used for w lane. - * @constructor - */ - SIMD.Int32x4.bool = function(x, y, z, w) { - return SIMD.Int32x4(fromBool(x), - fromBool(y), - fromBool(z), - fromBool(w)); - } -} - if (typeof SIMD.Int32x4.splat === "undefined") { /** - * Construct a new instance of Int32x4 number with the same value + * Construct a new instance of Int32x4 with the same value * in all lanes. * @param {integer} value used for all lanes. * @constructor @@ -762,16 +1780,6 @@ if (typeof SIMD.Int32x4.fromFloat32x4Bits === "undefined") { } } -if (typeof SIMD.Int32x4.fromInt64x2Bits === "undefined") { - /** - * @param {Int64x2} t An instance of Int64x2. - * @return {Int32x4} a bit-wise copy of t as an Int32x4. - */ - SIMD.Int32x4.fromInt64x2Bits = function(t) { - return t.int32x4_; - } -} - if (typeof SIMD.Int32x4.fromFloat64x2Bits === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. @@ -880,22 +1888,11 @@ if (typeof SIMD.Int16x8.extractLane === "undefined") { case 1: return t.s1_; case 2: return t.s2_; case 3: return t.s3_; - case 4: return t.s4_; - case 5: return t.s5_; - case 6: return t.s6_; - case 7: return t.s7_; - } - } -} - -if (typeof SIMD.Int16x8.extractLaneAsBool === "undefined") { - /** - * @param {Int16x8} t An instance of Int16x8. - * @param {integer} i Index in concatenation of t for lane i - * @return {Boolean} The value in lane i of t as a boolean. - */ - SIMD.Int16x8.extractLaneAsBool = function(t, i) { - return toBool(SIMD.Int16x8.extractLane(t, i)); + case 4: return t.s4_; + case 5: return t.s5_; + case 6: return t.s6_; + case 7: return t.s7_; + } } } @@ -916,48 +1913,6 @@ if (typeof SIMD.Int16x8.replaceLane === "undefined") { } } -if (typeof SIMD.Int16x8.allTrue === "undefined") { - /** - * Check if all 8 lanes hold a true value (bit 15 == 1) - * @param {Int16x8} v An instance of Int16x8. - * @return {Boolean} All 8 lanes holds a true value - */ - SIMD.Int16x8.allTrue = function(v) { - if (!(v instanceof SIMD.Int16x8)) { - throw new TypeError("argument is not a Int16x8."); - } - return SIMD.Int16x8.extractLaneAsBool(v, 0) && - SIMD.Int16x8.extractLaneAsBool(v, 1) && - SIMD.Int16x8.extractLaneAsBool(v, 2) && - SIMD.Int16x8.extractLaneAsBool(v, 3) && - SIMD.Int16x8.extractLaneAsBool(v, 4) && - SIMD.Int16x8.extractLaneAsBool(v, 5) && - SIMD.Int16x8.extractLaneAsBool(v, 6) && - SIMD.Int16x8.extractLaneAsBool(v, 7); - } -} - -if (typeof SIMD.Int16x8.anyTrue === "undefined") { - /** - * Check if any of the 8 lanes hold a true value (bit 15 == 1) - * @param {Int16x8} v An instance of Int16x8. - * @return {Boolean} Any of the 8 lanes holds a true value - */ - SIMD.Int16x8.anyTrue = function(v) { - if (!(v instanceof SIMD.Int16x8)) { - throw new TypeError("argument is not a Int16x8."); - } - return SIMD.Int16x8.extractLaneAsBool(v, 0) || - SIMD.Int16x8.extractLaneAsBool(v, 1) || - SIMD.Int16x8.extractLaneAsBool(v, 2) || - SIMD.Int16x8.extractLaneAsBool(v, 3) || - SIMD.Int16x8.extractLaneAsBool(v, 4) || - SIMD.Int16x8.extractLaneAsBool(v, 5) || - SIMD.Int16x8.extractLaneAsBool(v, 6) || - SIMD.Int16x8.extractLaneAsBool(v, 7); - } -} - if (typeof SIMD.Int16x8.check === "undefined") { /** * Check whether the argument is a Int16x8. @@ -972,35 +1927,9 @@ if (typeof SIMD.Int16x8.check === "undefined") { } } -if (typeof SIMD.Int16x8.bool === "undefined") { - /** - * Construct a new instance of Int16x8 number with true or false in each - * lane, depending on the truth value in s0, s1, s2, s3, s4, s5, s6, and s7. - * @param {boolean} flag used for s0 lane. - * @param {boolean} flag used for s1 lane. - * @param {boolean} flag used for s2 lane. - * @param {boolean} flag used for s3 lane. - * @param {boolean} flag used for s4 lane. - * @param {boolean} flag used for s5 lane. - * @param {boolean} flag used for s6 lane. - * @param {boolean} flag used for s7 lane. - * @constructor - */ - SIMD.Int16x8.bool = function(s0, s1, s2, s3, s4, s5, s6, s7) { - return SIMD.Int16x8(fromBool(s0), - fromBool(s1), - fromBool(s2), - fromBool(s3), - fromBool(s4), - fromBool(s5), - fromBool(s6), - fromBool(s7)); - } -} - if (typeof SIMD.Int16x8.splat === "undefined") { /** - * Construct a new instance of Int16x8 number with the same value + * Construct a new instance of Int16x8 with the same value * in all lanes. * @param {integer} value used for all lanes. * @constructor @@ -1171,17 +2100,6 @@ if (typeof SIMD.Int8x16.extractLane === "undefined") { } } -if (typeof SIMD.Int8x16.extractLaneAsBool === "undefined") { - /** - * @param {Int8x16} t An instance of Int8x16. - * @param {integer} i Index in concatenation of t for lane i - * @return {Boolean} The value in lane i of t as a boolean. - */ - SIMD.Int8x16.extractLaneAsBool = function(t, i) { - return toBool(SIMD.Int8x16.extractLane(t, i)); - } -} - if (typeof SIMD.Int8x16.replaceLane === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. @@ -1199,64 +2117,6 @@ if (typeof SIMD.Int8x16.replaceLane === "undefined") { } } -if (typeof SIMD.Int8x16.allTrue === "undefined") { - /** - * Check if all 16 lanes hold a true value (bit 7 == 1) - * @param {Int8x16} v An instance of Int8x16. - * @return {Boolean} All 16 lanes holds a true value - */ - SIMD.Int8x16.allTrue = function(v) { - if (!(v instanceof SIMD.Int8x16)) { - throw new TypeError("argument is not a Int8x16."); - } - return SIMD.Int8x16.extractLaneAsBool(v, 0) && - SIMD.Int8x16.extractLaneAsBool(v, 1) && - SIMD.Int8x16.extractLaneAsBool(v, 2) && - SIMD.Int8x16.extractLaneAsBool(v, 3) && - SIMD.Int8x16.extractLaneAsBool(v, 4) && - SIMD.Int8x16.extractLaneAsBool(v, 5) && - SIMD.Int8x16.extractLaneAsBool(v, 6) && - SIMD.Int8x16.extractLaneAsBool(v, 7) && - SIMD.Int8x16.extractLaneAsBool(v, 8) && - SIMD.Int8x16.extractLaneAsBool(v, 9) && - SIMD.Int8x16.extractLaneAsBool(v, 10) && - SIMD.Int8x16.extractLaneAsBool(v, 11) && - SIMD.Int8x16.extractLaneAsBool(v, 12) && - SIMD.Int8x16.extractLaneAsBool(v, 13) && - SIMD.Int8x16.extractLaneAsBool(v, 14) && - SIMD.Int8x16.extractLaneAsBool(v, 15); - } -} - -if (typeof SIMD.Int8x16.anyTrue === "undefined") { - /** - * Check if any of the 16 lanes hold a true value (bit 7 == 1) - * @param {Int8x16} v An instance of Int16x8. - * @return {Boolean} Any of the 16 lanes holds a true value - */ - SIMD.Int8x16.anyTrue = function(v) { - if (!(v instanceof SIMD.Int8x16)) { - throw new TypeError("argument is not a Int8x16."); - } - return SIMD.Int8x16.extractLaneAsBool(v, 0) || - SIMD.Int8x16.extractLaneAsBool(v, 1) || - SIMD.Int8x16.extractLaneAsBool(v, 2) || - SIMD.Int8x16.extractLaneAsBool(v, 3) || - SIMD.Int8x16.extractLaneAsBool(v, 4) || - SIMD.Int8x16.extractLaneAsBool(v, 5) || - SIMD.Int8x16.extractLaneAsBool(v, 6) || - SIMD.Int8x16.extractLaneAsBool(v, 7) || - SIMD.Int8x16.extractLaneAsBool(v, 8) || - SIMD.Int8x16.extractLaneAsBool(v, 9) || - SIMD.Int8x16.extractLaneAsBool(v, 10) || - SIMD.Int8x16.extractLaneAsBool(v, 11) || - SIMD.Int8x16.extractLaneAsBool(v, 12) || - SIMD.Int8x16.extractLaneAsBool(v, 13) || - SIMD.Int8x16.extractLaneAsBool(v, 14) || - SIMD.Int8x16.extractLaneAsBool(v, 15); - } -} - if (typeof SIMD.Int8x16.check === "undefined") { /** * Check whether the argument is a Int8x16. @@ -1271,53 +2131,9 @@ if (typeof SIMD.Int8x16.check === "undefined") { } } -if (typeof SIMD.Int8x16.bool === "undefined") { - /** - * Construct a new instance of Int8x16 number with true or false in each - * lane, depending on the truth value in s0, s1, s2, s3, s4, s5, s6, s7, - * s8, s9, s10, s11, s12, s13, s14, and s15. - * @param {boolean} flag used for s0 lane. - * @param {boolean} flag used for s1 lane. - * @param {boolean} flag used for s2 lane. - * @param {boolean} flag used for s3 lane. - * @param {boolean} flag used for s4 lane. - * @param {boolean} flag used for s5 lane. - * @param {boolean} flag used for s6 lane. - * @param {boolean} flag used for s7 lane. - * @param {boolean} flag used for s8 lane. - * @param {boolean} flag used for s9 lane. - * @param {boolean} flag used for s10 lane. - * @param {boolean} flag used for s11 lane. - * @param {boolean} flag used for s12 lane. - * @param {boolean} flag used for s13 lane. - * @param {boolean} flag used for s14 lane. - * @param {boolean} flag used for s15 lane. - * @constructor - */ - SIMD.Int8x16.bool = function(s0, s1, s2, s3, s4, s5, s6, s7, - s8, s9, s10, s11, s12, s13, s14, s15) { - return SIMD.Int8x16(fromBool(s0), - fromBool(s1), - fromBool(s2), - fromBool(s3), - fromBool(s4), - fromBool(s5), - fromBool(s6), - fromBool(s7), - fromBool(s8), - fromBool(s9), - fromBool(s10), - fromBool(s11), - fromBool(s12), - fromBool(s13), - fromBool(s14), - fromBool(s15)); - } -} - if (typeof SIMD.Int8x16.splat === "undefined") { /** - * Construct a new instance of Int8x16 number with the same value + * Construct a new instance of Int8x16 with the same value * in all lanes. * @param {integer} value used for all lanes. * @constructor @@ -1428,125 +2244,6 @@ if (!Object.hasOwnProperty(SIMD.Int8x16.prototype, 'valueOf')) { } } -if (typeof SIMD.Int64x2 === "undefined") { - /** - * Construct a new instance of Int64x2 number. - * This function conceptually requires 64-bit integer arguments. Until JS - * has support for that, this function cannot be passed any arguments. To - * produce an Int64x2 value, use Int64x2.load, Int64x2.bool, or a - * Float64x2 comparison. - * @constructor - */ - SIMD.Int64x2 = function() { - if (!(this instanceof SIMD.Int64x2)) { - return new SIMD.Int64x2(); - } - if (arguments.length != 0) { - throw new Error("Int64x2 cannot currently be directly constructed"); - } - - this.int32x4_ = SIMD.Int32x4.splat(0); - } -} - -if (typeof SIMD.Int64x2.extractLaneAsBool === "undefined") { - /** - * @param {Int64x2} t An instance of Int64x2. - * @param {integer} i Index in concatenation of t for lane i - * @return {Boolean} The value in lane i of t as a boolean. - */ - SIMD.Int64x2.extractLaneAsBool = function(t, i) { - t = SIMD.Int64x2.check(t); - return SIMD.Int32x4.extractLaneAsBool(t.int32x4_, i << 1) - } -} - - -if (typeof SIMD.Int64x2.allTrue === "undefined") { - /** - * Check if all 2 lanes hold a true value (bit 63 == 1) - * @param {Int64x2} v An instance of Int64x2. - * @return {Boolean} All 2 lanes hold a true value - */ - SIMD.Int64x2.allTrue = function(v) { - if (!(v instanceof SIMD.Int64x2)) { - throw new TypeError("argument is not a Int64x2."); - } - return SIMD.Int64x2.extractLaneAsBool(v, 0) && - SIMD.Int64x2.extractLaneAsBool(v, 1); - } -} - -if (typeof SIMD.Int64x2.anyTrue === "undefined") { - /** - * Check if any of the 2 lanes hold a true value (bit 63 == 1) - * @param {Int64x2} v An instance of Int64x2. - * @return {Boolean} Any of the 2 lanes holds a true value - */ - SIMD.Int64x2.anyTrue = function(v) { - if (!(v instanceof SIMD.Int64x2)) { - throw new TypeError("argument is not a Int64x2."); - } - return SIMD.Int64x2.extractLaneAsBool(v, 0) || - SIMD.Int64x2.extractLaneAsBool(v, 1); - } -} - -if (typeof SIMD.Int64x2.check === "undefined") { - /** - * Check whether the argument is a Int64x2. - * @param {Int64x2} v An instance of Int64x2. - * @return {Int64x2} The Int64x2 instance. - */ - SIMD.Int64x2.check = function(v) { - if (!(v instanceof SIMD.Int64x2)) { - throw new TypeError("argument is not a Int64x2."); - } - return v; - } -} - -if (typeof SIMD.Int64x2.bool === "undefined") { - /** - * Construct a new instance of Int64x2 number with either true or false in - * each lane, depending on the truth values in x and y. - * @param {boolean} flag used for x lane. - * @param {boolean} flag used for y lane. - * @constructor - */ - SIMD.Int64x2.bool = function(x, y) { - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.bool(x, 0, y, 0); - return v; - } -} - -if (typeof SIMD.Int64x2.fromFloat64x2Bits === "undefined") { - /** - * @param {Float64x2} t An instance of Float64x2. - * @return {Int64x2} a bit-wise copy of t as an Int64x2. - */ - SIMD.Int64x2.fromFloat64x2Bits = function(t) { - saveFloat64x2(t); - var v = SIMD.Int64x2(); - v.int32x4_ = restoreInt32x4(); - return v; - } -} - -if (typeof SIMD.Int64x2.fromInt32x4Bits === "undefined") { - /** - * @param {Int32x4} t An instance of Int32x4. - * @return {Int64x2} a bit-wise copy of t as an Int64x2. - */ - SIMD.Int64x2.fromInt32x4Bits = function(t) { - t = SIMD.Int32x4.check(t); - var v = SIMD.Int64x2(); - v.int32x4_ = t; - return v; - } -} - if (typeof SIMD.Float32x4.abs === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. @@ -1833,7 +2530,7 @@ if (typeof SIMD.Float32x4.lessThan === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. * @param {Float32x4} other An instance of Float32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t < other. */ SIMD.Float32x4.lessThan = function(t, other) { @@ -1847,7 +2544,7 @@ if (typeof SIMD.Float32x4.lessThan === "undefined") { SIMD.Float32x4.extractLane(t, 2) < SIMD.Float32x4.extractLane(other, 2); var cw = SIMD.Float32x4.extractLane(t, 3) < SIMD.Float32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -1855,7 +2552,7 @@ if (typeof SIMD.Float32x4.lessThanOrEqual === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. * @param {Float32x4} other An instance of Float32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t <= other. */ SIMD.Float32x4.lessThanOrEqual = function(t, other) { @@ -1869,7 +2566,7 @@ if (typeof SIMD.Float32x4.lessThanOrEqual === "undefined") { SIMD.Float32x4.extractLane(other, 2); var cw = SIMD.Float32x4.extractLane(t, 3) <= SIMD.Float32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -1877,7 +2574,7 @@ if (typeof SIMD.Float32x4.equal === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. * @param {Float32x4} other An instance of Float32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t == other. */ SIMD.Float32x4.equal = function(t, other) { @@ -1891,7 +2588,7 @@ if (typeof SIMD.Float32x4.equal === "undefined") { SIMD.Float32x4.extractLane(other, 2); var cw = SIMD.Float32x4.extractLane(t, 3) == SIMD.Float32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -1899,7 +2596,7 @@ if (typeof SIMD.Float32x4.notEqual === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. * @param {Float32x4} other An instance of Float32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t != other. */ SIMD.Float32x4.notEqual = function(t, other) { @@ -1913,7 +2610,7 @@ if (typeof SIMD.Float32x4.notEqual === "undefined") { SIMD.Float32x4.extractLane(other, 2); var cw = SIMD.Float32x4.extractLane(t, 3) != SIMD.Float32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -1921,7 +2618,7 @@ if (typeof SIMD.Float32x4.greaterThanOrEqual === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. * @param {Float32x4} other An instance of Float32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t >= other. */ SIMD.Float32x4.greaterThanOrEqual = function(t, other) { @@ -1935,7 +2632,7 @@ if (typeof SIMD.Float32x4.greaterThanOrEqual === "undefined") { SIMD.Float32x4.extractLane(other, 2); var cw = SIMD.Float32x4.extractLane(t, 3) >= SIMD.Float32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -1943,7 +2640,7 @@ if (typeof SIMD.Float32x4.greaterThan === "undefined") { /** * @param {Float32x4} t An instance of Float32x4. * @param {Float32x4} other An instance of Float32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t > other. */ SIMD.Float32x4.greaterThan = function(t, other) { @@ -1957,13 +2654,13 @@ if (typeof SIMD.Float32x4.greaterThan === "undefined") { SIMD.Float32x4.extractLane(t, 2) > SIMD.Float32x4.extractLane(other, 2); var cw = SIMD.Float32x4.extractLane(t, 3) > SIMD.Float32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } if (typeof SIMD.Float32x4.select === "undefined") { /** - * @param {Int32x4} t Selector mask. An instance of Int32x4 + * @param {Bool32x4} t Selector mask. An instance of Bool32x4 * @param {Float32x4} trueValue Pick lane from here if corresponding * selector lane is true * @param {Float32x4} falseValue Pick lane from here if corresponding @@ -1972,104 +2669,25 @@ if (typeof SIMD.Float32x4.select === "undefined") { * indicated */ SIMD.Float32x4.select = function(t, trueValue, falseValue) { - t = SIMD.Int32x4.check(t); + t = SIMD.Bool32x4.check(t); trueValue = SIMD.Float32x4.check(trueValue); falseValue = SIMD.Float32x4.check(falseValue); return SIMD.Float32x4( - SIMD.Int32x4.extractLaneAsBool(t, 0) ? + SIMD.Bool32x4.extractLane(t, 0) ? SIMD.Float32x4.extractLane(trueValue, 0) : SIMD.Float32x4.extractLane(falseValue, 0), - SIMD.Int32x4.extractLaneAsBool(t, 1) ? + SIMD.Bool32x4.extractLane(t, 1) ? SIMD.Float32x4.extractLane(trueValue, 1) : SIMD.Float32x4.extractLane(falseValue, 1), - SIMD.Int32x4.extractLaneAsBool(t, 2) ? + SIMD.Bool32x4.extractLane(t, 2) ? SIMD.Float32x4.extractLane(trueValue, 2) : SIMD.Float32x4.extractLane(falseValue, 2), - SIMD.Int32x4.extractLaneAsBool(t, 3) ? + SIMD.Bool32x4.extractLane(t, 3) ? SIMD.Float32x4.extractLane(trueValue, 3) : SIMD.Float32x4.extractLane(falseValue, 3)); } } -if (typeof SIMD.Float32x4.selectBits === "undefined") { - /** - * @param {Int32x4} t Selector mask. An instance of Int32x4 - * @param {Float32x4} trueValue Pick bit from here if corresponding - * selector bit is 1 - * @param {Float32x4} falseValue Pick bit from here if corresponding - * selector bit is 0 - * @return {Float32x4} Mix of bits from trueValue or falseValue as - * indicated - */ - SIMD.Float32x4.selectBits = function(t, trueValue, falseValue) { - t = SIMD.Int32x4.check(t); - trueValue = SIMD.Float32x4.check(trueValue); - falseValue = SIMD.Float32x4.check(falseValue); - var tv = SIMD.Int32x4.fromFloat32x4Bits(trueValue); - var fv = SIMD.Int32x4.fromFloat32x4Bits(falseValue); - var tr = SIMD.Int32x4.and(t, tv); - var fr = SIMD.Int32x4.and(SIMD.Int32x4.not(t), fv); - return SIMD.Float32x4.fromInt32x4Bits(SIMD.Int32x4.or(tr, fr)); - } -} - -if (typeof SIMD.Float32x4.and === "undefined") { - /** - * @param {Float32x4} a An instance of Float32x4. - * @param {Float32x4} b An instance of Float32x4. - * @return {Float32x4} New instance of Float32x4 with values of a & b. - */ - SIMD.Float32x4.and = function(a, b) { - a = SIMD.Float32x4.check(a); - b = SIMD.Float32x4.check(b); - var aInt = SIMD.Int32x4.fromFloat32x4Bits(a); - var bInt = SIMD.Int32x4.fromFloat32x4Bits(b); - return SIMD.Float32x4.fromInt32x4Bits(SIMD.Int32x4.and(aInt, bInt)); - } -} - -if (typeof SIMD.Float32x4.or === "undefined") { - /** - * @param {Float32x4} a An instance of Float32x4. - * @param {Float32x4} b An instance of Float32x4. - * @return {Float32x4} New instance of Float32x4 with values of a | b. - */ - SIMD.Float32x4.or = function(a, b) { - a = SIMD.Float32x4.check(a); - b = SIMD.Float32x4.check(b); - var aInt = SIMD.Int32x4.fromFloat32x4Bits(a); - var bInt = SIMD.Int32x4.fromFloat32x4Bits(b); - return SIMD.Float32x4.fromInt32x4Bits(SIMD.Int32x4.or(aInt, bInt)); - } -} - -if (typeof SIMD.Float32x4.xor === "undefined") { - /** - * @param {Float32x4} a An instance of Float32x4. - * @param {Float32x4} b An instance of Float32x4. - * @return {Float32x4} New instance of Float32x4 with values of a ^ b. - */ - SIMD.Float32x4.xor = function(a, b) { - a = SIMD.Float32x4.check(a); - b = SIMD.Float32x4.check(b); - var aInt = SIMD.Int32x4.fromFloat32x4Bits(a); - var bInt = SIMD.Int32x4.fromFloat32x4Bits(b); - return SIMD.Float32x4.fromInt32x4Bits(SIMD.Int32x4.xor(aInt, bInt)); - } -} - -if (typeof SIMD.Float32x4.not === "undefined") { - /** - * @param {Float32x4} a An instance of Float32x4. - * @return {Float32x4} New instance of Float32x4 with values of ~a. - */ - SIMD.Float32x4.not = function(a) { - a = SIMD.Float32x4.check(a); - var aInt = SIMD.Int32x4.fromFloat32x4Bits(a); - return SIMD.Float32x4.fromInt32x4Bits(SIMD.Int32x4.not(aInt)); - } -} - if (typeof SIMD.Float32x4.load === "undefined") { /** * @param {Typed array} tarray An instance of a typed array. @@ -2548,7 +3166,7 @@ if (typeof SIMD.Float64x2.lessThan === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. * @param {Float64x2} other An instance of Float64x2. - * @return {Int64x2} true or false in each lane depending on + * @return {bool64x2} true or false in each lane depending on * the result of t < other. */ SIMD.Float64x2.lessThan = function(t, other) { @@ -2558,7 +3176,7 @@ if (typeof SIMD.Float64x2.lessThan === "undefined") { SIMD.Float64x2.extractLane(t, 0) < SIMD.Float64x2.extractLane(other, 0); var cy = SIMD.Float64x2.extractLane(t, 1) < SIMD.Float64x2.extractLane(other, 1); - return SIMD.Int64x2.bool(cx, cy); + return SIMD.Bool64x2(cx, cy); } } @@ -2566,7 +3184,7 @@ if (typeof SIMD.Float64x2.lessThanOrEqual === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. * @param {Float64x2} other An instance of Float64x2. - * @return {Int64x2} true or false in each lane depending on + * @return {bool64x2} true or false in each lane depending on * the result of t <= other. */ SIMD.Float64x2.lessThanOrEqual = function(t, other) { @@ -2576,7 +3194,7 @@ if (typeof SIMD.Float64x2.lessThanOrEqual === "undefined") { SIMD.Float64x2.extractLane(other, 0); var cy = SIMD.Float64x2.extractLane(t, 1) <= SIMD.Float64x2.extractLane(other, 1); - return SIMD.Int64x2.bool(cx, cy); + return SIMD.Bool64x2(cx, cy); } } @@ -2584,7 +3202,7 @@ if (typeof SIMD.Float64x2.equal === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. * @param {Float64x2} other An instance of Float64x2. - * @return {Int64x2} true or false in each lane depending on + * @return {bool64x2} true or false in each lane depending on * the result of t == other. */ SIMD.Float64x2.equal = function(t, other) { @@ -2594,7 +3212,7 @@ if (typeof SIMD.Float64x2.equal === "undefined") { SIMD.Float64x2.extractLane(other, 0); var cy = SIMD.Float64x2.extractLane(t, 1) == SIMD.Float64x2.extractLane(other, 1); - return SIMD.Int64x2.bool(cx, cy); + return SIMD.Bool64x2(cx, cy); } } @@ -2602,7 +3220,7 @@ if (typeof SIMD.Float64x2.notEqual === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. * @param {Float64x2} other An instance of Float64x2. - * @return {Int64x2} true or false in each lane depending on + * @return {bool64x2} true or false in each lane depending on * the result of t != other. */ SIMD.Float64x2.notEqual = function(t, other) { @@ -2612,7 +3230,7 @@ if (typeof SIMD.Float64x2.notEqual === "undefined") { SIMD.Float64x2.extractLane(other, 0); var cy = SIMD.Float64x2.extractLane(t, 1) != SIMD.Float64x2.extractLane(other, 1); - return SIMD.Int64x2.bool(cx, cy); + return SIMD.Bool64x2(cx, cy); } } @@ -2620,7 +3238,7 @@ if (typeof SIMD.Float64x2.greaterThanOrEqual === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. * @param {Float64x2} other An instance of Float64x2. - * @return {Int64x2} true or false in each lane depending on + * @return {bool64x2} true or false in each lane depending on * the result of t >= other. */ SIMD.Float64x2.greaterThanOrEqual = function(t, other) { @@ -2630,7 +3248,7 @@ if (typeof SIMD.Float64x2.greaterThanOrEqual === "undefined") { SIMD.Float64x2.extractLane(other, 0); var cy = SIMD.Float64x2.extractLane(t, 1) >= SIMD.Float64x2.extractLane(other, 1); - return SIMD.Int64x2.bool(cx, cy); + return SIMD.Bool64x2(cx, cy); } } @@ -2638,7 +3256,7 @@ if (typeof SIMD.Float64x2.greaterThan === "undefined") { /** * @param {Float64x2} t An instance of Float64x2. * @param {Float64x2} other An instance of Float64x2. - * @return {Int64x2} true or false in each lane depending on + * @return {bool64x2} true or false in each lane depending on * the result of t > other. */ SIMD.Float64x2.greaterThan = function(t, other) { @@ -2648,13 +3266,13 @@ if (typeof SIMD.Float64x2.greaterThan === "undefined") { SIMD.Float64x2.extractLane(t, 0) > SIMD.Float64x2.extractLane(other, 0); var cy = SIMD.Float64x2.extractLane(t, 1) > SIMD.Float64x2.extractLane(other, 1); - return SIMD.Int64x2.bool(cx, cy); + return SIMD.Bool64x2(cx, cy); } } if (typeof SIMD.Float64x2.select === "undefined") { /** - * @param {Int64x2} t Selector mask. An instance of Int64x2 + * @param {bool64x2} t Selector mask. An instance of bool64x2 * @param {Float64x2} trueValue Pick lane from here if corresponding * selector lane is true * @param {Float64x2} falseValue Pick lane from here if corresponding @@ -2663,41 +3281,19 @@ if (typeof SIMD.Float64x2.select === "undefined") { * indicated */ SIMD.Float64x2.select = function(t, trueValue, falseValue) { - t = SIMD.Int64x2.check(t); + t = SIMD.Bool64x2.check(t); trueValue = SIMD.Float64x2.check(trueValue); falseValue = SIMD.Float64x2.check(falseValue); return SIMD.Float64x2( - SIMD.Int64x2.extractLaneAsBool(t, 0) ? + SIMD.Bool64x2.extractLane(t, 0) ? SIMD.Float64x2.extractLane(trueValue, 0) : SIMD.Float64x2.extractLane(falseValue, 0), - SIMD.Int64x2.extractLaneAsBool(t, 1) ? + SIMD.Bool64x2.extractLane(t, 1) ? SIMD.Float64x2.extractLane(trueValue, 1) : SIMD.Float64x2.extractLane(falseValue, 1)); } } -if (typeof SIMD.Float64x2.selectBits === "undefined") { - /** - * @param {Int64x2} t Selector mask. An instance of Int64x2 - * @param {Float64x2} trueValue Pick bit from here if corresponding - * selector bit is 1 - * @param {Float64x2} falseValue Pick bit from here if corresponding - * selector bit is 0 - * @return {Float64x2} Mix of bits from trueValue or falseValue as - * indicated - */ - SIMD.Float64x2.selectBits = function(t, trueValue, falseValue) { - t = SIMD.Int64x2.check(t); - trueValue = SIMD.Float64x2.check(trueValue); - falseValue = SIMD.Float64x2.check(falseValue); - var tv = SIMD.Int64x2.fromFloat64x2Bits(trueValue); - var fv = SIMD.Int64x2.fromFloat64x2Bits(falseValue); - var tr = SIMD.Int64x2.and(t, tv); - var fr = SIMD.Int64x2.and(SIMD.Int64x2.not(t), fv); - return SIMD.Float64x2.fromInt64x2Bits(SIMD.Int64x2.or(tr, fr)); - } -} - if (typeof SIMD.Float64x2.load === "undefined") { /** * @param {Typed array} tarray An instance of a typed array. @@ -2807,148 +3403,6 @@ if (typeof SIMD.Float64x2.store1 === "undefined") { } } -if (typeof SIMD.Int64x2.and === "undefined") { - /** - * @param {Int64x2} a An instance of Int64x2. - * @param {Int64x2} b An instance of Int64x2. - * @return {Int64x2} New instance of Int64x2 with values of a & b. - */ - SIMD.Int64x2.and = function(a, b) { - a = SIMD.Int64x2.check(a); - b = SIMD.Int64x2.check(b); - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.and(a.int32x4_, b.int32x4_); - return v; - } -} - -if (typeof SIMD.Int64x2.or === "undefined") { - /** - * @param {Int64x2} a An instance of Int64x2. - * @param {Int64x2} b An instance of Int64x2. - * @return {Int64x2} New instance of Int64x2 with values of a | b. - */ - SIMD.Int64x2.or = function(a, b) { - a = SIMD.Int64x2.check(a); - b = SIMD.Int64x2.check(b); - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.or(a.int32x4_, b.int32x4_); - return v; - } -} - -if (typeof SIMD.Int64x2.xor === "undefined") { - /** - * @param {Int64x2} a An instance of Int64x2. - * @param {Int64x2} b An instance of Int64x2. - * @return {Int64x2} New instance of Int64x2 with values of a ^ b. - */ - SIMD.Int64x2.xor = function(a, b) { - a = SIMD.Int64x2.check(a); - b = SIMD.Int64x2.check(b); - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.xor(a.int32x4_, b.int32x4_); - return v; - } -} - -if (typeof SIMD.Int64x2.not === "undefined") { - /** - * @param {Int64x2} t An instance of Int64x2. - * @return {Int64x2} New instance of Int64x2 with values of ~t - */ - SIMD.Int64x2.not = function(t) { - t = SIMD.Int64x2.check(t); - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.not(t.int32x4_); - return v; - } -} - -if (typeof SIMD.Int64x2.equal === "undefined") { - /** - * @param {Int64x2} t An instance of Int64x2. - * @param {Int64x2} other An instance of Int64x2. - * @return {Int64x2} true or false in each lane depending on - * the result of t == other. - */ - SIMD.Int64x2.equal = function(t, other) { - t = SIMD.Int64x2.check(t); - other = SIMD.Int64x2.check(other); - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.equal(t.int32x4_, other.int32x4_); - return v; - } -} - -if (typeof SIMD.Int64x2.notEqual === "undefined") { - /** - * @param {Int64x2} t An instance of Int64x2. - * @param {Int64x2} other An instance of Int64x2. - * @return {Int64x2} true or false in each lane depending on - * the result of t != other. - */ - SIMD.Int64x2.notEqual = function(t, other) { - t = SIMD.Int64x2.check(t); - other = SIMD.Int64x2.check(other); - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.notEqual(t.int32x4_, other.int32x4_); - return v; - } -} - -if (typeof SIMD.Int64x2.load === "undefined") { - /** - * @param {Typed array} tarray An instance of a typed array. - * @param {Number} index An instance of Number. - * @return {Int64x2} New instance of Int64x2. - */ - SIMD.Int64x2.load = function(tarray, index) { - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.load(tarray, index); - return v; - } -} - -if (typeof SIMD.Int64x2.load1 === "undefined") { - /** - * @param {Typed array} tarray An instance of a typed array. - * @param {Number} index An instance of Number. - * @return {Int64x2} New instance of Int64x2. - */ - SIMD.Int64x2.load1 = function(tarray, index) { - var v = SIMD.Int64x2(); - v.int32x4_ = SIMD.Int32x4.load2(tarray, index); - return v; - } -} - -if (typeof SIMD.Int64x2.store === "undefined") { - /** - * @param {Typed array} tarray An instance of a typed array. - * @param {Number} index An instance of Number. - * @param {Int64x2} value An instance of Int64x2. - * @return {void} - */ - SIMD.Int64x2.store = function(tarray, index, value) { - value = SIMD.Int64x2.check(value); - return SIMD.Int32x4.store(tarray, index, value.int32x4_); - } -} - -if (typeof SIMD.Int64x2.store1 === "undefined") { - /** - * @param {Typed array} tarray An instance of a typed array. - * @param {Number} index An instance of Number. - * @param {Int64x2} value An instance of Int64x2. - * @return {void} - */ - SIMD.Int64x2.store1 = function(tarray, index, value) { - value = SIMD.Int64x2.check(value); - return SIMD.Int32x4.store2(tarray, index, value.int32x4_); - } -} - if (typeof SIMD.Int32x4.and === "undefined") { /** * @param {Int32x4} a An instance of Int32x4. @@ -3142,7 +3596,7 @@ if (typeof SIMD.Int32x4.shuffle === "undefined") { if (typeof SIMD.Int32x4.select === "undefined") { /** - * @param {Int32x4} t Selector mask. An instance of Int32x4 + * @param {Bool32x4} t Selector mask. An instance of Bool32x4 * @param {Int32x4} trueValue Pick lane from here if corresponding * selector lane is true * @param {Int32x4} falseValue Pick lane from here if corresponding @@ -3151,20 +3605,20 @@ if (typeof SIMD.Int32x4.select === "undefined") { * indicated */ SIMD.Int32x4.select = function(t, trueValue, falseValue) { - t = SIMD.Int32x4.check(t); + t = SIMD.Bool32x4.check(t); trueValue = SIMD.Int32x4.check(trueValue); falseValue = SIMD.Int32x4.check(falseValue); return SIMD.Int32x4( - SIMD.Int32x4.extractLaneAsBool(t, 0) ? + SIMD.Bool32x4.extractLane(t, 0) ? SIMD.Int32x4.extractLane(trueValue, 0) : SIMD.Int32x4.extractLane(falseValue, 0), - SIMD.Int32x4.extractLaneAsBool(t, 1) ? + SIMD.Bool32x4.extractLane(t, 1) ? SIMD.Int32x4.extractLane(trueValue, 1) : SIMD.Int32x4.extractLane(falseValue, 1), - SIMD.Int32x4.extractLaneAsBool(t, 2) ? + SIMD.Bool32x4.extractLane(t, 2) ? SIMD.Int32x4.extractLane(trueValue, 2) : SIMD.Int32x4.extractLane(falseValue, 2), - SIMD.Int32x4.extractLaneAsBool(t, 3) ? + SIMD.Bool32x4.extractLane(t, 3) ? SIMD.Int32x4.extractLane(trueValue, 3) : SIMD.Int32x4.extractLane(falseValue, 3)); } @@ -3194,7 +3648,7 @@ if (typeof SIMD.Int32x4.equal === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. * @param {Int32x4} other An instance of Int32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t == other. */ SIMD.Int32x4.equal = function(t, other) { @@ -3208,7 +3662,7 @@ if (typeof SIMD.Int32x4.equal === "undefined") { SIMD.Int32x4.extractLane(t, 2) == SIMD.Int32x4.extractLane(other, 2); var cw = SIMD.Int32x4.extractLane(t, 3) == SIMD.Int32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -3216,7 +3670,7 @@ if (typeof SIMD.Int32x4.notEqual === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. * @param {Int32x4} other An instance of Int32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t != other. */ SIMD.Int32x4.notEqual = function(t, other) { @@ -3230,7 +3684,7 @@ if (typeof SIMD.Int32x4.notEqual === "undefined") { SIMD.Int32x4.extractLane(t, 2) != SIMD.Int32x4.extractLane(other, 2); var cw = SIMD.Int32x4.extractLane(t, 3) != SIMD.Int32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -3238,7 +3692,7 @@ if (typeof SIMD.Int32x4.greaterThan === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. * @param {Int32x4} other An instance of Int32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t > other. */ SIMD.Int32x4.greaterThan = function(t, other) { @@ -3252,7 +3706,7 @@ if (typeof SIMD.Int32x4.greaterThan === "undefined") { SIMD.Int32x4.extractLane(t, 2) > SIMD.Int32x4.extractLane(other, 2); var cw = SIMD.Int32x4.extractLane(t, 3) > SIMD.Int32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -3260,7 +3714,7 @@ if (typeof SIMD.Int32x4.greaterThanOrEqual === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. * @param {Int32x4} other An instance of Int32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t >= other. */ SIMD.Int32x4.greaterThanOrEqual = function(t, other) { @@ -3274,7 +3728,7 @@ if (typeof SIMD.Int32x4.greaterThanOrEqual === "undefined") { SIMD.Int32x4.extractLane(t, 2) >= SIMD.Int32x4.extractLane(other, 2); var cw = SIMD.Int32x4.extractLane(t, 3) >= SIMD.Int32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -3282,7 +3736,7 @@ if (typeof SIMD.Int32x4.lessThan === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. * @param {Int32x4} other An instance of Int32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t < other. */ SIMD.Int32x4.lessThan = function(t, other) { @@ -3296,7 +3750,7 @@ if (typeof SIMD.Int32x4.lessThan === "undefined") { SIMD.Int32x4.extractLane(t, 2) < SIMD.Int32x4.extractLane(other, 2); var cw = SIMD.Int32x4.extractLane(t, 3) < SIMD.Int32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -3304,7 +3758,7 @@ if (typeof SIMD.Int32x4.lessThanOrEqual === "undefined") { /** * @param {Int32x4} t An instance of Int32x4. * @param {Int32x4} other An instance of Int32x4. - * @return {Int32x4} true or false in each lane depending on + * @return {Bool32x4} true or false in each lane depending on * the result of t <= other. */ SIMD.Int32x4.lessThanOrEqual = function(t, other) { @@ -3318,7 +3772,7 @@ if (typeof SIMD.Int32x4.lessThanOrEqual === "undefined") { SIMD.Int32x4.extractLane(t, 2) <= SIMD.Int32x4.extractLane(other, 2); var cw = SIMD.Int32x4.extractLane(t, 3) <= SIMD.Int32x4.extractLane(other, 3); - return SIMD.Int32x4.bool(cx, cy, cz, cw); + return SIMD.Bool32x4(cx, cy, cz, cw); } } @@ -3882,8 +4336,9 @@ if (typeof SIMD.Int16x8.addSaturate === "undefined") { var max = SIMD.Int16x8.splat(0x7fff); var min = SIMD.Int16x8.splat(0x8000); var mask = SIMD.Int16x8.lessThan(c, a); - return SIMD.Int16x8.select(SIMD.Int16x8.and(mask, SIMD.Int16x8.not(b)), max, - SIMD.Int16x8.select(SIMD.Int16x8.and(SIMD.Int16x8.not(mask), b), min, + var bneg = SIMD.Int16x8.lessThan(b, SIMD.Int16x8.splat(0)); + return SIMD.Int16x8.select(SIMD.Bool16x8.and(mask, SIMD.Bool16x8.not(bneg)), max, + SIMD.Int16x8.select(SIMD.Bool16x8.and(SIMD.Bool16x8.not(mask), bneg), min, c)); } } @@ -3902,15 +4357,16 @@ if (typeof SIMD.Int16x8.subSaturate === "undefined") { var max = SIMD.Int16x8.splat(0x7fff); var min = SIMD.Int16x8.splat(0x8000); var mask = SIMD.Int16x8.greaterThan(c, a); - return SIMD.Int16x8.select(SIMD.Int16x8.and(mask, SIMD.Int16x8.not(b)), min, - SIMD.Int16x8.select(SIMD.Int16x8.and(SIMD.Int16x8.not(mask), b), max, + var bneg = SIMD.Int16x8.lessThan(b, SIMD.Int16x8.splat(0)); + return SIMD.Int16x8.select(SIMD.Bool16x8.and(mask, SIMD.Bool16x8.not(bneg)), min, + SIMD.Int16x8.select(SIMD.Bool16x8.and(SIMD.Bool16x8.not(mask), bneg), max, c)); } } if (typeof SIMD.Int16x8.select === "undefined") { /** - * @param {Int16x8} t Selector mask. An instance of Int16x8 + * @param {Bool16x8} t Selector mask. An instance of Bool16x8 * @param {Int16x8} trueValue Pick lane from here if corresponding * selector lane is true * @param {Int16x8} falseValue Pick lane from here if corresponding @@ -3919,32 +4375,32 @@ if (typeof SIMD.Int16x8.select === "undefined") { * indicated */ SIMD.Int16x8.select = function(t, trueValue, falseValue) { - t = SIMD.Int16x8.check(t); + t = SIMD.Bool16x8.check(t); trueValue = SIMD.Int16x8.check(trueValue); falseValue = SIMD.Int16x8.check(falseValue); return SIMD.Int16x8( - SIMD.Int16x8.extractLaneAsBool(t, 0) ? + SIMD.Bool16x8.extractLane(t, 0) ? SIMD.Int16x8.extractLane(trueValue, 0) : SIMD.Int16x8.extractLane(falseValue, 0), - SIMD.Int16x8.extractLaneAsBool(t, 1) ? + SIMD.Bool16x8.extractLane(t, 1) ? SIMD.Int16x8.extractLane(trueValue, 1) : SIMD.Int16x8.extractLane(falseValue, 1), - SIMD.Int16x8.extractLaneAsBool(t, 2) ? + SIMD.Bool16x8.extractLane(t, 2) ? SIMD.Int16x8.extractLane(trueValue, 2) : SIMD.Int16x8.extractLane(falseValue, 2), - SIMD.Int16x8.extractLaneAsBool(t, 3) ? + SIMD.Bool16x8.extractLane(t, 3) ? SIMD.Int16x8.extractLane(trueValue, 3) : SIMD.Int16x8.extractLane(falseValue, 3), - SIMD.Int16x8.extractLaneAsBool(t, 4) ? + SIMD.Bool16x8.extractLane(t, 4) ? SIMD.Int16x8.extractLane(trueValue, 4) : SIMD.Int16x8.extractLane(falseValue, 4), - SIMD.Int16x8.extractLaneAsBool(t, 5) ? + SIMD.Bool16x8.extractLane(t, 5) ? SIMD.Int16x8.extractLane(trueValue, 5) : SIMD.Int16x8.extractLane(falseValue, 5), - SIMD.Int16x8.extractLaneAsBool(t, 6) ? + SIMD.Bool16x8.extractLane(t, 6) ? SIMD.Int16x8.extractLane(trueValue, 6) : SIMD.Int16x8.extractLane(falseValue, 6), - SIMD.Int16x8.extractLaneAsBool(t, 7) ? + SIMD.Bool16x8.extractLane(t, 7) ? SIMD.Int16x8.extractLane(trueValue, 7) : SIMD.Int16x8.extractLane(falseValue, 7)); } @@ -3953,11 +4409,11 @@ if (typeof SIMD.Int16x8.select === "undefined") { if (typeof SIMD.Int16x8.selectBits === "undefined") { /** * @param {Int16x8} t Selector mask. An instance of Int16x8 - * @param {Int16x8} trueValue Pick lane from here if corresponding + * @param {Int16x8} trueValue Pick bit from here if corresponding * selector bit is 1 - * @param {Int16x8} falseValue Pick lane from here if corresponding + * @param {Int16x8} falseValue Pick bit from here if corresponding * selector bit is 0 - * @return {Int16x8} Mix of lanes from trueValue or falseValue as + * @return {Int16x8} Mix of bits from trueValue or falseValue as * indicated */ SIMD.Int16x8.selectBits = function(t, trueValue, falseValue) { @@ -3974,7 +4430,7 @@ if (typeof SIMD.Int16x8.equal === "undefined") { /** * @param {Int16x8} t An instance of Int16x8. * @param {Int16x8} other An instance of Int16x8. - * @return {Int16x8} true or false in each lane depending on + * @return {Bool16x8} true or false in each lane depending on * the result of t == other. */ SIMD.Int16x8.equal = function(t, other) { @@ -3996,7 +4452,7 @@ if (typeof SIMD.Int16x8.equal === "undefined") { SIMD.Int16x8.extractLane(t, 6) == SIMD.Int16x8.extractLane(other, 6); var cs7 = SIMD.Int16x8.extractLane(t, 7) == SIMD.Int16x8.extractLane(other, 7); - return SIMD.Int16x8.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); + return SIMD.Bool16x8(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); } } @@ -4004,7 +4460,7 @@ if (typeof SIMD.Int16x8.notEqual === "undefined") { /** * @param {Int16x8} t An instance of Int16x8. * @param {Int16x8} other An instance of Int16x8. - * @return {Int16x8} true or false in each lane depending on + * @return {Bool16x8} true or false in each lane depending on * the result of t != other. */ SIMD.Int16x8.notEqual = function(t, other) { @@ -4026,7 +4482,7 @@ if (typeof SIMD.Int16x8.notEqual === "undefined") { SIMD.Int16x8.extractLane(t, 6) != SIMD.Int16x8.extractLane(other, 6); var cs7 = SIMD.Int16x8.extractLane(t, 7) != SIMD.Int16x8.extractLane(other, 7); - return SIMD.Int16x8.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); + return SIMD.Bool16x8(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); } } @@ -4034,7 +4490,7 @@ if (typeof SIMD.Int16x8.greaterThan === "undefined") { /** * @param {Int16x8} t An instance of Int16x8. * @param {Int16x8} other An instance of Int16x8. - * @return {Int16x8} true or false in each lane depending on + * @return {Bool16x8} true or false in each lane depending on * the result of t > other. */ SIMD.Int16x8.greaterThan = function(t, other) { @@ -4056,7 +4512,7 @@ if (typeof SIMD.Int16x8.greaterThan === "undefined") { SIMD.Int16x8.extractLane(t, 6) > SIMD.Int16x8.extractLane(other, 6); var cs7 = SIMD.Int16x8.extractLane(t, 7) > SIMD.Int16x8.extractLane(other, 7); - return SIMD.Int16x8.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); + return SIMD.Bool16x8(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); } } @@ -4064,7 +4520,7 @@ if (typeof SIMD.Int16x8.greaterThanOrEqual === "undefined") { /** * @param {Int16x8} t An instance of Int16x8. * @param {Int16x8} other An instance of Int16x8. - * @return {Int16x8} true or false in each lane depending on + * @return {Bool16x8} true or false in each lane depending on * the result of t >= other. */ SIMD.Int16x8.greaterThanOrEqual = function(t, other) { @@ -4086,7 +4542,7 @@ if (typeof SIMD.Int16x8.greaterThanOrEqual === "undefined") { SIMD.Int16x8.extractLane(t, 6) >= SIMD.Int16x8.extractLane(other, 6); var cs7 = SIMD.Int16x8.extractLane(t, 7) >= SIMD.Int16x8.extractLane(other, 7); - return SIMD.Int16x8.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); + return SIMD.Bool16x8(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); } } @@ -4094,7 +4550,7 @@ if (typeof SIMD.Int16x8.lessThan === "undefined") { /** * @param {Int16x8} t An instance of Int16x8. * @param {Int16x8} other An instance of Int16x8. - * @return {Int16x8} true or false in each lane depending on + * @return {Bool16x8} true or false in each lane depending on * the result of t < other. */ SIMD.Int16x8.lessThan = function(t, other) { @@ -4116,7 +4572,7 @@ if (typeof SIMD.Int16x8.lessThan === "undefined") { SIMD.Int16x8.extractLane(t, 6) < SIMD.Int16x8.extractLane(other, 6); var cs7 = SIMD.Int16x8.extractLane(t, 7) < SIMD.Int16x8.extractLane(other, 7); - return SIMD.Int16x8.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); + return SIMD.Bool16x8(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); } } @@ -4124,7 +4580,7 @@ if (typeof SIMD.Int16x8.lessThanOrEqual === "undefined") { /** * @param {Int16x8} t An instance of Int16x8. * @param {Int16x8} other An instance of Int16x8. - * @return {Int16x8} true or false in each lane depending on + * @return {Bool16x8} true or false in each lane depending on * the result of t <= other. */ SIMD.Int16x8.lessThanOrEqual = function(t, other) { @@ -4146,7 +4602,7 @@ if (typeof SIMD.Int16x8.lessThanOrEqual === "undefined") { SIMD.Int16x8.extractLane(t, 6) <= SIMD.Int16x8.extractLane(other, 6); var cs7 = SIMD.Int16x8.extractLane(t, 7) <= SIMD.Int16x8.extractLane(other, 7); - return SIMD.Int16x8.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); + return SIMD.Bool16x8(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7); } } @@ -4682,8 +5138,9 @@ if (typeof SIMD.Int8x16.addSaturate === "undefined") { var max = SIMD.Int8x16.splat(0x7f); var min = SIMD.Int8x16.splat(0x80); var mask = SIMD.Int8x16.lessThan(c, a); - return SIMD.Int8x16.select(SIMD.Int8x16.and(mask, SIMD.Int8x16.not(b)), max, - SIMD.Int8x16.select(SIMD.Int8x16.and(SIMD.Int8x16.not(mask), b), min, + var bneg = SIMD.Int8x16.lessThan(b, SIMD.Int8x16.splat(0)); + return SIMD.Int8x16.select(SIMD.Bool8x16.and(mask, SIMD.Bool8x16.not(bneg)), max, + SIMD.Int8x16.select(SIMD.Bool8x16.and(SIMD.Bool8x16.not(mask), bneg), min, c)); } } @@ -4702,8 +5159,9 @@ if (typeof SIMD.Int8x16.subSaturate === "undefined") { var max = SIMD.Int8x16.splat(0x7f); var min = SIMD.Int8x16.splat(0x80); var mask = SIMD.Int8x16.greaterThan(c, a); - return SIMD.Int8x16.select(SIMD.Int8x16.and(mask, SIMD.Int8x16.not(b)), min, - SIMD.Int8x16.select(SIMD.Int8x16.and(SIMD.Int8x16.not(mask), b), max, + var bneg = SIMD.Int8x16.lessThan(b, SIMD.Int8x16.splat(0)); + return SIMD.Int8x16.select(SIMD.Bool8x16.and(mask, SIMD.Bool8x16.not(bneg)), min, + SIMD.Int8x16.select(SIMD.Bool8x16.and(SIMD.Bool8x16.not(mask), bneg), max, c)); } } @@ -4755,7 +5213,7 @@ if (typeof SIMD.Int8x16.sumOfAbsoluteDifferences === "undefined") { if (typeof SIMD.Int8x16.select === "undefined") { /** - * @param {Int8x16} t Selector mask. An instance of Int8x16 + * @param {Bool8x16} t Selector mask. An instance of Bool8x16 * @param {Int8x16} trueValue Pick lane from here if corresponding * selector lane is true * @param {Int8x16} falseValue Pick lane from here if corresponding @@ -4764,56 +5222,56 @@ if (typeof SIMD.Int8x16.select === "undefined") { * indicated */ SIMD.Int8x16.select = function(t, trueValue, falseValue) { - t = SIMD.Int8x16.check(t); + t = SIMD.Bool8x16.check(t); trueValue = SIMD.Int8x16.check(trueValue); falseValue = SIMD.Int8x16.check(falseValue); return SIMD.Int8x16( - SIMD.Int8x16.extractLaneAsBool(t, 0) ? + SIMD.Bool8x16.extractLane(t, 0) ? SIMD.Int8x16.extractLane(trueValue, 0) : SIMD.Int8x16.extractLane(falseValue, 0), - SIMD.Int8x16.extractLaneAsBool(t, 1) ? + SIMD.Bool8x16.extractLane(t, 1) ? SIMD.Int8x16.extractLane(trueValue, 1) : SIMD.Int8x16.extractLane(falseValue, 1), - SIMD.Int8x16.extractLaneAsBool(t, 2) ? + SIMD.Bool8x16.extractLane(t, 2) ? SIMD.Int8x16.extractLane(trueValue, 2) : SIMD.Int8x16.extractLane(falseValue, 2), - SIMD.Int8x16.extractLaneAsBool(t, 3) ? + SIMD.Bool8x16.extractLane(t, 3) ? SIMD.Int8x16.extractLane(trueValue, 3) : SIMD.Int8x16.extractLane(falseValue, 3), - SIMD.Int8x16.extractLaneAsBool(t, 4) ? + SIMD.Bool8x16.extractLane(t, 4) ? SIMD.Int8x16.extractLane(trueValue, 4) : SIMD.Int8x16.extractLane(falseValue, 4), - SIMD.Int8x16.extractLaneAsBool(t, 5) ? + SIMD.Bool8x16.extractLane(t, 5) ? SIMD.Int8x16.extractLane(trueValue, 5) : SIMD.Int8x16.extractLane(falseValue, 5), - SIMD.Int8x16.extractLaneAsBool(t, 6) ? + SIMD.Bool8x16.extractLane(t, 6) ? SIMD.Int8x16.extractLane(trueValue, 6) : SIMD.Int8x16.extractLane(falseValue, 6), - SIMD.Int8x16.extractLaneAsBool(t, 7) ? + SIMD.Bool8x16.extractLane(t, 7) ? SIMD.Int8x16.extractLane(trueValue, 7) : SIMD.Int8x16.extractLane(falseValue, 7), - SIMD.Int8x16.extractLaneAsBool(t, 8) ? + SIMD.Bool8x16.extractLane(t, 8) ? SIMD.Int8x16.extractLane(trueValue, 8) : SIMD.Int8x16.extractLane(falseValue, 8), - SIMD.Int8x16.extractLaneAsBool(t, 9) ? + SIMD.Bool8x16.extractLane(t, 9) ? SIMD.Int8x16.extractLane(trueValue, 9) : SIMD.Int8x16.extractLane(falseValue, 9), - SIMD.Int8x16.extractLaneAsBool(t, 10) ? + SIMD.Bool8x16.extractLane(t, 10) ? SIMD.Int8x16.extractLane(trueValue, 10) : SIMD.Int8x16.extractLane(falseValue, 10), - SIMD.Int8x16.extractLaneAsBool(t, 11) ? + SIMD.Bool8x16.extractLane(t, 11) ? SIMD.Int8x16.extractLane(trueValue, 11) : SIMD.Int8x16.extractLane(falseValue, 11), - SIMD.Int8x16.extractLaneAsBool(t, 12) ? + SIMD.Bool8x16.extractLane(t, 12) ? SIMD.Int8x16.extractLane(trueValue, 12) : SIMD.Int8x16.extractLane(falseValue, 12), - SIMD.Int8x16.extractLaneAsBool(t, 13) ? + SIMD.Bool8x16.extractLane(t, 13) ? SIMD.Int8x16.extractLane(trueValue, 13) : SIMD.Int8x16.extractLane(falseValue, 13), - SIMD.Int8x16.extractLaneAsBool(t, 14) ? + SIMD.Bool8x16.extractLane(t, 14) ? SIMD.Int8x16.extractLane(trueValue, 14) : SIMD.Int8x16.extractLane(falseValue, 14), - SIMD.Int8x16.extractLaneAsBool(t, 15) ? + SIMD.Bool8x16.extractLane(t, 15) ? SIMD.Int8x16.extractLane(trueValue, 15) : SIMD.Int8x16.extractLane(falseValue, 15)); } @@ -4822,11 +5280,11 @@ if (typeof SIMD.Int8x16.select === "undefined") { if (typeof SIMD.Int8x16.selectBits === "undefined") { /** * @param {Int8x16} t Selector mask. An instance of Int8x16 - * @param {Int8x16} trueValue Pick lane from here if corresponding + * @param {Int8x16} trueValue Pick bit from here if corresponding * selector bit is 1 - * @param {Int8x16} falseValue Pick lane from here if corresponding + * @param {Int8x16} falseValue Pick bit from here if corresponding * selector bit is 0 - * @return {Int8x16} Mix of lanes from trueValue or falseValue as + * @return {Int8x16} Mix of bits from trueValue or falseValue as * indicated */ SIMD.Int8x16.selectBits = function(t, trueValue, falseValue) { @@ -4843,7 +5301,7 @@ if (typeof SIMD.Int8x16.equal === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. * @param {Int8x16} other An instance of Int8x16. - * @return {Int8x16} true or false in each lane depending on + * @return {Bool8x16} true or false in each lane depending on * the result of t == other. */ SIMD.Int8x16.equal = function(t, other) { @@ -4881,8 +5339,8 @@ if (typeof SIMD.Int8x16.equal === "undefined") { SIMD.Int8x16.extractLane(t, 14) == SIMD.Int8x16.extractLane(other, 14); var cs15 = SIMD.Int8x16.extractLane(t, 15) == SIMD.Int8x16.extractLane(other, 15); - return SIMD.Int8x16.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, - cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); + return SIMD.Bool8x16(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, + cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); } } @@ -4890,7 +5348,7 @@ if (typeof SIMD.Int8x16.notEqual === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. * @param {Int8x16} other An instance of Int8x16. - * @return {Int8x16} true or false in each lane depending on + * @return {Bool8x16} true or false in each lane depending on * the result of t != other. */ SIMD.Int8x16.notEqual = function(t, other) { @@ -4928,8 +5386,8 @@ if (typeof SIMD.Int8x16.notEqual === "undefined") { SIMD.Int8x16.extractLane(t, 14) != SIMD.Int8x16.extractLane(other, 14); var cs15 = SIMD.Int8x16.extractLane(t, 15) != SIMD.Int8x16.extractLane(other, 15); - return SIMD.Int8x16.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, - cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); + return SIMD.Bool8x16(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, + cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); } } @@ -4937,7 +5395,7 @@ if (typeof SIMD.Int8x16.greaterThan === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. * @param {Int8x16} other An instance of Int8x16. - * @return {Int8x16} true or false in each lane depending on + * @return {Bool8x16} true or false in each lane depending on * the result of t > other. */ SIMD.Int8x16.greaterThan = function(t, other) { @@ -4975,8 +5433,8 @@ if (typeof SIMD.Int8x16.greaterThan === "undefined") { SIMD.Int8x16.extractLane(t, 14) > SIMD.Int8x16.extractLane(other, 14); var cs15 = SIMD.Int8x16.extractLane(t, 15) > SIMD.Int8x16.extractLane(other, 15); - return SIMD.Int8x16.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, - cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); + return SIMD.Bool8x16(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, + cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); } } @@ -4984,7 +5442,7 @@ if (typeof SIMD.Int8x16.greaterThanOrEqual === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. * @param {Int8x16} other An instance of Int8x16. - * @return {Int8x16} true or false in each lane depending on + * @return {Bool8x16} true or false in each lane depending on * the result of t >= other. */ SIMD.Int8x16.greaterThanOrEqual = function(t, other) { @@ -5022,8 +5480,8 @@ if (typeof SIMD.Int8x16.greaterThanOrEqual === "undefined") { SIMD.Int8x16.extractLane(t, 14) >= SIMD.Int8x16.extractLane(other, 14); var cs15 = SIMD.Int8x16.extractLane(t, 15) >= SIMD.Int8x16.extractLane(other, 15); - return SIMD.Int8x16.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, - cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); + return SIMD.Bool8x16(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, + cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); } } @@ -5031,7 +5489,7 @@ if (typeof SIMD.Int8x16.lessThan === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. * @param {Int8x16} other An instance of Int8x16. - * @return {Int8x16} true or false in each lane depending on + * @return {Bool8x16} true or false in each lane depending on * the result of t < other. */ SIMD.Int8x16.lessThan = function(t, other) { @@ -5069,8 +5527,8 @@ if (typeof SIMD.Int8x16.lessThan === "undefined") { SIMD.Int8x16.extractLane(t, 14) < SIMD.Int8x16.extractLane(other, 14); var cs15 = SIMD.Int8x16.extractLane(t, 15) < SIMD.Int8x16.extractLane(other, 15); - return SIMD.Int8x16.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, - cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); + return SIMD.Bool8x16(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, + cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); } } @@ -5078,7 +5536,7 @@ if (typeof SIMD.Int8x16.lessThanOrEqual === "undefined") { /** * @param {Int8x16} t An instance of Int8x16. * @param {Int8x16} other An instance of Int8x16. - * @return {Int8x16} true or false in each lane depending on + * @return {Bool8x16} true or false in each lane depending on * the result of t <= other. */ SIMD.Int8x16.lessThanOrEqual = function(t, other) { @@ -5116,8 +5574,8 @@ if (typeof SIMD.Int8x16.lessThanOrEqual === "undefined") { SIMD.Int8x16.extractLane(t, 14) <= SIMD.Int8x16.extractLane(other, 14); var cs15 = SIMD.Int8x16.extractLane(t, 15) <= SIMD.Int8x16.extractLane(other, 15); - return SIMD.Int8x16.bool(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, - cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); + return SIMD.Bool8x16(cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, + cs8, cs9, cs10, cs11, cs12, cs13, cs14, cs15); } } diff --git a/src/ecmascript_simd_tests.js b/src/ecmascript_simd_tests.js index 460d600..f8565ca 100644 --- a/src/ecmascript_simd_tests.js +++ b/src/ecmascript_simd_tests.js @@ -34,10 +34,6 @@ function isNaN(x) { ok(x != x); } -function toBool(x) { - return x < 0; -} - test('Float32x4 operators', function() { // Not possible to implement properly in polyfill: // ==, ===, !=, !== @@ -208,6 +204,1007 @@ test('Int16x8 operators', function() { equal(SIMD.Int16x8(0, 1, 2, 3, 4, 5, 6, 7) ? 1 : 2, 1); }); +test('bool64x2 constructor', function() { + equal('function', typeof SIMD.Bool64x2); + var m = SIMD.Bool64x2(false, true); + equal(false, SIMD.Bool64x2.extractLane(m, 0)); + equal(true, SIMD.Bool64x2.extractLane(m, 1)); + + throws(function() { SIMD.Bool32x4.check(m); }); + throws(function() { SIMD.Bool16x8.check(m); }); + throws(function() { SIMD.Bool8x16.check(m); }); +}); + +test('bool64x2 splat constructor', function() { + equal('function', typeof SIMD.Bool64x2.splat); + var m = SIMD.Bool64x2.splat(true); + equal(true, SIMD.Bool64x2.extractLane(m, 0)); + equal(true, SIMD.Bool64x2.extractLane(m, 1)); + m = SIMD.Bool64x2.splat(false); + equal(false, SIMD.Bool64x2.extractLane(m, 0)); + equal(false, SIMD.Bool64x2.extractLane(m, 1)); +}); + +test('bool64x2 scalar getters', function() { + var m = SIMD.Bool64x2(true, false); + equal(true, SIMD.Bool64x2.extractLane(m, 0)); + equal(false, SIMD.Bool64x2.extractLane(m, 1)); +}); + +test('bool64x2 replaceLane', function() { + var a = SIMD.Bool64x2(false, false); + var c = SIMD.Bool64x2.replaceLane(a, 0, true); + equal(true, SIMD.Bool64x2.extractLane(c, 0)); + equal(false, SIMD.Bool64x2.extractLane(c, 1)); + c = SIMD.Bool64x2.replaceLane(c, 1, true); + equal(true, SIMD.Bool64x2.extractLane(c, 0)); + equal(true, SIMD.Bool64x2.extractLane(c, 1)); + c = SIMD.Bool64x2.replaceLane(c, 0, false); + equal(false, SIMD.Bool64x2.extractLane(c, 0)); + equal(true, SIMD.Bool64x2.extractLane(c, 1)); + + function testIndexCheck(index) { + throws(function() { SIMD.Bool64x2.replaceLane(a, index, false); }); + } + testIndexCheck(13.37); + testIndexCheck(null); + testIndexCheck(undefined); + testIndexCheck({}); + testIndexCheck(true); + testIndexCheck('yo'); + testIndexCheck(-1); + testIndexCheck(2); +}); + +test('bool64x2 allTrue', function () { + var v00 = SIMD.Bool64x2(false, false); + var v01 = SIMD.Bool64x2(false, true); + var v10 = SIMD.Bool64x2(true, false); + var v11 = SIMD.Bool64x2(true, true); + equal(SIMD.Bool64x2.allTrue(v00), false); + equal(SIMD.Bool64x2.allTrue(v01), false); + equal(SIMD.Bool64x2.allTrue(v10), false); + equal(SIMD.Bool64x2.allTrue(v11), true); +}); + +test('bool64x2 anyTrue', function () { + var v00 = SIMD.Bool64x2(false, false); + var v01 = SIMD.Bool64x2(false, true); + var v10 = SIMD.Bool64x2(true, false); + var v11 = SIMD.Bool64x2(true, true); + equal(SIMD.Bool64x2.anyTrue(v00), false); + equal(SIMD.Bool64x2.anyTrue(v01), true); + equal(SIMD.Bool64x2.anyTrue(v10), true); + equal(SIMD.Bool64x2.anyTrue(v11), true); +}); + +test('bool64x2 and', function() { + var m = SIMD.Bool64x2(true, true); + var n = SIMD.Bool64x2(true, false); + var o = SIMD.Bool64x2.and(m,n); + equal(true, SIMD.Bool64x2.extractLane(o, 0)); + equal(false, SIMD.Bool64x2.extractLane(o, 1)); + m = SIMD.Bool64x2(false, false); + n = SIMD.Bool64x2(true, false); + o = SIMD.Bool64x2.and(m,n); + equal(false, SIMD.Bool64x2.extractLane(o, 0)); + equal(false, SIMD.Bool64x2.extractLane(o, 1)); +}); + +test('bool64x2 or', function() { + var m = SIMD.Bool64x2(true, true); + var n = SIMD.Bool64x2(true, false); + var o = SIMD.Bool64x2.or(m,n); + equal(true, SIMD.Bool64x2.extractLane(o, 0)); + equal(true, SIMD.Bool64x2.extractLane(o, 1)); + m = SIMD.Bool64x2(false, false); + n = SIMD.Bool64x2(true, false); + o = SIMD.Bool64x2.or(m,n); + equal(true, SIMD.Bool64x2.extractLane(o, 0)); + equal(false, SIMD.Bool64x2.extractLane(o, 1)); +}); + +test('bool64x2 xor', function() { + var m = SIMD.Bool64x2(true, true); + var n = SIMD.Bool64x2(true, false); + var o = SIMD.Bool64x2.xor(m,n); + equal(false, SIMD.Bool64x2.extractLane(o, 0)); + equal(true, SIMD.Bool64x2.extractLane(o, 1)); + m = SIMD.Bool64x2(false, false); + n = SIMD.Bool64x2(true, false); + o = SIMD.Bool64x2.xor(m,n); + equal(true, SIMD.Bool64x2.extractLane(o, 0)); + equal(false, SIMD.Bool64x2.extractLane(o, 1)); +}); + +test('bool64x2 not', function() { + var m = SIMD.Bool64x2(true, false); + var o = SIMD.Bool64x2.not(m); + equal(false, SIMD.Bool64x2.extractLane(o, 0)); + equal(true, SIMD.Bool64x2.extractLane(o, 1)); +}); + +test('bool64x2 comparisons', function() { + var m = SIMD.Bool64x2(true, true); + var n = SIMD.Bool64x2(false, true); + var cmp; + + cmp = SIMD.Bool64x2.equal(m, n); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); + + cmp = SIMD.Bool64x2.notEqual(m, n); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); +}); + +test('bool64x2 select', function() { + var m = SIMD.Bool64x2(true, false); + var t = SIMD.Bool64x2(true, true); + var f = SIMD.Bool64x2(false, false); + var s = SIMD.Bool64x2.select(m, t, f); + equal(true, SIMD.Bool64x2.extractLane(s, 0)); + equal(false, SIMD.Bool64x2.extractLane(s, 1)); +}); + +test('Bool32x4 constructor', function() { + equal('function', typeof SIMD.Bool32x4); + var m = SIMD.Bool32x4(false, true, true, false); + equal(false, SIMD.Bool32x4.extractLane(m, 0)); + equal(true, SIMD.Bool32x4.extractLane(m, 1)); + equal(true, SIMD.Bool32x4.extractLane(m, 2)); + equal(false, SIMD.Bool32x4.extractLane(m, 3)); + + throws(function() { SIMD.Bool64x2.check(m); }); + throws(function() { SIMD.Bool16x8.check(m); }); + throws(function() { SIMD.Bool8x16.check(m); }); +}); + +test('Bool32x4 splat constructor', function() { + equal('function', typeof SIMD.Bool32x4.splat); + var m = SIMD.Bool32x4.splat(true); + equal(true, SIMD.Bool32x4.extractLane(m, 0)); + equal(true, SIMD.Bool32x4.extractLane(m, 1)); + equal(true, SIMD.Bool32x4.extractLane(m, 2)); + equal(true, SIMD.Bool32x4.extractLane(m, 3)); + m = SIMD.Bool32x4.splat(false); + equal(false, SIMD.Bool32x4.extractLane(m, 0)); + equal(false, SIMD.Bool32x4.extractLane(m, 1)); + equal(false, SIMD.Bool32x4.extractLane(m, 2)); + equal(false, SIMD.Bool32x4.extractLane(m, 3)); +}); + +test('Bool32x4 scalar getters', function() { + var m = SIMD.Bool32x4(true, false, true, false); + equal(true, SIMD.Bool32x4.extractLane(m, 0)); + equal(false, SIMD.Bool32x4.extractLane(m, 1)); + equal(true, SIMD.Bool32x4.extractLane(m, 2)); + equal(false, SIMD.Bool32x4.extractLane(m, 3)); +}); + +test('Bool32x4 replaceLane', function() { + var a = SIMD.Bool32x4(false, false, false, false); + var c = SIMD.Bool32x4.replaceLane(a, 0, true); + equal(true, SIMD.Bool32x4.extractLane(c, 0)); + equal(false, SIMD.Bool32x4.extractLane(c, 1)); + equal(false, SIMD.Bool32x4.extractLane(c, 2)); + equal(false, SIMD.Bool32x4.extractLane(c, 3)); + c = SIMD.Bool32x4.replaceLane(c, 3, true); + equal(true, SIMD.Bool32x4.extractLane(c, 0)); + equal(false, SIMD.Bool32x4.extractLane(c, 1)); + equal(false, SIMD.Bool32x4.extractLane(c, 2)); + equal(true, SIMD.Bool32x4.extractLane(c, 3)); + c = SIMD.Bool32x4.replaceLane(c, 0, false); + equal(false, SIMD.Bool32x4.extractLane(c, 0)); + equal(false, SIMD.Bool32x4.extractLane(c, 1)); + equal(false, SIMD.Bool32x4.extractLane(c, 2)); + equal(true, SIMD.Bool32x4.extractLane(c, 3)); + + function testIndexCheck(index) { + throws(function() { SIMD.Bool32x4.replaceLane(a, index, false); }); + } + testIndexCheck(13.37); + testIndexCheck(null); + testIndexCheck(undefined); + testIndexCheck({}); + testIndexCheck(true); + testIndexCheck('yo'); + testIndexCheck(-1); + testIndexCheck(4); +}); + +test('Bool32x4 allTrue', function () { + var v00 = SIMD.Bool32x4(false, false, false, false); + var v01 = SIMD.Bool32x4(false, true, false, false); + var v10 = SIMD.Bool32x4(false, false, false, true); + var v11 = SIMD.Bool32x4(true, true, true, true); + equal(SIMD.Bool32x4.allTrue(v00), false); + equal(SIMD.Bool32x4.allTrue(v01), false); + equal(SIMD.Bool32x4.allTrue(v10), false); + equal(SIMD.Bool32x4.allTrue(v11), true); +}); + +test('Bool32x4 anyTrue', function () { + var v00 = SIMD.Bool32x4(false, false, false, false); + var v01 = SIMD.Bool32x4(false, true, false, false); + var v10 = SIMD.Bool32x4(false, false, false, true); + var v11 = SIMD.Bool32x4(true, true, true, true); + equal(SIMD.Bool32x4.anyTrue(v00), false); + equal(SIMD.Bool32x4.anyTrue(v01), true); + equal(SIMD.Bool32x4.anyTrue(v10), true); + equal(SIMD.Bool32x4.anyTrue(v11), true); +}); + +test('Bool32x4 and', function() { + var m = SIMD.Bool32x4(true, true, true, false); + var n = SIMD.Bool32x4(true, false, true, false); + var o = SIMD.Bool32x4.and(m,n); + equal(true, SIMD.Bool32x4.extractLane(o, 0)); + equal(false, SIMD.Bool32x4.extractLane(o, 1)); + equal(true, SIMD.Bool32x4.extractLane(o, 2)); + equal(false, SIMD.Bool32x4.extractLane(o, 3)); + m = SIMD.Bool32x4(false, false, false, true); + n = SIMD.Bool32x4(true, false, true, true); + o = SIMD.Bool32x4.and(m,n); + equal(false, SIMD.Bool32x4.extractLane(o, 0)); + equal(false, SIMD.Bool32x4.extractLane(o, 1)); + equal(false, SIMD.Bool32x4.extractLane(o, 2)); + equal(true, SIMD.Bool32x4.extractLane(o, 3)); +}); + +test('Bool32x4 or', function() { + var m = SIMD.Bool32x4(true, true, true, false); + var n = SIMD.Bool32x4(true, false, true, false); + var o = SIMD.Bool32x4.or(m,n); + equal(true, SIMD.Bool32x4.extractLane(o, 0)); + equal(true, SIMD.Bool32x4.extractLane(o, 1)); + equal(true, SIMD.Bool32x4.extractLane(o, 2)); + equal(false, SIMD.Bool32x4.extractLane(o, 3)); + m = SIMD.Bool32x4(false, false, false, true); + n = SIMD.Bool32x4(true, false, true, true); + o = SIMD.Bool32x4.or(m,n); + equal(true, SIMD.Bool32x4.extractLane(o, 0)); + equal(false, SIMD.Bool32x4.extractLane(o, 1)); + equal(true, SIMD.Bool32x4.extractLane(o, 2)); + equal(true, SIMD.Bool32x4.extractLane(o, 3)); +}); + +test('Bool32x4 xor', function() { + var m = SIMD.Bool32x4(true, true, true, false); + var n = SIMD.Bool32x4(true, false, true, false); + var o = SIMD.Bool32x4.xor(m,n); + equal(false, SIMD.Bool32x4.extractLane(o, 0)); + equal(true, SIMD.Bool32x4.extractLane(o, 1)); + equal(false, SIMD.Bool32x4.extractLane(o, 2)); + equal(false, SIMD.Bool32x4.extractLane(o, 3)); + m = SIMD.Bool32x4(false, false, false, true); + n = SIMD.Bool32x4(true, false, true, true); + o = SIMD.Bool32x4.xor(m,n); + equal(true, SIMD.Bool32x4.extractLane(o, 0)); + equal(false, SIMD.Bool32x4.extractLane(o, 1)); + equal(true, SIMD.Bool32x4.extractLane(o, 2)); + equal(false, SIMD.Bool32x4.extractLane(o, 3)); +}); + +test('Bool32x4 not', function() { + var m = SIMD.Bool32x4(true, false, true, false); + var o = SIMD.Bool32x4.not(m); + equal(false, SIMD.Bool32x4.extractLane(o, 0)); + equal(true, SIMD.Bool32x4.extractLane(o, 1)); + equal(false, SIMD.Bool32x4.extractLane(o, 2)); + equal(true, SIMD.Bool32x4.extractLane(o, 3)); +}); + +test('Bool32x4 comparisons', function() { + var m = SIMD.Bool32x4(true, true, false, false); + var n = SIMD.Bool32x4(false, true, false, true); + var cmp; + + cmp = SIMD.Bool32x4.equal(m, n); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); + + cmp = SIMD.Bool32x4.notEqual(m, n); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); +}); + +test('Bool32x4 select', function() { + var m = SIMD.Bool32x4(true, false, true, false); + var t = SIMD.Bool32x4(true, true, false, false); + var f = SIMD.Bool32x4(false, false, false, true); + var s = SIMD.Bool32x4.select(m, t, f); + equal(true, SIMD.Bool32x4.extractLane(s, 0)); + equal(false, SIMD.Bool32x4.extractLane(s, 1)); + equal(false, SIMD.Bool32x4.extractLane(s, 2)); + equal(true, SIMD.Bool32x4.extractLane(s, 3)); +}); + +test('Bool16x8 constructor', function() { + equal('function', typeof SIMD.Bool16x8); + var m = SIMD.Bool16x8(false, true, true, false, true, false, true, false); + equal(false, SIMD.Bool16x8.extractLane(m, 0)); + equal(true, SIMD.Bool16x8.extractLane(m, 1)); + equal(true, SIMD.Bool16x8.extractLane(m, 2)); + equal(false, SIMD.Bool16x8.extractLane(m, 3)); + equal(true, SIMD.Bool16x8.extractLane(m, 4)); + equal(false, SIMD.Bool16x8.extractLane(m, 5)); + equal(true, SIMD.Bool16x8.extractLane(m, 6)); + equal(false, SIMD.Bool16x8.extractLane(m, 7)); + + throws(function() { SIMD.Bool64x2.check(m); }); + throws(function() { SIMD.Bool32x4.check(m); }); + throws(function() { SIMD.Bool8x16.check(m); }); +}); + +test('Bool16x8 splat constructor', function() { + equal('function', typeof SIMD.Bool16x8.splat); + var m = SIMD.Bool16x8.splat(true); + equal(true, SIMD.Bool16x8.extractLane(m, 0)); + equal(true, SIMD.Bool16x8.extractLane(m, 1)); + equal(true, SIMD.Bool16x8.extractLane(m, 2)); + equal(true, SIMD.Bool16x8.extractLane(m, 3)); + equal(true, SIMD.Bool16x8.extractLane(m, 4)); + equal(true, SIMD.Bool16x8.extractLane(m, 5)); + equal(true, SIMD.Bool16x8.extractLane(m, 6)); + equal(true, SIMD.Bool16x8.extractLane(m, 7)); + m = SIMD.Bool16x8.splat(false); + equal(false, SIMD.Bool16x8.extractLane(m, 0)); + equal(false, SIMD.Bool16x8.extractLane(m, 1)); + equal(false, SIMD.Bool16x8.extractLane(m, 2)); + equal(false, SIMD.Bool16x8.extractLane(m, 3)); + equal(false, SIMD.Bool16x8.extractLane(m, 4)); + equal(false, SIMD.Bool16x8.extractLane(m, 5)); + equal(false, SIMD.Bool16x8.extractLane(m, 6)); + equal(false, SIMD.Bool16x8.extractLane(m, 7)); +}); + +test('Bool16x8 scalar getters', function() { + var m = SIMD.Bool16x8(true, false, true, false, true, true, false, false); + equal(true, SIMD.Bool16x8.extractLane(m, 0)); + equal(false, SIMD.Bool16x8.extractLane(m, 1)); + equal(true, SIMD.Bool16x8.extractLane(m, 2)); + equal(false, SIMD.Bool16x8.extractLane(m, 3)); + equal(true, SIMD.Bool16x8.extractLane(m, 4)); + equal(true, SIMD.Bool16x8.extractLane(m, 5)); + equal(false, SIMD.Bool16x8.extractLane(m, 6)); + equal(false, SIMD.Bool16x8.extractLane(m, 7)); +}); + +test('Bool16x8 replaceLane', function() { + var a = SIMD.Bool16x8(false, false, false, false, false, false, false, false); + var c = SIMD.Bool16x8.replaceLane(a, 0, true); + equal(true, SIMD.Bool16x8.extractLane(c, 0)); + equal(false, SIMD.Bool16x8.extractLane(c, 1)); + equal(false, SIMD.Bool16x8.extractLane(c, 2)); + equal(false, SIMD.Bool16x8.extractLane(c, 3)); + equal(false, SIMD.Bool16x8.extractLane(c, 4)); + equal(false, SIMD.Bool16x8.extractLane(c, 5)); + equal(false, SIMD.Bool16x8.extractLane(c, 6)); + equal(false, SIMD.Bool16x8.extractLane(c, 7)); + c = SIMD.Bool16x8.replaceLane(c, 3, true); + equal(true, SIMD.Bool16x8.extractLane(c, 0)); + equal(false, SIMD.Bool16x8.extractLane(c, 1)); + equal(false, SIMD.Bool16x8.extractLane(c, 2)); + equal(true, SIMD.Bool16x8.extractLane(c, 3)); + equal(false, SIMD.Bool16x8.extractLane(c, 4)); + equal(false, SIMD.Bool16x8.extractLane(c, 5)); + equal(false, SIMD.Bool16x8.extractLane(c, 6)); + equal(false, SIMD.Bool16x8.extractLane(c, 7)); + c = SIMD.Bool16x8.replaceLane(c, 6, true); + equal(true, SIMD.Bool16x8.extractLane(c, 0)); + equal(false, SIMD.Bool16x8.extractLane(c, 1)); + equal(false, SIMD.Bool16x8.extractLane(c, 2)); + equal(true, SIMD.Bool16x8.extractLane(c, 3)); + equal(false, SIMD.Bool16x8.extractLane(c, 4)); + equal(false, SIMD.Bool16x8.extractLane(c, 5)); + equal(true, SIMD.Bool16x8.extractLane(c, 6)); + equal(false, SIMD.Bool16x8.extractLane(c, 7)); + c = SIMD.Bool16x8.replaceLane(c, 0, false); + equal(false, SIMD.Bool16x8.extractLane(c, 0)); + equal(false, SIMD.Bool16x8.extractLane(c, 1)); + equal(false, SIMD.Bool16x8.extractLane(c, 2)); + equal(true, SIMD.Bool16x8.extractLane(c, 3)); + equal(false, SIMD.Bool16x8.extractLane(c, 4)); + equal(false, SIMD.Bool16x8.extractLane(c, 5)); + equal(true, SIMD.Bool16x8.extractLane(c, 6)); + equal(false, SIMD.Bool16x8.extractLane(c, 7)); + + function testIndexCheck(index) { + throws(function() { SIMD.Bool16x8.replaceLane(a, index, false); }); + } + testIndexCheck(13.37); + testIndexCheck(null); + testIndexCheck(undefined); + testIndexCheck({}); + testIndexCheck(true); + testIndexCheck('yo'); + testIndexCheck(-1); + testIndexCheck(8); +}); + +test('Bool16x8 allTrue', function () { + var v00 = SIMD.Bool16x8(false, false, false, false, false, false, false, false); + var v01 = SIMD.Bool16x8(false, true, false, false, true, true, true, true); + var v10 = SIMD.Bool16x8(false, false, false, true, true, true, true, true); + var v11 = SIMD.Bool16x8(true, true, true, true, true, true, true, true); + equal(SIMD.Bool16x8.allTrue(v00), false); + equal(SIMD.Bool16x8.allTrue(v01), false); + equal(SIMD.Bool16x8.allTrue(v10), false); + equal(SIMD.Bool16x8.allTrue(v11), true); +}); + +test('Bool16x8 anyTrue', function () { + var v00 = SIMD.Bool16x8(false, false, false, false, false, false, false, false); + var v01 = SIMD.Bool16x8(false, true, false, false, false, false, false, false); + var v10 = SIMD.Bool16x8(false, false, false, false, false, false, false, true); + var v11 = SIMD.Bool16x8(true, true, true, true, true, true, true, true); + equal(SIMD.Bool16x8.anyTrue(v00), false); + equal(SIMD.Bool16x8.anyTrue(v01), true); + equal(SIMD.Bool16x8.anyTrue(v10), true); + equal(SIMD.Bool16x8.anyTrue(v11), true); +}); + +test('Bool16x8 and', function() { + var m = SIMD.Bool16x8(true, true, true, true, false, false, false, false); + var n = SIMD.Bool16x8(true, false, true, false, true, true, false, false); + var o = SIMD.Bool16x8.and(m,n); + equal(true, SIMD.Bool16x8.extractLane(o, 0)); + equal(false, SIMD.Bool16x8.extractLane(o, 1)); + equal(true, SIMD.Bool16x8.extractLane(o, 2)); + equal(false, SIMD.Bool16x8.extractLane(o, 3)); + equal(false, SIMD.Bool16x8.extractLane(o, 4)); + equal(false, SIMD.Bool16x8.extractLane(o, 5)); + equal(false, SIMD.Bool16x8.extractLane(o, 6)); + equal(false, SIMD.Bool16x8.extractLane(o, 7)); + m = SIMD.Bool16x8(false, false, false, true, true, true, true, false); + n = SIMD.Bool16x8(true, false, true, true, false, true, false, false); + o = SIMD.Bool16x8.and(m,n); + equal(false, SIMD.Bool16x8.extractLane(o, 0)); + equal(false, SIMD.Bool16x8.extractLane(o, 1)); + equal(false, SIMD.Bool16x8.extractLane(o, 2)); + equal(true, SIMD.Bool16x8.extractLane(o, 3)); + equal(false, SIMD.Bool16x8.extractLane(o, 4)); + equal(true, SIMD.Bool16x8.extractLane(o, 5)); + equal(false, SIMD.Bool16x8.extractLane(o, 6)); + equal(false, SIMD.Bool16x8.extractLane(o, 7)); +}); + +test('Bool16x8 or', function() { + var m = SIMD.Bool16x8(true, true, true, true, false, false, false, false); + var n = SIMD.Bool16x8(true, false, true, false, true, true, false, false); + var o = SIMD.Bool16x8.or(m,n); + equal(true, SIMD.Bool16x8.extractLane(o, 0)); + equal(true, SIMD.Bool16x8.extractLane(o, 1)); + equal(true, SIMD.Bool16x8.extractLane(o, 2)); + equal(true, SIMD.Bool16x8.extractLane(o, 3)); + equal(true, SIMD.Bool16x8.extractLane(o, 4)); + equal(true, SIMD.Bool16x8.extractLane(o, 5)); + equal(false, SIMD.Bool16x8.extractLane(o, 6)); + equal(false, SIMD.Bool16x8.extractLane(o, 7)); + m = SIMD.Bool16x8(false, false, false, true, true, true, true, false); + n = SIMD.Bool16x8(true, false, true, true, false, true, false, false); + o = SIMD.Bool16x8.or(m,n); + equal(true, SIMD.Bool16x8.extractLane(o, 0)); + equal(false, SIMD.Bool16x8.extractLane(o, 1)); + equal(true, SIMD.Bool16x8.extractLane(o, 2)); + equal(true, SIMD.Bool16x8.extractLane(o, 3)); + equal(true, SIMD.Bool16x8.extractLane(o, 4)); + equal(true, SIMD.Bool16x8.extractLane(o, 5)); + equal(true, SIMD.Bool16x8.extractLane(o, 6)); + equal(false, SIMD.Bool16x8.extractLane(o, 7)); +}); + +test('Bool16x8 xor', function() { + var m = SIMD.Bool16x8(true, true, true, true, false, false, false, false); + var n = SIMD.Bool16x8(true, false, true, false, true, true, false, false); + var o = SIMD.Bool16x8.xor(m,n); + equal(false, SIMD.Bool16x8.extractLane(o, 0)); + equal(true, SIMD.Bool16x8.extractLane(o, 1)); + equal(false, SIMD.Bool16x8.extractLane(o, 2)); + equal(true, SIMD.Bool16x8.extractLane(o, 3)); + equal(true, SIMD.Bool16x8.extractLane(o, 4)); + equal(true, SIMD.Bool16x8.extractLane(o, 5)); + equal(false, SIMD.Bool16x8.extractLane(o, 6)); + equal(false, SIMD.Bool16x8.extractLane(o, 7)); + m = SIMD.Bool16x8(false, false, false, true, true, true, true, false); + n = SIMD.Bool16x8(true, false, true, true, false, true, false, false); + o = SIMD.Bool16x8.xor(m,n); + equal(true, SIMD.Bool16x8.extractLane(o, 0)); + equal(false, SIMD.Bool16x8.extractLane(o, 1)); + equal(true, SIMD.Bool16x8.extractLane(o, 2)); + equal(false, SIMD.Bool16x8.extractLane(o, 3)); + equal(true, SIMD.Bool16x8.extractLane(o, 4)); + equal(false, SIMD.Bool16x8.extractLane(o, 5)); + equal(true, SIMD.Bool16x8.extractLane(o, 6)); + equal(false, SIMD.Bool16x8.extractLane(o, 7)); +}); + +test('Bool16x8 not', function() { + var m = SIMD.Bool16x8(true, false, true, false, true, true, false, false); + var o = SIMD.Bool16x8.not(m); + equal(false, SIMD.Bool16x8.extractLane(o, 0)); + equal(true, SIMD.Bool16x8.extractLane(o, 1)); + equal(false, SIMD.Bool16x8.extractLane(o, 2)); + equal(true, SIMD.Bool16x8.extractLane(o, 3)); + equal(false, SIMD.Bool16x8.extractLane(o, 4)); + equal(false, SIMD.Bool16x8.extractLane(o, 5)); + equal(true, SIMD.Bool16x8.extractLane(o, 6)); + equal(true, SIMD.Bool16x8.extractLane(o, 7)); +}); + +test('Bool16x8 comparisons', function() { + var m = SIMD.Bool16x8(true, true, false, false, true, true, true, true); + var n = SIMD.Bool16x8(false, true, false, true, false, true, false, true); + var cmp; + + cmp = SIMD.Bool16x8.equal(m, n); + equal(false, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 7)); + + cmp = SIMD.Bool16x8.notEqual(m, n); + equal(true, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 7)); +}); + +test('Bool16x8 select', function() { + var m = SIMD.Bool16x8(true, false, true, false, true, false, true, false); + var t = SIMD.Bool16x8(true, true, false, false, true, true, false, false); + var f = SIMD.Bool16x8(false, false, false, true, true, true, true, false); + var s = SIMD.Bool16x8.select(m, t, f); + equal(true, SIMD.Bool16x8.extractLane(s, 0)); + equal(false, SIMD.Bool16x8.extractLane(s, 1)); + equal(false, SIMD.Bool16x8.extractLane(s, 2)); + equal(true, SIMD.Bool16x8.extractLane(s, 3)); + equal(true, SIMD.Bool16x8.extractLane(s, 4)); + equal(true, SIMD.Bool16x8.extractLane(s, 5)); + equal(false, SIMD.Bool16x8.extractLane(s, 6)); + equal(false, SIMD.Bool16x8.extractLane(s, 7)); +}); + +test('Bool8x16 constructor', function() { + equal('function', typeof SIMD.Bool8x16); + var m = SIMD.Bool8x16(false, true, true, false, true, false, true, false, + true, false, false, true, false, true, false, true); + equal(false, SIMD.Bool8x16.extractLane(m, 0)); + equal(true, SIMD.Bool8x16.extractLane(m, 1)); + equal(true, SIMD.Bool8x16.extractLane(m, 2)); + equal(false, SIMD.Bool8x16.extractLane(m, 3)); + equal(true, SIMD.Bool8x16.extractLane(m, 4)); + equal(false, SIMD.Bool8x16.extractLane(m, 5)); + equal(true, SIMD.Bool8x16.extractLane(m, 6)); + equal(false, SIMD.Bool8x16.extractLane(m, 7)); + equal(true, SIMD.Bool8x16.extractLane(m, 8)); + equal(false, SIMD.Bool8x16.extractLane(m, 9)); + equal(false, SIMD.Bool8x16.extractLane(m, 10)); + equal(true, SIMD.Bool8x16.extractLane(m, 11)); + equal(false, SIMD.Bool8x16.extractLane(m, 12)); + equal(true, SIMD.Bool8x16.extractLane(m, 13)); + equal(false, SIMD.Bool8x16.extractLane(m, 14)); + equal(true, SIMD.Bool8x16.extractLane(m, 15)); + + throws(function() { SIMD.Bool64x2.check(m); }); + throws(function() { SIMD.Bool32x4.check(m); }); + throws(function() { SIMD.Bool16x8.check(m); }); +}); + +test('Bool8x16 splat constructor', function() { + equal('function', typeof SIMD.Bool8x16.splat); + var m = SIMD.Bool8x16.splat(true); + equal(true, SIMD.Bool8x16.extractLane(m, 0)); + equal(true, SIMD.Bool8x16.extractLane(m, 1)); + equal(true, SIMD.Bool8x16.extractLane(m, 2)); + equal(true, SIMD.Bool8x16.extractLane(m, 3)); + equal(true, SIMD.Bool8x16.extractLane(m, 4)); + equal(true, SIMD.Bool8x16.extractLane(m, 5)); + equal(true, SIMD.Bool8x16.extractLane(m, 6)); + equal(true, SIMD.Bool8x16.extractLane(m, 7)); + equal(true, SIMD.Bool8x16.extractLane(m, 8)); + equal(true, SIMD.Bool8x16.extractLane(m, 9)); + equal(true, SIMD.Bool8x16.extractLane(m, 10)); + equal(true, SIMD.Bool8x16.extractLane(m, 11)); + equal(true, SIMD.Bool8x16.extractLane(m, 12)); + equal(true, SIMD.Bool8x16.extractLane(m, 13)); + equal(true, SIMD.Bool8x16.extractLane(m, 14)); + equal(true, SIMD.Bool8x16.extractLane(m, 15)); + m = SIMD.Bool8x16.splat(false); + equal(false, SIMD.Bool8x16.extractLane(m, 0)); + equal(false, SIMD.Bool8x16.extractLane(m, 1)); + equal(false, SIMD.Bool8x16.extractLane(m, 2)); + equal(false, SIMD.Bool8x16.extractLane(m, 3)); + equal(false, SIMD.Bool8x16.extractLane(m, 4)); + equal(false, SIMD.Bool8x16.extractLane(m, 5)); + equal(false, SIMD.Bool8x16.extractLane(m, 6)); + equal(false, SIMD.Bool8x16.extractLane(m, 7)); + equal(false, SIMD.Bool8x16.extractLane(m, 8)); + equal(false, SIMD.Bool8x16.extractLane(m, 9)); + equal(false, SIMD.Bool8x16.extractLane(m, 10)); + equal(false, SIMD.Bool8x16.extractLane(m, 11)); + equal(false, SIMD.Bool8x16.extractLane(m, 12)); + equal(false, SIMD.Bool8x16.extractLane(m, 13)); + equal(false, SIMD.Bool8x16.extractLane(m, 14)); + equal(false, SIMD.Bool8x16.extractLane(m, 15)); +}); + +test('Bool8x16 scalar getters', function() { + var m = SIMD.Bool8x16(true, false, true, false, true, true, false, false, + false, true, false, true, false, false, true, true); + equal(true, SIMD.Bool8x16.extractLane(m, 0)); + equal(false, SIMD.Bool8x16.extractLane(m, 1)); + equal(true, SIMD.Bool8x16.extractLane(m, 2)); + equal(false, SIMD.Bool8x16.extractLane(m, 3)); + equal(true, SIMD.Bool8x16.extractLane(m, 4)); + equal(true, SIMD.Bool8x16.extractLane(m, 5)); + equal(false, SIMD.Bool8x16.extractLane(m, 6)); + equal(false, SIMD.Bool8x16.extractLane(m, 7)); + equal(false, SIMD.Bool8x16.extractLane(m, 8)); + equal(true, SIMD.Bool8x16.extractLane(m, 9)); + equal(false, SIMD.Bool8x16.extractLane(m, 10)); + equal(true, SIMD.Bool8x16.extractLane(m, 11)); + equal(false, SIMD.Bool8x16.extractLane(m, 12)); + equal(false, SIMD.Bool8x16.extractLane(m, 13)); + equal(true, SIMD.Bool8x16.extractLane(m, 14)); + equal(true, SIMD.Bool8x16.extractLane(m, 15)); +}); + +test('Bool8x16 replaceLane', function() { + var a = SIMD.Bool8x16(false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false); + var c = SIMD.Bool8x16.replaceLane(a, 0, true); + equal(true, SIMD.Bool8x16.extractLane(c, 0)); + equal(false, SIMD.Bool8x16.extractLane(c, 1)); + equal(false, SIMD.Bool8x16.extractLane(c, 2)); + equal(false, SIMD.Bool8x16.extractLane(c, 3)); + equal(false, SIMD.Bool8x16.extractLane(c, 4)); + equal(false, SIMD.Bool8x16.extractLane(c, 5)); + equal(false, SIMD.Bool8x16.extractLane(c, 6)); + equal(false, SIMD.Bool8x16.extractLane(c, 7)); + equal(false, SIMD.Bool8x16.extractLane(c, 8)); + equal(false, SIMD.Bool8x16.extractLane(c, 9)); + equal(false, SIMD.Bool8x16.extractLane(c, 10)); + equal(false, SIMD.Bool8x16.extractLane(c, 11)); + equal(false, SIMD.Bool8x16.extractLane(c, 12)); + equal(false, SIMD.Bool8x16.extractLane(c, 13)); + equal(false, SIMD.Bool8x16.extractLane(c, 14)); + equal(false, SIMD.Bool8x16.extractLane(c, 15)); + c = SIMD.Bool8x16.replaceLane(c, 7, true); + equal(true, SIMD.Bool8x16.extractLane(c, 0)); + equal(false, SIMD.Bool8x16.extractLane(c, 1)); + equal(false, SIMD.Bool8x16.extractLane(c, 2)); + equal(false, SIMD.Bool8x16.extractLane(c, 3)); + equal(false, SIMD.Bool8x16.extractLane(c, 4)); + equal(false, SIMD.Bool8x16.extractLane(c, 5)); + equal(false, SIMD.Bool8x16.extractLane(c, 6)); + equal(true, SIMD.Bool8x16.extractLane(c, 7)); + equal(false, SIMD.Bool8x16.extractLane(c, 8)); + equal(false, SIMD.Bool8x16.extractLane(c, 9)); + equal(false, SIMD.Bool8x16.extractLane(c, 10)); + equal(false, SIMD.Bool8x16.extractLane(c, 11)); + equal(false, SIMD.Bool8x16.extractLane(c, 12)); + equal(false, SIMD.Bool8x16.extractLane(c, 13)); + equal(false, SIMD.Bool8x16.extractLane(c, 14)); + equal(false, SIMD.Bool8x16.extractLane(c, 15)); + c = SIMD.Bool8x16.replaceLane(c, 13, true); + equal(true, SIMD.Bool8x16.extractLane(c, 0)); + equal(false, SIMD.Bool8x16.extractLane(c, 1)); + equal(false, SIMD.Bool8x16.extractLane(c, 2)); + equal(false, SIMD.Bool8x16.extractLane(c, 3)); + equal(false, SIMD.Bool8x16.extractLane(c, 4)); + equal(false, SIMD.Bool8x16.extractLane(c, 5)); + equal(false, SIMD.Bool8x16.extractLane(c, 6)); + equal(true, SIMD.Bool8x16.extractLane(c, 7)); + equal(false, SIMD.Bool8x16.extractLane(c, 8)); + equal(false, SIMD.Bool8x16.extractLane(c, 9)); + equal(false, SIMD.Bool8x16.extractLane(c, 10)); + equal(false, SIMD.Bool8x16.extractLane(c, 11)); + equal(false, SIMD.Bool8x16.extractLane(c, 12)); + equal(true, SIMD.Bool8x16.extractLane(c, 13)); + equal(false, SIMD.Bool8x16.extractLane(c, 14)); + equal(false, SIMD.Bool8x16.extractLane(c, 15)); + c = SIMD.Bool8x16.replaceLane(c, 0, false); + equal(false, SIMD.Bool8x16.extractLane(c, 0)); + equal(false, SIMD.Bool8x16.extractLane(c, 1)); + equal(false, SIMD.Bool8x16.extractLane(c, 2)); + equal(false, SIMD.Bool8x16.extractLane(c, 3)); + equal(false, SIMD.Bool8x16.extractLane(c, 4)); + equal(false, SIMD.Bool8x16.extractLane(c, 5)); + equal(false, SIMD.Bool8x16.extractLane(c, 6)); + equal(true, SIMD.Bool8x16.extractLane(c, 7)); + equal(false, SIMD.Bool8x16.extractLane(c, 8)); + equal(false, SIMD.Bool8x16.extractLane(c, 9)); + equal(false, SIMD.Bool8x16.extractLane(c, 10)); + equal(false, SIMD.Bool8x16.extractLane(c, 11)); + equal(false, SIMD.Bool8x16.extractLane(c, 12)); + equal(true, SIMD.Bool8x16.extractLane(c, 13)); + equal(false, SIMD.Bool8x16.extractLane(c, 14)); + equal(false, SIMD.Bool8x16.extractLane(c, 15)); + + function testIndexCheck(index) { + throws(function() { SIMD.Bool8x16.replaceLane(a, index, false); }); + } + testIndexCheck(13.37); + testIndexCheck(null); + testIndexCheck(undefined); + testIndexCheck({}); + testIndexCheck(true); + testIndexCheck('yo'); + testIndexCheck(-1); + testIndexCheck(16); +}); + +test('Bool8x16 allTrue', function () { + var v00 = SIMD.Bool8x16(false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false); + var v01 = SIMD.Bool8x16(false, true, false, false, true, true, true, true, + false, true, false, false, true, true, true, true); + var v10 = SIMD.Bool8x16(false, false, false, true, true, true, true, true, + false, false, false, true, true, true, true, true); + var v11 = SIMD.Bool8x16(true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true); + equal(SIMD.Bool8x16.allTrue(v00), false); + equal(SIMD.Bool8x16.allTrue(v01), false); + equal(SIMD.Bool8x16.allTrue(v10), false); + equal(SIMD.Bool8x16.allTrue(v11), true); +}); + +test('Bool8x16 anyTrue', function () { + var v00 = SIMD.Bool8x16(false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false); + var v01 = SIMD.Bool8x16(false, true, false, false, true, true, true, true, + false, true, false, false, true, true, true, true); + var v10 = SIMD.Bool8x16(false, false, false, true, true, true, true, true, + false, false, false, true, true, true, true, true); + var v11 = SIMD.Bool8x16(true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true); + equal(SIMD.Bool8x16.anyTrue(v00), false); + equal(SIMD.Bool8x16.anyTrue(v01), true); + equal(SIMD.Bool8x16.anyTrue(v10), true); + equal(SIMD.Bool8x16.anyTrue(v11), true); +}); + +test('Bool8x16 and', function() { + var m = SIMD.Bool8x16(true, true, true, true, false, false, false, false, + true, true, true, true, false, false, false, false); + var n = SIMD.Bool8x16(true, false, true, false, true, true, false, false, + true, false, true, false, true, true, false, false); + var o = SIMD.Bool8x16.and(m,n); + equal(true, SIMD.Bool8x16.extractLane(o, 0)); + equal(false, SIMD.Bool8x16.extractLane(o, 1)); + equal(true, SIMD.Bool8x16.extractLane(o, 2)); + equal(false, SIMD.Bool8x16.extractLane(o, 3)); + equal(false, SIMD.Bool8x16.extractLane(o, 4)); + equal(false, SIMD.Bool8x16.extractLane(o, 5)); + equal(false, SIMD.Bool8x16.extractLane(o, 6)); + equal(false, SIMD.Bool8x16.extractLane(o, 7)); + equal(true, SIMD.Bool8x16.extractLane(o, 8)); + equal(false, SIMD.Bool8x16.extractLane(o, 9)); + equal(true, SIMD.Bool8x16.extractLane(o, 10)); + equal(false, SIMD.Bool8x16.extractLane(o, 11)); + equal(false, SIMD.Bool8x16.extractLane(o, 12)); + equal(false, SIMD.Bool8x16.extractLane(o, 13)); + equal(false, SIMD.Bool8x16.extractLane(o, 14)); + equal(false, SIMD.Bool8x16.extractLane(o, 15)); + m = SIMD.Bool8x16(false, false, false, true, true, true, true, false, + false, false, false, true, true, true, true, false); + n = SIMD.Bool8x16(true, false, true, true, false, true, false, false, + true, false, true, true, false, true, false, false); + o = SIMD.Bool8x16.and(m,n); + equal(false, SIMD.Bool8x16.extractLane(o, 0)); + equal(false, SIMD.Bool8x16.extractLane(o, 1)); + equal(false, SIMD.Bool8x16.extractLane(o, 2)); + equal(true, SIMD.Bool8x16.extractLane(o, 3)); + equal(false, SIMD.Bool8x16.extractLane(o, 4)); + equal(true, SIMD.Bool8x16.extractLane(o, 5)); + equal(false, SIMD.Bool8x16.extractLane(o, 6)); + equal(false, SIMD.Bool8x16.extractLane(o, 7)); + equal(false, SIMD.Bool8x16.extractLane(o, 8)); + equal(false, SIMD.Bool8x16.extractLane(o, 9)); + equal(false, SIMD.Bool8x16.extractLane(o, 10)); + equal(true, SIMD.Bool8x16.extractLane(o, 11)); + equal(false, SIMD.Bool8x16.extractLane(o, 12)); + equal(true, SIMD.Bool8x16.extractLane(o, 13)); + equal(false, SIMD.Bool8x16.extractLane(o, 14)); + equal(false, SIMD.Bool8x16.extractLane(o, 15)); +}); + +test('Bool8x16 or', function() { + var m = SIMD.Bool8x16(true, true, true, true, false, false, false, false, + true, true, true, true, false, false, false, false); + var n = SIMD.Bool8x16(true, false, true, false, true, true, false, false, + true, false, true, false, true, true, false, false); + var o = SIMD.Bool8x16.or(m,n); + equal(true, SIMD.Bool8x16.extractLane(o, 0)); + equal(true, SIMD.Bool8x16.extractLane(o, 1)); + equal(true, SIMD.Bool8x16.extractLane(o, 2)); + equal(true, SIMD.Bool8x16.extractLane(o, 3)); + equal(true, SIMD.Bool8x16.extractLane(o, 4)); + equal(true, SIMD.Bool8x16.extractLane(o, 5)); + equal(false, SIMD.Bool8x16.extractLane(o, 6)); + equal(false, SIMD.Bool8x16.extractLane(o, 7)); + equal(true, SIMD.Bool8x16.extractLane(o, 8)); + equal(true, SIMD.Bool8x16.extractLane(o, 9)); + equal(true, SIMD.Bool8x16.extractLane(o, 10)); + equal(true, SIMD.Bool8x16.extractLane(o, 11)); + equal(true, SIMD.Bool8x16.extractLane(o, 12)); + equal(true, SIMD.Bool8x16.extractLane(o, 13)); + equal(false, SIMD.Bool8x16.extractLane(o, 14)); + equal(false, SIMD.Bool8x16.extractLane(o, 15)); + m = SIMD.Bool8x16(false, false, false, true, true, true, true, false, + false, false, false, true, true, true, true, false); + n = SIMD.Bool8x16(true, false, true, true, false, true, false, false, + true, false, true, true, false, true, false, false); + o = SIMD.Bool8x16.or(m,n); + equal(true, SIMD.Bool8x16.extractLane(o, 0)); + equal(false, SIMD.Bool8x16.extractLane(o, 1)); + equal(true, SIMD.Bool8x16.extractLane(o, 2)); + equal(true, SIMD.Bool8x16.extractLane(o, 3)); + equal(true, SIMD.Bool8x16.extractLane(o, 4)); + equal(true, SIMD.Bool8x16.extractLane(o, 5)); + equal(true, SIMD.Bool8x16.extractLane(o, 6)); + equal(false, SIMD.Bool8x16.extractLane(o, 7)); + equal(true, SIMD.Bool8x16.extractLane(o, 8)); + equal(false, SIMD.Bool8x16.extractLane(o, 9)); + equal(true, SIMD.Bool8x16.extractLane(o, 10)); + equal(true, SIMD.Bool8x16.extractLane(o, 11)); + equal(true, SIMD.Bool8x16.extractLane(o, 12)); + equal(true, SIMD.Bool8x16.extractLane(o, 13)); + equal(true, SIMD.Bool8x16.extractLane(o, 14)); + equal(false, SIMD.Bool8x16.extractLane(o, 15)); +}); + +test('Bool8x16 xor', function() { + var m = SIMD.Bool8x16(true, true, true, true, false, false, false, false, + true, true, true, true, false, false, false, false); + var n = SIMD.Bool8x16(true, false, true, false, true, true, false, false, + true, false, true, false, true, true, false, false); + var o = SIMD.Bool8x16.xor(m,n); + equal(false, SIMD.Bool8x16.extractLane(o, 0)); + equal(true, SIMD.Bool8x16.extractLane(o, 1)); + equal(false, SIMD.Bool8x16.extractLane(o, 2)); + equal(true, SIMD.Bool8x16.extractLane(o, 3)); + equal(true, SIMD.Bool8x16.extractLane(o, 4)); + equal(true, SIMD.Bool8x16.extractLane(o, 5)); + equal(false, SIMD.Bool8x16.extractLane(o, 6)); + equal(false, SIMD.Bool8x16.extractLane(o, 7)); + equal(false, SIMD.Bool8x16.extractLane(o, 8)); + equal(true, SIMD.Bool8x16.extractLane(o, 9)); + equal(false, SIMD.Bool8x16.extractLane(o, 10)); + equal(true, SIMD.Bool8x16.extractLane(o, 11)); + equal(true, SIMD.Bool8x16.extractLane(o, 12)); + equal(true, SIMD.Bool8x16.extractLane(o, 13)); + equal(false, SIMD.Bool8x16.extractLane(o, 14)); + equal(false, SIMD.Bool8x16.extractLane(o, 15)); + m = SIMD.Bool8x16(false, false, false, true, true, true, true, false, + false, false, false, true, true, true, true, false); + n = SIMD.Bool8x16(true, false, true, true, false, true, false, false, + true, false, true, true, false, true, false, false); + o = SIMD.Bool8x16.xor(m,n); + equal(true, SIMD.Bool8x16.extractLane(o, 0)); + equal(false, SIMD.Bool8x16.extractLane(o, 1)); + equal(true, SIMD.Bool8x16.extractLane(o, 2)); + equal(false, SIMD.Bool8x16.extractLane(o, 3)); + equal(true, SIMD.Bool8x16.extractLane(o, 4)); + equal(false, SIMD.Bool8x16.extractLane(o, 5)); + equal(true, SIMD.Bool8x16.extractLane(o, 6)); + equal(false, SIMD.Bool8x16.extractLane(o, 7)); + equal(true, SIMD.Bool8x16.extractLane(o, 8)); + equal(false, SIMD.Bool8x16.extractLane(o, 9)); + equal(true, SIMD.Bool8x16.extractLane(o, 10)); + equal(false, SIMD.Bool8x16.extractLane(o, 11)); + equal(true, SIMD.Bool8x16.extractLane(o, 12)); + equal(false, SIMD.Bool8x16.extractLane(o, 13)); + equal(true, SIMD.Bool8x16.extractLane(o, 14)); + equal(false, SIMD.Bool8x16.extractLane(o, 15)); +}); + +test('Bool8x16 not', function() { + var m = SIMD.Bool8x16(true, false, true, false, true, true, false, false, + true, false, true, false, true, true, false, false); + var o = SIMD.Bool8x16.not(m); + equal(false, SIMD.Bool8x16.extractLane(o, 0)); + equal(true, SIMD.Bool8x16.extractLane(o, 1)); + equal(false, SIMD.Bool8x16.extractLane(o, 2)); + equal(true, SIMD.Bool8x16.extractLane(o, 3)); + equal(false, SIMD.Bool8x16.extractLane(o, 4)); + equal(false, SIMD.Bool8x16.extractLane(o, 5)); + equal(true, SIMD.Bool8x16.extractLane(o, 6)); + equal(true, SIMD.Bool8x16.extractLane(o, 7)); + equal(false, SIMD.Bool8x16.extractLane(o, 8)); + equal(true, SIMD.Bool8x16.extractLane(o, 9)); + equal(false, SIMD.Bool8x16.extractLane(o, 10)); + equal(true, SIMD.Bool8x16.extractLane(o, 11)); + equal(false, SIMD.Bool8x16.extractLane(o, 12)); + equal(false, SIMD.Bool8x16.extractLane(o, 13)); + equal(true, SIMD.Bool8x16.extractLane(o, 14)); + equal(true, SIMD.Bool8x16.extractLane(o, 15)); +}); + +test('Bool8x16 comparisons', function() { + var m = SIMD.Bool8x16(true, true, false, false, true, true, true, true, + false, false, true, true, false, false, false, false); + var n = SIMD.Bool8x16(false, true, false, true, false, true, false, true, + true, false, true, false, true, false, true, false); + var cmp; + + cmp = SIMD.Bool8x16.equal(m, n); + equal(false, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 15)); + + cmp = SIMD.Bool8x16.notEqual(m, n); + equal(true, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 15)); +}); + +test('Bool8x16 select', function() { + var m = SIMD.Bool8x16(true, false, true, false, true, false, true, false, + true, false, true, false, true, false, true, false); + var t = SIMD.Bool8x16(true, true, false, false, true, true, false, false, + true, true, false, false, true, true, false, false); + var f = SIMD.Bool8x16(false, false, false, true, true, true, true, false, + false, false, false, true, true, true, true, false); + var s = SIMD.Bool8x16.select(m, t, f); + equal(true, SIMD.Bool8x16.extractLane(s, 0)); + equal(false, SIMD.Bool8x16.extractLane(s, 1)); + equal(false, SIMD.Bool8x16.extractLane(s, 2)); + equal(true, SIMD.Bool8x16.extractLane(s, 3)); + equal(true, SIMD.Bool8x16.extractLane(s, 4)); + equal(true, SIMD.Bool8x16.extractLane(s, 5)); + equal(false, SIMD.Bool8x16.extractLane(s, 6)); + equal(false, SIMD.Bool8x16.extractLane(s, 7)); + equal(true, SIMD.Bool8x16.extractLane(s, 8)); + equal(false, SIMD.Bool8x16.extractLane(s, 9)); + equal(false, SIMD.Bool8x16.extractLane(s, 10)); + equal(true, SIMD.Bool8x16.extractLane(s, 11)); + equal(true, SIMD.Bool8x16.extractLane(s, 12)); + equal(true, SIMD.Bool8x16.extractLane(s, 13)); + equal(false, SIMD.Bool8x16.extractLane(s, 14)); + equal(false, SIMD.Bool8x16.extractLane(s, 15)); +}); + test('Float32x4 constructor', function() { notEqual(undefined, SIMD.Float32x4); // Type. notEqual(undefined, SIMD.Float32x4(1.0, 2.0, 3.0, 4.0)); // New object. @@ -732,82 +1729,82 @@ test('Float32x4 comparisons', function() { var n = SIMD.Float32x4(2.0, 2.0, 0.001, 0.1); var cmp; cmp = SIMD.Float32x4.lessThan(m, n); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.lessThanOrEqual(m, n); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.equal(m, n); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.notEqual(m, n); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.greaterThanOrEqual(m, n); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.greaterThan(m, n); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); var o = SIMD.Float32x4(0.0, -0.0, 0.0, NaN); var p = SIMD.Float32x4(-0.0, 0.0, NaN, 0.0); cmp = SIMD.Float32x4.lessThan(o, p); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.lessThanOrEqual(o, p); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.equal(o, p); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.notEqual(o, p); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.greaterThanOrEqual(o, p); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Float32x4.greaterThan(o, p); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); }); test('Float32x4 select', function() { - var m = SIMD.Int32x4(0xaaaaaaaa, 0xaaaaaaaa, 0x55555555, 0x55555555); + var m = SIMD.Bool32x4(true, true, false, false); var t = SIMD.Float32x4(1.0, 2.0, 3.0, 4.0); var f = SIMD.Float32x4(5.0, 6.0, 7.0, 8.0); var s = SIMD.Float32x4.select(m, t, f); @@ -817,17 +1814,6 @@ test('Float32x4 select', function() { equal(8.0, SIMD.Float32x4.extractLane(s, 3)); }); -test('Float32x4 selectBits', function() { - var m = SIMD.Int32x4(0xaaaaaaaa, 0xaaaaaaaa, 0x55555555, 0x55555555); - var t = SIMD.Float32x4(1.0, 2.0, 3.0, 4.0); - var f = SIMD.Float32x4(5.0, 6.0, 7.0, 8.0); - var s = SIMD.Float32x4.selectBits(m, t, f); - equal(7.737125245533627e+25, SIMD.Float32x4.extractLane(s, 0)); - equal(3.0, SIMD.Float32x4.extractLane(s, 1)); - equal(7.0, SIMD.Float32x4.extractLane(s, 2)); - equal(2.0, SIMD.Float32x4.extractLane(s, 3)); -}); - test('Float32x4 Int32x4 bit conversion', function() { var m = SIMD.Int32x4(0x3F800000, 0x40000000, 0x40400000, 0x40800000); var n = SIMD.Float32x4.fromInt32x4Bits(m); @@ -1096,7 +2082,7 @@ test('Float32x4 store', function() { } var v = SIMD.Float32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store(a, 0, v), v))); }); test('Float32x4 overaligned store', function() { @@ -1140,7 +2126,7 @@ test('Float32x4 store1', function() { } var v = SIMD.Float32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store1(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store1(a, 0, v), v))); }); test('Float32x4 overaligned store1', function() { @@ -1190,7 +2176,7 @@ test('Float32x4 store2', function() { } var v = SIMD.Float32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store2(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store2(a, 0, v), v))); }); test('Float32x4 overaligned store2', function() { @@ -1235,7 +2221,7 @@ test('Float32x4 store3', function() { } var v = SIMD.Float32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store3(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Float32x4.equal(SIMD.Float32x4.store3(a, 0, v), v))); }); test('Float32x4 overaligned store3', function() { @@ -1462,13 +2448,6 @@ test('Float64x2 fromFloat32x4Bits constructor', function() { equal(2.0, SIMD.Float64x2.extractLane(n, 1)); }); -test('Float64x2 fromInt64x2Bits constructor', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x3ff00000, 0x00000000, 0x40000000)); - var n = SIMD.Float64x2.fromInt64x2Bits(m); - equal(1.0, SIMD.Float64x2.extractLane(n, 0)); - equal(2.0, SIMD.Float64x2.extractLane(n, 1)); -}); - test('Float64x2 fromInt32x4Bits constructor', function() { var m = SIMD.Int32x4(0x00000000, 0x3ff00000, 0x00000000, 0x40000000); var n = SIMD.Float64x2.fromInt32x4Bits(m); @@ -1866,97 +2845,96 @@ test('Float64x2 comparisons', function() { var cmp; cmp = SIMD.Float64x2.lessThan(m, n); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.lessThan(o, p); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.lessThanOrEqual(m, n); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.lessThanOrEqual(o, p); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.equal(m, n); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.equal(o, p); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.notEqual(m, n); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.notEqual(o, p); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThanOrEqual(m, n); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThanOrEqual(o, p); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThan(m, n); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThan(o, p); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); var o = SIMD.Float64x2(0.0, -0.0); var p = SIMD.Float64x2(-0.0, 0.0); var q = SIMD.Float64x2(0.0, NaN); var r = SIMD.Float64x2(NaN, 0.0); cmp = SIMD.Float64x2.lessThan(o, p); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.lessThan(q, r); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.lessThanOrEqual(o, p); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.lessThanOrEqual(q, r); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.equal(o, p); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.equal(q, r); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.notEqual(o, p); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.notEqual(q, r); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThanOrEqual(o, p); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(true, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThanOrEqual(q, r); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThan(o, p); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); cmp = SIMD.Float64x2.greaterThan(q, r); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 0)); + equal(false, SIMD.Bool64x2.extractLane(cmp, 1)); }); test('Float64x2 select', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0xaaaaaaaa, 0xaaaaaaaa, - 0x55555555, 0x55555555)); + var m = SIMD.Bool64x2(true, false); var t = SIMD.Float64x2(1.0, 2.0); var f = SIMD.Float64x2(3.0, 4.0); var s = SIMD.Float64x2.select(m, t, f); @@ -1964,16 +2942,6 @@ test('Float64x2 select', function() { equal(4.0, SIMD.Float64x2.extractLane(s, 1)); }); -test('Float64x2 selectBits', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0xaaaaaaaa, 0xaaaaaaaa, - 0x55555555, 0x55555555)); - var t = SIMD.Float64x2(1.0, 2.0); - var f = SIMD.Float64x2(3.0, 4.0); - var s = SIMD.Float64x2.selectBits(m, t, f); - equal(4.013165208090495e+205, SIMD.Float64x2.extractLane(s, 0)); - equal(2.0, SIMD.Float64x2.extractLane(s, 1)); -}); - test('Float64x2 load', function() { var a = new Float64Array(8); for (var i = 0; i < a.length; i++) { @@ -2050,7 +3018,7 @@ test('Float64x2 store', function() { } var v = SIMD.Float64x2(0, 1); - equal(true, SIMD.Int64x2.allTrue(SIMD.Float64x2.equal(SIMD.Float64x2.store(a, 0, v), v))); + equal(true, SIMD.Bool64x2.allTrue(SIMD.Float64x2.equal(SIMD.Float64x2.store(a, 0, v), v))); }); test('Float64x2 unaligned store', function() { @@ -2082,7 +3050,7 @@ test('Float64x2 store1', function() { } var v = SIMD.Float64x2(0, 1); - equal(true, SIMD.Int64x2.allTrue(SIMD.Float64x2.equal(SIMD.Float64x2.store1(a, 0, v), v))); + equal(true, SIMD.Bool64x2.allTrue(SIMD.Float64x2.equal(SIMD.Float64x2.store1(a, 0, v), v))); }); test('Float64x2 unaligned store1', function() { @@ -2178,309 +3146,6 @@ test('Float64x2 store1 exceptions', function () { }); }); -test('Int64x2 allTrue', function () { - var v0000 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A)); - var v0001 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0xA5A5A5A5)); - var v0010 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0x5A5A5A5A)); - var v0100 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0xFFFFFFFF, 0x00000001, 0x5A5A5A5A)); - var v1000 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x80000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A)); - var v0011 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0xA5A5A5A5)); - var v0111 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0xFFFFFFFF, 0x80000001, 0xA5A5A5A5)); - var v1111 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x80000000, 0xFFFFFFFF, 0x80000001, 0xA5A5A5A5)); - equal(SIMD.Int64x2.allTrue(v0000), false); - equal(SIMD.Int64x2.allTrue(v0001), false); - equal(SIMD.Int64x2.allTrue(v0010), false); - equal(SIMD.Int64x2.allTrue(v0100), false); - equal(SIMD.Int64x2.allTrue(v1000), false); - equal(SIMD.Int64x2.allTrue(v0011), false); - equal(SIMD.Int64x2.allTrue(v0111), false); - equal(SIMD.Int64x2.allTrue(v1111), true); -}); - -test('Int64x2 fromFloat64x2Bits constructor', function() { - var m = SIMD.Float64x2(1.0, 2.0); - var n = SIMD.Int64x2.fromFloat64x2Bits(m); - var v = SIMD.Int32x4.fromInt64x2Bits(n); - equal(0x00000000, SIMD.Int32x4.extractLane(v, 0)); - equal(0x3FF00000, SIMD.Int32x4.extractLane(v, 1)); - equal(0x00000000, SIMD.Int32x4.extractLane(v, 2)); - equal(0x40000000, SIMD.Int32x4.extractLane(v, 3)); -}); - -test('Int64x2 anyTrue', function () { - var v00 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A)); - var v01 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0x5A5A5A5A)); - var v10 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x80000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A)); - var v11 = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x80000000, 0x7FFFFFFF, 0x80000001, 0x5A5A5A5A)); - equal(SIMD.Int64x2.anyTrue(v00), false); - equal(SIMD.Int64x2.anyTrue(v01), true); - equal(SIMD.Int64x2.anyTrue(v10), true); - equal(SIMD.Int64x2.anyTrue(v11), true); -}); - -test('Int64x2 and', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0xAAAAAAAA, 0xAAAAAAAA, -1431655766, 0xAAAAAAAA)); - var n = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x55555555, 0x55555555, 0x55555555, 0x55555555)); - var o = SIMD.Int64x2.and(m,n); // and - var p = SIMD.Int32x4.fromInt64x2Bits(o); - equal(0x0, SIMD.Int32x4.extractLane(p, 0)); - equal(0x0, SIMD.Int32x4.extractLane(p, 1)); - equal(0x0, SIMD.Int32x4.extractLane(p, 2)); - equal(0x0, SIMD.Int32x4.extractLane(p, 3)); - equal(false, SIMD.Int64x2.extractLaneAsBool(o, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(o, 1)); -}); - -test('Int64x2 or', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA)); - var n = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x55555555, 0x55555555, 0x55555555, 0x55555555)); - var o = SIMD.Int64x2.or(m,n); // or - var p = SIMD.Int32x4.fromInt64x2Bits(o); - equal(-1, SIMD.Int32x4.extractLane(p, 0)); - equal(-1, SIMD.Int32x4.extractLane(p, 1)); - equal(-1, SIMD.Int32x4.extractLane(p, 2)); - equal(-1, SIMD.Int32x4.extractLane(p, 3)); - equal(true, SIMD.Int64x2.extractLaneAsBool(o, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(o, 1)); -}); - -test('Int64x2 xor', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA)); - var n = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0x55555555, 0x55555555, 0x55555555, 0x55555555)); - var o = SIMD.Int64x2.xor(m,n); // xor - var p = SIMD.Int32x4.fromInt64x2Bits(o); - equal(-1, SIMD.Int32x4.extractLane(p, 0)); - equal(-1, SIMD.Int32x4.extractLane(p, 1)); - equal(-1, SIMD.Int32x4.extractLane(p, 2)); - equal(-1, SIMD.Int32x4.extractLane(p, 3)); - equal(true, SIMD.Int64x2.extractLaneAsBool(o, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(o, 1)); -}); - -test('Int64x2 comparisons', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(1000, 2000, 100, 100)); - var n = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(-2000, 2000, 100, 100)); - var cmp; - - cmp = SIMD.Int64x2.equal(m, n); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); - - cmp = SIMD.Int64x2.notEqual(m, n); - equal(true, SIMD.Int64x2.extractLaneAsBool(cmp, 0)); - equal(false, SIMD.Int64x2.extractLaneAsBool(cmp, 1)); -}); - -test('Int64x2 load', function() { - var a = new Int32Array(16); - for (var i = 0; i < a.length; i++) { - a[i] = i; - } - for (var i = 0; i < a.length - 3; i++) { - var v = SIMD.Int64x2.load(a, i); - var w = SIMD.Int32x4.fromInt64x2Bits(v); - equal(i, SIMD.Int32x4.extractLane(w, 0)); - equal(i+1, SIMD.Int32x4.extractLane(w, 1)); - equal(i+2, SIMD.Int32x4.extractLane(w, 2)); - equal(i+3, SIMD.Int32x4.extractLane(w, 3)); - } -}); - -test('Int64x2 unaligned load', function() { - var a = new Int32Array(16); - var ai = new Int8Array(a.buffer); - for (var i = 0; i < a.length; i++) { - a[i] = i; - } - - // Copy the bytes, offset by 1. - var b = new Int8Array(ai.length + 1); - for (var i = 0; i < ai.length; i++) { - b[i + 1] = ai[i]; - } - - // Load the values unaligned. - for (var i = 0; i < a.length - 3; i++) { - var v = SIMD.Int64x2.load(b, i * 4 + 1); - var w = SIMD.Int32x4.fromInt64x2Bits(v); - equal(i, SIMD.Int32x4.extractLane(w, 0)); - equal(i+1, SIMD.Int32x4.extractLane(w, 1)); - equal(i+2, SIMD.Int32x4.extractLane(w, 2)); - equal(i+3, SIMD.Int32x4.extractLane(w, 3)); - } -}); - -test('Int64x2 load1', function() { - var a = new Int32Array(16); - for (var i = 0; i < a.length; i++) { - a[i] = i; - } - for (var i = 0; i < a.length - 1; i++) { - var v = SIMD.Int64x2.load1(a, i); - var w = SIMD.Int32x4.fromInt64x2Bits(v); - equal(i, SIMD.Int32x4.extractLane(w, 0)); - equal(i+1, SIMD.Int32x4.extractLane(w, 1)); - isPositiveZero(SIMD.Int32x4.extractLane(w, 2)); - isPositiveZero(SIMD.Int32x4.extractLane(w, 3)); - } -}); - -test('Int64x2 unaligned load1', function() { - var a = new Int32Array(16); - var ai = new Int8Array(a.buffer); - for (var i = 0; i < a.length; i++) { - a[i] = i; - } - - // Copy the bytes, offset by 1. - var b = new Int8Array(ai.length + 1); - for (var i = 0; i < ai.length; i++) { - b[i + 1] = ai[i]; - } - - // Copy the values unaligned. - for (var i = 0; i < a.length - 1; i++) { - var v = SIMD.Int64x2.load1(b, i * 4 + 1); - var w = SIMD.Int32x4.fromInt64x2Bits(v); - equal(i, SIMD.Int32x4.extractLane(w, 0)); - equal(i+1, SIMD.Int32x4.extractLane(w, 1)); - isPositiveZero(SIMD.Int32x4.extractLane(w, 2)); - isPositiveZero(SIMD.Int32x4.extractLane(w, 3)); - } -}); - -test('Int64x2 store', function() { - var a = new Int32Array(12); - SIMD.Int64x2.store(a, 0, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0, 1, 2, 3))); - SIMD.Int64x2.store(a, 4, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(4, 5, 6, 7))); - SIMD.Int64x2.store(a, 8, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(8, 9, 10, 11))); - for (var i = 0; i < a.length; i++) { - equal(i, a[i]); - } -}); - -test('Int64x2 unaligned store', function() { - var c = new Int8Array(48 + 1); - SIMD.Int64x2.store(c, 0 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0, 1, 2, 3))); - SIMD.Int64x2.store(c, 16 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(4, 5, 6, 7))); - SIMD.Int64x2.store(c, 32 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(8, 9, 10, 11))); - - // Copy the bytes, offset by 1. - var b = new Int8Array(c.length - 1); - for (var i = 1; i < c.length; i++) { - b[i - 1] = c[i]; - } - - var a = new Int32Array(b.buffer); - for (var i = 0; i < a.length; i++) { - equal(i, a[i]); - } -}); - -test('Int64x2 store1', function() { - var a = new Int32Array(8); - SIMD.Int64x2.store1(a, 0, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0, 1, -1, -1))); - SIMD.Int64x2.store1(a, 2, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(2, 3, -1, -1))); - SIMD.Int64x2.store1(a, 4, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(4, 5, -1, -1))); - SIMD.Int64x2.store1(a, 6, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(6, 7, -1, -1))); - for (var i = 0; i < a.length; i++) { - equal(i, a[i]); - } -}); - -test('Int64x2 unaligned store1', function() { - var c = new Int8Array(32 + 1); - SIMD.Int64x2.store1(c, 0 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0, 1, -1, -1))); - SIMD.Int64x2.store1(c, 8 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(2, 3, -1, -1))); - SIMD.Int64x2.store1(c, 16 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(4, 5, -1, -1))); - SIMD.Int64x2.store1(c, 24 + 1, SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(6, 7, -1, -1))); - - // Copy the bytes, offset by 1. - var b = new Int8Array(c.length - 1); - for (var i = 1; i < c.length; i++) { - b[i - 1] = c[i]; - } - - var a = new Int32Array(b.buffer); - for (var i = 0; i < a.length; i++) { - equal(i, a[i]); - } -}); - -test('Int64x2 load exceptions', function () { - var a = new Float64Array(8); - throws(function () { - var f = SIMD.Int64x2.load(a, -1); - }); - throws(function () { - var f = SIMD.Int64x2.load(a, 7); - }); - throws(function () { - var f = SIMD.Int64x2.load(a.buffer, 1); - }); - throws(function () { - var f = SIMD.Int64x2.load(a, "a"); - }); -}); - -test('Int64x2 load1 exceptions', function () { - var a = new Float64Array(8); - throws(function () { - var f = SIMD.Int64x2.load1(a, -1); - }); - throws(function () { - var f = SIMD.Int64x2.load1(a, 8); - }); - throws(function () { - var f = SIMD.Int64x2.load1(a.buffer, 1); - }); - throws(function () { - var f = SIMD.Int64x2.load1(a, "a"); - }); -}); - -test('Int64x2 store exceptions', function () { - var a = new Float64Array(8); - var f = SIMD.Int64x2(1, 2); - var i = SIMD.Int32x4(1, 2, 3, 4); - throws(function () { - SIMD.Int64x2.store(a, -1, f); - }); - throws(function () { - SIMD.Int64x2.store(a, 7, f); - }); - throws(function () { - SIMD.Int64x2.store(a.buffer, 1, f); - }); - throws(function () { - SIMD.Int64x2.store(a, "a", f); - }); - throws(function () { - SIMD.Int64x2.store(a, 1, i); - }); -}); - -test('Int64x2 store1 exceptions', function () { - var a = new Float64Array(8); - var f = SIMD.Int64x2(1, 2); - var i = SIMD.Int32x4(1, 2, 3, 4); - throws(function () { - SIMD.Int64x2.store1(a, -1, f); - }); - throws(function () { - SIMD.Int64x2.store1(a, 8, f); - }); - throws(function () { - SIMD.Int64x2.store1(a.buffer, 1, f); - }); - throws(function () { - SIMD.Int64x2.store1(a, "a", f); - }); - throws(function () { - SIMD.Int64x2.store1(a, 1, i); - }); -}); - test('Int32x4 fromFloat32x4 constructor', function() { var m = SIMD.Float32x4(1.0, 2.2, 3.6, 4.8); var n = SIMD.Int32x4.fromFloat32x4(m); @@ -2570,15 +3235,6 @@ test('Int32x4 fromFloat64x2 constructor', function() { }); }); -test('Int32x4 fromInt64x2Bits constructor', function() { - var m = SIMD.Int64x2.fromInt32x4Bits(SIMD.Int32x4(0, 1, 2, 3)); - var n = SIMD.Int32x4.fromInt64x2Bits(m); - equal(0, SIMD.Int32x4.extractLane(n, 0)); - equal(1, SIMD.Int32x4.extractLane(n, 1)); - equal(2, SIMD.Int32x4.extractLane(n, 2)); - equal(3, SIMD.Int32x4.extractLane(n, 3)); -}); - test('Int32x4 fromFloat32x4Bits constructor', function() { var m = SIMD.Float32x4(1.0, 2.0, 3.0, 4.0); var n = SIMD.Int32x4.fromFloat32x4Bits(m); @@ -2723,23 +3379,11 @@ test('Int32x4 and', function() { equal(0x55555555, SIMD.Int32x4.extractLane(n, 1)); equal(0x55555555, SIMD.Int32x4.extractLane(n, 2)); equal(0x55555555, SIMD.Int32x4.extractLane(n, 3)); - equal(true, toBool(SIMD.Int32x4.extractLane(m, 0))); - equal(true, toBool(SIMD.Int32x4.extractLane(m, 1))); - equal(true, toBool(SIMD.Int32x4.extractLane(m, 2))); - equal(true, toBool(SIMD.Int32x4.extractLane(m, 3))); - equal(false, toBool(SIMD.Int32x4.extractLane(n, 0))); - equal(false, toBool(SIMD.Int32x4.extractLane(n, 1))); - equal(false, toBool(SIMD.Int32x4.extractLane(n, 2))); - equal(false, toBool(SIMD.Int32x4.extractLane(n, 3))); var o = SIMD.Int32x4.and(m,n); // and equal(0x0, SIMD.Int32x4.extractLane(o, 0)); equal(0x0, SIMD.Int32x4.extractLane(o, 1)); equal(0x0, SIMD.Int32x4.extractLane(o, 2)); equal(0x0, SIMD.Int32x4.extractLane(o, 3)); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 0))); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 1))); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 2))); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 3))); }); test('Int32x4 or', function() { @@ -2750,10 +3394,6 @@ test('Int32x4 or', function() { equal(-1, SIMD.Int32x4.extractLane(o, 1)); equal(-1, SIMD.Int32x4.extractLane(o, 2)); equal(-1, SIMD.Int32x4.extractLane(o, 3)); - equal(true, toBool(SIMD.Int32x4.extractLane(o, 0))); - equal(true, toBool(SIMD.Int32x4.extractLane(o, 1))); - equal(true, toBool(SIMD.Int32x4.extractLane(o, 2))); - equal(true, toBool(SIMD.Int32x4.extractLane(o, 3))); }); test('Int32x4 xor', function() { @@ -2772,10 +3412,6 @@ test('Int32x4 xor', function() { equal(0x0, SIMD.Int32x4.extractLane(o, 1)); equal(0x0, SIMD.Int32x4.extractLane(o, 2)); equal(0x0, SIMD.Int32x4.extractLane(o, 3)); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 0))); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 1))); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 2))); - equal(false, toBool(SIMD.Int32x4.extractLane(o, 3))); }); test('Int32x4 neg', function() { @@ -2794,44 +3430,6 @@ test('Int32x4 neg', function() { equal(-2147483648, SIMD.Int32x4.extractLane(n, 3)); }); -test('Int32x4 allTrue', function () { - var v0000 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A); - var v0001 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0xA5A5A5A5); - var v0010 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0x5A5A5A5A); - var v0100 = SIMD.Int32x4(0x00000000, 0xFFFFFFFF, 0x00000001, 0x5A5A5A5A); - var v1000 = SIMD.Int32x4(0x80000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A); - var v0011 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0xA5A5A5A5); - var v0111 = SIMD.Int32x4(0x00000000, 0xFFFFFFFF, 0x80000001, 0xA5A5A5A5); - var v1111 = SIMD.Int32x4(0x80000000, 0xFFFFFFFF, 0x80000001, 0xA5A5A5A5); - equal(SIMD.Int32x4.allTrue(v0000), false); - equal(SIMD.Int32x4.allTrue(v0001), false); - equal(SIMD.Int32x4.allTrue(v0010), false); - equal(SIMD.Int32x4.allTrue(v0100), false); - equal(SIMD.Int32x4.allTrue(v1000), false); - equal(SIMD.Int32x4.allTrue(v0011), false); - equal(SIMD.Int32x4.allTrue(v0111), false); - equal(SIMD.Int32x4.allTrue(v1111), true); -}); - -test('Int32x4 anyTrue', function () { - var v0000 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A); - var v0001 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x00000001, 0xA5A5A5A5); - var v0010 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0x5A5A5A5A); - var v0100 = SIMD.Int32x4(0x00000000, 0xFFFFFFFF, 0x00000001, 0x5A5A5A5A); - var v1000 = SIMD.Int32x4(0x80000000, 0x7FFFFFFF, 0x00000001, 0x5A5A5A5A); - var v0011 = SIMD.Int32x4(0x00000000, 0x7FFFFFFF, 0x80000001, 0xA5A5A5A5); - var v0111 = SIMD.Int32x4(0x00000000, 0xFFFFFFFF, 0x80000001, 0xA5A5A5A5); - var v1111 = SIMD.Int32x4(0x80000000, 0xFFFFFFFF, 0x80000001, 0xA5A5A5A5); - equal(SIMD.Int32x4.anyTrue(v0000), false); - equal(SIMD.Int32x4.anyTrue(v0001), true); - equal(SIMD.Int32x4.anyTrue(v0010), true); - equal(SIMD.Int32x4.anyTrue(v0100), true); - equal(SIMD.Int32x4.anyTrue(v1000), true); - equal(SIMD.Int32x4.anyTrue(v0011), true); - equal(SIMD.Int32x4.anyTrue(v0111), true); - equal(SIMD.Int32x4.anyTrue(v1111), true); -}); - test('Int32x4 vector getters', function () { var a = SIMD.Int32x4(4, 3, 2, 1); var xxxx = SIMD.Int32x4.swizzle(a, 0, 0, 0, 0); @@ -2896,40 +3494,40 @@ test('Int32x4 comparisons', function() { var n = SIMD.Int32x4(-2000, 2000, 1, 100); var cmp; cmp = SIMD.Int32x4.lessThan(m, n); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Int32x4.lessThanOrEqual(m, n); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Int32x4.equal(m, n); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Int32x4.notEqual(m, n); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Int32x4.greaterThan(m, n); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); cmp = SIMD.Int32x4.greaterThanOrEqual(m, n); - equal(-1, SIMD.Int32x4.extractLane(cmp, 0)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 1)); - equal(-1, SIMD.Int32x4.extractLane(cmp, 2)); - equal(0x0, SIMD.Int32x4.extractLane(cmp, 3)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 0)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 1)); + equal(true, SIMD.Bool32x4.extractLane(cmp, 2)); + equal(false, SIMD.Bool32x4.extractLane(cmp, 3)); }); test('Int32x4 shiftLeftByScalar', function() { @@ -3041,7 +3639,7 @@ test('Int32x4 shiftRightLogicalByScalar', function() { }); test('Int32x4 select', function() { - var m = SIMD.Int32x4(0xaaaaaaaa, 0xaaaaaaaa, 0x55555555, 0x55555555); + var m = SIMD.Bool32x4(true, true, false, false); var t = SIMD.Int32x4(1, 2, 3, 4); var f = SIMD.Int32x4(5, 6, 7, 8); var s = SIMD.Int32x4.select(m, t, f); @@ -3284,7 +3882,7 @@ test('Int32x4 store', function() { } var v = SIMD.Int32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store(a, 0, v), v))); }); test('Int32x4 overaligned store', function() { @@ -3328,7 +3926,7 @@ test('Int32x4 store1', function() { } var v = SIMD.Int32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store1(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store1(a, 0, v), v))); }); test('Int32x4 overaligned store1', function() { @@ -3367,7 +3965,7 @@ test('Int32x4 unaligned store1', function() { } var v = SIMD.Int32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store2(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store2(a, 0, v), v))); }); test('Int32x4 store2', function() { @@ -3422,7 +4020,7 @@ test('Int32x4 store3', function() { } var v = SIMD.Int32x4(0, 1, 2, 3); - equal(true, SIMD.Int32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store3(a, 0, v), v))); + equal(true, SIMD.Bool32x4.allTrue(SIMD.Int32x4.equal(SIMD.Int32x4.store3(a, 0, v), v))); }); test('Int32x4 overaligned store3', function() { @@ -3801,44 +4399,6 @@ test('Int16x8 neg', function() { equal(0, SIMD.Int16x8.extractLane(n, 7)); }); -test('Int16x8 allTrue', function () { - var v0000 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x0001, 0x0001, 0x5A5A, 0x5A5A); - var v0001 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x0001, 0x0001, 0xA5A5, 0xA5A5); - var v0010 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x8000, 0x8001, 0x5A5A, 0x5A5A); - var v0100 = SIMD.Int16x8(0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0001, 0x0001, 0x5A5A, 0x5A5A); - var v1000 = SIMD.Int16x8(0x8000, 0x0000, 0x7FFF, 0x7FFF, 0x0001, 0x0001, 0x5A5A, 0x5A5A); - var v0011 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x8001, 0x8001, 0xA5A5, 0xA5A5); - var v0111 = SIMD.Int16x8(0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x8000, 0x8001, 0xA5A5, 0xA5A5); - var v1111 = SIMD.Int16x8(0x8000, 0x8000, 0xFFFF, 0xFFFF, 0x8001, 0x8001, 0xA5A5, 0xA5A5); - equal(SIMD.Int16x8.allTrue(v0000), false); - equal(SIMD.Int16x8.allTrue(v0001), false); - equal(SIMD.Int16x8.allTrue(v0010), false); - equal(SIMD.Int16x8.allTrue(v0100), false); - equal(SIMD.Int16x8.allTrue(v1000), false); - equal(SIMD.Int16x8.allTrue(v0011), false); - equal(SIMD.Int16x8.allTrue(v0111), false); - equal(SIMD.Int16x8.allTrue(v1111), true); -}); - -test('Int16x8 anyTrue', function () { - var v0000 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x0001, 0x0001, 0x5A5A, 0x5A5A); - var v0001 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x0001, 0x0001, 0xA5A5, 0xA5A5); - var v0010 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x8000, 0x8001, 0x5A5A, 0x5A5A); - var v0100 = SIMD.Int16x8(0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x0001, 0x0001, 0x5A5A, 0x5A5A); - var v1000 = SIMD.Int16x8(0x8000, 0x0000, 0x7FFF, 0x7FFF, 0x0001, 0x0001, 0x5A5A, 0x5A5A); - var v0011 = SIMD.Int16x8(0x0000, 0x0000, 0x7FFF, 0x7FFF, 0x8001, 0x8001, 0xA5A5, 0xA5A5); - var v0111 = SIMD.Int16x8(0x0000, 0x0000, 0xFFFF, 0xFFFF, 0x8000, 0x8001, 0xA5A5, 0xA5A5); - var v1111 = SIMD.Int16x8(0x8000, 0x8000, 0xFFFF, 0xFFFF, 0x8001, 0x8001, 0xA5A5, 0xA5A5); - equal(SIMD.Int16x8.anyTrue(v0000), false); - equal(SIMD.Int16x8.anyTrue(v0001), true); - equal(SIMD.Int16x8.anyTrue(v0010), true); - equal(SIMD.Int16x8.anyTrue(v0100), true); - equal(SIMD.Int16x8.anyTrue(v1000), true); - equal(SIMD.Int16x8.anyTrue(v0011), true); - equal(SIMD.Int16x8.anyTrue(v0111), true); - equal(SIMD.Int16x8.anyTrue(v1111), true); -}); - test('Int16x8 add', function() { var a = SIMD.Int16x8(0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x7fff, 0xffff, 0x0, 0x0); var b = SIMD.Int16x8(0x0, 0x1, 0xFFFF, 0xFFFF, 0x0, 0x1, 0xFFFF, 0xFFFF); @@ -3934,64 +4494,64 @@ test('Int16x8 comparisons', function() { var n = SIMD.Int16x8(-2000, 2000, 1, 100, 2000, -2000, -1, -100); var cmp; cmp = SIMD.Int16x8.lessThan(m, n); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 0)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 1)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 2)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 3)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 4)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 5)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 6)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 7)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 7)); cmp = SIMD.Int16x8.lessThanOrEqual(m, n); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 0)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 1)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 2)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 3)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 4)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 5)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 6)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 7)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 7)); cmp = SIMD.Int16x8.equal(m, n); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 0)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 1)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 2)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 3)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 4)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 5)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 6)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 7)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 7)); cmp = SIMD.Int16x8.notEqual(m, n); - equal(-1, SIMD.Int16x8.extractLane(cmp, 0)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 1)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 2)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 3)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 4)); - equal(0x0, SIMD.Int16x8.extractLane(cmp, 5)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 6)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 7)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 7)); cmp = SIMD.Int16x8.greaterThan(m, n); - equal(-1, SIMD.Int16x8.extractLane(cmp, 0)); - equal(0, SIMD.Int16x8.extractLane(cmp, 1)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 2)); - equal(0, SIMD.Int16x8.extractLane(cmp, 3)); - equal(0, SIMD.Int16x8.extractLane(cmp, 4)); - equal(0, SIMD.Int16x8.extractLane(cmp, 5)); - equal(0, SIMD.Int16x8.extractLane(cmp, 6)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 7)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 7)); cmp = SIMD.Int16x8.greaterThanOrEqual(m, n); - equal(-1, SIMD.Int16x8.extractLane(cmp, 0)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 1)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 2)); - equal(0, SIMD.Int16x8.extractLane(cmp, 3)); - equal(0, SIMD.Int16x8.extractLane(cmp, 4)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 5)); - equal(0, SIMD.Int16x8.extractLane(cmp, 6)); - equal(-1, SIMD.Int16x8.extractLane(cmp, 7)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 0)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 1)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 2)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 3)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 4)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 5)); + equal(false, SIMD.Bool16x8.extractLane(cmp, 6)); + equal(true, SIMD.Bool16x8.extractLane(cmp, 7)); }); test('Int16x8 shiftLeftByScalar', function() { @@ -4175,7 +4735,7 @@ test('Int16x8 shiftRightLogicalByScalar', function() { }); test('Int16x8 select', function() { - var m = SIMD.Int16x8.bool(true, true, true, true, false, false, false, false); + var m = SIMD.Bool16x8(true, true, true, true, false, false, false, false); var t = SIMD.Int16x8(1, 2, 3, 4, 5, 6, 7, 8); var f = SIMD.Int16x8(9, 10, 11, 12, 13, 14, 15, 16); var s = SIMD.Int16x8.select(m, t, f); @@ -4494,44 +5054,6 @@ test('Int8x16 neg', function() { equal(0, SIMD.Int8x16.extractLane(n, 15)); }); -test('Int8x16 allTrue', function () { - var v0000 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0x5A, 0x5A, 0x5A, 0x5A); - var v0001 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0xA5, 0xA5, 0xA5, 0xA5); - var v0010 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x81, 0x81, 0x81, 0x81, 0x5A, 0x5A, 0x5A, 0x5A); - var v0100 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x5A, 0x5A, 0x5A, 0x5A); - var v1000 = SIMD.Int8x16(0x80, 0x80, 0x80, 0x80, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0x5A, 0x5A, 0x5A, 0x5A); - var v0011 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x81, 0x81, 0x81, 0x81, 0xA5, 0xA5, 0xA5, 0xA5); - var v0111 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0x81, 0x81, 0x81, 0xA5, 0xA5, 0xA5, 0xA5); - var v1111 = SIMD.Int8x16(0x80, 0x80, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0x81, 0x81, 0x81, 0xA5, 0xA5, 0xA5, 0xA5); - equal(SIMD.Int8x16.allTrue(v0000), false); - equal(SIMD.Int8x16.allTrue(v0001), false); - equal(SIMD.Int8x16.allTrue(v0010), false); - equal(SIMD.Int8x16.allTrue(v0100), false); - equal(SIMD.Int8x16.allTrue(v1000), false); - equal(SIMD.Int8x16.allTrue(v0011), false); - equal(SIMD.Int8x16.allTrue(v0111), false); - equal(SIMD.Int8x16.allTrue(v1111), true); -}); - -test('Int8x16 anyTrue', function () { - var v0000 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0x5A, 0x5A, 0x5A, 0x5A); - var v0001 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0xA5, 0xA5, 0xA5, 0xA5); - var v0010 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x81, 0x81, 0x81, 0x81, 0x5A, 0x5A, 0x5A, 0x5A); - var v0100 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x01, 0x01, 0x01, 0x5A, 0x5A, 0x5A, 0x5A); - var v1000 = SIMD.Int8x16(0x80, 0x80, 0x80, 0x80, 0x7F, 0x7F, 0x7F, 0x7F, 0x01, 0x01, 0x01, 0x01, 0x5A, 0x5A, 0x5A, 0x5A); - var v0011 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x81, 0x81, 0x81, 0x81, 0xA5, 0xA5, 0xA5, 0xA5); - var v0111 = SIMD.Int8x16(0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0x81, 0x81, 0x81, 0xA5, 0xA5, 0xA5, 0xA5); - var v1111 = SIMD.Int8x16(0x80, 0x80, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x81, 0x81, 0x81, 0x81, 0xA5, 0xA5, 0xA5, 0xA5); - equal(SIMD.Int8x16.anyTrue(v0000), false); - equal(SIMD.Int8x16.anyTrue(v0001), true); - equal(SIMD.Int8x16.anyTrue(v0010), true); - equal(SIMD.Int8x16.anyTrue(v0100), true); - equal(SIMD.Int8x16.anyTrue(v1000), true); - equal(SIMD.Int8x16.anyTrue(v0011), true); - equal(SIMD.Int8x16.anyTrue(v0111), true); - equal(SIMD.Int8x16.anyTrue(v1111), true); -}); - test('Int8x16 add', function () { var a = SIMD.Int8x16(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7f, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x0); var b = SIMD.Int8x16(0x0, 0x0, 0x0, 0x1, 0xFF, 0xFF, 0xFF, 0xFF, 0x0, 0x0, 0x0, 0x1, 0xFF, 0xFF, 0xFF, 0xFF); @@ -4690,112 +5212,112 @@ test('Int8x16 comparisons', function() { var n = SIMD.Int8x16(-2000, 2000, 1, 100, 2000, -2000, -1, -100, -1, 1, -2, 2, 0, 0, 0, 0); var cmp; cmp = SIMD.Int8x16.lessThan(m, n); - equal(-1, SIMD.Int8x16.extractLane(cmp, 0)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 1)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 2)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 3)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 4)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 5)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 6)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 7)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 8)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 9)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 10)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 11)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 12)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 13)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 14)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 15)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 15)); cmp = SIMD.Int8x16.lessThanOrEqual(m, n); - equal(-1, SIMD.Int8x16.extractLane(cmp, 0)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 1)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 2)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 3)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 4)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 5)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 6)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 7)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 8)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 9)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 10)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 11)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 12)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 13)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 14)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 15)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 15)); cmp = SIMD.Int8x16.equal(m, n); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 0)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 1)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 2)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 3)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 4)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 5)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 6)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 7)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 8)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 9)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 10)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 11)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 12)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 13)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 14)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 15)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 15)); cmp = SIMD.Int8x16.notEqual(m, n); - equal(-1, SIMD.Int8x16.extractLane(cmp, 0)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 1)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 2)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 3)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 4)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 5)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 6)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 7)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 8)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 9)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 10)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 11)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 12)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 13)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 14)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 15)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 15)); cmp = SIMD.Int8x16.greaterThan(m, n); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 0)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 1)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 2)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 3)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 4)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 5)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 6)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 7)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 8)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 9)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 10)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 11)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 12)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 13)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 14)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 15)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 15)); cmp = SIMD.Int8x16.greaterThanOrEqual(m, n); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 0)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 1)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 2)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 3)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 4)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 5)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 6)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 7)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 8)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 9)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 10)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 11)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 12)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 13)); - equal(0x0, SIMD.Int8x16.extractLane(cmp, 14)); - equal(-1, SIMD.Int8x16.extractLane(cmp, 15)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 0)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 1)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 2)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 3)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 4)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 5)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 6)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 7)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 8)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 9)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 10)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 11)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 12)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 13)); + equal(false, SIMD.Bool8x16.extractLane(cmp, 14)); + equal(true, SIMD.Bool8x16.extractLane(cmp, 15)); }); test('Int8x16 shiftLeftByScalar', function() { @@ -5123,7 +5645,7 @@ test('Int8x16 shiftRightLogicalByScalar', function() { }); test('Int8x16 select', function() { - var m = SIMD.Int8x16.bool(true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false); + var m = SIMD.Bool8x16(true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false); var t = SIMD.Int8x16(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); var f = SIMD.Int8x16(17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32); var s = SIMD.Int8x16.select(m, t, f);