Bug 1072300 - IonMonkey MIPS: tests fail on MIPS (asm.js/testMathLib.js, ion/testFloat32-correctness.js, ion/testFloat32.js). r=rankov

This commit is contained in:
Aleksandar Zlicic 2014-09-24 15:37:15 +02:00
Родитель 13366270f1
Коммит 5bf9825a0a
2 изменённых файлов: 49 добавлений и 0 удалений

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

@ -276,6 +276,54 @@ CodeGeneratorMIPS::visitMinMaxD(LMinMaxD *ins)
return true;
}
bool
CodeGeneratorMIPS::visitMinMaxF(LMinMaxF *ins)
{
FloatRegister first = ToFloatRegister(ins->first());
FloatRegister second = ToFloatRegister(ins->second());
FloatRegister output = ToFloatRegister(ins->output());
MOZ_ASSERT(first == output);
Assembler::DoubleCondition cond = ins->mir()->isMax()
? Assembler::DoubleLessThanOrEqual
: Assembler::DoubleGreaterThanOrEqual;
Label nan, equal, returnSecond, done;
// First or second is NaN, result is NaN.
masm.ma_bc1s(first, second, &nan, Assembler::DoubleUnordered, ShortJump);
// Make sure we handle -0 and 0 right.
masm.ma_bc1s(first, second, &equal, Assembler::DoubleEqual, ShortJump);
masm.ma_bc1s(first, second, &returnSecond, cond, ShortJump);
masm.ma_b(&done, ShortJump);
// Check for zero.
masm.bind(&equal);
masm.loadConstantFloat32(0.0, ScratchFloat32Reg);
// First wasn't 0 or -0, so just return it.
masm.ma_bc1s(first, ScratchFloat32Reg, &done, Assembler::DoubleNotEqualOrUnordered, ShortJump);
// So now both operands are either -0 or 0.
if (ins->mir()->isMax()) {
// -0 + -0 = -0 and -0 + 0 = 0.
masm.as_adds(first, first, second);
} else {
masm.as_negs(first, first);
masm.as_subs(first, first, second);
masm.as_negs(first, first);
}
masm.ma_b(&done, ShortJump);
masm.bind(&nan);
masm.loadConstantFloat32(GenericNaN(), output);
masm.ma_b(&done, ShortJump);
masm.bind(&returnSecond);
masm.as_movs(output, second);
masm.bind(&done);
return true;
}
bool
CodeGeneratorMIPS::visitAbsD(LAbsD *ins)
{

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

@ -162,6 +162,7 @@ class CodeGeneratorMIPS : public CodeGeneratorShared
public:
// Instruction visitors.
virtual bool visitMinMaxD(LMinMaxD *ins);
virtual bool visitMinMaxF(LMinMaxF *ins);
virtual bool visitAbsD(LAbsD *ins);
virtual bool visitAbsF(LAbsF *ins);
virtual bool visitSqrtD(LSqrtD *ins);