Closed Bug 891534 Opened 11 years ago Closed 11 years ago

IonMonkey: Use asm.js ops for truncated unsigned div or mod

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: bhackett1024, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
asm.js uses specialized patterns on divisions or modulus ops like (x>>>0) / (y>>>0).  It would be good to use these for vanilla Ion compilation on these patterns, to avoid extra code and bailouts from the shifts.  The attached patch does this, and also allows division ops to be marked as truncated, which wasn't happening before (fixing bug 891055).  This improves vanilla x86 performance on asmjs-ubench-corrections from 65% slower than with asm.js to 9% slower.  A couple notes:

- The relevant division is of the form ((x>>>0) / (y>>>0)) >>> 0.  Changing the latter bit from >>> 0 to | 0 improves things so that performance is at parity between asm.js and vanilla compilation.  This change is valid to make and is consistent with how other integer operations behave in asm.js.

- This and many other range analysis truncation optimizations only work if the division or shifts have never overflowed while running in baseline.  Such operations will cause the div/shifts to use double arithmetic and go really slow.  This doesn't affect the corrections benchmark but will I think need to be fixed, probably by improving the range analysis so that it can respecialize arithmetic ops on int32s.
Attachment #772843 - Flags: review?(jdemooij)
Attachment #772843 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/05bfd456e558
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Depends on: 893904
Blocks: 940864
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: