Chromium Code Reviews| Index: runtime/tests/vm/dart/simd128float32_array_test.dart |
| diff --git a/runtime/tests/vm/dart/simd128float32_array_test.dart b/runtime/tests/vm/dart/simd128float32_array_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..776be8e920443d71d90a969f06836badcf8ea6f0 |
| --- /dev/null |
| +++ b/runtime/tests/vm/dart/simd128float32_array_test.dart |
| @@ -0,0 +1,59 @@ |
| +import 'dart:scalarlist'; |
|
kasperl
2013/02/21 11:28:15
Add copyright notice.
Cutch
2013/02/21 18:45:16
Done.
|
| + |
| +testLoadStore(array) { |
| + Expect.equals(8, array.length); |
| + Expect.isTrue(array is List<Simd128Float32>); |
| + array[0] = new Simd128Float32(1.0, 2.0, 3.0, 4.0); |
| + Expect.equals(1.0, array[0].x); |
| + Expect.equals(2.0, array[0].y); |
| + Expect.equals(3.0, array[0].z); |
| + Expect.equals(4.0, array[0].w); |
| + array[1] = array[0]; |
| + array[0] = array[0].setX(9.0); |
| + Expect.equals(9.0, array[0].x); |
| + Expect.equals(2.0, array[0].y); |
| + Expect.equals(3.0, array[0].z); |
| + Expect.equals(4.0, array[0].w); |
| + Expect.equals(1.0, array[1].x); |
| + Expect.equals(2.0, array[1].y); |
| + Expect.equals(3.0, array[1].z); |
| + Expect.equals(4.0, array[1].w); |
| +} |
| + |
| +testView(array) { |
| + Expect.equals(8, array.length); |
| + Expect.isTrue(array is List<Simd128Float32>); |
| + Expect.equals(0.0, array[0].x); |
| + Expect.equals(1.0, array[0].y); |
| + Expect.equals(2.0, array[0].z); |
| + Expect.equals(3.0, array[0].w); |
| + Expect.equals(4.0, array[1].x); |
| + Expect.equals(5.0, array[1].y); |
| + Expect.equals(6.0, array[1].z); |
| + Expect.equals(7.0, array[1].w); |
| +} |
| + |
| +main() { |
| + var list; |
| + |
| + list = new Simd128Float32List(8); |
| + for (int i = 0; i < 3000; i++) { |
| + testLoadStore(list); |
| + } |
| + |
| + list = new Simd128Float32List.transferable(8); |
| + for (int i = 0; i < 3000; i++) { |
| + testLoadStore(list); |
| + } |
| + Float32List floatList = new Float32List(32); |
| + for (int i = 0; i < floatList.length; i++) { |
| + floatList[i] = i.toDouble(); |
| + } |
| + list = new Simd128Float32List.view(floatList.asByteArray()); |
| + for (int i = 0; i < 3000; i++) { |
| + testView(list); |
| + } |
| + for (int i = 0; i < 3000; i++) { |
| + testLoadStore(list); |
| + } |
| +} |