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

Unified Diff: runtime/tests/vm/dart/simd128float32_array_test.dart

Issue 12303013: Simd128Float32, Simd128Mask, and Simd128Float32List additions for dart:scalarlist (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix strict aliasing warning Created 7 years, 10 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
« no previous file with comments | « runtime/lib/simd128.dart ('k') | runtime/tests/vm/dart/simd128float32_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..54616e6138c19cb1474c8ec1b1a7e0fdc52120fb
--- /dev/null
+++ b/runtime/tests/vm/dart/simd128float32_array_test.dart
@@ -0,0 +1,63 @@
+// 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.
+
+import 'dart:scalarlist';
+
+testLoadStore(array) {
+ Expect.equals(8, array.length);
+ Expect.isTrue(array is List<Float32x4>);
+ array[0] = new Float32x4(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].withX(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<Float32x4>);
+ 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 Float32x4List(8);
+ for (int i = 0; i < 3000; i++) {
+ testLoadStore(list);
+ }
+
+ list = new Float32x4List.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 Float32x4List.view(floatList.asByteArray());
+ for (int i = 0; i < 3000; i++) {
+ testView(list);
+ }
+ for (int i = 0; i < 3000; i++) {
+ testLoadStore(list);
+ }
+}
« no previous file with comments | « runtime/lib/simd128.dart ('k') | runtime/tests/vm/dart/simd128float32_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698