Yes, this is not in the asm.js spec yet. I think that might be added soon,
but it depends on the SIMD spec being stable.

- Alon



On Thu, Apr 10, 2014 at 5:17 AM, Soeren Balko <[email protected]> wrote:

> I saw the SIMD object existing in Firefox Nightly. I can quickly check if
> it conforms with the polyfill implementation. Also, I haven't been able to
> locate a formal draft of some spec - the documentation of the polyfill
> implementation is my only reference...
>
> On a different note: the SIMD.int32x4 and SIMD.float32x4 objects aren't
> asm.js compliant, or are they?
>
> Soeren
>
> On Thursday, April 10, 2014 9:50:38 AM UTC+10, Alon Zakai wrote:
>
>> Frankly, JS SIMD is still being specced out, so the emscripten polyfill
>> might lag behind the spec, and might well be suboptimal as not much effort
>> has gone into optimizations yet. Currently implementations of the spec are
>> expected to land in firefox and chrome, after that happens I think it will
>> make more sense to spend time on emscripten's SIMD support.
>>
>> - Alon
>>
>>
>>
>> On Tue, Apr 8, 2014 at 9:56 PM, Soeren Balko <[email protected]> wrote:
>>
>>> I reviewed the current SIMD implementation (as given by vector.h and in
>>> library.js). Unfortunately, the documentation on Javascript's
>>> implementation of SIMD is somewhat sparse, so I am using the documentation
>>> given in the polyfill implementation (https://github.com/
>>> johnmccutchan/ecmascript_simd/blob/master/src/ecmascript_simd.js) as a
>>> reference.
>>>
>>> Some of the implementations in library.js do a lot of copying/casting,
>>> e.g.
>>>
>>> emscripten_float32x4_and__inline: function(a, b) {
>>>     return 
>>> 'SIMD.int32x4.bitsToFloat32x4(SIMD.int32x4.and(SIMD.float32x4.bitsToInt32x4('
>>> + a + '), SIMD.float32x4.bitsToInt32x4(' + b + ')))';
>>> },
>>>
>>> Given the fact that float32x4 and int32x4 objects are immutable, this
>>> has noticable performance penalties. Also, looking at the polyfill
>>> implementation of SIMD.float32x4.and(...), I don't think I understand the
>>> rationale behind these copies:
>>>
>>>
>>> */***
>>> *  * @param {float32x4} a An instance of float32x4.*
>>> *  * @param {float32x4} b An instance of float32x4. *
>>> *  * @return {float32x4} New instance of float32x4 with values of a & b.*
>>> *  */*SIMD.float32x4.and *=* *function*(a, b) {
>>>   *var* aInt *=* SIMD.float32x4.bitsToInt32x4(a);
>>>   *var* bInt *=* SIMD.float32x4.bitsToInt32x4(b);
>>>   *return* SIMD.int32x4.bitsToFloat32x4(SIMD.int32x4.and(aInt, bInt));
>>> }
>>>
>>> In other cases, the emscripten function signature is different from the
>>> Javascript SIMD implementation. Like in case of
>>>
>>> emscripten_float32x4_lessThan__inline: function(a, b) {
>>>    return 'SIMD.int32x4.bitsToFloat32x4(SIMD.float32x4.lessThan(' + a +
>>> ', ' + b + '))';
>>> },
>>>
>>> which returns an float32x4 object, whereas the polyfill implementation
>>> returns an int32x4:
>>>
>>>
>>> */***
>>> *  * @param {float32x4} t An instance of float32x4.*
>>> *  * @param {float32x4} other An instance of float32x4. *
>>> *  * @return {int32x4} 0xFFFFFFFF or 0x0 in each lane depending on*
>>> *  * the result of t < other.*
>>> *  */ *SIMD.float32x4.lessThan *=* *function*(t, other) {
>>>   *var* cx *=* t.x *<* other.x;
>>>   *var* cy *=* t.y *<* other.y;
>>>   *var* cz *=* t.z *<* other.z;
>>>   *var* cw *=* t.w *<* other.w;
>>>   *return* SIMD.int32x4.bool(cx, cy, cz, cw);
>>> }
>>>
>>> Can someone educate me why that is, please?
>>>
>>> Soeren
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "emscripten-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to