Closed Bug 888237 Opened 11 years ago Closed 11 years ago

IonMonkey: (ARM) Use hardware divide instruction to calculate modulus

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Following on from bug 872824, we can use the divide instruction to calculate modulus too, on appropriate hardware.
Attached patch Proposed changeSplinter Review
Very similar to the divide case. Uses the combination of divide and then multiply-subtract to calculate the modulus.
Attachment #777179 - Flags: review?(mrosenberg)
Comment on attachment 777179 [details] [diff] [review] Proposed change Review of attachment 777179 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/ion/arm/CodeGenerator-arm.cpp @@ +706,5 @@ > + // save the lhs in case we end up with a 0 that should be a -0.0 because lhs < 0. > + masm.ma_mov(lhs, callTemp); > + > + Label done; > + if (!modICommon(mir, lhs, rhs, output, ins->snapshot(), done)) I suspect that we can eliminate this. The ARM ARM says that INT_MIN / -1 produces INT_MIN, and INT_MIN - (INT_MIN * -1) == INT_MIN + INT_MIN == 0, which is the result that we want. The following negative checks should ensure that a non-truncated result bails, and truncated results become 0.
Attachment #777179 - Flags: review?(mrosenberg) → review+
Status: ASSIGNED → 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.

Attachment

General

Created:
Updated:
Size: