X87: Fixed flooring division by a power of 2, once again...

port r21769

original message:
    Avoid right shifts by zero bits: On ARM it actually means shifting by
    32 bits (correctness issue) and on other platforms they are useless
    (performance issue). This is fix for the fix in r20544.

    BUG=v8:3259
    LOG=y
R=weiliang.lin@intel.com

Review URL: https://codereview.chromium.org/330133004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21829 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ac18d082
...@@ -1546,14 +1546,17 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) { ...@@ -1546,14 +1546,17 @@ void LCodeGen::DoFlooringDivByPowerOf2I(LFlooringDivByPowerOf2I* instr) {
DeoptimizeIf(zero, instr->environment()); DeoptimizeIf(zero, instr->environment());
} }
if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) { // Dividing by -1 is basically negation, unless we overflow.
__ sar(dividend, shift); if (divisor == -1) {
if (instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
DeoptimizeIf(overflow, instr->environment());
}
return; return;
} }
// Dividing by -1 is basically negation, unless we overflow. // If the negation could not overflow, simply shifting is OK.
if (divisor == -1) { if (!instr->hydrogen()->CheckFlag(HValue::kLeftCanBeMinInt)) {
DeoptimizeIf(overflow, instr->environment()); __ sar(dividend, shift);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment