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

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

Issue 345563007: Add Uint32 representation (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/locations.h ('k') | tests/language/vm/uint32_right_shift_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4 // VMOptions=--optimization_counter_threshold=10
5
6 import 'package:expect/expect.dart';
7
8 trunc(x) => x & 0xFFFFFFFF;
9
10 f(t, x) => t(x) + 1;
11
12 g(t, x) => t(x + 1);
13
14 // Foo should be entirely replaced by Uint32 operations. Running with
15 // --trace-integer-ir-selection should result in:
16 // CheckStackOverflow:4()
17 // v22 <- UnboxUint32:14(v2)
18 // v24 <- UnboxUint32:14(v3)
19 // v6 <- BinaryUint32Op:14(+, v22 , v24 )
20 // v26 <- UnboxUint32:22(v4)
21 // v8 <- BinaryUint32Op:22(+, v6 , v26 )
22 // v28 <- UnboxUint32:30(v5)
23 // v10 <- BinaryUint32Op:30(+, v8 , v28 )
24 // v30 <- UnboxUint32:14(v21)
25 // v19 <- BinaryUint32Op:14(&, v10 , v30 )
26 // v32 <- BoxUint32:90(v19 )
27 // Return:38(v32 )
28 foo(a, b, c, i) {
29 return trunc(a + b + c + i);
30 }
31
32 main() {
33 for (var i = 0; i < 20000; i++) {
34 Expect.equals(0x100000000, f(trunc, 0xFFFFFFFF));
35 Expect.equals(0x0, g(trunc, 0xFFFFFFFF));
36 }
37
38 var a = 0xFFFFFFFF;
39 var b = 0xCCCCCCCC;
40 var c = 0x33333335;
41
42 for (var i = 0; i < 20000; i++) {
43 Expect.equals(i, foo(a, b, c, i));
44 }
45 }
46
OLDNEW
« no previous file with comments | « runtime/vm/locations.h ('k') | tests/language/vm/uint32_right_shift_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698