Chromium Code Reviews| Index: runtime/lib/simd128.dart |
| diff --git a/runtime/lib/simd128.dart b/runtime/lib/simd128.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a8a42e52c58979b2e804bb058a706bb1b0c98029 |
| --- /dev/null |
| +++ b/runtime/lib/simd128.dart |
| @@ -0,0 +1,752 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +patch class Simd128Float32x4 { |
| + /* patch */ factory Simd128Float32x4(double x, double y, double z, double w) { |
| + return new _Simd128Float32x4(x, y, z, w); |
| + } |
| + /* patch */ factory Simd128Float32x4.zero() { |
| + return new _Simd128Float32x4.zero(); |
| + } |
| +} |
| + |
| +patch class Simd128Mask { |
| + /* patch */ factory Simd128Mask(int x, int y, int z, int w) { |
| + return new _Simd128Mask(x, y, z, w); |
| + } |
| + /* patch */ factory Simd128Mask.bool(bool x, bool y, bool z, bool w) { |
| + return new _Simd128Mask.bool(x, y, z, w); |
| + } |
| +} |
| + |
| + |
| +patch class Simd128Float32x4List { |
| + /* patch */ factory Simd128Float32x4List(int length) { |
| + return new _Simd128Float32x4Array(length); |
| + } |
| + |
| + /* patch */ factory Simd128Float32x4List.transferable(int length) { |
| + return _newTransferable(length); |
| + } |
| + |
| + /* patch */ factory Simd128Float32x4List.view(ByteArray array, |
| + [int start = 0, int length]) { |
| + return new _Simd128Float32x4ArrayView(array, start, length); |
| + } |
| + |
| + static _ExternalSimd128Float32x4Array _newTransferable(int length) |
| + native "Simd128Float32x4List_newTransferable"; |
| +} |
| + |
| + |
| +// Expose native square root. |
| +double _sqrt(double x) native "Math_sqrt"; |
|
srdjan
2013/02/21 21:43:25
Why is that needed? Can't you get at dart:math?
Cutch
2013/02/22 03:30:55
I couldn't import 'dart:math' from this source fil
|
| +class _Simd128Float32x4Dart implements Simd128Float32x4 { |
| + final Float32List _storage = new Float32List(4); |
| + _Simd128Float32x4Dart.empty() { |
| + } |
| + _Simd128Float32x4Dart.copy(Float32List other) { |
| + _storage[0] = other._storage[0]; |
| + _storage[1] = other._storage[1]; |
| + _storage[2] = other._storage[2]; |
| + _storage[3] = other._storage[3]; |
| + } |
| + factory _Simd128Float32x4Dart(double x, double y, double z, double w) { |
| + var instance = new _Simd128Float32x4Dart.empty(); |
| + instance._storage[0] = x; |
| + instance._storage[1] = y; |
| + instance._storage[2] = z; |
| + instance._storage[3] = w; |
| + return instance; |
| + } |
| + factory _Simd128Float32x4Dart.zero() { |
| + var instance = new _Simd128Float32x4Dart.empty(); |
| + return instance; |
| + } |
| + Simd128Float32x4 operator+(Simd128Float32x4 other) { |
|
srdjan
2013/02/21 21:43:25
Please put space between operator and operator nam
Cutch
2013/02/22 03:30:55
Done.
|
| + var instance = new _Simd128Float32x4Dart.copy(this); |
|
srdjan
2013/02/21 21:43:25
This way to compute seems quite slow: first you co
Cutch
2013/02/22 03:30:55
Done.
|
| + instance._storage[0] += other._storage[0]; |
| + instance._storage[1] += other._storage[1]; |
| + instance._storage[2] += other._storage[2]; |
| + instance._storage[3] += other._storage[3]; |
| + return instance; |
| + } |
| + Simd128Float32x4 operator-() { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] *= -1.0; |
| + instance._storage[1] *= -1.0; |
| + instance._storage[2] *= -1.0; |
| + instance._storage[3] *= -1.0; |
| + return instance; |
| + } |
| + Simd128Float32x4 operator-(Simd128Float32x4 other) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] -= other._storage[0]; |
| + instance._storage[1] -= other._storage[1]; |
| + instance._storage[2] -= other._storage[2]; |
| + instance._storage[3] -= other._storage[3]; |
| + return instance; |
| + } |
| + Simd128Float32x4 operator*(Simd128Float32x4 other) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] *= other._storage[0]; |
| + instance._storage[1] *= other._storage[1]; |
| + instance._storage[2] *= other._storage[2]; |
| + instance._storage[3] *= other._storage[3]; |
| + return instance; |
| + } |
| + Simd128Float32x4 operator/(Simd128Float32x4 other) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] /= other._storage[0]; |
| + instance._storage[1] /= other._storage[1]; |
| + instance._storage[2] /= other._storage[2]; |
| + instance._storage[3] /= other._storage[3]; |
| + return instance; |
| + } |
| + Simd128Mask lessThan(Simd128Float32x4 other) { |
| + bool _x = _storage[0] < other._storage[0]; |
| + bool _y = _storage[1] < other._storage[1]; |
| + bool _z = _storage[2] < other._storage[2]; |
| + bool _w = _storage[3] < other._storage[3]; |
| + return new Simd128Mask.bool(_x, _y, _z, _w); |
| + } |
| + Simd128Mask lessThanOrEqual(Simd128Float32x4 other) { |
| + bool _x = _storage[0] <= other._storage[0]; |
| + bool _y = _storage[1] <= other._storage[1]; |
| + bool _z = _storage[2] <= other._storage[2]; |
| + bool _w = _storage[3] <= other._storage[3]; |
| + return new Simd128Mask.bool(_x, _y, _z, _w); |
| + } |
| + Simd128Mask greaterThan(Simd128Float32x4 other) { |
| + bool _x = _storage[0] > other._storage[0]; |
| + bool _y = _storage[1] > other._storage[1]; |
| + bool _z = _storage[2] > other._storage[2]; |
| + bool _w = _storage[3] > other._storage[3]; |
| + return new Simd128Mask.bool(_x, _y, _z, _w); |
| + } |
| + Simd128Mask greaterThanOrEqual(Simd128Float32x4 other) { |
| + bool _x = _storage[0] >= other._storage[0]; |
| + bool _y = _storage[1] >= other._storage[1]; |
| + bool _z = _storage[2] >= other._storage[2]; |
| + bool _w = _storage[3] >= other._storage[3]; |
| + return new Simd128Mask.bool(_x, _y, _z, _w); |
| + } |
| + Simd128Mask equal(Simd128Float32x4 other) { |
| + bool _x = _storage[0] == other._storage[0]; |
| + bool _y = _storage[1] == other._storage[1]; |
| + bool _z = _storage[2] == other._storage[2]; |
| + bool _w = _storage[3] == other._storage[3]; |
| + return new Simd128Mask.bool(_x, _y, _z, _w); |
| + } |
| + Simd128Mask notEqual(Simd128Float32x4 other) { |
| + bool _x = _storage[0] != other._storage[0]; |
| + bool _y = _storage[1] != other._storage[1]; |
| + bool _z = _storage[2] != other._storage[2]; |
| + bool _w = _storage[3] != other._storage[3]; |
| + return new Simd128Mask.bool(_x, _y, _z, _w); |
| + } |
| + Simd128Float32x4 scale(double s) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] *= s; |
| + instance._storage[1] *= s; |
| + instance._storage[2] *= s; |
| + instance._storage[3] *= s; |
| + return instance; |
| + } |
| + Simd128Float32x4 abs() { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = instance._storage[0].abs(); |
| + instance._storage[1] = instance._storage[1].abs(); |
| + instance._storage[2] = instance._storage[2].abs(); |
| + instance._storage[3] = instance._storage[3].abs(); |
| + return instance; |
| + } |
| + Simd128Float32x4 clamp(Simd128Float32x4 lowerLimit, |
| + Simd128Float32x4 upperLimit) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + if (instance._storage[0] > upperLimit._storage[0]) { |
| + instance._storage[0] = upperLimit._storage[0]; |
| + } |
| + if (instance._storage[1] > upperLimit._storage[1]) { |
| + instance._storage[1] = upperLimit._storage[1]; |
| + } |
| + if (instance._storage[2] > upperLimit._storage[2]) { |
| + instance._storage[2] = upperLimit._storage[2]; |
| + } |
| + if (instance._storage[3] > upperLimit._storage[3]) { |
| + instance._storage[3] = upperLimit._storage[3]; |
| + } |
| + if (instance._storage[0] < lowerLimit._storage[0]) { |
| + instance._storage[0] = lowerLimit._storage[0]; |
| + } |
| + if (instance._storage[1] < lowerLimit._storage[1]) { |
| + instance._storage[1] = lowerLimit._storage[1]; |
| + } |
| + if (instance._storage[2] < lowerLimit._storage[2]) { |
| + instance._storage[2] = lowerLimit._storage[2]; |
| + } |
| + if (instance._storage[3] < lowerLimit._storage[3]) { |
| + instance._storage[3] = lowerLimit._storage[3]; |
| + } |
| + return instance; |
| + } |
| + double get x => _storage[0]; |
| + double get y => _storage[1]; |
| + double get z => _storage[2]; |
| + double get w => _storage[3]; |
| + Simd128Float32x4 get xxxx { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[1] = instance._storage[0]; |
| + instance._storage[2] = instance._storage[0]; |
| + instance._storage[3] = instance._storage[0]; |
| + return instance; |
| + } |
| + Simd128Float32x4 get yyyy { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = instance._storage[1]; |
| + instance._storage[2] = instance._storage[1]; |
| + instance._storage[3] = instance._storage[1]; |
| + return instance; |
| + } |
| + Simd128Float32x4 get zzzz { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = instance._storage[2]; |
| + instance._storage[1] = instance._storage[2]; |
| + instance._storage[3] = instance._storage[2]; |
| + return instance; |
| + } |
| + Simd128Float32x4 get wwww { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = instance._storage[3]; |
| + instance._storage[1] = instance._storage[3]; |
| + instance._storage[2] = instance._storage[3]; |
| + return instance; |
| + } |
| + Simd128Float32x4 withX(double x) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = x; |
| + return instance; |
| + } |
| + Simd128Float32x4 withY(double y) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[1] = y; |
| + return instance; |
| + } |
| + Simd128Float32x4 withZ(double z) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[2] = z; |
| + return instance; |
| + } |
| + Simd128Float32x4 withW(double w) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[3] = w; |
| + return instance; |
| + } |
| + Simd128Float32x4 min(Simd128Float32x4 other) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + if (instance._storage[0] > other._storage[0]) { |
| + instance._storage[0] = other._storage[0]; |
| + } |
| + if (instance._storage[1] > other._storage[1]) { |
| + instance._storage[1] = other._storage[1]; |
| + } |
| + if (instance._storage[2] > other._storage[2]) { |
| + instance._storage[2] = other._storage[2]; |
| + } |
| + if (instance._storage[3] > other._storage[3]) { |
| + instance._storage[3] = other._storage[3]; |
| + } |
| + return instance; |
| + } |
| + Simd128Float32x4 max(Simd128Float32x4 other) { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + if (instance._storage[0] < other._storage[0]) { |
| + instance._storage[0] = other._storage[0]; |
| + } |
| + if (instance._storage[1] < other._storage[1]) { |
| + instance._storage[1] = other._storage[1]; |
| + } |
| + if (instance._storage[2] < other._storage[2]) { |
| + instance._storage[2] = other._storage[2]; |
| + } |
| + if (instance._storage[3] < other._storage[3]) { |
| + instance._storage[3] = other._storage[3]; |
| + } |
| + return instance; |
| + } |
| + Simd128Float32x4 sqrt() { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = _sqrt(instance._storage[0]); |
| + instance._storage[1] = _sqrt(instance._storage[1]); |
| + instance._storage[2] = _sqrt(instance._storage[2]); |
| + instance._storage[3] = _sqrt(instance._storage[3]); |
| + return instance; |
| + } |
| + Simd128Float32x4 reciprocal() { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = (1.0 / instance._storage[0]); |
| + instance._storage[1] = (1.0 / instance._storage[1]); |
| + instance._storage[2] = (1.0 / instance._storage[2]); |
| + instance._storage[3] = (1.0 / instance._storage[3]); |
| + return instance; |
| + } |
| + Simd128Float32x4 reciprocalSqrt() { |
| + var instance = new _Simd128Float32x4Dart.copy(this); |
| + instance._storage[0] = _sqrt(1.0 / instance._storage[0]); |
| + instance._storage[1] = _sqrt(1.0 / instance._storage[1]); |
| + instance._storage[2] = _sqrt(1.0 / instance._storage[2]); |
| + instance._storage[3] = _sqrt(1.0 / instance._storage[3]); |
| + return instance; |
| + } |
| + Simd128Mask toSimd128Mask() { |
| + Uint32List view = new Uint32List.view(_storage.asByteArray()); |
| + return new Simd128Mask(view[0], view[1], view[2], view[3]); |
| + } |
| +} |
| + |
| +class _Simd128MaskDart implements Simd128Mask { |
| + final Uint32List _storage = new Uint32List(4); |
| + _Simd128MaskDart.empty() { |
| + } |
| + _Simd128MaskDart.copy(_Simd128MaskDart other) { |
| + _storage[0] = other._storage[0]; |
| + _storage[1] = other._storage[1]; |
| + _storage[2] = other._storage[2]; |
| + _storage[3] = other._storage[3]; |
| + } |
| + factory _Simd128MaskDart(int x, int y, int z, int w) { |
| + var instance = new _Simd128MaskDart.empty(); |
| + instance._storage[0] = x; |
| + instance._storage[1] = y; |
| + instance._storage[2] = z; |
| + instance._storage[3] = w; |
| + return instance; |
| + } |
| + factory _Simd128MaskDart.bool(bool x, bool y, bool z, bool w) { |
| + var instance = new _Simd128MaskDart.empty(); |
| + instance._storage[0] = x ? 0xFFFFFFFF : 0x0; |
| + instance._storage[1] = y ? 0xFFFFFFFF : 0x0; |
| + instance._storage[2] = z ? 0xFFFFFFFF : 0x0; |
| + instance._storage[3] = w ? 0xFFFFFFFF : 0x0; |
| + return instance; |
| + } |
| + Simd128Mask operator|(Simd128Mask other) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[0] |= other._storage[0]; |
| + instance._storage[1] |= other._storage[1]; |
| + instance._storage[2] |= other._storage[2]; |
| + instance._storage[3] |= other._storage[3]; |
| + return instance; |
| + } |
| + Simd128Mask operator&(Simd128Mask other) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[0] &= other._storage[0]; |
| + instance._storage[1] &= other._storage[1]; |
| + instance._storage[2] &= other._storage[2]; |
| + instance._storage[3] &= other._storage[3]; |
| + return instance; |
| + } |
| + Simd128Mask operator^(Simd128Mask other) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[0] ^= other._storage[0]; |
| + instance._storage[1] ^= other._storage[1]; |
| + instance._storage[2] ^= other._storage[2]; |
| + instance._storage[3] ^= other._storage[3]; |
| + return instance; |
| + } |
| + int get x => _storage[0]; |
| + int get y => _storage[1]; |
| + int get z => _storage[2]; |
| + int get w => _storage[3]; |
| + Simd128Mask withX(int x) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[0] = x & 0xFFFFFFFF; |
| + return instance; |
| + } |
| + Simd128Mask withY(int y) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[1] = y & 0xFFFFFFFF; |
| + return instance; |
| + } |
| + Simd128Mask withZ(int z) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[2] = z & 0xFFFFFFFF; |
| + return instance; |
| + } |
| + Simd128Mask withW(int w) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[3] = w & 0xFFFFFFFF; |
| + return instance; |
| + } |
| + bool get flagX => _storage[0] != 0x0; |
| + bool get flagY => _storage[1] != 0x0; |
| + bool get flagZ => _storage[2] != 0x0; |
| + bool get flagW => _storage[3] != 0x0; |
| + Simd128Mask withFlagX(bool x) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[0] = x ? 0xFFFFFFFF : 0x0; |
| + return instance; |
| + } |
| + Simd128Mask withFlagY(bool y) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[1] = y ? 0xFFFFFFFF : 0x0; |
| + return instance; |
| + } |
| + Simd128Mask withFlagZ(bool z) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[2] = z ? 0xFFFFFFFF : 0x0; |
| + return instance; |
| + } |
| + Simd128Mask withFlagW(bool w) { |
| + var instance = new _Simd128MaskDart.copy(this); |
| + instance._storage[3] = w ? 0xFFFFFFFF : 0x0; |
| + return instance; |
| + } |
| + Simd128Float32x4 select(Simd128Float32x4 trueValue, |
| + Simd128Float32x4 falseValue) { |
| + Simd128Mask trueMask = trueValue.toSimd128Mask(); |
| + Simd128Mask falseMask = falseValue.toSimd128Mask(); |
| + var instance = new _Simd128MaskDart.empty(); |
| + instance._storage[0] = (_storage[0] & trueMask._storage[0]); |
| + instance._storage[1] = (_storage[1] & trueMask._storage[1]); |
| + instance._storage[2] = (_storage[2] & trueMask._storage[2]); |
| + instance._storage[3] = (_storage[3] & trueMask._storage[3]); |
| + instance._storage[0] |= (~_storage[0] & falseMask._storage[0]); |
| + instance._storage[1] |= (~_storage[1] & falseMask._storage[1]); |
| + instance._storage[2] |= (~_storage[2] & falseMask._storage[2]); |
| + instance._storage[3] |= (~_storage[3] & falseMask._storage[3]); |
| + return instance.toSimd128Float32x4(); |
| + } |
| + Simd128Float32x4 toSimd128Float32x4() { |
| + Float32List view = new Float32List.view(_storage.asByteArray()); |
| + return new Simd128Float32x4(view[0], view[1], view[2], view[3]); |
| + } |
| +} |
| + |
| +class _Simd128Float32x4 implements Simd128Float32x4 { |
| + factory _Simd128Float32x4(double x, double y, double z, double w) |
| + native "Simd128Float32_fromDoubles"; |
| + factory _Simd128Float32x4.zero() native "Simd128Float32_zero"; |
| + Simd128Float32x4 operator+(Simd128Float32x4 other) { |
| + return _add(other); |
| + } |
| + Simd128Float32x4 _add(Simd128Float32x4 other) native "Simd128Float32_add"; |
| + Simd128Float32x4 operator-() { |
| + return _negate(); |
| + } |
| + Simd128Float32x4 _negate() native "Simd128Float32_negate"; |
| + Simd128Float32x4 operator-(Simd128Float32x4 other) { |
| + return _sub(other); |
| + } |
| + Simd128Float32x4 _sub(Simd128Float32x4 other) native "Simd128Float32_sub"; |
| + Simd128Float32x4 operator*(Simd128Float32x4 other) { |
| + return _mul(other); |
| + } |
| + Simd128Float32x4 _mul(Simd128Float32x4 other) native "Simd128Float32_mul"; |
| + Simd128Float32x4 operator/(Simd128Float32x4 other) { |
| + return _div(other); |
| + } |
| + Simd128Float32x4 _div(Simd128Float32x4 other) native "Simd128Float32_div"; |
| + Simd128Mask lessThan(Simd128Float32x4 other) { |
| + return _cmplt(other); |
| + } |
| + Simd128Mask _cmplt(Simd128Float32x4 other) native "Simd128Float32_cmplt"; |
| + Simd128Mask lessThanOrEqual(Simd128Float32x4 other) { |
| + return _cmplte(other); |
| + } |
| + Simd128Mask _cmplte(Simd128Float32x4 other) native "Simd128Float32_cmplte"; |
| + Simd128Mask greaterThan(Simd128Float32x4 other) { |
| + return _cmpgt(other); |
| + } |
| + Simd128Mask _cmpgt(Simd128Float32x4 other) native "Simd128Float32_cmpgt"; |
| + Simd128Mask greaterThanOrEqual(Simd128Float32x4 other) { |
| + return _cmpgte(other); |
| + } |
| + Simd128Mask _cmpgte(Simd128Float32x4 other) native "Simd128Float32_cmpgte"; |
| + Simd128Mask equal(Simd128Float32x4 other) { |
| + return _cmpequal(other); |
| + } |
| + Simd128Mask _cmpequal(Simd128Float32x4 other) |
| + native "Simd128Float32_cmpequal"; |
| + Simd128Mask notEqual(Simd128Float32x4 other) { |
| + return _cmpnequal(other); |
| + } |
| + Simd128Mask _cmpnequal(Simd128Float32x4 other) |
| + native "Simd128Float32_cmpnequal"; |
| + Simd128Float32x4 scale(double s) { |
| + return _scale(s); |
| + } |
| + Simd128Float32x4 _scale(double s) native "Simd128Float32_scale"; |
| + Simd128Float32x4 abs() { |
| + return _abs(); |
| + } |
| + Simd128Float32x4 _abs() native "Simd128Float32_abs"; |
| + Simd128Float32x4 clamp(Simd128Float32x4 lowerLimit, |
| + Simd128Float32x4 upperLimit) { |
| + return _clamp(lowerLimit, upperLimit); |
| + } |
| + Simd128Float32x4 _clamp(Simd128Float32x4 lowerLimit, |
| + Simd128Float32x4 upperLimit) |
| + native "Simd128Float32_clamp"; |
| + double get x native "Simd128Float32_getX"; |
| + double get y native "Simd128Float32_getY"; |
| + double get z native "Simd128Float32_getZ"; |
| + double get w native "Simd128Float32_getW"; |
| + Simd128Float32x4 get xxxx native "Simd128Float32_getXXXX"; |
| + Simd128Float32x4 get yyyy native "Simd128Float32_getYYYY"; |
| + Simd128Float32x4 get zzzz native "Simd128Float32_getZZZZ"; |
| + Simd128Float32x4 get wwww native "Simd128Float32_getWWWW"; |
| + Simd128Float32x4 withX(double x) native "Simd128Float32_setX"; |
| + Simd128Float32x4 withY(double y) native "Simd128Float32_setY"; |
| + Simd128Float32x4 withZ(double z) native "Simd128Float32_setZ"; |
| + Simd128Float32x4 withW(double w) native "Simd128Float32_setW"; |
| + Simd128Float32x4 min(Simd128Float32x4 other) { |
| + return _min(other); |
| + } |
| + Simd128Float32x4 _min(Simd128Float32x4 other) native "Simd128Float32_min"; |
| + Simd128Float32x4 max(Simd128Float32x4 other) { |
| + return _max(other); |
| + } |
| + Simd128Float32x4 _max(Simd128Float32x4 other) native "Simd128Float32_max"; |
| + Simd128Float32x4 sqrt() { |
| + return _sqrt(); |
| + } |
| + Simd128Float32x4 _sqrt() native "Simd128Float32_sqrt"; |
| + Simd128Float32x4 reciprocal() { |
| + return _reciprocal(); |
| + } |
| + Simd128Float32x4 _reciprocal() native "Simd128Float32_reciprocal"; |
| + Simd128Float32x4 reciprocalSqrt() { |
| + return _reciprocalSqrt(); |
| + } |
| + Simd128Float32x4 _reciprocalSqrt() native "Simd128Float32_reciprocalSqrt"; |
| + Simd128Mask toSimd128Mask() { |
| + return _toSimd128Mask(); |
| + } |
| + Simd128Mask _toSimd128Mask() native "Simd128Float32_toSimd128Mask"; |
| +} |
| + |
| +class _Simd128Mask implements Simd128Mask { |
| + factory _Simd128Mask(int x, int y, int z, int w) |
| + native "Simd128Mask_fromInts"; |
| + factory _Simd128Mask.bool(bool x, bool y, bool z, bool w) |
| + native "Simd128Mask_fromBools"; |
| + Simd128Mask operator|(Simd128Mask other) { |
| + return _or(other); |
| + } |
| + Simd128Mask _or(Simd128Mask other) native "Simd128Mask_or"; |
| + Simd128Mask operator&(Simd128Mask other) { |
| + return _and(other); |
| + } |
| + Simd128Mask _and(Simd128Mask other) native "Simd128Mask_and"; |
| + Simd128Mask operator^(Simd128Mask other) { |
| + return _xor(other); |
| + } |
| + Simd128Mask _xor(Simd128Mask other) native "Simd128Mask_xor"; |
| + int get x native "Simd128Mask_getX"; |
| + int get y native "Simd128Mask_getY"; |
| + int get z native "Simd128Mask_getZ"; |
| + int get w native "Simd128Mask_getW"; |
| + Simd128Mask withX(int x) native "Simd128Mask_setX"; |
| + Simd128Mask withY(int y) native "Simd128Mask_setY"; |
| + Simd128Mask withZ(int z) native "Simd128Mask_setZ"; |
| + Simd128Mask withW(int w) native "Simd128Mask_setW"; |
| + bool get flagX native "Simd128Mask_getFlagX"; |
| + bool get flagY native "Simd128Mask_getFlagY"; |
| + bool get flagZ native "Simd128Mask_getFlagZ"; |
| + bool get flagW native "Simd128Mask_getFlagW"; |
| + Simd128Mask withFlagX(bool x) native "Simd128Mask_setFlagX"; |
| + Simd128Mask withFlagY(bool y) native "Simd128Mask_setFlagY"; |
| + Simd128Mask withFlagZ(bool z) native "Simd128Mask_setFlagZ"; |
| + Simd128Mask withFlagW(bool w) native "Simd128Mask_setFlagW"; |
| + Simd128Float32x4 select(Simd128Float32x4 trueValue, |
| + Simd128Float32x4 falseValue) { |
| + return _select(trueValue, falseValue); |
| + } |
| + Simd128Float32x4 _select(Simd128Float32x4 trueValue, |
| + Simd128Float32x4 falseValue) |
| + native "Simd128Mask_select"; |
| + Simd128Float32x4 toSimd128Float32x4() { |
| + return _toSimd128Float32x4(); |
| + } |
| + Simd128Float32x4 _toSimd128Float32x4() native "Simd128Mask_toSimd128Float32"; |
| +} |
| + |
| + |
| +class _Simd128Float32x4Array extends _ByteArrayBase |
| + implements Simd128Float32x4List { |
| + factory _Simd128Float32x4Array(int length) { |
| + return _new(length); |
| + } |
| + factory _Simd128Float32x4Array.view(ByteArray array, |
| + [int start = 0, int length]) { |
| + if (length == null) { |
| + length = (array.lengthInBytes() - start) ~/ _BYTES_PER_ELEMENT; |
| + } |
| + return new _Simd128Float32x4ArrayView(array, start, length); |
| + } |
| + Simd128Float32x4 operator[](int index) { |
| + return _getIndexed(index); |
| + } |
| + int operator[]=(int index, Simd128Float32x4 value) { |
| + _setIndexed(index, value); |
| + } |
| + Iterator<Simd128Float32x4> get iterator { |
| + return new _ByteArrayIterator<Simd128Float32x4>(this); |
| + } |
| + List<Simd128Float32x4> getRange(int start, int length) { |
| + _rangeCheck(this.length, start, length); |
| + List<Simd128Float32x4> result = _new(length); |
| + result.setRange(0, length, this, start); |
| + return result; |
| + } |
| + void setRange(int start, int length, List<Simd128Float32x4> from, |
| + [int startFrom = 0]) { |
| + if (from is _Simd128Float32x4Array) { |
| + _setRange(start * _BYTES_PER_ELEMENT, |
| + length * _BYTES_PER_ELEMENT, |
| + from, |
| + startFrom * _BYTES_PER_ELEMENT); |
| + } else { |
| + Arrays.copy(from, startFrom, this, start, length); |
| + } |
| + } |
| + String toString() { |
| + return Collections.collectionToString(this); |
| + } |
| + int bytesPerElement() { |
| + return _BYTES_PER_ELEMENT; |
| + } |
| + int lengthInBytes() { |
| + return _length() * _BYTES_PER_ELEMENT; |
| + } |
| + static const int _BYTES_PER_ELEMENT = 16; |
| + static _Simd128Float32x4Array _new(int length) |
| + native "Simd128Float32Array_new"; |
| + Simd128Float32x4 _getIndexed(int index) |
| + native "Simd128Float32Array_getIndexed"; |
| + int _setIndexed(int index, Simd128Float32x4 value) |
| + native "Simd128Float32Array_setIndexed"; |
| +} |
| + |
| + |
| +class _Simd128Float32x4ArrayView extends _ByteArrayViewBase |
| + implements Simd128Float32x4List { |
| + _Simd128Float32x4ArrayView(ByteArray array, |
| + [int offsetInBytes = 0, int _length]) |
| + : super(array, _requireInteger(offsetInBytes), |
| + _requireIntegerOrNull( |
| + _length, |
| + ((array.lengthInBytes() - offsetInBytes) ~/ _BYTES_PER_ELEMENT))) { |
| + _rangeCheck(array.lengthInBytes(), _offset, length * _BYTES_PER_ELEMENT); |
| + } |
| + |
| + Simd128Float32x4 operator[](int index) { |
| + if (index < 0 || index >= length) { |
| + String message = "$index must be in the range [0..$length)"; |
| + throw new RangeError(message); |
| + } |
| + return _array.getSimd128Float32x4(_offset + (index * _BYTES_PER_ELEMENT)); |
| + } |
| + |
| + void operator[]=(int index, Simd128Float32x4 value) { |
| + if (index < 0 || index >= length) { |
| + String message = "$index must be in the range [0..$length)"; |
| + throw new RangeError(message); |
| + } |
| + _array.setSimd128Float32x4(_offset + (index * _BYTES_PER_ELEMENT), value); |
| + } |
| + |
| + Iterator<Simd128Float32x4> get iterator { |
| + return new _ByteArrayIterator<Simd128Float32x4>(this); |
| + } |
| + |
| + List<Simd128Float32x4> getRange(int start, int length) { |
| + _rangeCheck(this.length, start, length); |
| + List<Simd128Float32x4> result = new Float32List(length); |
| + result.setRange(0, length, this, start); |
| + return result; |
| + } |
| + |
| + void setRange(int start, int length, List<Simd128Float32x4> from, |
| + [int startFrom = 0]) { |
| + Arrays.copy(from, startFrom, this, start, length); |
| + } |
| + |
| + String toString() { |
| + return Collections.collectionToString(this); |
| + } |
| + |
| + int bytesPerElement() { |
| + return _BYTES_PER_ELEMENT; |
| + } |
| + |
| + int lengthInBytes() { |
| + return length * _BYTES_PER_ELEMENT; |
| + } |
| + |
| + ByteArray asByteArray([int start = 0, int length]) { |
| + if (length == null) { |
| + length = this.lengthInBytes(); |
| + } |
| + _rangeCheck(this.length, start, length); |
| + return _array.subByteArray(_offset + start, length); |
| + } |
| + |
| + static const int _BYTES_PER_ELEMENT = 16; |
| +} |
| + |
| + |
| +class _ExternalSimd128Float32x4Array extends _ByteArrayBase |
| + implements Simd128Float32x4List { |
| + Simd128Float32x4 operator[](int index) { |
| + return _getIndexed(index); |
| + } |
| + |
| + int operator[]=(int index, Simd128Float32x4 value) { |
| + _setIndexed(index, value); |
| + } |
| + |
| + Iterator<Simd128Float32x4> get iterator { |
| + return new _ByteArrayIterator<Simd128Float32x4>(this); |
| + } |
| + |
| + List<Simd128Float32x4> getRange(int start, int length) { |
| + _rangeCheck(this.length, start, length); |
| + List<Simd128Float32x4> result = new Simd128Float32x4List(length); |
| + result.setRange(0, length, this, start); |
| + return result; |
| + } |
| + |
| + void setRange(int start, int length, List<Simd128Float32x4> from, |
| + [int startFrom = 0]) { |
| + if (from is _ExternalSimd128Float32x4Array) { |
| + _setRange(start * _BYTES_PER_ELEMENT, |
| + length * _BYTES_PER_ELEMENT, |
| + from, |
| + startFrom * _BYTES_PER_ELEMENT); |
| + } else { |
| + Arrays.copy(from, startFrom, this, start, length); |
| + } |
| + } |
| + |
| + String toString() { |
| + return Collections.collectionToString(this); |
| + } |
| + |
| + int bytesPerElement() { |
| + return _BYTES_PER_ELEMENT; |
| + } |
| + |
| + int lengthInBytes() { |
| + return _length() * _BYTES_PER_ELEMENT; |
| + } |
| + |
| + static const int _BYTES_PER_ELEMENT = 16; |
| + |
| + Simd128Float32x4 _getIndexed(int index) |
| + native "ExternalSimd128Float32Array_getIndexed"; |
| + int _setIndexed(int index, Simd128Float32x4 value) |
| + native "ExternalSimd128Float32Array_setIndexed"; |
| +} |