Closed Bug 940642 Opened 11 years ago Closed 11 years ago

IonMonkey: Incorrect result for multiplication when also calling imul

Categories

(Core :: JavaScript Engine: JIT, defect)

x86_64
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28
Tracking Status
firefox28 --- fixed

People

(Reporter: jruderman, Assigned: evilpie)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

function sprod(x, y) {
    var iprod = Math.imul(x | 0, y | 0);
    var fprod = (x | 0) * (y | 0);
    return iprod + fprod;
}
assertEq(sprod(2, 2), 8);
assertEq(sprod(0x10000, 0x10000), 0x100000000);


With --ion-eager:
c.js:7:0 Error: Assertion failed: got 0, expected 4294967296


The first bad revision is:
changeset:   http://hg.mozilla.org/mozilla-central/rev/b9c4a9483492
user:        Tom Schuster
date:        Fri Jan 04 00:10:19 2013 +0100
summary:     Bug 822436 - IonMonkey: Inline Math.imul. r=h4writer
Attached patch imulSplinter Review
Assignee: nobody → evilpies
Status: NEW → ASSIGNED
Attachment #8336773 - Flags: review?(hv1989)
Comment on attachment 8336773 [details] [diff] [review]
imul

Review of attachment 8336773 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/jit/MIR.h
@@ +4000,5 @@
> +
> +        MMul *mul = ins->toMul();
> +        if (canBeNegativeZero_ != mul->canBeNegativeZero() ||
> +            mode_ != mul->mode())
> +            return false;

I would split it as following:

if (canBeNegativeZero_ != mul->canBeNegativeZero())
    return false;

if (mode_ != mul->mode())
    return false;

@@ +4002,5 @@
> +        if (canBeNegativeZero_ != mul->canBeNegativeZero() ||
> +            mode_ != mul->mode())
> +            return false;
> +
> +        return congruentIfOperandsEqual(ins);

MBinaryInstruction::congruentTo()

That will also change to order of the operands if that is deemed better.
Attachment #8336773 - Flags: review?(hv1989) → review+
https://hg.mozilla.org/mozilla-central/rev/883577706b74
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: