Bug 1555153 - ARM64 division by constant: compare remainder against zero. r=sstangl

Differential Revision: https://phabricator.services.mozilla.com/D33015

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas B. Pierron 2019-06-01 03:33:15 +00:00
parent b37b2bcb8f
commit dcb38ecb71
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
x = [99999999999999999999999999, -(2 ** 53 - 2)];
res = [0, 2 / 3];
for (let i = 0; i < 2; ++i) {
assertEq((x[i] | 0) / 3, res[i]);
}

View File

@ -598,7 +598,7 @@ void CodeGenerator::visitDivConstantI(LDivConstantI* ins) {
masm.Mov(const32, d);
masm.Msub(const32, output32, const32, lhs32);
// bailout if (lhs - output * d != 0)
masm.Cmp(const32, const32);
masm.Cmp(const32, wzr);
auto bailoutCond = Assembler::NonZero;
// If lhs is zero and the divisor is negative, the answer should have
@ -608,7 +608,7 @@ void CodeGenerator::visitDivConstantI(LDivConstantI* ins) {
// ^ ^
// | '-- masm.Ccmp(lhs32, lhs32, .., ..)
// '-- masm.Ccmp(.., .., vixl::ZFlag, ! bailoutCond)
masm.Ccmp(lhs32, lhs32, vixl::ZFlag, Assembler::Zero);
masm.Ccmp(lhs32, wzr, vixl::ZFlag, Assembler::Zero);
bailoutCond = Assembler::Zero;
}