Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1173)

Unified Diff: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart

Issue 14531008: Added SIMD stubs for dart2js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
diff --git a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
index 3187a8c810362a1b6c934de4b1376a5d73b0a7cf..06604ceb9d6811c71759e25b5f1626d745dc9a42 100644
--- a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
+++ b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
@@ -2344,6 +2344,172 @@ class Uint64List extends TypedData implements JavaScriptIndexingBehavior, List<i
}
+abstract class Float32x4List implements List<Float32x4>, TypedData {
+ factory Float32x4List(int length) {
+ throw new UnsupportedError("Float32x4List not supported by dart2js.");
+ }
+
+ factory Float32x4List.view(ByteBuffer buffer,
+ [int offsetInBytes = 0, int length]) {
+ throw new UnsupportedError("Float32x4List not supported by dart2js.");
+ }
+
+ static const int BYTES_PER_ELEMENT = 16;
+}
+
+
+abstract class Float32x4 {
blois 2013/04/29 22:01:01 Is there no good way to share the declaration of t
vsm 2013/04/29 23:55:39 Not easily. These classes are external / patched
+ factory Float32x4(double x, double y, double z, double w) {
+ throw new UnsupportedError("Float32x4 not supported by dart2js.");
+ }
+ factory Float32x4.splat(double v) {
+ throw new UnsupportedError("Float32x4 not supported by dart2js.");
+ }
+ factory Float32x4.zero() {
+ throw new UnsupportedError("Float32x4 not supported by dart2js.");
+ }
+
+ /// Addition operator.
+ Float32x4 operator+(Float32x4 other);
+ /// Negate operator.
+ Float32x4 operator-();
+ /// Subtraction operator.
+ Float32x4 operator-(Float32x4 other);
+ /// Multiplication operator.
+ Float32x4 operator*(Float32x4 other);
+ /// Division operator.
+ Float32x4 operator/(Float32x4 other);
+
+ /// Relational less than.
+ Uint32x4 lessThan(Float32x4 other);
+ /// Relational less than or equal.
+ Uint32x4 lessThanOrEqual(Float32x4 other);
+ /// Relational greater than.
+ Uint32x4 greaterThan(Float32x4 other);
+ /// Relational greater than or equal.
+ Uint32x4 greaterThanOrEqual(Float32x4 other);
+ /// Relational equal.
+ Uint32x4 equal(Float32x4 other);
+ /// Relational not-equal.
+ Uint32x4 notEqual(Float32x4 other);
+
+ /// Returns a copy of [this] each lane being scaled by [s].
+ Float32x4 scale(double s);
+ /// Returns the absolute value of this [Float32x4].
+ Float32x4 abs();
+ /// Clamps [this] to be in the range [lowerLimit]-[upperLimit].
+ Float32x4 clamp(Float32x4 lowerLimit,
+ Float32x4 upperLimit);
+
+ /// Extracted x value.
+ double get x;
+ /// Extracted y value.
+ double get y;
+ /// Extracted z value.
+ double get z;
+ /// Extracted w value.
+ double get w;
+
+ /// Returns a new [Float32x4] with [this]' x value in all four lanes.
+ Float32x4 get xxxx;
+ /// Returns a new [Float32x4] with [this]' y value in all four lanes.
+ Float32x4 get yyyy;
+ /// Returns a new [Float32x4] with [this]' z value in all four lanes.
+ Float32x4 get zzzz;
+ /// Returns a new [Float32x4] with [this]' w value in all four lanes.
+ Float32x4 get wwww;
+ // TODO(johnmccutchan): Add all 256 possible combinations.
+
+ /// Returns a new [Float32x4] copied from [this] with a new x value.
+ Float32x4 withX(double x);
+ /// Returns a new [Float32x4] copied from [this] with a new y value.
+ Float32x4 withY(double y);
+ /// Returns a new [Float32x4] copied from [this] with a new z value.
+ Float32x4 withZ(double z);
+ /// Returns a new [Float32x4] copied from [this] with a new w value.
+ Float32x4 withW(double w);
+
+ /// Returns the lane-wise minimum value in [this] or [other].
+ Float32x4 min(Float32x4 other);
+
+ /// Returns the lane-wise maximum value in [this] or [other].
+ Float32x4 max(Float32x4 other);
+
+ /// Returns the square root of [this].
+ Float32x4 sqrt();
+
+ /// Returns the reciprocal of [this].
+ Float32x4 reciprocal();
+
+ /// Returns the square root of the reciprocal of [this].
+ Float32x4 reciprocalSqrt();
+
+ /// Returns a bit-wise copy of [this] as a [Uint32x4].
+ Uint32x4 toUint32x4();
+}
+
+
+abstract class Uint32x4 {
+ factory Uint32x4(int x, int y, int z, int w) {
+ throw new UnsupportedError("Uint32x4 not supported by dart2js.");
+ }
+ factory Uint32x4.bool(bool x, bool y, bool z, bool w) {
+ throw new UnsupportedError("Uint32x4 not supported by dart2js.");
+ }
+
+ /// The bit-wise or operator.
+ Uint32x4 operator|(Uint32x4 other);
+ /// The bit-wise and operator.
+ Uint32x4 operator&(Uint32x4 other);
+ /// The bit-wise xor operator.
+ Uint32x4 operator^(Uint32x4 other);
+
+ /// Extract 32-bit mask from x lane.
+ int get x;
+ /// Extract 32-bit mask from y lane.
+ int get y;
+ /// Extract 32-bit mask from z lane.
+ int get z;
+ /// Extract 32-bit mask from w lane.
+ int get w;
+
+ /// Returns a new [Uint32x4] copied from [this] with a new x value.
+ Uint32x4 withX(int x);
+ /// Returns a new [Uint32x4] copied from [this] with a new y value.
+ Uint32x4 withY(int y);
+ /// Returns a new [Uint32x4] copied from [this] with a new z value.
+ Uint32x4 withZ(int z);
+ /// Returns a new [Uint32x4] copied from [this] with a new w value.
+ Uint32x4 withW(int w);
+
+ /// Extracted x value. Returns false for 0, true for any other value.
+ bool get flagX;
+ /// Extracted y value. Returns false for 0, true for any other value.
+ bool get flagY;
+ /// Extracted z value. Returns false for 0, true for any other value.
+ bool get flagZ;
+ /// Extracted w value. Returns false for 0, true for any other value.
+ bool get flagW;
+
+ /// Returns a new [Uint32x4] copied from [this] with a new x value.
+ Uint32x4 withFlagX(bool x);
+ /// Returns a new [Uint32x4] copied from [this] with a new y value.
+ Uint32x4 withFlagY(bool y);
+ /// Returns a new [Uint32x4] copied from [this] with a new z value.
+ Uint32x4 withFlagZ(bool z);
+ /// Returns a new [Uint32x4] copied from [this] with a new w value.
+ Uint32x4 withFlagW(bool w);
+
+ /// Merge [trueValue] and [falseValue] based on [this]' bit mask:
+ /// Select bit from [trueValue] when bit in [this] is on.
+ /// Select bit from [falseValue] when bit in [this] is off.
+ Float32x4 select(Float32x4 trueValue, Float32x4 falseValue);
+
+ /// Returns a bit-wise copy of [this] as a [Float32x4].
+ Float32x4 toFloat32x4();
+}
+
+
// TODO(vsm): Eliminate this class and just inline into above.
class _TypedArrayFactoryProvider {
static ByteData createByteData(int length) => _B8(length);

Powered by Google App Engine
This is Rietveld 408576698