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

Side by Side Diff: tests/language/vm/unaligned_float_access_literal_index_test.dart

Issue 2940883008: [arm, arm64] Implemented unaligned scalar float access. (Closed)
Patch Set: . Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation 4 // VMOptions=--optimization_counter_threshold=10 --no-background_compilation
5 5
6 import 'dart:typed_data'; 6 import 'dart:typed_data';
7 import 'package:expect/expect.dart'; 7 import 'package:expect/expect.dart';
8 8
9 unalignedFloat32() { 9 unalignedFloat32() {
10 var bytes = new ByteData(64); 10 var bytes = new ByteData(64);
11 bytes.setFloat32(0, 16.25); 11 bytes.setFloat32(0, 16.25, Endianness.HOST_ENDIAN);
12 Expect.equals(16.25, bytes.getFloat32(0)); 12 Expect.equals(16.25, bytes.getFloat32(0, Endianness.HOST_ENDIAN));
13 bytes.setFloat32(1, 32.125); 13 bytes.setFloat32(1, 32.125, Endianness.HOST_ENDIAN);
14 Expect.equals(32.125, bytes.getFloat32(1)); 14 Expect.equals(32.125, bytes.getFloat32(1, Endianness.HOST_ENDIAN));
15 bytes.setFloat32(2, 16.25); 15 bytes.setFloat32(2, 16.25, Endianness.HOST_ENDIAN);
16 Expect.equals(16.25, bytes.getFloat32(2)); 16 Expect.equals(16.25, bytes.getFloat32(2, Endianness.HOST_ENDIAN));
17 bytes.setFloat32(3, 32.125); 17 bytes.setFloat32(3, 32.125, Endianness.HOST_ENDIAN);
18 Expect.equals(32.125, bytes.getFloat32(3)); 18 Expect.equals(32.125, bytes.getFloat32(3, Endianness.HOST_ENDIAN));
19 } 19 }
20 20
21 unalignedFloat64() { 21 unalignedFloat64() {
22 var bytes = new ByteData(64); 22 var bytes = new ByteData(64);
23 bytes.setFloat64(0, 16.25); 23 bytes.setFloat64(0, 16.25, Endianness.HOST_ENDIAN);
24 Expect.equals(16.25, bytes.getFloat64(0)); 24 Expect.equals(16.25, bytes.getFloat64(0, Endianness.HOST_ENDIAN));
25 bytes.setFloat64(1, 32.125); 25 bytes.setFloat64(1, 32.125, Endianness.HOST_ENDIAN);
26 Expect.equals(32.125, bytes.getFloat64(1)); 26 Expect.equals(32.125, bytes.getFloat64(1, Endianness.HOST_ENDIAN));
27 bytes.setFloat64(2, 16.25); 27 bytes.setFloat64(2, 16.25, Endianness.HOST_ENDIAN);
28 Expect.equals(16.25, bytes.getFloat64(2)); 28 Expect.equals(16.25, bytes.getFloat64(2, Endianness.HOST_ENDIAN));
29 bytes.setFloat64(3, 32.125); 29 bytes.setFloat64(3, 32.125, Endianness.HOST_ENDIAN);
30 Expect.equals(32.125, bytes.getFloat64(3)); 30 Expect.equals(32.125, bytes.getFloat64(3, Endianness.HOST_ENDIAN));
31 bytes.setFloat64(4, 16.25); 31 bytes.setFloat64(4, 16.25, Endianness.HOST_ENDIAN);
32 Expect.equals(16.25, bytes.getFloat64(4)); 32 Expect.equals(16.25, bytes.getFloat64(4, Endianness.HOST_ENDIAN));
33 bytes.setFloat64(5, 32.125); 33 bytes.setFloat64(5, 32.125, Endianness.HOST_ENDIAN);
34 Expect.equals(32.125, bytes.getFloat64(5)); 34 Expect.equals(32.125, bytes.getFloat64(5, Endianness.HOST_ENDIAN));
35 bytes.setFloat64(6, 16.25); 35 bytes.setFloat64(6, 16.25, Endianness.HOST_ENDIAN);
36 Expect.equals(16.25, bytes.getFloat64(6)); 36 Expect.equals(16.25, bytes.getFloat64(6, Endianness.HOST_ENDIAN));
37 bytes.setFloat64(7, 32.125); 37 bytes.setFloat64(7, 32.125, Endianness.HOST_ENDIAN);
38 Expect.equals(32.125, bytes.getFloat64(7)); 38 Expect.equals(32.125, bytes.getFloat64(7, Endianness.HOST_ENDIAN));
39 } 39 }
40 40
41 main() { 41 main() {
42 for (var i = 0; i < 20; i++) { 42 for (var i = 0; i < 20; i++) {
43 unalignedFloat32(); 43 unalignedFloat32();
44 unalignedFloat64(); 44 unalignedFloat64();
45 } 45 }
46 } 46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698