Closed Bug 1048923 Opened 11 years ago Closed 11 years ago

SIMD: Tidy up SIMD.{h,cpp} and better handle unary binary functions

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla34

People

(Reporter: bbouvier, Assigned: bbouvier)

Details

Attachments

(5 files)

No description provided.
This patch renames js::Create<SimdType> into js::CreateSimd<SimdType>, as asked in the SIMD odin bug.
Attachment #8467808 - Flags: review?(luke)
GetLane can actually take advantage of those helpers introduced in a former patch.
Attachment #8467809 - Flags: review?(nmatsakis)
Another helper that creates the result object and stores it in args.rval(). Easy tidying up.
Attachment #8467810 - Flags: review?(nmatsakis)
The fact that unary and binary SIMD functions are handled the same way makes it quite difficult to specialize for the number of arguments, leading to weird possible uses. For instance, one can call an unary SIMD operator with two arguments, and the second will be ignored. More fancy: one can also call a binary SIMD op with only argument, and in this case the second argument will be 0 by default. var x = SIMD.float32x4(1,2,3,4); SIMD.float32x4.add(x); // returns x SIMD.float32x4.mul(x); // returns 0 x 4 SIMD.float32x4.div(x); // returns Infinity x 4 Let's just split the logic into two functions, that makes it easier to follow and less error prone.
Attachment #8467811 - Flags: review?(nmatsakis)
The last macro param in the functions list isn't used and probably won't be.
Attachment #8467812 - Flags: review?(nmatsakis)
Comment on attachment 8467808 [details] [diff] [review] Rename js::Create into js::CreateSimd Review of attachment 8467808 [details] [diff] [review]: ----------------------------------------------------------------- As mentioned in bug 992267, perhaps we can standardize on "SIMD" instead of "Simd".
Attachment #8467808 - Flags: review?(luke) → review+
Part 1: (we agreed on keeping on using the Simd form, to avoid forms like AsmJSSIMDSomething) https://hg.mozilla.org/integration/mozilla-inbound/rev/044f81a162bf
Keywords: leave-open
Comment on attachment 8467809 [details] [diff] [review] Use helpers in GetLane Review of attachment 8467809 [details] [diff] [review]: ----------------------------------------------------------------- Hard to object to this!
Attachment #8467809 - Flags: review?(nmatsakis) → review+
Attachment #8467810 - Flags: review?(nmatsakis) → review+
Attachment #8467811 - Flags: review?(nmatsakis) → review+
Attachment #8467812 - Flags: review?(nmatsakis) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: