Bug 779361 - Reuse input in LAbsD and LSqrtD. r=pierron

This commit is contained in:
Sean Stangl 2012-07-31 20:48:26 -07:00
parent 8bc23053db
commit 8c2b614697
4 changed files with 17 additions and 17 deletions

View File

@ -1222,7 +1222,7 @@ class LAbsI : public LInstructionHelper<1, 1, 0>
}
};
// Absolute value of an integer.
// Absolute value of a double.
class LAbsD : public LInstructionHelper<1, 1, 0>
{
public:
@ -1239,7 +1239,7 @@ class LAbsD : public LInstructionHelper<1, 1, 0>
}
};
// Absolute value of an integer.
// Square root of a double.
class LSqrtD : public LInstructionHelper<1, 1, 0>
{
public:

View File

@ -659,11 +659,11 @@ LIRGenerator::visitAbs(MAbs *ins)
if (!ins->range()->isFinite() && !assignSnapshot(lir))
return false;
return defineReuseInput(lir, ins, 0);
} else {
JS_ASSERT(num->type() == MIRType_Double);
LAbsD *lir = new LAbsD(useRegister(num));
return define(lir, ins);
}
JS_ASSERT(num->type() == MIRType_Double);
LAbsD *lir = new LAbsD(useRegisterAtStart(num));
return defineReuseInput(lir, ins, 0);
}
bool
@ -672,7 +672,7 @@ LIRGenerator::visitSqrt(MSqrt *ins)
MDefinition *num = ins->num();
JS_ASSERT(num->type() == MIRType_Double);
LSqrtD *lir = new LSqrtD(useRegisterAtStart(num));
return define(lir, ins);
return defineReuseInput(lir, ins, 0);
}
bool

View File

@ -278,8 +278,8 @@ bool
CodeGeneratorARM::visitAbsD(LAbsD *ins)
{
FloatRegister input = ToFloatRegister(ins->input());
FloatRegister output = ToFloatRegister(ins->output());
masm.as_vabs(output, input);
JS_ASSERT(input == ToFloatRegister(ins->output()));
masm.as_vabs(input, input);
return true;
}
@ -287,8 +287,8 @@ bool
CodeGeneratorARM::visitSqrtD(LSqrtD *ins)
{
FloatRegister input = ToFloatRegister(ins->input());
FloatRegister output = ToFloatRegister(ins->output());
masm.as_vsqrt(output, input);
JS_ASSERT(input == ToFloatRegister(ins->output()));
masm.as_vsqrt(input, input);
return true;
}

View File

@ -405,10 +405,10 @@ bool
CodeGeneratorX86Shared::visitAbsD(LAbsD *ins)
{
FloatRegister input = ToFloatRegister(ins->input());
FloatRegister output = ToFloatRegister(ins->output());
masm.xorpd(output, output);
masm.subsd(input, output); // negate the sign bit.
masm.andpd(input, output); // s & ~s
JS_ASSERT(input == ToFloatRegister(ins->output()));
masm.xorpd(ScratchFloatReg, ScratchFloatReg);
masm.subsd(input, ScratchFloatReg); // negate the sign bit.
masm.andpd(ScratchFloatReg, input); // s & ~s
return true;
}
@ -416,8 +416,8 @@ bool
CodeGeneratorX86Shared::visitSqrtD(LSqrtD *ins)
{
FloatRegister input = ToFloatRegister(ins->input());
FloatRegister output = ToFloatRegister(ins->output());
masm.sqrtsd(input, output);
JS_ASSERT(input == ToFloatRegister(ins->output()));
masm.sqrtsd(input, input);
return true;
}