From 44f39fa2263f73294386dbae509cebeeddeeed56 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 6 Jul 2015 11:09:33 +0200 Subject: [PATCH] Bug 1155211: Rename bitselect into selectBits; r=nbp --HG-- extra : rebase_source : d1838024d623afb7c83ba874b8c8660d9a651bbc extra : histedit_source : 824c85d7b4761b1ee98ecaca95ea014701e8f8f5 --- js/src/asmjs/AsmJSValidate.cpp | 2 +- js/src/builtin/SIMD.cpp | 2 +- js/src/builtin/SIMD.h | 12 +++---- js/src/jit-test/tests/SIMD/select.js | 6 ++-- js/src/jit-test/tests/asm.js/testSIMD.js | 14 ++++---- js/src/jit/MCallOptimize.cpp | 4 +-- js/src/tests/ecma_7/SIMD/select-bitselect.js | 38 ++++++++++---------- 7 files changed, 39 insertions(+), 39 deletions(-) diff --git a/js/src/asmjs/AsmJSValidate.cpp b/js/src/asmjs/AsmJSValidate.cpp index 08c982b8ead8..bc4d0ff1e8e3 100644 --- a/js/src/asmjs/AsmJSValidate.cpp +++ b/js/src/asmjs/AsmJSValidate.cpp @@ -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); diff --git a/js/src/builtin/SIMD.cpp b/js/src/builtin/SIMD.cpp index 71fca8311ff8..be80de69919e 100644 --- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -1065,7 +1065,7 @@ Clamp(JSContext* cx, unsigned argc, Value* vp) template 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; diff --git a/js/src/builtin/SIMD.h b/js/src/builtin/SIMD.h index 07148032f1dd..32ee3be86288 100644 --- a/js/src/builtin/SIMD.h +++ b/js/src/builtin/SIMD.h @@ -61,10 +61,10 @@ V(xor, (CoercedBinaryFunc), 2) #define FLOAT32X4_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, (BitSelect), 3) \ V(clamp, Clamp, 3) \ V(replaceLane, (ReplaceLane), 3) \ V(select, (Select), 3) \ + V(selectBits, (SelectBits), 3) \ V(store, (Store), 3) \ V(store3, (Store), 3) \ V(store2, (Store), 3) \ @@ -115,10 +115,10 @@ V(sub, (BinaryFunc), 2) #define FLOAT64X2_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, (BitSelect), 3) \ V(clamp, Clamp, 3) \ V(replaceLane, (ReplaceLane), 3) \ V(select, (Select), 3) \ + V(selectBits, (SelectBits), 3) \ V(store, (Store), 3) \ V(store1, (Store), 3) @@ -162,9 +162,9 @@ V(xor, (BinaryFunc), 2) #define INT8X16_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, (BitSelect), 3) \ V(replaceLane, (ReplaceLane), 3) \ V(select, (Select), 3) \ + V(selectBits, (SelectBits), 3) \ V(store, (Store), 3) #define INT8X16_BOOL_FUNCTION_LIST(V) \ @@ -211,9 +211,9 @@ V(xor, (BinaryFunc), 2) #define INT16X8_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, (BitSelect), 3) \ V(replaceLane, (ReplaceLane), 3) \ V(select, (Select), 3) \ + V(selectBits, (SelectBits), 3) \ V(store, (Store), 3) #define INT16X8_BOOL_FUNCTION_LIST(V) \ @@ -265,9 +265,9 @@ V(xor, (BinaryFunc), 2) #define INT32X4_TERNARY_FUNCTION_LIST(V) \ - V(bitselect, (BitSelect), 3) \ V(replaceLane, (ReplaceLane), 3) \ V(select, (Select), 3) \ + V(selectBits, (SelectBits), 3) \ V(store, (Store), 3) \ V(store3, (Store), 3) \ V(store2, (Store), 3) \ @@ -332,8 +332,8 @@ BITWISE_COMMONX4_SIMD_OP(_) \ _(extractLane) \ _(replaceLane) \ - _(bitselect) \ _(select) \ + _(selectBits) \ _(splat) \ _(not) \ _(neg) \ diff --git a/js/src/jit-test/tests/SIMD/select.js b/js/src/jit-test/tests/SIMD/select.js index 279facabe6e3..613f09454764 100644 --- a/js/src/jit-test/tests/SIMD/select.js +++ b/js/src/jit-test/tests/SIMD/select.js @@ -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)); } } diff --git a/js/src/jit-test/tests/asm.js/testSIMD.js b/js/src/jit-test/tests/asm.js/testSIMD.js index 4760961fbe36..be9ab2e1cc04 100644 --- a/js/src/jit-test/tests/asm.js/testSIMD.js +++ b/js/src/jit-test/tests/asm.js/testSIMD.js @@ -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;' diff --git a/js/src/jit/MCallOptimize.cpp b/js/src/jit/MCallOptimize.cpp index 9f02d7cd791c..0d2864358ec2 100644 --- a/js/src/jit/MCallOptimize.cpp +++ b/js/src/jit/MCallOptimize.cpp @@ -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) diff --git a/js/src/tests/ecma_7/SIMD/select-bitselect.js b/js/src/tests/ecma_7/SIMD/select-bitselect.js index 1ee363d41c25..8e56cfc6f6b7 100644 --- a/js/src/tests/ecma_7/SIMD/select-bitselect.js +++ b/js/src/tests/ecma_7/SIMD/select-bitselect.js @@ -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);