зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155211: Rename bitselect into selectBits; r=nbp
--HG-- extra : rebase_source : d1838024d623afb7c83ba874b8c8660d9a651bbc extra : histedit_source : 824c85d7b4761b1ee98ecaca95ea014701e8f8f5
This commit is contained in:
Родитель
dc18ab1de6
Коммит
44f39fa226
|
@ -7641,7 +7641,7 @@ CheckSimdOperationCall(FunctionBuilder& f, ParseNode* call, const ModuleCompiler
|
|||
case AsmJSSimdOperation_store3:
|
||||
return CheckSimdStore(f, call, opType, 3, type);
|
||||
|
||||
case AsmJSSimdOperation_bitselect:
|
||||
case AsmJSSimdOperation_selectBits:
|
||||
return CheckSimdSelect(f, call, opType, /*isElementWise */ false, type);
|
||||
case AsmJSSimdOperation_select:
|
||||
return CheckSimdSelect(f, call, opType, /*isElementWise */ true, type);
|
||||
|
|
|
@ -1065,7 +1065,7 @@ Clamp(JSContext* cx, unsigned argc, Value* vp)
|
|||
|
||||
template<typename V, typename MaskType>
|
||||
static bool
|
||||
BitSelect(JSContext* cx, unsigned argc, Value* vp)
|
||||
SelectBits(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
typedef typename V::Elem Elem;
|
||||
typedef typename MaskType::Elem MaskTypeElem;
|
||||
|
|
|
@ -61,10 +61,10 @@
|
|||
V(xor, (CoercedBinaryFunc<Float32x4, Int32x4, Xor, Float32x4>), 2)
|
||||
|
||||
#define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
V(bitselect, (BitSelect<Float32x4, Int32x4>), 3) \
|
||||
V(clamp, Clamp<Float32x4>, 3) \
|
||||
V(replaceLane, (ReplaceLane<Float32x4>), 3) \
|
||||
V(select, (Select<Float32x4, Int32x4>), 3) \
|
||||
V(selectBits, (SelectBits<Float32x4, Int32x4>), 3) \
|
||||
V(store, (Store<Float32x4, 4>), 3) \
|
||||
V(store3, (Store<Float32x4, 3>), 3) \
|
||||
V(store2, (Store<Float32x4, 2>), 3) \
|
||||
|
@ -115,10 +115,10 @@
|
|||
V(sub, (BinaryFunc<Float64x2, Sub, Float64x2>), 2)
|
||||
|
||||
#define FLOAT64X2_TERNARY_FUNCTION_LIST(V) \
|
||||
V(bitselect, (BitSelect<Float64x2, Int32x4>), 3) \
|
||||
V(clamp, Clamp<Float64x2>, 3) \
|
||||
V(replaceLane, (ReplaceLane<Float64x2>), 3) \
|
||||
V(select, (Select<Float64x2, Int32x4>), 3) \
|
||||
V(selectBits, (SelectBits<Float64x2, Int32x4>), 3) \
|
||||
V(store, (Store<Float64x2, 2>), 3) \
|
||||
V(store1, (Store<Float64x2, 1>), 3)
|
||||
|
||||
|
@ -162,9 +162,9 @@
|
|||
V(xor, (BinaryFunc<Int8x16, Xor, Int8x16>), 2)
|
||||
|
||||
#define INT8X16_TERNARY_FUNCTION_LIST(V) \
|
||||
V(bitselect, (BitSelect<Int8x16, Int8x16>), 3) \
|
||||
V(replaceLane, (ReplaceLane<Int8x16>), 3) \
|
||||
V(select, (Select<Int8x16, Int8x16>), 3) \
|
||||
V(selectBits, (SelectBits<Int8x16, Int8x16>), 3) \
|
||||
V(store, (Store<Int8x16, 16>), 3)
|
||||
|
||||
#define INT8X16_BOOL_FUNCTION_LIST(V) \
|
||||
|
@ -211,9 +211,9 @@
|
|||
V(xor, (BinaryFunc<Int16x8, Xor, Int16x8>), 2)
|
||||
|
||||
#define INT16X8_TERNARY_FUNCTION_LIST(V) \
|
||||
V(bitselect, (BitSelect<Int16x8, Int16x8>), 3) \
|
||||
V(replaceLane, (ReplaceLane<Int16x8>), 3) \
|
||||
V(select, (Select<Int16x8, Int16x8>), 3) \
|
||||
V(selectBits, (SelectBits<Int16x8, Int16x8>), 3) \
|
||||
V(store, (Store<Int16x8, 8>), 3)
|
||||
|
||||
#define INT16X8_BOOL_FUNCTION_LIST(V) \
|
||||
|
@ -265,9 +265,9 @@
|
|||
V(xor, (BinaryFunc<Int32x4, Xor, Int32x4>), 2)
|
||||
|
||||
#define INT32X4_TERNARY_FUNCTION_LIST(V) \
|
||||
V(bitselect, (BitSelect<Int32x4, Int32x4>), 3) \
|
||||
V(replaceLane, (ReplaceLane<Int32x4>), 3) \
|
||||
V(select, (Select<Int32x4, Int32x4>), 3) \
|
||||
V(selectBits, (SelectBits<Int32x4, Int32x4>), 3) \
|
||||
V(store, (Store<Int32x4, 4>), 3) \
|
||||
V(store3, (Store<Int32x4, 3>), 3) \
|
||||
V(store2, (Store<Int32x4, 2>), 3) \
|
||||
|
@ -332,8 +332,8 @@
|
|||
BITWISE_COMMONX4_SIMD_OP(_) \
|
||||
_(extractLane) \
|
||||
_(replaceLane) \
|
||||
_(bitselect) \
|
||||
_(select) \
|
||||
_(selectBits) \
|
||||
_(splat) \
|
||||
_(not) \
|
||||
_(neg) \
|
||||
|
|
|
@ -10,7 +10,7 @@ function Int32x4FromTypeBits(type, vec) {
|
|||
throw 'unimplemented';
|
||||
}
|
||||
|
||||
function bitselect(type, mask, ifTrue, ifFalse) {
|
||||
function selectBits(type, mask, ifTrue, ifFalse) {
|
||||
var Int32x4 = SIMD.Int32x4;
|
||||
var tv = Int32x4FromTypeBits(type, ifTrue);
|
||||
var fv = Int32x4FromTypeBits(type, ifFalse);
|
||||
|
@ -48,8 +48,8 @@ function f() {
|
|||
assertEqX4(SIMD.Int32x4.select(TFTF, i1, i2), select(SIMD.Int32x4, TFTF, i1, i2));
|
||||
assertEqX4(SIMD.Int32x4.select(TTFT, i1, i2), select(SIMD.Int32x4, TTFT, i1, i2));
|
||||
|
||||
assertEqX4(SIMD.Float32x4.bitselect(mask, f1, f2), bitselect(SIMD.Float32x4, mask, f1, f2));
|
||||
assertEqX4(SIMD.Int32x4.bitselect(mask, i1, i2), bitselect(SIMD.Int32x4, mask, i1, i2));
|
||||
assertEqX4(SIMD.Float32x4.selectBits(mask, f1, f2), selectBits(SIMD.Float32x4, mask, f1, f2));
|
||||
assertEqX4(SIMD.Int32x4.selectBits(mask, i1, i2), selectBits(SIMD.Int32x4, mask, i1, i2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -876,8 +876,8 @@ for (var i = 1; i < 64; i++) {
|
|||
// Select
|
||||
const I32SEL = 'var i4sel = i4.select;'
|
||||
const F32SEL = 'var f4sel = f4.select;'
|
||||
const I32BSEL = 'var i4sel = i4.bitselect;'
|
||||
const F32BSEL = 'var f4sel = f4.bitselect;'
|
||||
const I32BSEL = 'var i4sel = i4.selectBits;'
|
||||
const F32BSEL = 'var f4sel = f4.selectBits;'
|
||||
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CI32 + I32SEL + "function f() {var x=f4(1,2,3,4); return ci4(i4sel(x,x,x));} return f");
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CI32 + I32SEL + "function f() {var m=f4(1,2,3,4); var x=i4(1,2,3,4); return ci4(i4sel(m,x,x));} return f");
|
||||
|
@ -893,7 +893,7 @@ assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CF32 + F32SEL + "function f() {v
|
|||
assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CF32 + F32SEL + "function f() {var m=i4(1,2,3,4); var x=f4(1,2,3,4); var y=i4(5,6,7,8); return cf4(f4sel(m,x,y));} return f");
|
||||
assertAsmTypeFail('glob', USE_ASM + I32 + F32 + CF32 + F32SEL + "function f() {var m=i4(1,2,3,4); var x=i4(1,2,3,4); var y=f4(5,6,7,8); return cf4(f4sel(m,x,y));} return f");
|
||||
|
||||
// These pass with select but not bitselect
|
||||
// These pass with select but not selectBits
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32SEL + "function f() {var m=i4(0,0,0,0); var x=i4(1,2,3,4); var y=i4(5,6,7,8); return ci4(i4sel(m,x,y)); } return f"), this)(), [5, 6, 7, 8]);
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32SEL + "function f() {var m=i4(-1,-2,-3,-42); var x=i4(1,2,3,4); var y=i4(5,6,7,8); return ci4(i4sel(m,x,y)); } return f"), this)(), [1, 2, 3, 4]);
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32SEL + "function f() {var m=i4(1,-1,2,-2); var x=i4(1,2,3,4); var y=i4(5,6,7,8); return ci4(i4sel(m,x,y)); } return f"), this)(), [5, 2, 7, 4]);
|
||||
|
@ -904,7 +904,7 @@ assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32SEL + "fun
|
|||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32SEL + "function f() {var m=i4(1,-1,2,-2); var x=f4(1,2,3,4); var y=f4(5,6,7,8); return cf4(f4sel(m,x,y)); } return f"), this)(), [5, 2, 7, 4]);
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32SEL + "function f() {var m=i4(42,45,-42,-47); var x=f4(1,2,3,4); var y=f4(5,6,7,8); return cf4(f4sel(m,x,y)); } return f"), this)(), [5, 6, 3, 4]);
|
||||
|
||||
// These pass for both select and bitselect
|
||||
// These pass for both select and selectBits
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32SEL + "function f() {var m=i4(0,0,0,0); var x=i4(1,2,3,4); var y=i4(5,6,7,8); return ci4(i4sel(m,x,y)); } return f"), this)(), [5, 6, 7, 8]);
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32SEL + "function f() {var m=i4(0xffffffff,0xffffffff,0xffffffff,0xffffffff); var x=i4(1,2,3,4); var y=i4(5,6,7,8); return ci4(i4sel(m,x,y)); } return f"), this)(), [1, 2, 3, 4]);
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32SEL + "function f() {var m=i4(0,0xffffffff,0,0xffffffff); var x=i4(1,2,3,4); var y=i4(5,6,7,8); return ci4(i4sel(m,x,y)); } return f"), this)(), [5, 2, 7, 4]);
|
||||
|
@ -925,7 +925,7 @@ assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32BSEL + "fu
|
|||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32BSEL + "function f() {var m=i4(0,0xffffffff,0,0xffffffff); var x=f4(1,2,3,4); var y=f4(5,6,7,8); return cf4(f4sel(m,x,y)); } return f"), this)(), [5, 2, 7, 4]);
|
||||
assertEqX4(asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CF32 + F32BSEL + "function f() {var m=i4(0,0,0xffffffff,0xffffffff); var x=f4(1,2,3,4); var y=f4(5,6,7,8); return cf4(f4sel(m,x,y)); } return f"), this)(), [5, 6, 3, 4]);
|
||||
|
||||
// Specific bitselect tests
|
||||
// Specific selectBits tests
|
||||
var masks = [
|
||||
SIMD.Int32x4(1337, 0x1337, 0x42, 42),
|
||||
SIMD.Int32x4(0x00FF1CE, 0xBAADF00D, 0xDEADBEEF, 0xCAFED00D),
|
||||
|
@ -941,7 +941,7 @@ var i32bsel = asmLink(asmCompile('glob', USE_ASM + I32 + CI32 + I32BSEL + "funct
|
|||
|
||||
for (var mask of masks) {
|
||||
for (var [x, y] of inputs) {
|
||||
assertEqX4(i32bsel(mask, x, y), simdToArray(SIMD.Int32x4.bitselect(mask, x, y)));
|
||||
assertEqX4(i32bsel(mask, x, y), simdToArray(SIMD.Int32x4.selectBits(mask, x, y)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -955,7 +955,7 @@ var f32bsel = asmLink(asmCompile('glob', USE_ASM + I32 + F32 + CI32 + CF32 + F32
|
|||
|
||||
for (var mask of masks)
|
||||
for (var [x, y] of inputs)
|
||||
assertEqX4(f32bsel(mask, x, y), simdToArray(SIMD.Float32x4.bitselect(mask, x, y)));
|
||||
assertEqX4(f32bsel(mask, x, y), simdToArray(SIMD.Float32x4.selectBits(mask, x, y)));
|
||||
|
||||
// Splat
|
||||
const I32SPLAT = 'var splat=i4.splat;'
|
||||
|
|
|
@ -364,11 +364,11 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
|
|||
typedef bool IsElementWise;
|
||||
if (native == js::simd_int32x4_select)
|
||||
return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::Int32x4);
|
||||
if (native == js::simd_int32x4_bitselect)
|
||||
if (native == js::simd_int32x4_selectBits)
|
||||
return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::Int32x4);
|
||||
if (native == js::simd_float32x4_select)
|
||||
return inlineSimdSelect(callInfo, native, IsElementWise(true), SimdTypeDescr::Float32x4);
|
||||
if (native == js::simd_float32x4_bitselect)
|
||||
if (native == js::simd_float32x4_selectBits)
|
||||
return inlineSimdSelect(callInfo, native, IsElementWise(false), SimdTypeDescr::Float32x4);
|
||||
|
||||
if (native == js::simd_int32x4_swizzle)
|
||||
|
|
|
@ -74,7 +74,7 @@ function intFromTypeBits(type, vec) {
|
|||
}
|
||||
}
|
||||
|
||||
function bitselect(type, mask, ifTrue, ifFalse) {
|
||||
function selectBits(type, mask, ifTrue, ifFalse) {
|
||||
var maskType = selectMaskType(type);
|
||||
var tv = intFromTypeBits(type, ifTrue);
|
||||
var fv = intFromTypeBits(type, ifFalse);
|
||||
|
@ -97,10 +97,10 @@ function findCorrespondingScalarTypedArray(type) {
|
|||
}
|
||||
|
||||
/**
|
||||
* This tests type.bitselect on all boolean masks, as in select. For these,
|
||||
* bitselect(mask, x, y) === select(mask, x, y)
|
||||
* This tests type.selectBits on all boolean masks, as in select. For these,
|
||||
* selectBits(mask, x, y) === select(mask, x, y)
|
||||
*/
|
||||
function testBitSelectSimple(type, inputs) {
|
||||
function testSelectBitsSimple(type, inputs) {
|
||||
var x, y;
|
||||
var maskLength = simdLengthType(type);
|
||||
maskLength = maskLength != 2 ? maskLength : 4;
|
||||
|
@ -108,15 +108,15 @@ function testBitSelectSimple(type, inputs) {
|
|||
for (var i = 0; i < Math.pow(maskLength, 2); i++) {
|
||||
var mask = getMask(i, maskLength);
|
||||
for ([x, y] of inputs)
|
||||
assertEqVec(type.bitselect(mask, x, y), bitselect(type, mask, x, y));
|
||||
assertEqVec(type.selectBits(mask, x, y), selectBits(type, mask, x, y));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This tests type.bitselect on a few hand-defined masks. For these,
|
||||
* bitselect(mask, x, y) !== select(mask, x, y)
|
||||
* This tests type.selectBits on a few hand-defined masks. For these,
|
||||
* selectBits(mask, x, y) !== select(mask, x, y)
|
||||
*/
|
||||
function testBitSelectComplex(type, inputs) {
|
||||
function testSelectBitsComplex(type, inputs) {
|
||||
var masks8 = [
|
||||
Int8x16(0x42, 42, INT8_MAX, INT8_MIN, INT8_MAX + 1, INT8_MIN - 1, 13, 37, -42, 125, -125, -1, 1, 0xA, 0xB, 0xC)
|
||||
]
|
||||
|
@ -144,7 +144,7 @@ function testBitSelectComplex(type, inputs) {
|
|||
var ScalarTypedArray = findCorrespondingScalarTypedArray(type);
|
||||
for (var mask of masks) {
|
||||
for ([x, y] of inputs)
|
||||
assertEqVec(type.bitselect(mask, x, y), bitselect(type, mask, x, y));
|
||||
assertEqVec(type.selectBits(mask, x, y), selectBits(type, mask, x, y));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,8 +156,8 @@ function test() {
|
|||
];
|
||||
|
||||
testSelect(Int8x16, inputs);
|
||||
testBitSelectSimple(Int8x16, inputs);
|
||||
testBitSelectComplex(Int8x16, inputs);
|
||||
testSelectBitsSimple(Int8x16, inputs);
|
||||
testSelectBitsComplex(Int8x16, inputs);
|
||||
|
||||
inputs = [
|
||||
[Int16x8(0,4,9,16,25,36,49,64), Int16x8(1,2,3,4,5,6,7,8)],
|
||||
|
@ -166,8 +166,8 @@ function test() {
|
|||
];
|
||||
|
||||
testSelect(Int16x8, inputs);
|
||||
testBitSelectSimple(Int16x8, inputs);
|
||||
testBitSelectComplex(Int16x8, inputs);
|
||||
testSelectBitsSimple(Int16x8, inputs);
|
||||
testSelectBitsComplex(Int16x8, inputs);
|
||||
|
||||
inputs = [
|
||||
[Int32x4(0,4,9,16), Int32x4(1,2,3,4)],
|
||||
|
@ -175,8 +175,8 @@ function test() {
|
|||
];
|
||||
|
||||
testSelect(Int32x4, inputs);
|
||||
testBitSelectSimple(Int32x4, inputs);
|
||||
testBitSelectComplex(Int32x4, inputs);
|
||||
testSelectBitsSimple(Int32x4, inputs);
|
||||
testSelectBitsComplex(Int32x4, inputs);
|
||||
|
||||
inputs = [
|
||||
[Float32x4(0.125,4.25,9.75,16.125), Float32x4(1.5,2.75,3.25,4.5)],
|
||||
|
@ -185,8 +185,8 @@ function test() {
|
|||
];
|
||||
|
||||
testSelect(Float32x4, inputs);
|
||||
testBitSelectSimple(Float32x4, inputs);
|
||||
testBitSelectComplex(Float32x4, inputs);
|
||||
testSelectBitsSimple(Float32x4, inputs);
|
||||
testSelectBitsComplex(Float32x4, inputs);
|
||||
|
||||
inputs = [
|
||||
[Float64x2(0.125,4.25), Float64x2(9.75,16.125)],
|
||||
|
@ -198,8 +198,8 @@ function test() {
|
|||
];
|
||||
|
||||
testSelect(Float64x2, inputs);
|
||||
testBitSelectSimple(Float64x2, inputs);
|
||||
testBitSelectComplex(Float64x2, inputs);
|
||||
testSelectBitsSimple(Float64x2, inputs);
|
||||
testSelectBitsComplex(Float64x2, inputs);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче