Closed Bug 983448 Opened 11 years ago Closed 11 years ago

masm.convertUInt32ToFloat32 gives wrong results on x86

Categories

(Core :: JavaScript Engine: JIT, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30
Tracking Status
firefox29 --- fixed
firefox30 --- fixed

People

(Reporter: luke, Assigned: luke)

References

Details

Attachments

(1 file)

convertUInt32ToFloat32 uses the same scheme as convertUInt32ToDouble (subtract 2^31, cvtsi2sd, add 2^31), except that this doesn't work for float because float can't precisely represent integers as large as 2^31 so the final addition ends up producing the wrong number for small integers. (Atm, convertUint3ToFloat32 is only generated from MAsmJSUnsignedToFloat32 so this is an asm.js-only bug.) The C++ compiler does various arcane things for unsigned-to-float conversion but, seeing as this is a fairly rare operation, I just went with convertUint32ToDouble convertDoubleToFloat32 in this patch.
Attachment #8390885 - Flags: review?(benj)
Comment on attachment 8390885 [details] [diff] [review] fix-unsigned-to-float32 Review of attachment 8390885 [details] [diff] [review]: ----------------------------------------------------------------- Doh, nice catch!
Attachment #8390885 - Flags: review?(benj) → review+
Assignee: nobody → luke
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Comment on attachment 8390885 [details] [diff] [review] fix-unsigned-to-float32 [Approval Request Comment] Bug caused by (feature/regressing bug #): 904918 User impact if declined: incorrect JS results Testing completed (on m-c, etc.): m-c, m-a Risk to taking this patch (and alternatives if risky): very low
Attachment #8390885 - Flags: approval-mozilla-beta?
Attachment #8390885 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: