bug 1180874 - Use DivOrModConstantI for unsigned division or modulo by constant. r=nbp

This commit is contained in:
Sander Mathijs van Veen 2015-07-07 17:03:59 +02:00
parent 7f696d590e
commit e698a46466

View File

@ -171,11 +171,6 @@ LIRGeneratorX86Shared::lowerMulI(MMul* mul, MDefinition* lhs, MDefinition* rhs)
void
LIRGeneratorX86Shared::lowerDivI(MDiv* div)
{
if (div->isUnsigned()) {
lowerUDiv(div);
return;
}
// Division instructions are slow. Division by constant denominators can be
// rewritten to use other instructions.
if (div->rhs()->isConstant()) {
@ -210,6 +205,11 @@ LIRGeneratorX86Shared::lowerDivI(MDiv* div)
}
}
if (div->isUnsigned()) {
lowerUDiv(div);
return;
}
LDivI* lir = new(alloc()) LDivI(useRegister(div->lhs()), useRegister(div->rhs()),
tempFixed(edx));
if (div->fallible())
@ -220,11 +220,6 @@ LIRGeneratorX86Shared::lowerDivI(MDiv* div)
void
LIRGeneratorX86Shared::lowerModI(MMod* mod)
{
if (mod->isUnsigned()) {
lowerUMod(mod);
return;
}
if (mod->rhs()->isConstant()) {
int32_t rhs = mod->rhs()->toConstant()->value().toInt32();
int32_t shift = FloorLog2(Abs(rhs));
@ -245,6 +240,11 @@ LIRGeneratorX86Shared::lowerModI(MMod* mod)
}
}
if (mod->isUnsigned()) {
lowerUMod(mod);
return;
}
LModI* lir = new(alloc()) LModI(useRegister(mod->lhs()),
useRegister(mod->rhs()),
tempFixed(eax));