Bug 1063946 SIMD: Group tests in logical units - binary operations; r=bbouvier

--HG--
extra : rebase_source : cf9095803e5504478dae22b53835566dcda5c87e
This commit is contained in:
Florian Merz 2015-04-13 21:37:06 +02:00
Родитель 1766d6c625
Коммит eee7d61543
14 изменённых файлов: 250 добавлений и 536 удалений

Просмотреть файл

@ -0,0 +1,250 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
function testFloat32x4add() {
function addf(a, b) {
return Math.fround(Math.fround(a) + Math.fround(b));
}
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.57, 2.27, 3.57, 4.19], [10.31, 20.49, 30.41, 40.72]],
[[NaN, -0, Infinity, -Infinity], [0, -0, -Infinity, -Infinity]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.add, addf);
}
}
function testFloat32x4and() {
var andf = (function() {
var i = new Int32Array(3);
var f = new Float32Array(i.buffer);
return function(x, y) {
f[0] = x;
f[1] = y;
i[2] = i[0] & i[1];
return f[2];
};
})();
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.51, 2.98, 3.65, 4.34], [10.29, 20.12, 30.79, 40.41]],
[[NaN, -0, Infinity, -Infinity], [NaN, -0, -Infinity, Infinity]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.and, andf);
}
}
function testFloat32x4div() {
function divf(a, b) {
return Math.fround(Math.fround(a) / Math.fround(b));
}
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.26, 2.03, 3.17, 4.59], [11.025, 17.3768, 29.1957, 46.4049]],
[[0, -0, Infinity, -Infinity], [1, 1, -Infinity, Infinity]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.div, divf);
}
}
function testFloat32x4mul() {
function mulf(a, b) {
return Math.fround(Math.fround(a) * Math.fround(b));
}
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.66, 2.57, 3.73, 4.12], [10.67, 20.68, 30.02, 40.58]],
[[NaN, -0, Infinity, -Infinity], [NaN, -0, -Infinity, 0]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.mul, mulf);
}
}
function testFloat32x4or() {
var orf = (function() {
var i = new Int32Array(3);
var f = new Float32Array(i.buffer);
return function(x, y) {
f[0] = x;
f[1] = y;
i[2] = i[0] | i[1];
return f[2];
};
})();
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.12, 2.39, 3.83, 4.57], [10.76, 20.41, 30.96, 40.23]],
[[NaN, -0, Infinity, -Infinity], [5, 5, -Infinity, Infinity]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.or, orf);
}
}
function testFloat32x4sub() {
function subf(a, b) {
return Math.fround(Math.fround(a) - Math.fround(b));
}
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.34, 2.95, 3.17, 4.29], [10.18, 20.43, 30.63, 40.38]],
[[NaN, -0, -Infinity, -Infinity], [NaN, -0, Infinity, -Infinity]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.sub, subf);
}
}
function testFloat32x4xor() {
var xorf = (function() {
var i = new Int32Array(3);
var f = new Float32Array(i.buffer);
return function(x, y) {
f[0] = x;
f[1] = y;
i[2] = i[0] ^ i[1];
return f[2];
};
})();
var vals = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[1.07, 2.62, 3.79, 4.15], [10.38, 20.47, 30.44, 40.16]],
[[NaN, -0, Infinity, -Infinity], [-0, Infinity, -Infinity, NaN]]
];
for (var [v,w] of vals) {
testBinaryFunc(float32x4(...v), float32x4(...w), float32x4.xor, xorf);
}
}
function testInt32x4add() {
function addi(a, b) {
return (a + b) | 0;
}
var valsExp = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN], [1, -1, 0, 0]]
];
for (var [v,w] of valsExp) {
testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.add, addi);
}
}
function testInt32x4and() {
function andi(a, b) {
return (a & b) | 0;
}
var valsExp = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN], [INT32_MIN, INT32_MAX, INT32_MAX, INT32_MIN]]
];
for (var [v,w] of valsExp) {
testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.and, andi);
}
}
function testInt32x4mul() {
function muli(x, y) {
return (x * y) | 0;
}
var valsExp = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN], [-1, -1, INT32_MIN, INT32_MIN]]
];
for (var [v,w] of valsExp) {
testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.mul, muli);
}
}
function testInt32x4or() {
function ori(a, b) {
return (a | b) | 0;
}
var valsExp = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN], [INT32_MIN, INT32_MAX, INT32_MAX, INT32_MIN]]
];
for (var [v,w] of valsExp) {
testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.or, ori);
}
}
function testInt32x4sub() {
function subi(a, b) {
return (a - b) | 0;
}
var valsExp = [
[[10, 20, 30, 40], [1, 2, 3, 4]],
[[INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN], [-1, 1, INT32_MAX, INT32_MIN]]
];
for (var [v,w] of valsExp) {
testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.sub, subi);
}
}
function testInt32x4xor() {
function xori(a, b) {
return (a ^ b) | 0;
}
var valsExp = [
[[1, 2, 3, 4], [10, 20, 30, 40]],
[[INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN], [INT32_MIN, INT32_MAX, INT32_MAX, INT32_MIN]]
];
for (var [v,w] of valsExp) {
testBinaryFunc(int32x4(...v), int32x4(...w), int32x4.xor, xori);
}
}
function test() {
testFloat32x4add();
testFloat32x4and();
testFloat32x4div();
testFloat32x4mul();
testFloat32x4or();
testFloat32x4sub();
testFloat32x4xor();
testInt32x4add();
testInt32x4and();
testInt32x4mul();
testInt32x4or();
testInt32x4sub();
testInt32x4xor();
if (typeof reportCompare === "function") {
reportCompare(true, true);
}
}
test();

