Bug 1100123 - IonMonkey: Simplify LSimdSelect's regalloc constraints r=bbouvier

This commit is contained in:
Dan Gohman 2014-12-17 08:45:51 -08:00
Родитель 874f24a205
Коммит 741647f18a
3 изменённых файлов: 23 добавлений и 16 удалений

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

@ -476,7 +476,7 @@ class LSimdShift : public LInstructionHelper<1, 2, 0>
// SIMD selection of lanes from two int32x4 or float32x4 arguments based on a
// int32x4 argument.
class LSimdSelect : public LInstructionHelper<1, 3, 0>
class LSimdSelect : public LInstructionHelper<1, 3, 1>
{
public:
LIR_HEADER(SimdSelect);
@ -489,6 +489,9 @@ class LSimdSelect : public LInstructionHelper<1, 3, 0>
const LAllocation *rhs() {
return getOperand(2);
}
const LDefinition *temp() {
return getTemp(0);
}
MSimdTernaryBitwise::Operation operation() const {
return mir_->toSimdTernaryBitwise()->operation();
}

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

@ -2940,11 +2940,17 @@ CodeGeneratorX86Shared::visitSimdSelect(LSimdSelect *ins)
FloatRegister mask = ToFloatRegister(ins->mask());
FloatRegister onTrue = ToFloatRegister(ins->lhs());
FloatRegister onFalse = ToFloatRegister(ins->rhs());
FloatRegister output = ToFloatRegister(ins->output());
FloatRegister temp = ToFloatRegister(ins->temp());
MOZ_ASSERT(onTrue == ToFloatRegister(ins->output()));
masm.bitwiseAndX4(Operand(mask), onTrue);
masm.bitwiseAndNotX4(Operand(onFalse), mask);
masm.bitwiseOrX4(Operand(mask), onTrue);
if (onTrue != output)
masm.movaps(onTrue, output);
if (mask != temp)
masm.movaps(mask, temp);
masm.bitwiseAndX4(Operand(mask), output);
masm.bitwiseAndNotX4(Operand(onFalse), temp);
masm.bitwiseOrX4(Operand(temp), output);
}
void

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

@ -677,18 +677,16 @@ LIRGeneratorX86Shared::visitSimdTernaryBitwise(MSimdTernaryBitwise *ins)
if (ins->type() == MIRType_Int32x4 || ins->type() == MIRType_Float32x4) {
LSimdSelect *lins = new(alloc()) LSimdSelect;
MDefinition *r0 = ins->getOperand(0);
MDefinition *r1 = ins->getOperand(1);
MDefinition *r2 = ins->getOperand(2);
// This must be useRegisterAtStart() because it is destroyed.
lins->setOperand(0, useRegisterAtStart(ins->getOperand(0)));
// This must be useRegisterAtStart() because it is destroyed.
lins->setOperand(1, useRegisterAtStart(ins->getOperand(1)));
// This could be useRegister(), but combining it with
// useRegisterAtStart() is broken see bug 772830.
lins->setOperand(2, useRegisterAtStart(ins->getOperand(2)));
// The output is constrained to be in the same register as the second
// argument to avoid redundantly copying the result into place. The
// register allocator will move the result if necessary.
defineReuseInput(lins, ins, 1);
lins->setOperand(0, useRegister(r0));
lins->setOperand(1, useRegister(r1));
lins->setOperand(2, useRegister(r2));
lins->setTemp(0, temp(LDefinition::FLOAT32X4));
define(lins, ins);
} else {
MOZ_CRASH("Unknown SIMD kind when doing bitwise operations");
}