зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155211 - SIMD: rename lane mutators - load/store. r=bbouvier
--HG-- extra : rebase_source : 680e0dfa297d8a3c00f20cec254847f9df0d5608
This commit is contained in:
Родитель
c8c50385b3
Коммит
7e34e69202
|
@ -5984,19 +5984,19 @@ CheckSimdOperationCall(FunctionCompiler& f, ParseNode* call, const ModuleCompile
|
|||
|
||||
case AsmJSSimdOperation_load:
|
||||
return CheckSimdLoad(f, call, opType, 4, def, type);
|
||||
case AsmJSSimdOperation_loadX:
|
||||
case AsmJSSimdOperation_load1:
|
||||
return CheckSimdLoad(f, call, opType, 1, def, type);
|
||||
case AsmJSSimdOperation_loadXY:
|
||||
case AsmJSSimdOperation_load2:
|
||||
return CheckSimdLoad(f, call, opType, 2, def, type);
|
||||
case AsmJSSimdOperation_loadXYZ:
|
||||
case AsmJSSimdOperation_load3:
|
||||
return CheckSimdLoad(f, call, opType, 3, def, type);
|
||||
case AsmJSSimdOperation_store:
|
||||
return CheckSimdStore(f, call, opType, 4, def, type);
|
||||
case AsmJSSimdOperation_storeX:
|
||||
case AsmJSSimdOperation_store1:
|
||||
return CheckSimdStore(f, call, opType, 1, def, type);
|
||||
case AsmJSSimdOperation_storeXY:
|
||||
case AsmJSSimdOperation_store2:
|
||||
return CheckSimdStore(f, call, opType, 2, def, type);
|
||||
case AsmJSSimdOperation_storeXYZ:
|
||||
case AsmJSSimdOperation_store3:
|
||||
return CheckSimdStore(f, call, opType, 3, def, type);
|
||||
|
||||
case AsmJSSimdOperation_bitselect:
|
||||
|
|
|
@ -43,10 +43,10 @@
|
|||
V(greaterThanOrEqual, (CompareFunc<Float32x4, GreaterThanOrEqual>), 2) \
|
||||
V(lessThan, (CompareFunc<Float32x4, LessThan>), 2) \
|
||||
V(lessThanOrEqual, (CompareFunc<Float32x4, LessThanOrEqual>), 2) \
|
||||
V(load, (Load<Float32x4, 4>), 2) \
|
||||
V(loadXYZ, (Load<Float32x4, 3>), 2) \
|
||||
V(loadXY, (Load<Float32x4, 2>), 2) \
|
||||
V(loadX, (Load<Float32x4, 1>), 2) \
|
||||
V(load, (Load<Float32x4, 4>), 2) \
|
||||
V(load3, (Load<Float32x4, 3>), 2) \
|
||||
V(load2, (Load<Float32x4, 2>), 2) \
|
||||
V(load1, (Load<Float32x4, 1>), 2) \
|
||||
V(max, (BinaryFunc<Float32x4, Maximum, Float32x4>), 2) \
|
||||
V(maxNum, (BinaryFunc<Float32x4, MaxNum, Float32x4>), 2) \
|
||||
V(min, (BinaryFunc<Float32x4, Minimum, Float32x4>), 2) \
|
||||
|
@ -54,10 +54,10 @@
|
|||
V(mul, (BinaryFunc<Float32x4, Mul, Float32x4>), 2) \
|
||||
V(notEqual, (CompareFunc<Float32x4, NotEqual>), 2) \
|
||||
V(or, (CoercedBinaryFunc<Float32x4, Int32x4, Or, Float32x4>), 2) \
|
||||
V(store, (Store<Float32x4, 4>), 3) \
|
||||
V(storeXYZ, (Store<Float32x4, 3>), 3) \
|
||||
V(storeXY, (Store<Float32x4, 2>), 3) \
|
||||
V(storeX, (Store<Float32x4, 1>), 3) \
|
||||
V(store, (Store<Float32x4, 4>), 3) \
|
||||
V(store3, (Store<Float32x4, 3>), 3) \
|
||||
V(store2, (Store<Float32x4, 2>), 3) \
|
||||
V(store1, (Store<Float32x4, 1>), 3) \
|
||||
V(sub, (BinaryFunc<Float32x4, Sub, Float32x4>), 2) \
|
||||
V(withX, (FuncWith<Float32x4, WithX>), 2) \
|
||||
V(withY, (FuncWith<Float32x4, WithY>), 2) \
|
||||
|
@ -101,16 +101,16 @@
|
|||
V(greaterThanOrEqual, (CompareFunc<Float64x2, GreaterThanOrEqual>), 2) \
|
||||
V(lessThan, (CompareFunc<Float64x2, LessThan>), 2) \
|
||||
V(lessThanOrEqual, (CompareFunc<Float64x2, LessThanOrEqual>), 2) \
|
||||
V(load, (Load<Float64x2, 2>), 2) \
|
||||
V(loadX, (Load<Float64x2, 1>), 2) \
|
||||
V(load, (Load<Float64x2, 2>), 2) \
|
||||
V(load1, (Load<Float64x2, 1>), 2) \
|
||||
V(max, (BinaryFunc<Float64x2, Maximum, Float64x2>), 2) \
|
||||
V(maxNum, (BinaryFunc<Float64x2, MaxNum, Float64x2>), 2) \
|
||||
V(min, (BinaryFunc<Float64x2, Minimum, Float64x2>), 2) \
|
||||
V(minNum, (BinaryFunc<Float64x2, MinNum, Float64x2>), 2) \
|
||||
V(mul, (BinaryFunc<Float64x2, Mul, Float64x2>), 2) \
|
||||
V(notEqual, (CompareFunc<Float64x2, NotEqual>), 2) \
|
||||
V(store, (Store<Float64x2, 2>), 3) \
|
||||
V(storeX, (Store<Float64x2, 1>), 3) \
|
||||
V(store, (Store<Float64x2, 2>), 3) \
|
||||
V(store1, (Store<Float64x2, 1>), 3) \
|
||||
V(sub, (BinaryFunc<Float64x2, Sub, Float64x2>), 2) \
|
||||
V(withX, (FuncWith<Float64x2, WithX>), 2) \
|
||||
V(withY, (FuncWith<Float64x2, WithY>), 2)
|
||||
|
@ -148,10 +148,10 @@
|
|||
V(greaterThanOrEqual, (CompareFunc<Int32x4, GreaterThanOrEqual>), 2) \
|
||||
V(lessThan, (CompareFunc<Int32x4, LessThan>), 2) \
|
||||
V(lessThanOrEqual, (CompareFunc<Int32x4, LessThanOrEqual>), 2) \
|
||||
V(load, (Load<Int32x4, 4>), 2) \
|
||||
V(loadXYZ, (Load<Int32x4, 3>), 2) \
|
||||
V(loadXY, (Load<Int32x4, 2>), 2) \
|
||||
V(loadX, (Load<Int32x4, 1>), 2) \
|
||||
V(load, (Load<Int32x4, 4>), 2) \
|
||||
V(load3, (Load<Int32x4, 3>), 2) \
|
||||
V(load2, (Load<Int32x4, 2>), 2) \
|
||||
V(load1, (Load<Int32x4, 1>), 2) \
|
||||
V(mul, (BinaryFunc<Int32x4, Mul, Int32x4>), 2) \
|
||||
V(notEqual, (CompareFunc<Int32x4, NotEqual>), 2) \
|
||||
V(or, (BinaryFunc<Int32x4, Or, Int32x4>), 2) \
|
||||
|
@ -159,10 +159,10 @@
|
|||
V(shiftLeftByScalar, (Int32x4BinaryScalar<ShiftLeft>), 2) \
|
||||
V(shiftRightArithmeticByScalar, (Int32x4BinaryScalar<ShiftRightArithmetic>), 2) \
|
||||
V(shiftRightLogicalByScalar, (Int32x4BinaryScalar<ShiftRightLogical>), 2) \
|
||||
V(store, (Store<Int32x4, 4>), 3) \
|
||||
V(storeXYZ, (Store<Int32x4, 3>), 3) \
|
||||
V(storeXY, (Store<Int32x4, 2>), 3) \
|
||||
V(storeX, (Store<Int32x4, 1>), 3) \
|
||||
V(store, (Store<Int32x4, 4>), 3) \
|
||||
V(store3, (Store<Int32x4, 3>), 3) \
|
||||
V(store2, (Store<Int32x4, 2>), 3) \
|
||||
V(store1, (Store<Int32x4, 1>), 3) \
|
||||
V(withX, (FuncWith<Int32x4, WithX>), 2) \
|
||||
V(withY, (FuncWith<Int32x4, WithY>), 2) \
|
||||
V(withZ, (FuncWith<Int32x4, WithZ>), 2) \
|
||||
|
@ -244,13 +244,13 @@
|
|||
_(swizzle) \
|
||||
_(shuffle) \
|
||||
_(load) \
|
||||
_(loadX) \
|
||||
_(loadXY) \
|
||||
_(loadXYZ) \
|
||||
_(load1) \
|
||||
_(load2) \
|
||||
_(load3) \
|
||||
_(store) \
|
||||
_(storeX) \
|
||||
_(storeXY) \
|
||||
_(storeXYZ) \
|
||||
_(store1) \
|
||||
_(store2) \
|
||||
_(store3) \
|
||||
_(check)
|
||||
#define ION_ONLY_INT32X4_SIMD_OP(_) \
|
||||
_(bool)
|
||||
|
|
|
@ -33,65 +33,65 @@ function f() {
|
|||
assertEqX4(SIMD.float32x4.load(u8, (16 << 2) - (4 << 2)), [13,14,15,16]);
|
||||
}
|
||||
|
||||
function testLoadX() {
|
||||
assertEqX4(SIMD.float32x4.loadX(f64, 0), [1,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(f32, 1), [2,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(i32, 2), [3,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(i16, 3 << 1), [4,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(u16, 4 << 1), [5,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(i8 , 5 << 2), [6,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(u8 , 6 << 2), [7,0,0,0]);
|
||||
function testLoad1() {
|
||||
assertEqX4(SIMD.float32x4.load1(f64, 0), [1,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(f32, 1), [2,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(i32, 2), [3,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(i16, 3 << 1), [4,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(u16, 4 << 1), [5,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(i8 , 5 << 2), [6,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(u8 , 6 << 2), [7,0,0,0]);
|
||||
|
||||
assertEqX4(SIMD.float32x4.loadX(f64, (16 >> 1) - (4 >> 1)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(f32, 16 - 4), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(i32, 16 - 4), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(i16, (16 << 1) - (4 << 1)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(u16, (16 << 1) - (4 << 1)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(i8, (16 << 2) - (4 << 2)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadX(u8, (16 << 2) - (4 << 2)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(f64, (16 >> 1) - (4 >> 1)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(f32, 16 - 4), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(i32, 16 - 4), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(i16, (16 << 1) - (4 << 1)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(u16, (16 << 1) - (4 << 1)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(i8, (16 << 2) - (4 << 2)), [13,0,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load1(u8, (16 << 2) - (4 << 2)), [13,0,0,0]);
|
||||
}
|
||||
|
||||
function testLoadXY() {
|
||||
assertEqX4(SIMD.float32x4.loadXY(f64, 0), [1,2,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(f32, 1), [2,3,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(i32, 2), [3,4,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(i16, 3 << 1), [4,5,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(u16, 4 << 1), [5,6,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(i8 , 5 << 2), [6,7,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(u8 , 6 << 2), [7,8,0,0]);
|
||||
function testLoad2() {
|
||||
assertEqX4(SIMD.float32x4.load2(f64, 0), [1,2,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(f32, 1), [2,3,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(i32, 2), [3,4,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(i16, 3 << 1), [4,5,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(u16, 4 << 1), [5,6,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(i8 , 5 << 2), [6,7,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(u8 , 6 << 2), [7,8,0,0]);
|
||||
|
||||
assertEqX4(SIMD.float32x4.loadXY(f64, (16 >> 1) - (4 >> 1)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(f32, 16 - 4), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(i32, 16 - 4), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(i16, (16 << 1) - (4 << 1)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(u16, (16 << 1) - (4 << 1)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(i8, (16 << 2) - (4 << 2)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXY(u8, (16 << 2) - (4 << 2)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(f64, (16 >> 1) - (4 >> 1)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(f32, 16 - 4), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(i32, 16 - 4), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(i16, (16 << 1) - (4 << 1)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(u16, (16 << 1) - (4 << 1)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(i8, (16 << 2) - (4 << 2)), [13,14,0,0]);
|
||||
assertEqX4(SIMD.float32x4.load2(u8, (16 << 2) - (4 << 2)), [13,14,0,0]);
|
||||
}
|
||||
|
||||
function testLoadXYZ() {
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(f64, 0), [1,2,3,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(f32, 1), [2,3,4,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(i32, 2), [3,4,5,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(i16, 3 << 1), [4,5,6,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(u16, 4 << 1), [5,6,7,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(i8 , 5 << 2), [6,7,8,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(u8 , 6 << 2), [7,8,9,0]);
|
||||
function testLoad3() {
|
||||
assertEqX4(SIMD.float32x4.load3(f64, 0), [1,2,3,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(f32, 1), [2,3,4,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(i32, 2), [3,4,5,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(i16, 3 << 1), [4,5,6,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(u16, 4 << 1), [5,6,7,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(i8 , 5 << 2), [6,7,8,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(u8 , 6 << 2), [7,8,9,0]);
|
||||
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(f64, (16 >> 1) - (4 >> 1)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(f32, 16 - 4), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(i32, 16 - 4), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(i16, (16 << 1) - (4 << 1)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(u16, (16 << 1) - (4 << 1)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(i8, (16 << 2) - (4 << 2)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.loadXYZ(u8, (16 << 2) - (4 << 2)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(f64, (16 >> 1) - (4 >> 1)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(f32, 16 - 4), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(i32, 16 - 4), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(i16, (16 << 1) - (4 << 1)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(u16, (16 << 1) - (4 << 1)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(i8, (16 << 2) - (4 << 2)), [13,14,15,0]);
|
||||
assertEqX4(SIMD.float32x4.load3(u8, (16 << 2) - (4 << 2)), [13,14,15,0]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 150; i++) {
|
||||
testLoad();
|
||||
testLoadX();
|
||||
testLoadXY();
|
||||
testLoadXYZ();
|
||||
testLoad1();
|
||||
testLoad2();
|
||||
testLoad3();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -48,68 +48,68 @@ function f() {
|
|||
check(4);
|
||||
}
|
||||
|
||||
function testStoreX() {
|
||||
SIMD.float32x4.storeX(f64, 0, f4);
|
||||
function testStore1() {
|
||||
SIMD.float32x4.store1(f64, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(f32, 0, f4);
|
||||
SIMD.float32x4.store1(f32, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(i32, 0, f4);
|
||||
SIMD.float32x4.store1(i32, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(u32, 0, f4);
|
||||
SIMD.float32x4.store1(u32, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(i16, 0, f4);
|
||||
SIMD.float32x4.store1(i16, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(u16, 0, f4);
|
||||
SIMD.float32x4.store1(u16, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(i8, 0, f4);
|
||||
SIMD.float32x4.store1(i8, 0, f4);
|
||||
check(1);
|
||||
SIMD.float32x4.storeX(u8, 0, f4);
|
||||
SIMD.float32x4.store1(u8, 0, f4);
|
||||
check(1);
|
||||
}
|
||||
|
||||
function testStoreXY() {
|
||||
SIMD.float32x4.storeXY(f64, 0, f4);
|
||||
function testStore2() {
|
||||
SIMD.float32x4.store2(f64, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(f32, 0, f4);
|
||||
SIMD.float32x4.store2(f32, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(i32, 0, f4);
|
||||
SIMD.float32x4.store2(i32, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(u32, 0, f4);
|
||||
SIMD.float32x4.store2(u32, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(i16, 0, f4);
|
||||
SIMD.float32x4.store2(i16, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(u16, 0, f4);
|
||||
SIMD.float32x4.store2(u16, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(i8, 0, f4);
|
||||
SIMD.float32x4.store2(i8, 0, f4);
|
||||
check(2);
|
||||
SIMD.float32x4.storeXY(u8, 0, f4);
|
||||
SIMD.float32x4.store2(u8, 0, f4);
|
||||
check(2);
|
||||
}
|
||||
|
||||
function testStoreXYZ() {
|
||||
SIMD.float32x4.storeXYZ(f64, 0, f4);
|
||||
function testStore3() {
|
||||
SIMD.float32x4.store3(f64, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(f32, 0, f4);
|
||||
SIMD.float32x4.store3(f32, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(i32, 0, f4);
|
||||
SIMD.float32x4.store3(i32, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(u32, 0, f4);
|
||||
SIMD.float32x4.store3(u32, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(i16, 0, f4);
|
||||
SIMD.float32x4.store3(i16, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(u16, 0, f4);
|
||||
SIMD.float32x4.store3(u16, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(i8, 0, f4);
|
||||
SIMD.float32x4.store3(i8, 0, f4);
|
||||
check(3);
|
||||
SIMD.float32x4.storeXYZ(u8, 0, f4);
|
||||
SIMD.float32x4.store3(u8, 0, f4);
|
||||
check(3);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 150; i++) {
|
||||
testStore();
|
||||
testStoreX();
|
||||
testStoreXY();
|
||||
testStoreXYZ();
|
||||
testStore1();
|
||||
testStore2();
|
||||
testStore3();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -141,4 +141,3 @@ print('Testing range checks...');
|
|||
testBailout(-1);
|
||||
testBailout(-15);
|
||||
testBailout(12 * 4 + 1);
|
||||
|
||||
|
|
|
@ -280,45 +280,45 @@ function MakeCodeFor(typeName) {
|
|||
var type = glob.SIMD.${typeName};
|
||||
var c = type.check;
|
||||
|
||||
var lx = type.loadX;
|
||||
var lxy = type.loadXY;
|
||||
var lxyz = type.loadXYZ;
|
||||
var l1 = type.load1;
|
||||
var l2 = type.load2;
|
||||
var l3 = type.load3;
|
||||
|
||||
var sx = type.storeX;
|
||||
var sxy = type.storeXY;
|
||||
var sxyz = type.storeXYZ;
|
||||
var s1 = type.store1;
|
||||
var s2 = type.store2;
|
||||
var s3 = type.store3;
|
||||
|
||||
var u8 = new glob.Uint8Array(heap);
|
||||
|
||||
function loadX(i) { i=i|0; return lx(u8, i); }
|
||||
function loadXY(i) { i=i|0; return lxy(u8, i); }
|
||||
function loadXYZ(i) { i=i|0; return lxyz(u8, i); }
|
||||
function load1(i) { i=i|0; return l1(u8, i); }
|
||||
function load2(i) { i=i|0; return l2(u8, i); }
|
||||
function load3(i) { i=i|0; return l3(u8, i); }
|
||||
|
||||
function loadCstX() { return lx(u8, 41 << 2); }
|
||||
function loadCstXY() { return lxy(u8, 41 << 2); }
|
||||
function loadCstXYZ() { return lxyz(u8, 41 << 2); }
|
||||
function loadCst1() { return l1(u8, 41 << 2); }
|
||||
function loadCst2() { return l2(u8, 41 << 2); }
|
||||
function loadCst3() { return l3(u8, 41 << 2); }
|
||||
|
||||
function storeX(i, x) { i=i|0; x=c(x); return sx(u8, i, x); }
|
||||
function storeXY(i, x) { i=i|0; x=c(x); return sxy(u8, i, x); }
|
||||
function storeXYZ(i, x) { i=i|0; x=c(x); return sxyz(u8, i, x); }
|
||||
function store1(i, x) { i=i|0; x=c(x); return s1(u8, i, x); }
|
||||
function store2(i, x) { i=i|0; x=c(x); return s2(u8, i, x); }
|
||||
function store3(i, x) { i=i|0; x=c(x); return s3(u8, i, x); }
|
||||
|
||||
function storeCstX(x) { x=c(x); return sx(u8, 41 << 2, x); }
|
||||
function storeCstXY(x) { x=c(x); return sxy(u8, 41 << 2, x); }
|
||||
function storeCstXYZ(x) { x=c(x); return sxyz(u8, 41 << 2, x); }
|
||||
function storeCst1(x) { x=c(x); return s1(u8, 41 << 2, x); }
|
||||
function storeCst2(x) { x=c(x); return s2(u8, 41 << 2, x); }
|
||||
function storeCst3(x) { x=c(x); return s3(u8, 41 << 2, x); }
|
||||
|
||||
return {
|
||||
loadX: loadX,
|
||||
loadXY: loadXY,
|
||||
loadXYZ: loadXYZ,
|
||||
loadCstX: loadCstX,
|
||||
loadCstXY: loadCstXY,
|
||||
loadCstXYZ: loadCstXYZ,
|
||||
storeX: storeX,
|
||||
storeXY: storeXY,
|
||||
storeXYZ: storeXYZ,
|
||||
storeCstX: storeCstX,
|
||||
storeCstXY: storeCstXY,
|
||||
storeCstXYZ: storeCstXYZ,
|
||||
load1: load1,
|
||||
load2: load2,
|
||||
load3: load3,
|
||||
loadCst1: loadCst1,
|
||||
loadCst2: loadCst2,
|
||||
loadCst3: loadCst3,
|
||||
store1: store1,
|
||||
store2: store2,
|
||||
store3: store3,
|
||||
storeCst1: storeCst1,
|
||||
storeCst2: storeCst2,
|
||||
storeCst3: storeCst3,
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
@ -336,45 +336,45 @@ function TestPartialLoads(m, typedArray, x, y, z, w) {
|
|||
|
||||
// Test correct loads
|
||||
var i = 0, j = 0; // i in elems, j in bytes
|
||||
assertEqX4(m.loadX(j), [x(i), 0, 0, 0]);
|
||||
assertEqX4(m.loadXY(j), [x(i), y(i), 0, 0]);
|
||||
assertEqX4(m.loadXYZ(j), [x(i), y(i), z(i), 0]);
|
||||
assertEqX4(m.load1(j), [x(i), 0, 0, 0]);
|
||||
assertEqX4(m.load2(j), [x(i), y(i), 0, 0]);
|
||||
assertEqX4(m.load3(j), [x(i), y(i), z(i), 0]);
|
||||
|
||||
j += 4;
|
||||
assertEqX4(m.loadX(j), [y(i), 0, 0, 0]);
|
||||
assertEqX4(m.loadXY(j), [y(i), z(i), 0, 0]);
|
||||
assertEqX4(m.loadXYZ(j), [y(i), z(i), w(i), 0]);
|
||||
assertEqX4(m.load1(j), [y(i), 0, 0, 0]);
|
||||
assertEqX4(m.load2(j), [y(i), z(i), 0, 0]);
|
||||
assertEqX4(m.load3(j), [y(i), z(i), w(i), 0]);
|
||||
|
||||
j += 4;
|
||||
assertEqX4(m.loadX(j), [z(i), 0, 0, 0]);
|
||||
assertEqX4(m.loadXY(j), [z(i), w(i), 0, 0]);
|
||||
assertEqX4(m.loadXYZ(j), [z(i), w(i), x(i+4), 0]);
|
||||
assertEqX4(m.load1(j), [z(i), 0, 0, 0]);
|
||||
assertEqX4(m.load2(j), [z(i), w(i), 0, 0]);
|
||||
assertEqX4(m.load3(j), [z(i), w(i), x(i+4), 0]);
|
||||
|
||||
j += 4;
|
||||
assertEqX4(m.loadX(j), [w(i), 0, 0, 0]);
|
||||
assertEqX4(m.loadXY(j), [w(i), x(i+4), 0, 0]);
|
||||
assertEqX4(m.loadXYZ(j), [w(i), x(i+4), y(i+4), 0]);
|
||||
assertEqX4(m.load1(j), [w(i), 0, 0, 0]);
|
||||
assertEqX4(m.load2(j), [w(i), x(i+4), 0, 0]);
|
||||
assertEqX4(m.load3(j), [w(i), x(i+4), y(i+4), 0]);
|
||||
|
||||
j += 4;
|
||||
i += 4;
|
||||
assertEqX4(m.loadX(j), [x(i), 0, 0, 0]);
|
||||
assertEqX4(m.loadXY(j), [x(i), y(i), 0, 0]);
|
||||
assertEqX4(m.loadXYZ(j), [x(i), y(i), z(i), 0]);
|
||||
assertEqX4(m.load1(j), [x(i), 0, 0, 0]);
|
||||
assertEqX4(m.load2(j), [x(i), y(i), 0, 0]);
|
||||
assertEqX4(m.load3(j), [x(i), y(i), z(i), 0]);
|
||||
|
||||
// Test loads with constant indexes (41)
|
||||
assertEqX4(m.loadCstX(), [y(40), 0, 0, 0]);
|
||||
assertEqX4(m.loadCstXY(), [y(40), z(40), 0, 0]);
|
||||
assertEqX4(m.loadCstXYZ(), [y(40), z(40), w(40), 0]);
|
||||
assertEqX4(m.loadCst1(), [y(40), 0, 0, 0]);
|
||||
assertEqX4(m.loadCst2(), [y(40), z(40), 0, 0]);
|
||||
assertEqX4(m.loadCst3(), [y(40), z(40), w(40), 0]);
|
||||
|
||||
// Test limit and OOB accesses
|
||||
assertEqX4(m.loadX((SIZE - 1) << 2), [w(SIZE - 4), 0, 0, 0]);
|
||||
assertThrowsInstanceOf(() => m.loadX(((SIZE - 1) << 2) + 1), RangeError);
|
||||
assertEqX4(m.load1((SIZE - 1) << 2), [w(SIZE - 4), 0, 0, 0]);
|
||||
assertThrowsInstanceOf(() => m.load1(((SIZE - 1) << 2) + 1), RangeError);
|
||||
|
||||
assertEqX4(m.loadXY((SIZE - 2) << 2), [z(SIZE - 4), w(SIZE - 4), 0, 0]);
|
||||
assertThrowsInstanceOf(() => m.loadXY(((SIZE - 2) << 2) + 1), RangeError);
|
||||
assertEqX4(m.load2((SIZE - 2) << 2), [z(SIZE - 4), w(SIZE - 4), 0, 0]);
|
||||
assertThrowsInstanceOf(() => m.load2(((SIZE - 2) << 2) + 1), RangeError);
|
||||
|
||||
assertEqX4(m.loadXYZ((SIZE - 3) << 2), [y(SIZE - 4), z(SIZE - 4), w(SIZE - 4), 0]);
|
||||
assertThrowsInstanceOf(() => m.loadXYZ(((SIZE - 3) << 2) + 1), RangeError);
|
||||
assertEqX4(m.load3((SIZE - 3) << 2), [y(SIZE - 4), z(SIZE - 4), w(SIZE - 4), 0]);
|
||||
assertThrowsInstanceOf(() => m.load3(((SIZE - 3) << 2) + 1), RangeError);
|
||||
}
|
||||
|
||||
// Partial stores
|
||||
|
@ -390,16 +390,16 @@ function TestPartialStores(m, typedArray, typeName, x, y, z, w) {
|
|||
assertEq(typedArray[i], i + 1);
|
||||
}
|
||||
|
||||
function TestStoreX(i) {
|
||||
m.storeX(i, val);
|
||||
function TestStore1(i) {
|
||||
m.store1(i, val);
|
||||
CheckNotModified(0, i >> 2);
|
||||
assertEq(typedArray[i >> 2], x);
|
||||
CheckNotModified((i >> 2) + 1, SIZE);
|
||||
typedArray[i >> 2] = (i >> 2) + 1;
|
||||
}
|
||||
|
||||
function TestStoreXY(i) {
|
||||
m.storeXY(i, val);
|
||||
function TestStore2(i) {
|
||||
m.store2(i, val);
|
||||
CheckNotModified(0, i >> 2);
|
||||
assertEq(typedArray[i >> 2], x);
|
||||
assertEq(typedArray[(i >> 2) + 1], y);
|
||||
|
@ -408,8 +408,8 @@ function TestPartialStores(m, typedArray, typeName, x, y, z, w) {
|
|||
typedArray[(i >> 2) + 1] = (i >> 2) + 2;
|
||||
}
|
||||
|
||||
function TestStoreXYZ(i) {
|
||||
m.storeXYZ(i, val);
|
||||
function TestStore3(i) {
|
||||
m.store3(i, val);
|
||||
CheckNotModified(0, i >> 2);
|
||||
assertEq(typedArray[i >> 2], x);
|
||||
assertEq(typedArray[(i >> 2) + 1], y);
|
||||
|
@ -427,48 +427,48 @@ function TestPartialStores(m, typedArray, typeName, x, y, z, w) {
|
|||
|
||||
Reset();
|
||||
|
||||
TestStoreX(0);
|
||||
TestStoreX(1 << 2);
|
||||
TestStoreX(2 << 2);
|
||||
TestStoreX(3 << 2);
|
||||
TestStoreX(1337 << 2);
|
||||
TestStore1(0);
|
||||
TestStore1(1 << 2);
|
||||
TestStore1(2 << 2);
|
||||
TestStore1(3 << 2);
|
||||
TestStore1(1337 << 2);
|
||||
|
||||
var i = (SIZE - 1) << 2;
|
||||
TestStoreX(i);
|
||||
TestOOBStore(() => m.storeX(i + 1, val));
|
||||
TestOOBStore(() => m.storeX(-1, val));
|
||||
TestStore1(i);
|
||||
TestOOBStore(() => m.store1(i + 1, val));
|
||||
TestOOBStore(() => m.store1(-1, val));
|
||||
|
||||
TestStoreXY(0);
|
||||
TestStoreXY(1 << 2);
|
||||
TestStoreXY(2 << 2);
|
||||
TestStoreXY(3 << 2);
|
||||
TestStoreXY(1337 << 2);
|
||||
TestStore2(0);
|
||||
TestStore2(1 << 2);
|
||||
TestStore2(2 << 2);
|
||||
TestStore2(3 << 2);
|
||||
TestStore2(1337 << 2);
|
||||
|
||||
var i = (SIZE - 2) << 2;
|
||||
TestStoreXY(i);
|
||||
TestOOBStore(() => m.storeXY(i + 1, val));
|
||||
TestOOBStore(() => m.storeXY(-1, val));
|
||||
TestStore2(i);
|
||||
TestOOBStore(() => m.store2(i + 1, val));
|
||||
TestOOBStore(() => m.store2(-1, val));
|
||||
|
||||
TestStoreXYZ(0);
|
||||
TestStoreXYZ(1 << 2);
|
||||
TestStoreXYZ(2 << 2);
|
||||
TestStoreXYZ(3 << 2);
|
||||
TestStoreXYZ(1337 << 2);
|
||||
TestStore3(0);
|
||||
TestStore3(1 << 2);
|
||||
TestStore3(2 << 2);
|
||||
TestStore3(3 << 2);
|
||||
TestStore3(1337 << 2);
|
||||
|
||||
var i = (SIZE - 3) << 2;
|
||||
TestStoreXYZ(i);
|
||||
TestOOBStore(() => m.storeXYZ(i + 1, val));
|
||||
TestOOBStore(() => m.storeXYZ(-1, val));
|
||||
TestOOBStore(() => m.storeXYZ(-9, val));
|
||||
TestStore3(i);
|
||||
TestOOBStore(() => m.store3(i + 1, val));
|
||||
TestOOBStore(() => m.store3(-1, val));
|
||||
TestOOBStore(() => m.store3(-9, val));
|
||||
|
||||
// Constant indexes (41)
|
||||
m.storeCstX(val);
|
||||
m.storeCst1(val);
|
||||
CheckNotModified(0, 41);
|
||||
assertEq(typedArray[41], x);
|
||||
CheckNotModified(42, SIZE);
|
||||
typedArray[41] = 42;
|
||||
|
||||
m.storeCstXY(val);
|
||||
m.storeCst2(val);
|
||||
CheckNotModified(0, 41);
|
||||
assertEq(typedArray[41], x);
|
||||
assertEq(typedArray[42], y);
|
||||
|
@ -476,7 +476,7 @@ function TestPartialStores(m, typedArray, typeName, x, y, z, w) {
|
|||
typedArray[41] = 42;
|
||||
typedArray[42] = 43;
|
||||
|
||||
m.storeCstXYZ(val);
|
||||
m.storeCst3(val);
|
||||
CheckNotModified(0, 41);
|
||||
assertEq(typedArray[41], x);
|
||||
assertEq(typedArray[42], y);
|
||||
|
|
|
@ -104,81 +104,81 @@ function testSimdX4(ctor, shift, scale, disp, simdName, simdCtor) {
|
|||
'var SIMD_' + simdName + ' = glob.SIMD.' + simdName + '; ' +
|
||||
'var SIMD_' + simdName + '_check = SIMD_' + simdName + '.check; ' +
|
||||
'var SIMD_' + simdName + '_load = SIMD_' + simdName + '.load; ' +
|
||||
'var SIMD_' + simdName + '_loadXYZ = SIMD_' + simdName + '.loadXYZ; ' +
|
||||
'var SIMD_' + simdName + '_loadXY = SIMD_' + simdName + '.loadXY; ' +
|
||||
'var SIMD_' + simdName + '_loadX = SIMD_' + simdName + '.loadX; ' +
|
||||
'var SIMD_' + simdName + '_load3 = SIMD_' + simdName + '.load3; ' +
|
||||
'var SIMD_' + simdName + '_load2 = SIMD_' + simdName + '.load2; ' +
|
||||
'var SIMD_' + simdName + '_load1 = SIMD_' + simdName + '.load1; ' +
|
||||
'var SIMD_' + simdName + '_store = SIMD_' + simdName + '.store; ' +
|
||||
'var SIMD_' + simdName + '_storeXYZ = SIMD_' + simdName + '.storeXYZ; ' +
|
||||
'var SIMD_' + simdName + '_storeXY = SIMD_' + simdName + '.storeXY; ' +
|
||||
'var SIMD_' + simdName + '_storeX = SIMD_' + simdName + '.storeX; ' +
|
||||
'var SIMD_' + simdName + '_store3 = SIMD_' + simdName + '.store3; ' +
|
||||
'var SIMD_' + simdName + '_store2 = SIMD_' + simdName + '.store2; ' +
|
||||
'var SIMD_' + simdName + '_store1 = SIMD_' + simdName + '.store1; ' +
|
||||
'function load(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_load(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function loadXYZ(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_loadXYZ(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function loadXY(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_loadXY(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function loadX(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_loadX(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function load3(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_load3(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function load2(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_load2(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function load1(i) {i=i|0; return SIMD_' + simdName + '_check(SIMD_' + simdName + '_load1(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ')) } ' +
|
||||
'function store(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_store(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'function storeXYZ(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_storeXYZ(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'function storeXY(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_storeXY(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'function storeX(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_storeX(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'return { load: load, loadXYZ: loadXYZ, loadXY: loadXY, loadX: loadX, store: store, storeXYZ: storeXYZ, storeXY : storeXY, storeX : storeX }');
|
||||
'function store3(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_store3(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'function store2(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_store2(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'function store1(i,j) {i=i|0;j=SIMD_' + simdName + '_check(j); SIMD_' + simdName + '_store1(arr, ((i<<' + scale + ')+' + disp + ')>>' + shift + ', j) } ' +
|
||||
'return { load: load, load3: load3, load2: load2, load1: load1, store: store, store3: store3, store2 : store2, store1 : store1 }');
|
||||
var f = asmLink(c, this, null, ab);
|
||||
|
||||
for (var i of indices) {
|
||||
var index = ((i<<scale)+disp)>>shift;
|
||||
|
||||
var v, vXYZ, vXY, vX;
|
||||
var t = false, tXYZ = false, tXY = false, tX = false;
|
||||
var v, v3, v2, v1;
|
||||
var t = false, t3 = false, t2 = false, t1 = false;
|
||||
try { v = simdCtor.load(arr, index); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
t = true;
|
||||
}
|
||||
try { vXYZ = simdCtor.loadXYZ(arr, index); }
|
||||
try { v3 = simdCtor.load3(arr, index); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
tXYZ = true;
|
||||
t3 = true;
|
||||
}
|
||||
try { vXY = simdCtor.loadXY(arr, index); }
|
||||
try { v2 = simdCtor.load2(arr, index); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
tXY = true;
|
||||
t2 = true;
|
||||
}
|
||||
try { vX = simdCtor.loadX(arr, index); }
|
||||
try { v1 = simdCtor.load1(arr, index); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
tX = true;
|
||||
t1 = true;
|
||||
}
|
||||
|
||||
// Loads
|
||||
var l, lXYZ, lXY, lX;
|
||||
var r = false, rXYZ = false, rXY = false, rX = false;
|
||||
var l, l3, l2, l1;
|
||||
var r = false, r3 = false, r2 = false, r1 = false;
|
||||
try { l = f.load(i); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
r = true;
|
||||
}
|
||||
try { lXYZ = f.loadXYZ(i); }
|
||||
try { l3 = f.load3(i); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
rXYZ = true;
|
||||
r3 = true;
|
||||
}
|
||||
try { lXY = f.loadXY(i); }
|
||||
try { l2 = f.load2(i); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
rXY = true;
|
||||
r2 = true;
|
||||
}
|
||||
try { lX = f.loadX(i); }
|
||||
try { l1 = f.load1(i); }
|
||||
catch (e) {
|
||||
assertEq(e instanceof RangeError, true);
|
||||
rX = true;
|
||||
r1 = true;
|
||||
}
|
||||
assertEq(t, r);
|
||||
assertEq(tXYZ, rXYZ);
|
||||
assertEq(tXY, rXY);
|
||||
assertEq(tX, rX);
|
||||
assertEq(t3, r3);
|
||||
assertEq(t2, r2);
|
||||
assertEq(t1, r1);
|
||||
if (!t) assertEqX4(v, l);
|
||||
if (!tXYZ) assertEqX4(vXYZ, lXYZ);
|
||||
if (!tXY) assertEqX4(vXY, lXY);
|
||||
if (!tX) assertEqX4(vX, lX);
|
||||
if (!t3) assertEqX4(v3, l3);
|
||||
if (!t2) assertEqX4(v2, l2);
|
||||
if (!t1) assertEqX4(v1, l1);
|
||||
|
||||
// Stores
|
||||
if (!t) {
|
||||
|
@ -187,24 +187,24 @@ function testSimdX4(ctor, shift, scale, disp, simdName, simdCtor) {
|
|||
assertEqX4(simdCtor.load(arr, index), v);
|
||||
} else
|
||||
assertThrowsInstanceOf(() => f.store(i, simdCtor()), RangeError);
|
||||
if (!tXYZ) {
|
||||
simdCtor.storeXYZ(arr, index, simdCtor.not(vXYZ));
|
||||
f.storeXYZ(i, vXYZ);
|
||||
assertEqX4(simdCtor.loadXYZ(arr, index), vXYZ);
|
||||
if (!t3) {
|
||||
simdCtor.store3(arr, index, simdCtor.not(v3));
|
||||
f.store3(i, v3);
|
||||
assertEqX4(simdCtor.load3(arr, index), v3);
|
||||
} else
|
||||
assertThrowsInstanceOf(() => f.storeXYZ(i, simdCtor()), RangeError);
|
||||
if (!tXY) {
|
||||
simdCtor.storeXY(arr, index, simdCtor.not(vXY));
|
||||
f.storeXY(i, vXY);
|
||||
assertEqX4(simdCtor.loadXY(arr, index), vXY);
|
||||
assertThrowsInstanceOf(() => f.store3(i, simdCtor()), RangeError);
|
||||
if (!t2) {
|
||||
simdCtor.store2(arr, index, simdCtor.not(v2));
|
||||
f.store2(i, v2);
|
||||
assertEqX4(simdCtor.load2(arr, index), v2);
|
||||
} else
|
||||
assertThrowsInstanceOf(() => f.storeXY(i, simdCtor()), RangeError);
|
||||
if (!tX) {
|
||||
simdCtor.storeX(arr, index, simdCtor.not(vX));
|
||||
f.storeX(i, vX);
|
||||
assertEqX4(simdCtor.loadX(arr, index), vX);
|
||||
assertThrowsInstanceOf(() => f.store2(i, simdCtor()), RangeError);
|
||||
if (!t1) {
|
||||
simdCtor.store1(arr, index, simdCtor.not(v1));
|
||||
f.store1(i, v1);
|
||||
assertEqX4(simdCtor.load1(arr, index), v1);
|
||||
} else
|
||||
assertThrowsInstanceOf(() => f.storeX(i, simdCtor()), RangeError);
|
||||
assertThrowsInstanceOf(() => f.store1(i, simdCtor()), RangeError);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -383,37 +383,37 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
|
|||
|
||||
if (native == js::simd_int32x4_load)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 4);
|
||||
if (native == js::simd_int32x4_loadX)
|
||||
if (native == js::simd_int32x4_load1)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 1);
|
||||
if (native == js::simd_int32x4_loadXY)
|
||||
if (native == js::simd_int32x4_load2)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 2);
|
||||
if (native == js::simd_int32x4_loadXYZ)
|
||||
if (native == js::simd_int32x4_load3)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 3);
|
||||
|
||||
if (native == js::simd_float32x4_load)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 4);
|
||||
if (native == js::simd_float32x4_loadX)
|
||||
if (native == js::simd_float32x4_load1)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 1);
|
||||
if (native == js::simd_float32x4_loadXY)
|
||||
if (native == js::simd_float32x4_load2)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 2);
|
||||
if (native == js::simd_float32x4_loadXYZ)
|
||||
if (native == js::simd_float32x4_load3)
|
||||
return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 3);
|
||||
|
||||
if (native == js::simd_int32x4_store)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 4);
|
||||
if (native == js::simd_int32x4_storeX)
|
||||
if (native == js::simd_int32x4_store1)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 1);
|
||||
if (native == js::simd_int32x4_storeXY)
|
||||
if (native == js::simd_int32x4_store2)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 2);
|
||||
if (native == js::simd_int32x4_storeXYZ)
|
||||
if (native == js::simd_int32x4_store3)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 3);
|
||||
if (native == js::simd_float32x4_store)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 4);
|
||||
if (native == js::simd_float32x4_storeX)
|
||||
if (native == js::simd_float32x4_store1)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 1);
|
||||
if (native == js::simd_float32x4_storeXY)
|
||||
if (native == js::simd_float32x4_store2)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 2);
|
||||
if (native == js::simd_float32x4_storeXYZ)
|
||||
if (native == js::simd_float32x4_store3)
|
||||
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 3);
|
||||
|
||||
if (native == js::simd_int32x4_bool)
|
||||
|
|
|
@ -51,7 +51,7 @@ function MakeComparator(kind, arr, shared) {
|
|||
var asArray = Array.prototype.slice.call(uint8, startBytes, endBytes);
|
||||
|
||||
// If length is less than SIZE_BYTES bytes, fill with 0.
|
||||
// This is needed for loadX, loadXY, loadXYZ which do only partial
|
||||
// This is needed for load1, load2, load3 which do only partial
|
||||
// reads.
|
||||
for (var i = asArray.length; i < SIZE_BYTES; i++) asArray[i] = 0;
|
||||
assertEq(asArray.length, SIZE_BYTES);
|
||||
|
@ -62,22 +62,22 @@ function MakeComparator(kind, arr, shared) {
|
|||
var assertFunc = (lanes == 2) ? assertEqX2 : assertEqX4;
|
||||
var type = SIMD[kind];
|
||||
return {
|
||||
loadX: function(index) {
|
||||
var v = type.loadX(arr, index);
|
||||
load1: function(index) {
|
||||
var v = type.load1(arr, index);
|
||||
assertFunc(v, slice(index, 1));
|
||||
},
|
||||
|
||||
loadXY: function(index) {
|
||||
load2: function(index) {
|
||||
if (lanes < 4)
|
||||
return;
|
||||
var v = type.loadXY(arr, index);
|
||||
var v = type.load2(arr, index);
|
||||
assertFunc(v, slice(index, 2));
|
||||
},
|
||||
|
||||
loadXYZ: function(index) {
|
||||
load3: function(index) {
|
||||
if (lanes < 4)
|
||||
return;
|
||||
var v = type.loadXYZ(arr, index);
|
||||
var v = type.load3(arr, index);
|
||||
assertFunc(v, slice(index, 3));
|
||||
},
|
||||
|
||||
|
@ -114,9 +114,9 @@ function testLoad(kind, TA) {
|
|||
var C = MakeComparator(kind, ta);
|
||||
var bpe = ta.BYTES_PER_ELEMENT;
|
||||
|
||||
var lastValidArgLoadX = (SIZE_BYTES - (lanes == 4 ? 4 : 8)) / bpe | 0;
|
||||
var lastValidArgLoadXY = (SIZE_BYTES - 8) / bpe | 0;
|
||||
var lastValidArgLoadXYZ = (SIZE_BYTES - 12) / bpe | 0;
|
||||
var lastValidArgLoad1 = (SIZE_BYTES - (lanes == 4 ? 4 : 8)) / bpe | 0;
|
||||
var lastValidArgLoad2 = (SIZE_BYTES - 8) / bpe | 0;
|
||||
var lastValidArgLoad3 = (SIZE_BYTES - 12) / bpe | 0;
|
||||
var lastValidArgLoad = (SIZE_BYTES - 16) / bpe | 0;
|
||||
|
||||
C.load(0);
|
||||
|
@ -126,28 +126,28 @@ function testLoad(kind, TA) {
|
|||
C.load(lastValidArgLoad);
|
||||
assertThrowsInstanceOf(() => SIMD[kind].load(ta, lastValidArgLoad + 1), RangeError);
|
||||
|
||||
C.loadX(0);
|
||||
C.loadX(1);
|
||||
C.loadX(2);
|
||||
C.loadX(3);
|
||||
C.loadX(lastValidArgLoadX);
|
||||
assertThrowsInstanceOf(() => SIMD[kind].loadX(ta, lastValidArgLoadX + 1), RangeError);
|
||||
C.load1(0);
|
||||
C.load1(1);
|
||||
C.load1(2);
|
||||
C.load1(3);
|
||||
C.load1(lastValidArgLoad1);
|
||||
assertThrowsInstanceOf(() => SIMD[kind].load1(ta, lastValidArgLoad1 + 1), RangeError);
|
||||
|
||||
C.loadXY(0);
|
||||
C.loadXY(1);
|
||||
C.loadXY(2);
|
||||
C.loadXY(3);
|
||||
C.loadXY(lastValidArgLoadXY);
|
||||
C.load2(0);
|
||||
C.load2(1);
|
||||
C.load2(2);
|
||||
C.load2(3);
|
||||
C.load2(lastValidArgLoad2);
|
||||
|
||||
C.loadXYZ(0);
|
||||
C.loadXYZ(1);
|
||||
C.loadXYZ(2);
|
||||
C.loadXYZ(3);
|
||||
C.loadXYZ(lastValidArgLoadXYZ);
|
||||
C.load3(0);
|
||||
C.load3(1);
|
||||
C.load3(2);
|
||||
C.load3(3);
|
||||
C.load3(lastValidArgLoad3);
|
||||
|
||||
if (lanes >= 4) {
|
||||
assertThrowsInstanceOf(() => SIMD[kind].loadXY(ta, lastValidArgLoadXY + 1), RangeError);
|
||||
assertThrowsInstanceOf(() => SIMD[kind].loadXYZ(ta, lastValidArgLoadXYZ + 1), RangeError);
|
||||
assertThrowsInstanceOf(() => SIMD[kind].load2(ta, lastValidArgLoad2 + 1), RangeError);
|
||||
assertThrowsInstanceOf(() => SIMD[kind].load3(ta, lastValidArgLoad3 + 1), RangeError);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,14 +191,14 @@ function testSharedArrayBufferCompat() {
|
|||
for (var kind of ['int32x4', 'float32x4', 'float64x2']) {
|
||||
var comp = MakeComparator(kind, ta);
|
||||
comp.load(0);
|
||||
comp.loadX(0);
|
||||
comp.loadXY(0);
|
||||
comp.loadXYZ(0);
|
||||
comp.load1(0);
|
||||
comp.load2(0);
|
||||
comp.load3(0);
|
||||
|
||||
comp.load(3);
|
||||
comp.loadX(3);
|
||||
comp.loadXY(3);
|
||||
comp.loadXYZ(3);
|
||||
comp.load1(3);
|
||||
comp.load2(3);
|
||||
comp.load3(3);
|
||||
}
|
||||
|
||||
assertThrowsInstanceOf(() => SIMD.int32x4.load(ta, 1024), RangeError);
|
||||
|
|
|
@ -28,7 +28,7 @@ function assertChanged(ta, from, expected) {
|
|||
|
||||
function testStore(ta, kind, i, v) {
|
||||
reset(ta);
|
||||
SIMD[kind].storeX(ta, i, v);
|
||||
SIMD[kind].store1(ta, i, v);
|
||||
assertChanged(ta, i, [v.x]);
|
||||
|
||||
reset(ta);
|
||||
|
@ -37,11 +37,11 @@ function testStore(ta, kind, i, v) {
|
|||
|
||||
if (simdLength(v) > 2) {
|
||||
reset(ta);
|
||||
SIMD[kind].storeXY(ta, i, v);
|
||||
SIMD[kind].store2(ta, i, v);
|
||||
assertChanged(ta, i, [v.x, v.y]);
|
||||
|
||||
reset(ta);
|
||||
SIMD[kind].storeXYZ(ta, i, v);
|
||||
SIMD[kind].store3(ta, i, v);
|
||||
assertChanged(ta, i, [v.x, v.y, v.z]);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче