Bug 1176864 - Truncate modulo operator for int32 r=h4writer, r=nbp

--HG--
extra : rebase_source : 8a0f02a60176f6e243594ae56713f79284f0fd2d
This commit is contained in:
Sander Mathijs van Veen 2015-06-26 00:18:20 +02:00
Родитель 9b5f31c84a
Коммит aaa261a733
1 изменённых файлов: 6 добавлений и 3 удалений

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

@ -2902,10 +2902,13 @@ ComputeTruncateKind(MDefinition* candidate, bool* shouldClone)
const Range* r = candidate->range();
bool canHaveRoundingErrors = !r || r->canHaveRoundingErrors();
// Special case integer division: the result of a/b can be infinite
// but cannot actually have rounding errors induced by truncation.
if (candidate->isDiv() && candidate->toDiv()->specialization() == MIRType_Int32)
// Special case integer division and modulo: a/b can be infinite, and a%b
// can be NaN but cannot actually have rounding errors induced by truncation.
if ((candidate->isDiv() || candidate->isMod()) &&
static_cast<const MBinaryArithInstruction *>(candidate)->specialization() == MIRType_Int32)
{
canHaveRoundingErrors = false;
}
if (canHaveRoundingErrors)
return MDefinition::NoTruncate;