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

Side by Side Diff: tests/language/vm/unaligned_integer_access_register_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 unalignedUint16() { 9 unalignedUint16() {
10 var bytes = new ByteData(64); 10 var bytes = new ByteData(64);
11 for (var i = 0; i < 2; i++) { 11 for (var i = 0; i < 2; i++) {
12 bytes.setUint16(i, 0xABCD); 12 bytes.setUint16(i, 0xABCD, Endianness.HOST_ENDIAN);
13 Expect.equals(0xABCD, bytes.getUint16(i)); 13 Expect.equals(0xABCD, bytes.getUint16(i, Endianness.HOST_ENDIAN));
14 } 14 }
15 } 15 }
16 16
17 unalignedInt16() { 17 unalignedInt16() {
18 var bytes = new ByteData(64); 18 var bytes = new ByteData(64);
19 for (var i = 0; i < 2; i++) { 19 for (var i = 0; i < 2; i++) {
20 bytes.setInt16(i, -0x1234); 20 bytes.setInt16(i, -0x1234, Endianness.HOST_ENDIAN);
21 Expect.equals(-0x1234, bytes.getInt16(i)); 21 Expect.equals(-0x1234, bytes.getInt16(i, Endianness.HOST_ENDIAN));
22 } 22 }
23 } 23 }
24 24
25 unalignedUint32() { 25 unalignedUint32() {
26 var bytes = new ByteData(64); 26 var bytes = new ByteData(64);
27 for (var i = 0; i < 4; i++) { 27 for (var i = 0; i < 4; i++) {
28 bytes.setUint32(i, 0xABCDABCD); 28 bytes.setUint32(i, 0xABCDABCD, Endianness.HOST_ENDIAN);
29 Expect.equals(0xABCDABCD, bytes.getUint32(i)); 29 Expect.equals(0xABCDABCD, bytes.getUint32(i, Endianness.HOST_ENDIAN));
30 } 30 }
31 } 31 }
32 32
33 unalignedInt32() { 33 unalignedInt32() {
34 var bytes = new ByteData(64); 34 var bytes = new ByteData(64);
35 for (var i = 0; i < 4; i++) { 35 for (var i = 0; i < 4; i++) {
36 bytes.setInt32(i, -0x12341234); 36 bytes.setInt32(i, -0x12341234, Endianness.HOST_ENDIAN);
37 Expect.equals(-0x12341234, bytes.getInt32(i)); 37 Expect.equals(-0x12341234, bytes.getInt32(i, Endianness.HOST_ENDIAN));
38 } 38 }
39 } 39 }
40 40
41 unalignedUint64() { 41 unalignedUint64() {
42 var bytes = new ByteData(64); 42 var bytes = new ByteData(64);
43 for (var i = 0; i < 8; i++) { 43 for (var i = 0; i < 8; i++) {
44 bytes.setUint64(i, 0xABCDABCD); 44 bytes.setUint64(i, 0xABCDABCD12345678, Endianness.HOST_ENDIAN);
45 Expect.equals(0xABCDABCD, bytes.getUint64(i)); 45 Expect.equals(0xABCDABCD12345678, bytes.getUint64(i, Endianness.HOST_ENDIAN) );
46 } 46 }
47 } 47 }
48 48
49 unalignedInt64() { 49 unalignedInt64() {
50 var bytes = new ByteData(64); 50 var bytes = new ByteData(64);
51 for (var i = 0; i < 8; i++) { 51 for (var i = 0; i < 8; i++) {
52 bytes.setInt64(i, -0x12341234); 52 bytes.setInt64(i, -0x12341234ABCDABCD, Endianness.HOST_ENDIAN);
53 Expect.equals(-0x12341234, bytes.getInt64(i)); 53 Expect.equals(-0x12341234ABCDABCD, bytes.getInt64(i, Endianness.HOST_ENDIAN) );
54 } 54 }
55 } 55 }
56 56
57 main() { 57 main() {
58 for (var i = 0; i < 20; i++) { 58 for (var i = 0; i < 20; i++) {
59 unalignedUint16(); 59 unalignedUint16();
60 unalignedInt16(); 60 unalignedInt16();
61 unalignedUint32(); 61 unalignedUint32();
62 unalignedInt32(); 62 unalignedInt32();
63 unalignedUint64(); 63 unalignedUint64();
64 unalignedInt64(); 64 unalignedInt64();
65 } 65 }
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698