dslomov / typed-objects-es7

ES7 typed objects spec draft
127 stars 7 forks source link

Grounded SIMD types #11

Open RLH opened 10 years ago

RLH commented 10 years ago

What is the approach going to be for SIMD vector types such as float32x4? Is the hope that the "sufficiently sophisticated compiler" will be able to take an array of float32s and interpret it as an array of float32x4 without hints from the programmer? Alternatively a struct with 4 float32 fields might be recognized as amenable to SIMD instructions being generated by the compiler. Finally what is the relationship between the base types of the value types.

dslomov commented 10 years ago

Our hope is that float32x4 will be expressible as a "value object" - which is a concept related to typed objects but different. One idea would be:

  const float32x4 = new ValueType({x : float32, y : float32, z : float32, w : float32 });
  float32x4.prototype.xxyy = ... // native function translated to SIMD instruction