mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1180874 - Use DivOrModConstantI for unsigned division or modulo by constant. r=nbp
This commit is contained in:
parent
9801843608
commit
d243cf2fea
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user