Closed Bug 1252927 Opened 5 years ago Closed 5 years ago

SIMD: Truncate before range check in Uint32x4.fromFloat32x4()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: jolesen, Assigned: jolesen)

References

Details

Attachments

(1 file)

The semantics of the float to integer conversions changed slightly in the SIMD.js spec: https://github.com/tc39/ecmascript_simd/pull/332

The new method truncates the floating point input to an integer value *before* the range check. Previously, the range check was performen on the possibly fractional input.

This means that -0.9 now converts to 0 when previously it would throw a RangeError when converting to Uint32.
Fix this both in the VM and the x86 JIT.
Attachment #8725889 - Flags: review?(sunfish)
Comment on attachment 8725889 [details] [diff] [review]
SIMD: Truncate before range check.

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

Implements the desired semantics, and uses less code at the same time :-).
Attachment #8725889 - Flags: review?(sunfish) → review+
https://hg.mozilla.org/mozilla-central/rev/63688afe0bd3
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.