Closed
Bug 740096
Opened 13 years ago
Closed 5 months ago
IonMonkey: Demote fdivs to idivs when inputs are int32s and result is floored or truncated
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: djvj, Unassigned)
Details
(Whiteboard: [ion:t])
Attachments
(1 file)
10.52 KB,
text/plain
|
Details |
In expressions such as 'Math.floor(i/j)', '(i/j)>>x', and '(i/j)&x' where 'i' and 'j' are integers, but the result of the division may be non-integer, Ion currently promotes i and j to doubles, and then does a floating point divide, followed by a truncate or round as appropriate.
These operations can be simplified in the case of result-truncation by removing any incoming ToDoubles, and converting any incoming Constant doubles to Constant int32s, and then using integer division to generate an auto-truncated result.
These operations can be simplified in the case of result-flooring by doing a quick adjustment of the truncated result after an integer divmod.
Reporter | ||
Comment 1•13 years ago
|
||
This patch is not quite ready for prime time.
It only generates code on x86 and x64 architectures, which means that it generates INCORRECT code on ARM. Also, it doesn't show any gains on benches.
It does show a 40% gain on the following microbench:
var V=3;
function foo(i) {
return ((i / 9)>>V) + ((i / 10)>>V);
}
var sum = 0;
for(var i = 0; i < 1000 * 1000 * 300; i++) {
sum += foo(i);
}
print("SCRIPTOUT: " + sum);
This patch might be more relevant in the future when its gains on real code are more apparent, and it can be fixed up and thrown in, but right now it's here for holding for future-reference purposes.
Updated•12 years ago
|
Whiteboard: [ion:t]
Assignee | ||
Updated•10 years ago
|
Assignee: general → nobody
Updated•2 years ago
|
Severity: normal → S3
Updated•5 months ago
|
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•