Просмотреть файл

@ -1,43 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 add';
function addf(a, b) {
return Math.fround(Math.fround(a) + Math.fround(b));
}
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.add(a, b);
assertEq(c.x, 11);
assertEq(c.y, 22);
assertEq(c.z, 33);
assertEq(c.w, 44);
var d = float32x4(1.57, 2.27, 3.57, 4.19);
var e = float32x4(10.31, 20.49, 30.41, 40.72);
var f = SIMD.float32x4.add(d, e);
assertEq(f.x, addf(1.57, 10.31));
assertEq(f.y, addf(2.27, 20.49));
assertEq(f.z, addf(3.57, 30.41));
assertEq(f.w, addf(4.19, 40.72));
var g = float32x4(NaN, -0, Infinity, -Infinity);
var h = float32x4(0, -0, -Infinity, -Infinity);
var i = SIMD.float32x4.add(g, h);
assertEq(i.x, NaN);
assertEq(i.y, -0);
assertEq(i.z, NaN);
assertEq(i.w, -Infinity);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,51 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 996076;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 and';
var andf = (function() {
var i = new Int32Array(3);
var f = new Float32Array(i.buffer);
return function(x, y) {
f[0] = x;
f[1] = y;
i[2] = i[0] & i[1];
return f[2];
}
})();
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.and(a, b);
assertEq(c.x, andf(1, 10));
assertEq(c.y, andf(2, 20));
assertEq(c.z, andf(3, 30));
assertEq(c.w, andf(4, 40));
var d = float32x4(1.51, 2.98, 3.65, 4.34);
var e = float32x4(10.29, 20.12, 30.79, 40.41);
var f = SIMD.float32x4.and(d, e);
assertEq(f.x, andf(1.51, 10.29));
assertEq(f.y, andf(2.98, 20.12));
assertEq(f.z, andf(3.65, 30.79));
assertEq(f.w, andf(4.34, 40.41));
var g = float32x4(NaN, -0, Infinity, -Infinity);
var h = float32x4(NaN, -0, -Infinity, Infinity);
var i = SIMD.float32x4.and(g, h);
assertEq(i.x, NaN);
assertEq(i.y, -0);
assertEq(i.z, Infinity);
assertEq(i.w, Infinity);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,43 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 div';
function divf(a, b) {
return Math.fround(Math.fround(a) / Math.fround(b));
}
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.div(b, a);
assertEq(c.x, 10);
assertEq(c.y, 10);
assertEq(c.z, 10);
assertEq(c.w, 10);
var d = float32x4(1.26, 2.03, 3.17, 4.59);
var e = float32x4(11.025, 17.3768, 29.1957, 46.4049);
var f = SIMD.float32x4.div(e, d);
assertEq(f.x, divf(11.025, 1.26));
assertEq(f.y, divf(17.3768, 2.03));
assertEq(f.z, divf(29.1957, 3.17));
assertEq(f.w, divf(46.4049, 4.59));
var g = float32x4(0, -0, Infinity, -Infinity);
var h = float32x4(1, 1, -Infinity, Infinity);
var i = SIMD.float32x4.div(h, g);
assertEq(i.x, Infinity);
assertEq(i.y, -Infinity);
assertEq(i.z, NaN);
assertEq(i.w, NaN);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,43 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 mul';
function mulf(a, b) {
return Math.fround(Math.fround(a) * Math.fround(b));
}
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.mul(a, b);
assertEq(c.x, 10);
assertEq(c.y, 40);
assertEq(c.z, 90);
assertEq(c.w, 160);
var d = float32x4(1.66, 2.57, 3.73, 4.12);
var e = float32x4(10.67, 20.68, 30.02, 40.58);
var f = SIMD.float32x4.mul(d, e);
assertEq(f.x, mulf(1.66, 10.67));
assertEq(f.y, mulf(2.57, 20.68));
assertEq(f.z, mulf(3.73, 30.02));
assertEq(f.w, mulf(4.12, 40.58));
var g = float32x4(NaN, -0, Infinity, -Infinity);
var h = float32x4(NaN, -0, -Infinity, 0);
var i = SIMD.float32x4.mul(g, h);
assertEq(i.x, NaN);
assertEq(i.y, 0);
assertEq(i.z, -Infinity);
assertEq(i.w, NaN);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,51 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 996076;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 and';
var orf = (function() {
var i = new Int32Array(3);
var f = new Float32Array(i.buffer);
return function(x, y) {
f[0] = x;
f[1] = y;
i[2] = i[0] | i[1];
return f[2];
}
})();
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.or(a, b);
assertEq(c.x, orf(1, 10));
assertEq(c.y, orf(2, 20));
assertEq(c.z, orf(3, 30));
assertEq(c.w, orf(4, 40));
var d = float32x4(1.12, 2.39, 3.83, 4.57);
var e = float32x4(10.76, 20.41, 30.96, 40.23);
var f = SIMD.float32x4.or(d, e);
assertEq(f.x, orf(1.12, 10.76));
assertEq(f.y, orf(2.39, 20.41));
assertEq(f.z, orf(3.83, 30.96));
assertEq(f.w, orf(4.57, 40.23));
var g = float32x4(NaN, -0, Infinity, -Infinity);
var h = float32x4(5, 5, -Infinity, Infinity);
var i = SIMD.float32x4.or(g, h);
assertEq(i.x, orf(NaN, 5));
assertEq(i.y, orf(-0, 5));
assertEq(i.z, orf(Infinity, -Infinity));
assertEq(i.w, orf(-Infinity, Infinity));
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,44 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 sub';
function subf(a, b) {
return Math.fround(Math.fround(a) - Math.fround(b));
}
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.sub(b, a);
assertEq(c.x, 9);
assertEq(c.y, 18);
assertEq(c.z, 27);
assertEq(c.w, 36);
var d = float32x4(1.34, 2.95, 3.17, 4.29);
var e = float32x4(10.18, 20.43, 30.63, 40.38);
var f = SIMD.float32x4.sub(e, d);
assertEq(f.x, subf(10.18, 1.34));
assertEq(f.y, subf(20.43, 2.95));
assertEq(f.z, subf(30.63, 3.17));
assertEq(f.w, subf(40.38, 4.29));
var g = float32x4(NaN, -0, -Infinity, -Infinity);
var h = float32x4(NaN, -0, Infinity, -Infinity);
var i = SIMD.float32x4.sub(h, g);
assertEq(i.x, NaN);
assertEq(i.y, 0);
assertEq(i.z, Infinity);
assertEq(i.w, NaN);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,51 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 996076;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'float32x4 and';
var xorf = (function() {
var i = new Int32Array(3);
var f = new Float32Array(i.buffer);
return function(x, y) {
f[0] = x;
f[1] = y;
i[2] = i[0] ^ i[1];
return f[2];
}
})();
function test() {
print(BUGNUMBER + ": " + summary);
var a = float32x4(1, 2, 3, 4);
var b = float32x4(10, 20, 30, 40);
var c = SIMD.float32x4.xor(a, b);
assertEq(c.x, xorf(1, 10));
assertEq(c.y, xorf(2, 20));
assertEq(c.z, xorf(3, 30));
assertEq(c.w, xorf(4, 40));
var d = float32x4(1.07, 2.62, 3.79, 4.15);
var e = float32x4(10.38, 20.47, 30.44, 40.16);
var f = SIMD.float32x4.xor(d, e);
assertEq(f.x, xorf(1.07, 10.38));
assertEq(f.y, xorf(2.62, 20.47));
assertEq(f.z, xorf(3.79, 30.44));
assertEq(f.w, xorf(4.15, 40.16));
var g = float32x4(NaN, -0, Infinity, -Infinity);
var h = float32x4(-0, Infinity, -Infinity, NaN);
var i = SIMD.float32x4.xor(g, h);
assertEq(i.x, xorf(NaN, -0));
assertEq(i.y, xorf(-0, Infinity));
assertEq(i.z, xorf(Infinity, -Infinity));
assertEq(i.w, xorf(-Infinity, NaN));
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,35 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'int32x4 add';
function test() {
print(BUGNUMBER + ": " + summary);
var a = int32x4(1, 2, 3, 4);
var b = int32x4(10, 20, 30, 40);
var c = SIMD.int32x4.add(a, b);
assertEq(c.x, 11);
assertEq(c.y, 22);
assertEq(c.z, 33);
assertEq(c.w, 44);
var INT32_MAX = Math.pow(2, 31) - 1;
var INT32_MIN = -Math.pow(2, 31);
var d = int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN);
var e = int32x4(1, -1, 0, 0);
var f = SIMD.int32x4.add(d, e);
assertEq(f.x, INT32_MIN);
assertEq(f.y, INT32_MAX);
assertEq(f.z, INT32_MAX);
assertEq(f.w, INT32_MIN);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,35 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'int32x4 and';
function test() {
print(BUGNUMBER + ": " + summary);
var a = int32x4(1, 2, 3, 4);
var b = int32x4(10, 20, 30, 40);
var c = SIMD.int32x4.and(a, b);
assertEq(c.x, 0);
assertEq(c.y, 0);
assertEq(c.z, 2);
assertEq(c.w, 0);
var INT32_MAX = Math.pow(2, 31) - 1;
var INT32_MIN = -Math.pow(2, 31);
var d = int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN);
var e = int32x4(INT32_MIN, INT32_MAX, INT32_MAX, INT32_MIN);
var f = SIMD.int32x4.and(d, e);
assertEq(f.x, (INT32_MAX & INT32_MIN) | 0);
assertEq(f.y, (INT32_MIN & INT32_MAX) | 0);
assertEq(f.z, (INT32_MAX & INT32_MAX) | 0);
assertEq(f.w, (INT32_MIN & INT32_MIN) | 0);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,35 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'int32x4 mul';
function test() {
print(BUGNUMBER + ": " + summary);
var a = int32x4(1, 2, 3, 4);
var b = int32x4(10, 20, 30, 40);
var c = SIMD.int32x4.mul(a, b);
assertEq(c.x, 10);
assertEq(c.y, 40);
assertEq(c.z, 90);
assertEq(c.w, 160);
var INT32_MAX = Math.pow(2, 31) - 1;
var INT32_MIN = -Math.pow(2, 31);
var d = int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN);
var e = int32x4(-1, -1, INT32_MIN, INT32_MIN);
var f = SIMD.int32x4.mul(d, e);
assertEq(f.x, (INT32_MAX * -1) | 0);
assertEq(f.y, (INT32_MIN * -1) | 0);
assertEq(f.z, (INT32_MAX * INT32_MIN) | 0);
assertEq(f.w, (INT32_MIN * INT32_MIN) | 0);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,35 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'int32x4 or';
function test() {
print(BUGNUMBER + ": " + summary);
var a = int32x4(1, 2, 3, 4);
var b = int32x4(10, 20, 30, 40);
var c = SIMD.int32x4.or(a, b);
assertEq(c.x, 11);
assertEq(c.y, 22);
assertEq(c.z, 31);
assertEq(c.w, 44);
var INT32_MAX = Math.pow(2, 31) - 1;
var INT32_MIN = -Math.pow(2, 31);
var d = int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN);
var e = int32x4(INT32_MIN, INT32_MAX, INT32_MAX, INT32_MIN);
var f = SIMD.int32x4.or(d, e);
assertEq(f.x, (INT32_MAX | INT32_MIN) | 0);
assertEq(f.y, (INT32_MIN | INT32_MAX) | 0);
assertEq(f.z, (INT32_MAX | INT32_MAX) | 0);
assertEq(f.w, (INT32_MIN | INT32_MIN) | 0);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,35 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'int32x4 sub';
function test() {
print(BUGNUMBER + ": " + summary);
var a = int32x4(1, 2, 3, 4);
var b = int32x4(10, 20, 30, 40);
var c = SIMD.int32x4.sub(b,a);
assertEq(c.x, 9);
assertEq(c.y, 18);
assertEq(c.z, 27);
assertEq(c.w, 36);
var INT32_MAX = Math.pow(2, 31) - 1;
var INT32_MIN = -Math.pow(2, 31);
var d = int32x4(-1, 1, INT32_MAX, INT32_MIN);
var e = int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN);
var f = SIMD.int32x4.sub(e, d);
assertEq(f.x, (INT32_MAX - -1) | 0);
assertEq(f.y, (INT32_MIN - 1) | 0);
assertEq(f.z, 0);
assertEq(f.w, 0);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();

Просмотреть файл

@ -1,35 +0,0 @@
// |reftest| skip-if(!this.hasOwnProperty("SIMD"))
var BUGNUMBER = 946042;
var float32x4 = SIMD.float32x4;
var int32x4 = SIMD.int32x4;
var summary = 'int32x4 xor';
function test() {
print(BUGNUMBER + ": " + summary);
var a = int32x4(1, 2, 3, 4);
var b = int32x4(10, 20, 30, 40);
var c = SIMD.int32x4.xor(a, b);
assertEq(c.x, 11);
assertEq(c.y, 22);
assertEq(c.z, 29);
assertEq(c.w, 44);
var INT32_MAX = Math.pow(2, 31) - 1;
var INT32_MIN = -Math.pow(2, 31);
var d = int32x4(INT32_MAX, INT32_MIN, INT32_MAX, INT32_MIN);
var e = int32x4(INT32_MIN, INT32_MAX, INT32_MAX, INT32_MIN);
var f = SIMD.int32x4.xor(d, e);
assertEq(f.x, (INT32_MAX ^ INT32_MIN) | 0);
assertEq(f.y, (INT32_MIN ^ INT32_MAX) | 0);
assertEq(f.z, (INT32_MAX ^ INT32_MAX) | 0);
assertEq(f.w, (INT32_MIN ^ INT32_MIN) | 0);
if (typeof reportCompare === "function")
reportCompare(true, true);
}
test();