Bug 1258632 - Distinguish signed/unsigned MDiv/MMod in GVN. r=bbouvier

Modify the congruentTo method of MDiv and MMod opcodes to take into
account signedness, which is necessary for correct code generation.

--HG--
extra : rebase_source : 73037989ae280384c9bb2fd21f5e58243f06da4f
This commit is contained in:
Pip 2016-03-22 09:41:00 +01:00
Родитель ba85a895cf
Коммит 7b1dd2c692
2 изменённых файлов: 11 добавлений и 0 удалений

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

@ -393,3 +393,4 @@ for (let i = 0; i < 31; i++) {
assertEq(f(Math.pow(2,i)), (Math.pow(2,i) * 2)|0);
assertEq(f(Math.pow(2,i+1) - 1), ((Math.pow(2,i+1) - 1) * 2)|0);
}
assertEq(asmLink(asmCompile(USE_ASM + "var g=0; function f(x, y) { x = x|0; y = y|0; g = (x>>>0)%(y>>>0)|0; return (x|0)%(y|0)|0; } return f;"))(0xff40001, 0xfff80000), 0x40001);

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

@ -6905,6 +6905,11 @@ class MDiv : public MBinaryArithInstruction
return specialization_ < MIRType_Object;
}
bool congruentTo(const MDefinition* ins) const override {
return MBinaryArithInstruction::congruentTo(ins) &&
unsigned_ == ins->toDiv()->isUnsigned();
}
ALLOW_CLONE(MDiv)
};
@ -6983,6 +6988,11 @@ class MMod : public MBinaryArithInstruction
void collectRangeInfoPreTrunc() override;
TruncateKind operandTruncateKind(size_t index) const override;
bool congruentTo(const MDefinition* ins) const override {
return MBinaryArithInstruction::congruentTo(ins) &&
unsigned_ == ins->toMod()->isUnsigned();
}
ALLOW_CLONE(MMod)
};