Closed
Bug 898461
Opened 11 years ago
Closed 11 years ago
div and mod optimizations
Categories
(Core :: JavaScript Engine, enhancement)
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: sunfish, Unassigned)
Details
Attachments
(2 files)
2.93 KB,
patch
|
Details | Diff | Splinter Review | |
8.62 KB,
patch
|
jandem
:
review+
|
Details | Diff | Splinter Review |
The following are two div/mod optimization patches for x86/x64.
Reporter | ||
Updated•11 years ago
|
Whiteboard: [leave open]
Reporter | ||
Comment 1•11 years ago
|
||
Make LModI require its lhs to be in eax, instead of requiring a temp and copying lhs into it. This theoretically gives the register allocator the flexibility to avoid a copy in some cases :-).
Attachment #781737 -
Flags: review?(bhackett1024)
Reporter | ||
Comment 2•11 years ago
|
||
Attachment #781738 -
Flags: review?(jdemooij)
Comment 3•11 years ago
|
||
Comment on attachment 781737 [details] [diff] [review]
optimize-modi.patch
Review of attachment 781737 [details] [diff] [review]:
-----------------------------------------------------------------
The idiv instruction in ModI can clobber eax, right? Removing the useFixed temp seems to mean the regalloc is allowed to reuse eax in future instructions which have the mod lhs as an input, without reloading it. Is there another mechanism preventing this?
Attachment #781737 -
Flags: review?(bhackett1024)
Reporter | ||
Comment 4•11 years ago
|
||
> The idiv instruction in ModI can clobber eax, right? Removing the useFixed
> temp seems to mean the regalloc is allowed to reuse eax in future
> instructions which have the mod lhs as an input, without reloading it. Is
> there another mechanism preventing this?
Oh, you're right. And I can even reproduce the problem with --ion-regalloc=backtracking. Would it be valid to do useFixed(mod->lhs(), eax) and tempFixed(eax) at the same time instead?
Comment 5•11 years ago
|
||
(In reply to Dan Gohman [:sunfish] from comment #4)
> > The idiv instruction in ModI can clobber eax, right? Removing the useFixed
> > temp seems to mean the regalloc is allowed to reuse eax in future
> > instructions which have the mod lhs as an input, without reloading it. Is
> > there another mechanism preventing this?
>
> Oh, you're right. And I can even reproduce the problem with
> --ion-regalloc=backtracking. Would it be valid to do useFixed(mod->lhs(),
> eax) and tempFixed(eax) at the same time instead?
Unfortunately it doesn't look like this will work, looking at the intervals generated by the regalloc for uses/defs/temps. When these are fixed their ranges all cover the instruction's input. Not sure why this holds with lsra for defs, as the backtracking allocator doesn't have this restriction.
Updated•11 years ago
|
Attachment #781738 -
Flags: review?(jdemooij) → review+
Reporter | ||
Comment 6•11 years ago
|
||
Whiteboard: [leave open]
Comment 7•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in
before you can comment on or make changes to this bug.
Description
•