Bug 1112156 - Add SimdPolicy to extract SIMD operands based on the type of the instruction. r=bbouvier

This commit is contained in:
Nicolas B. Pierron 2015-01-26 12:22:55 +01:00
Родитель 0cb9c4ed18
Коммит 6fef855444
2 изменённых файлов: 36 добавлений и 0 удалений

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

@ -717,6 +717,29 @@ template bool ObjectPolicy<1>::staticAdjustInputs(TempAllocator &alloc, MInstruc
template bool ObjectPolicy<2>::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
template bool ObjectPolicy<3>::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
template <unsigned Op>
bool
SimdSameAsReturnedTypePolicy<Op>::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins)
{
MIRType type = ins->type();
MOZ_ASSERT(IsSimdType(type));
MDefinition *in = ins->getOperand(Op);
if (in->type() == type)
return true;
MSimdUnbox *replace = MSimdUnbox::New(alloc, in, type);
ins->block()->insertBefore(ins, replace);
ins->replaceOperand(Op, replace);
return replace->typePolicy()->adjustInputs(alloc, replace);
}
template bool
SimdSameAsReturnedTypePolicy<0>::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
template bool
SimdSameAsReturnedTypePolicy<1>::staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
bool
CallPolicy::adjustInputs(TempAllocator &alloc, MInstruction *ins)
{

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

@ -317,6 +317,19 @@ class SimdScalarPolicy MOZ_FINAL : public TypePolicy
}
};
// SIMD value-type policy, use the returned type of the instruction to determine
// how to unbox its operand.
template <unsigned Op>
class SimdSameAsReturnedTypePolicy MOZ_FINAL : public TypePolicy
{
public:
EMPTY_DATA_;
static bool staticAdjustInputs(TempAllocator &alloc, MInstruction *ins);
virtual bool adjustInputs(TempAllocator &alloc, MInstruction *ins) MOZ_OVERRIDE {
return staticAdjustInputs(alloc, ins);
}
};
template <unsigned Op>
class BoxPolicy MOZ_FINAL : public TypePolicy
{