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

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

Issue 78733002: Generalize if-conversion to arbitrary smi comparisons. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/intermediate_language_x64.cc ('k') | tests/language/vm/optimized_testsmi_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
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 // Test if-convertion pass in the optimizing compiler. 5 // Test if-convertion pass in the optimizing compiler.
6 // VMOptions=--optimization-counter-threshold=10 --no-use-osr 6 // VMOptions=--optimization-counter-threshold=10 --no-use-osr
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 f1(i) => (i == 0) ? 0 : 1; 10 f1(i) => (i == 0) ? 0 : 1;
(...skipping 24 matching lines...) Expand all
35 final a = i == 0 ? 0 : 1; 35 final a = i == 0 ? 0 : 1;
36 final b = i == 0 ? 2 : 3; 36 final b = i == 0 ? 2 : 3;
37 return a + b; 37 return a + b;
38 } 38 }
39 39
40 f17(b) => b ? 0 : 11; 40 f17(b) => b ? 0 : 11;
41 f18(b) => b ? 2 : 0; 41 f18(b) => b ? 2 : 0;
42 42
43 f19(i) => i == 0 ? 0 : 0; 43 f19(i) => i == 0 ? 0 : 0;
44 44
45 f20(i) => i > 0 ? 0 : 1;
46 f21(i) => i > 0 ? 2 : 3;
47 f22(i) => i & 1 == 0 ? 0 : 1;
48 f23(i) => i & 1 != 0 ? 1 : 0;
49
50 f24(i) => i >= 0 ? 0 : 1;
51 f25(i) => i < 0 ? 0 : 1;
52 f26(i) => i <= 0 ? 0 : 1;
53
45 main() { 54 main() {
46 for (var i = 0; i < 20; i++) { 55 for (var i = 0; i < 20; i++) {
47 f1(i); 56 f1(i);
48 f2(i); 57 f2(i);
49 f3(i); 58 f3(i);
50 f4(i); 59 f4(i);
51 f5(i); 60 f5(i);
52 f6(i); 61 f6(i);
53 f7(i); 62 f7(i);
54 f8(i); 63 f8(i);
55 f9(i); 64 f9(i);
56 f10(i); 65 f10(i);
57 f11(i); 66 f11(i);
58 f12(i); 67 f12(i);
59 f13(i); 68 f13(i);
60 f14(i); 69 f14(i);
61 f15(i); 70 f15(i);
62 f16(i); 71 f16(i);
63 cse(i); 72 cse(i);
64 bigPower(i); 73 bigPower(i);
65 f17(true); 74 f17(true);
66 f18(true); 75 f18(true);
67 f19(i); 76 f19(i);
77 f20(i);
78 f21(i);
79 f22(i);
80 f23(i);
81 f24(i);
82 f25(i);
83 f26(i);
68 } 84 }
69 85
70 Expect.equals(0, f1(0)); 86 Expect.equals(0, f1(0));
71 Expect.equals(1, f1(44)); 87 Expect.equals(1, f1(44));
72 Expect.equals(2, f2(0)); 88 Expect.equals(2, f2(0));
73 Expect.equals(3, f2(44)); 89 Expect.equals(3, f2(44));
74 Expect.equals(0, f3(null)); 90 Expect.equals(0, f3(null));
75 Expect.equals(1, f3(44)); 91 Expect.equals(1, f3(44));
76 Expect.equals(2, f4(null)); 92 Expect.equals(2, f4(null));
77 Expect.equals(3, f4(44)); 93 Expect.equals(3, f4(44));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 Expect.equals(4, cse(1)); 126 Expect.equals(4, cse(1));
111 127
112 Expect.equals(11, f17(false)); 128 Expect.equals(11, f17(false));
113 Expect.equals(0, f17(true)); 129 Expect.equals(0, f17(true));
114 130
115 Expect.equals(0, f18(false)); 131 Expect.equals(0, f18(false));
116 Expect.equals(2, f18(true)); 132 Expect.equals(2, f18(true));
117 133
118 Expect.equals(0, f19(0)); 134 Expect.equals(0, f19(0));
119 Expect.equals(0, f19(1)); 135 Expect.equals(0, f19(1));
136
137 Expect.equals(0, f20(123));
138 Expect.equals(2, f21(123));
139 Expect.equals(0, f22(122));
140 Expect.equals(1, f22(123));
141 Expect.equals(0, f23(122));
142 Expect.equals(1, f23(123));
143
144 Expect.equals(0, f24(0));
145 Expect.equals(1, f24(-1));
146
147 Expect.equals(0, f25(-1));
148 Expect.equals(1, f25(0));
149
150 Expect.equals(0, f26(0));
151 Expect.equals(1, f26(1));
120 } 152 }
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | tests/language/vm/optimized_testsmi_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698