RESOLVED DUPLICATE of bug 154683 154725
[DFG] DFG ArithRound for non-zero-case is incorrect for negative numbers in x86
https://bugs.webkit.org/show_bug.cgi?id=154725
Summary [DFG] DFG ArithRound for non-zero-case is incorrect for negative numbers in x86
Yusuke Suzuki
Reported 2016-02-26 06:10:32 PST
We use branchTruncateDoubleToInt32, it emits cvttsd2si_rr. But its rounding mode is not floor. The test case is the following. function mathRoundDoesNotCareAboutMinusZero(value) { return Math.round(value)|0; } noInline(mathRoundDoesNotCareAboutMinusZero); for (var i = 0; i < 1e4; ++i) { var doubleMid = -9901 - 0.6; var roundedValue = mathRoundDoesNotCareAboutMinusZero(doubleMid); print(doubleMid, roundedValue); if (roundedValue !== -9902) throw "mathRoundDoesNotCareAboutMinusZero(" + doubleMid + ") = " + roundedValue; }
Attachments
Yusuke Suzuki
Comment 1 2016-02-26 06:11:23 PST
If we can use SSE 4.2 roundss, we should do that (It takes rounding mode!)
Yusuke Suzuki
Comment 2 2016-02-26 10:03:43 PST
I'll fix this with https://bugs.webkit.org/show_bug.cgi?id=154683 *** This bug has been marked as a duplicate of bug 154683 ***
Note You need to log in before you can comment on or make changes to this bug.