Bug 154725
Summary: | [DFG] DFG ArithRound for non-zero-case is incorrect for negative numbers in x86 | ||
---|---|---|---|
Product: | WebKit | Reporter: | Yusuke Suzuki <ysuzuki> |
Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | benjamin, fpizlo, ggaren, mark.lam, msaboff, saam |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Yusuke Suzuki
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Yusuke Suzuki
If we can use SSE 4.2 roundss, we should do that (It takes rounding mode!)
Yusuke Suzuki
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 ***