[turbofan] Fix recognition of Uint32Div in simplified lowering.
TEST=mjsunit/asm R=jarin@chromium.org Review URL: https://codereview.chromium.org/701813003 Cr-Commit-Position: refs/heads/master@{#25103} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25103 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1d66934565
commit
e6cfe350f8
@ -632,7 +632,7 @@ class RepresentationSelector {
|
|||||||
if (lower()) DeferReplacement(node, lowering->Int32Div(node));
|
if (lower()) DeferReplacement(node, lowering->Int32Div(node));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (CanLowerToUint32Binop(node, use)) {
|
if (BothInputsAre(node, Type::Unsigned32()) && !CanObserveNaN(use)) {
|
||||||
// => unsigned Uint32Div
|
// => unsigned Uint32Div
|
||||||
VisitUint32Binop(node);
|
VisitUint32Binop(node);
|
||||||
if (lower()) DeferReplacement(node, lowering->Uint32Div(node));
|
if (lower()) DeferReplacement(node, lowering->Uint32Div(node));
|
||||||
|
@ -22,8 +22,24 @@ function Uint32Div(divisor) {
|
|||||||
var divisors = [0, 1, 3, 4, 10, 42, 64, 100, 1024, 2147483647, 4294967295];
|
var divisors = [0, 1, 3, 4, 10, 42, 64, 100, 1024, 2147483647, 4294967295];
|
||||||
for (var i in divisors) {
|
for (var i in divisors) {
|
||||||
var divisor = divisors[i];
|
var divisor = divisors[i];
|
||||||
var mod = Uint32Div(divisor);
|
var div = Uint32Div(divisor);
|
||||||
for (var dividend = 0; dividend < 4294967296; dividend += 3999773) {
|
for (var dividend = 0; dividend < 4294967296; dividend += 3999773) {
|
||||||
assertEquals((dividend / divisor) >>> 0, mod(dividend));
|
assertEquals((dividend / divisor) >>> 0, div(dividend));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var div = (function(stdlib, foreign, heap) {
|
||||||
|
"use asm";
|
||||||
|
function div(dividend, divisor) {
|
||||||
|
return (dividend >>> 0) / (divisor >>> 0) | 0;
|
||||||
|
}
|
||||||
|
return {div: div};
|
||||||
|
})(stdlib, foreign, heap).div;
|
||||||
|
|
||||||
|
for (var i in divisors) {
|
||||||
|
var divisor = divisors[i];
|
||||||
|
for (var dividend = 0; dividend < 4294967296; dividend += 3999773) {
|
||||||
|
assertEquals((dividend >>> 0) / (divisor >>> 0) | 0,
|
||||||
|
div(dividend, divisor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user