Closed Bug 586267 Opened 14 years ago Closed 13 years ago

JM: Detect MUL overflow on ARM.

Categories

(Core :: JavaScript Engine, enhancement)

ARM
Linux
enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 673314

People

(Reporter: jbramley, Assigned: jbramley)

Details

From jsop_binary:
----
#if defined(JS_CPU_ARM)
        /* ARM cannot detect integer overflow with multiplication. */
        || op == JSOP_MUL
#endif /* JS_CPU_ARM */
----

It is possible using this sequence:

SMULL   rLo, rHi, rA, rB
CMP     rHi, rLo, ASR #31

The 32-bit result will be in rLo. rHi can be any scratch register. The only caveat is that the sequence sets the Z flag, not the V flag.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.