Bug 1136226 - Enable inlining of 8x16 and 16x8 types. r=sunfish

This commit is contained in:
Jakob Olesen 2016-05-31 09:00:20 -07:00
parent 61cdb6908f
commit 6a4e9a4585
6 changed files with 84 additions and 30 deletions

View File

@ -277,6 +277,22 @@ static_assert(uint64_t(SimdOperation::Last) <= UINT16_MAX, "SimdOperation must f
FLOAT32X4_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Int8x16, Name)
INT8X16_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Uint8x16, Name)
UINT8X16_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Int16x8, Name)
INT16X8_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Uint16x8, Name)
UINT16X8_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Int32x4, Name)
INT32X4_FUNCTION_LIST(TDEFN)
#undef TDEFN
@ -285,6 +301,14 @@ INT32X4_FUNCTION_LIST(TDEFN)
UINT32X4_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Bool8x16, Name)
BOOL8X16_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Bool16x8, Name)
BOOL16X8_FUNCTION_LIST(TDEFN)
#undef TDEFN
#define TDEFN(Name, Func, Operands) DEFN(Bool32x4, Name)
BOOL32X4_FUNCTION_LIST(TDEFN)
#undef TDEFN
@ -310,7 +334,7 @@ const JSFunctionSpec Float64x2Defn::Methods[] = {
const JSFunctionSpec Int8x16Defn::Methods[] = {
#define SIMD_INT8X16_FUNCTION_ITEM(Name, Func, Operands) \
JS_FN(#Name, js::simd_int8x16_##Name, Operands, 0),
JS_INLINABLE_FN(#Name, js::simd_int8x16_##Name, Operands, 0, SimdInt8x16_##Name),
INT8X16_FUNCTION_LIST(SIMD_INT8X16_FUNCTION_ITEM)
#undef SIMD_INT8X16_FUNCTION_ITEM
JS_FS_END
@ -318,7 +342,7 @@ const JSFunctionSpec Int8x16Defn::Methods[] = {
const JSFunctionSpec Int16x8Defn::Methods[] = {
#define SIMD_INT16X8_FUNCTION_ITEM(Name, Func, Operands) \
JS_FN(#Name, js::simd_int16x8_##Name, Operands, 0),
JS_INLINABLE_FN(#Name, js::simd_int16x8_##Name, Operands, 0, SimdInt16x8_##Name),
INT16X8_FUNCTION_LIST(SIMD_INT16X8_FUNCTION_ITEM)
#undef SIMD_INT16X8_FUNCTION_ITEM
JS_FS_END
@ -334,7 +358,7 @@ const JSFunctionSpec Int32x4Defn::Methods[] = {
const JSFunctionSpec Uint8x16Defn::Methods[] = {
#define SIMD_UINT8X16_FUNCTION_ITEM(Name, Func, Operands) \
JS_FN(#Name, js::simd_uint8x16_##Name, Operands, 0),
JS_INLINABLE_FN(#Name, js::simd_uint8x16_##Name, Operands, 0, SimdUint8x16_##Name),
UINT8X16_FUNCTION_LIST(SIMD_UINT8X16_FUNCTION_ITEM)
#undef SIMD_UINT8X16_FUNCTION_ITEM
JS_FS_END
@ -342,7 +366,7 @@ const JSFunctionSpec Uint8x16Defn::Methods[] = {
const JSFunctionSpec Uint16x8Defn::Methods[] = {
#define SIMD_UINT16X8_FUNCTION_ITEM(Name, Func, Operands) \
JS_FN(#Name, js::simd_uint16x8_##Name, Operands, 0),
JS_INLINABLE_FN(#Name, js::simd_uint16x8_##Name, Operands, 0, SimdUint16x8_##Name),
UINT16X8_FUNCTION_LIST(SIMD_UINT16X8_FUNCTION_ITEM)
#undef SIMD_UINT16X8_FUNCTION_ITEM
JS_FS_END
@ -358,7 +382,7 @@ const JSFunctionSpec Uint32x4Defn::Methods[] = {
const JSFunctionSpec Bool8x16Defn::Methods[] = {
#define SIMD_BOOL8X16_FUNCTION_ITEM(Name, Func, Operands) \
JS_FN(#Name, js::simd_bool8x16_##Name, Operands, 0),
JS_INLINABLE_FN(#Name, js::simd_bool8x16_##Name, Operands, 0, SimdBool8x16_##Name),
BOOL8X16_FUNCTION_LIST(SIMD_BOOL8X16_FUNCTION_ITEM)
#undef SIMD_BOOL8X16_FUNCTION_ITEM
JS_FS_END
@ -366,7 +390,7 @@ const JSFunctionSpec Bool8x16Defn::Methods[] = {
const JSFunctionSpec Bool16x8Defn::Methods[] = {
#define SIMD_BOOL16X8_FUNCTION_ITEM(Name, Func, Operands) \
JS_FN(#Name, js::simd_bool16x8_##Name, Operands, 0),
JS_INLINABLE_FN(#Name, js::simd_bool16x8_##Name, Operands, 0, SimdBool16x8_##Name),
BOOL16X8_FUNCTION_LIST(SIMD_BOOL16X8_FUNCTION_ITEM)
#undef SIMD_BOOL16X8_FUNCTION_ITEM
JS_FS_END

View File

@ -5423,9 +5423,15 @@ GetTemplateObjectForSimd(JSContext* cx, JSFunction* target, MutableHandleObject
// Check if this is a native inlinable SIMD operation.
SimdType ctrlType;
switch (jitInfo->inlinableNative) {
case InlinableNative::SimdInt8x16: ctrlType = SimdType::Int8x16; break;
case InlinableNative::SimdUint8x16: ctrlType = SimdType::Uint8x16; break;
case InlinableNative::SimdInt16x8: ctrlType = SimdType::Int16x8; break;
case InlinableNative::SimdUint16x8: ctrlType = SimdType::Uint16x8; break;
case InlinableNative::SimdInt32x4: ctrlType = SimdType::Int32x4; break;
case InlinableNative::SimdUint32x4: ctrlType = SimdType::Uint32x4; break;
case InlinableNative::SimdFloat32x4: ctrlType = SimdType::Float32x4; break;
case InlinableNative::SimdBool8x16: ctrlType = SimdType::Bool8x16; break;
case InlinableNative::SimdBool16x8: ctrlType = SimdType::Bool16x8; break;
case InlinableNative::SimdBool32x4: ctrlType = SimdType::Bool32x4; break;
// This is not an inlinable SIMD operation.
default: return false;

View File

@ -84,8 +84,14 @@
\
_(SimdInt32x4) \
_(SimdUint32x4) \
_(SimdInt16x8) \
_(SimdUint16x8) \
_(SimdInt8x16) \
_(SimdUint8x16) \
_(SimdFloat32x4) \
_(SimdBool32x4) \
_(SimdBool16x8) \
_(SimdBool8x16) \
\
_(TestBailout) \
_(TestAssertFloat32) \

View File

@ -216,10 +216,22 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
return inlineSimd(callInfo, target, SimdType::Int32x4);
case InlinableNative::SimdUint32x4:
return inlineSimd(callInfo, target, SimdType::Uint32x4);
case InlinableNative::SimdInt16x8:
return inlineSimd(callInfo, target, SimdType::Int16x8);
case InlinableNative::SimdUint16x8:
return inlineSimd(callInfo, target, SimdType::Uint16x8);
case InlinableNative::SimdInt8x16:
return inlineSimd(callInfo, target, SimdType::Int8x16);
case InlinableNative::SimdUint8x16:
return inlineSimd(callInfo, target, SimdType::Uint8x16);
case InlinableNative::SimdFloat32x4:
return inlineSimd(callInfo, target, SimdType::Float32x4);
case InlinableNative::SimdBool32x4:
return inlineSimd(callInfo, target, SimdType::Bool32x4);
case InlinableNative::SimdBool16x8:
return inlineSimd(callInfo, target, SimdType::Bool16x8);
case InlinableNative::SimdBool8x16:
return inlineSimd(callInfo, target, SimdType::Bool8x16);
// Testing functions.
case InlinableNative::TestBailout:
@ -3328,16 +3340,18 @@ IonBuilder::inlineSimd(CallInfo& callInfo, JSFunction* target, SimdType type)
return inlineSimdStore(callInfo, native, type, 3);
// Bitcasts. One for each type with a memory representation.
case SimdOperation::Fn_fromInt8x16Bits:
case SimdOperation::Fn_fromInt16x8Bits:
return InliningStatus_NotInlined;
case SimdOperation::Fn_fromInt32x4Bits:
return inlineSimdConvert(callInfo, native, true, SimdType::Int32x4, type);
case SimdOperation::Fn_fromUint32x4Bits:
return inlineSimdConvert(callInfo, native, true, SimdType::Uint32x4, type);
case SimdOperation::Fn_fromUint8x16Bits:
case SimdOperation::Fn_fromInt16x8Bits:
return inlineSimdConvert(callInfo, native, true, SimdType::Int16x8, type);
case SimdOperation::Fn_fromUint16x8Bits:
return InliningStatus_NotInlined;
return inlineSimdConvert(callInfo, native, true, SimdType::Uint16x8, type);
case SimdOperation::Fn_fromInt8x16Bits:
return inlineSimdConvert(callInfo, native, true, SimdType::Int8x16, type);
case SimdOperation::Fn_fromUint8x16Bits:
return inlineSimdConvert(callInfo, native, true, SimdType::Uint8x16, type);
case SimdOperation::Fn_fromFloat32x4Bits:
return inlineSimdConvert(callInfo, native, true, SimdType::Float32x4, type);
case SimdOperation::Fn_fromFloat64x2Bits:

View File

@ -1354,6 +1354,24 @@ RSimdBox::recover(JSContext* cx, SnapshotIterator& iter) const
MOZ_ASSERT_IF(a.mode() == RValueAllocation::ANY_FLOAT_REG, a.fpuReg().isSimd128());
const FloatRegisters::RegisterContent* raw = iter.floatAllocationPointer(a);
switch (SimdType(type_)) {
case SimdType::Bool8x16:
resultObject = js::CreateSimd<Bool8x16>(cx, (const Bool8x16::Elem*) raw);
break;
case SimdType::Int8x16:
resultObject = js::CreateSimd<Int8x16>(cx, (const Int8x16::Elem*) raw);
break;
case SimdType::Uint8x16:
resultObject = js::CreateSimd<Uint8x16>(cx, (const Uint8x16::Elem*) raw);
break;
case SimdType::Bool16x8:
resultObject = js::CreateSimd<Bool16x8>(cx, (const Bool16x8::Elem*) raw);
break;
case SimdType::Int16x8:
resultObject = js::CreateSimd<Int16x8>(cx, (const Int16x8::Elem*) raw);
break;
case SimdType::Uint16x8:
resultObject = js::CreateSimd<Uint16x8>(cx, (const Uint16x8::Elem*) raw);
break;
case SimdType::Bool32x4:
resultObject = js::CreateSimd<Bool32x4>(cx, (const Bool32x4::Elem*) raw);
break;
@ -1369,24 +1387,6 @@ RSimdBox::recover(JSContext* cx, SnapshotIterator& iter) const
case SimdType::Float64x2:
MOZ_CRASH("NYI, RSimdBox of Float64x2");
break;
case SimdType::Int8x16:
MOZ_CRASH("NYI, RSimdBox of Int8x16");
break;
case SimdType::Int16x8:
MOZ_CRASH("NYI, RSimdBox of Int16x8");
break;
case SimdType::Uint8x16:
MOZ_CRASH("NYI, RSimdBox of UInt8x16");
break;
case SimdType::Uint16x8:
MOZ_CRASH("NYI, RSimdBox of UInt16x8");
break;
case SimdType::Bool8x16:
MOZ_CRASH("NYI, RSimdBox of Bool8x16");
break;
case SimdType::Bool16x8:
MOZ_CRASH("NYI, RSimdBox of Bool16x8");
break;
case SimdType::Bool64x2:
MOZ_CRASH("NYI, RSimdBox of Bool64x2");
break;

View File

@ -458,9 +458,13 @@ CodeGeneratorShared::encodeAllocation(LSnapshot* snapshot, MDefinition* mir,
break;
}
case MIRType::Float32:
case MIRType::Bool32x4:
case MIRType::Int8x16:
case MIRType::Int16x8:
case MIRType::Int32x4:
case MIRType::Float32x4:
case MIRType::Bool8x16:
case MIRType::Bool16x8:
case MIRType::Bool32x4:
{
LAllocation* payload = snapshot->payloadOfSlot(*allocIndex);
if (payload->isConstant()) {