blob: 43bc9d06a292b2aab6b1f5c0d103a08a20bbd1ce [file] [log] [blame]
David Brazdilee690a32014-12-01 17:04:16 +00001/*
Roland Levillain6a92a032015-07-23 12:15:01 +01002 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
David Brazdilee690a32014-12-01 17:04:16 +000016
David Brazdil4846d132015-01-15 19:07:08 +000017public class Main {
David Brazdilee690a32014-12-01 17:04:16 +000018
Roland Levillain3b55ebb2015-05-08 13:13:19 +010019 public static void assertFalse(boolean condition) {
20 if (condition) {
21 throw new Error();
22 }
23 }
24
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +000025 public static void assertIntEquals(int expected, int result) {
26 if (expected != result) {
27 throw new Error("Expected: " + expected + ", found: " + result);
28 }
29 }
30
31 public static void assertLongEquals(long expected, long result) {
32 if (expected != result) {
33 throw new Error("Expected: " + expected + ", found: " + result);
34 }
35 }
36
Mark Mendelle82549b2015-05-06 10:55:34 -040037 public static void assertFloatEquals(float expected, float result) {
38 if (expected != result) {
39 throw new Error("Expected: " + expected + ", found: " + result);
40 }
41 }
42
43 public static void assertDoubleEquals(double expected, double result) {
44 if (expected != result) {
45 throw new Error("Expected: " + expected + ", found: " + result);
46 }
47 }
48
Roland Levillainb65eb502015-07-23 12:11:42 +010049
David Brazdilee690a32014-12-01 17:04:16 +000050 /**
Roland Levillainb65eb502015-07-23 12:11:42 +010051 * Exercise constant folding on negation.
David Brazdilee690a32014-12-01 17:04:16 +000052 */
53
David Brazdila06d66a2015-05-28 11:14:54 +010054 /// CHECK-START: int Main.IntNegation() constant_folding (before)
55 /// CHECK-DAG: <<Const42:i\d+>> IntConstant 42
56 /// CHECK-DAG: <<Neg:i\d+>> Neg [<<Const42>>]
57 /// CHECK-DAG: Return [<<Neg>>]
David Brazdilee690a32014-12-01 17:04:16 +000058
David Brazdila06d66a2015-05-28 11:14:54 +010059 /// CHECK-START: int Main.IntNegation() constant_folding (after)
60 /// CHECK-DAG: <<ConstN42:i\d+>> IntConstant -42
61 /// CHECK-DAG: Return [<<ConstN42>>]
David Brazdilee690a32014-12-01 17:04:16 +000062
Roland Levillainb65eb502015-07-23 12:11:42 +010063 /// CHECK-START: int Main.IntNegation() constant_folding (after)
64 /// CHECK-NOT: Neg
65
David Brazdilee690a32014-12-01 17:04:16 +000066 public static int IntNegation() {
67 int x, y;
68 x = 42;
69 y = -x;
70 return y;
71 }
72
Roland Levillainc90bc7c2014-12-11 12:14:33 +000073 /// CHECK-START: long Main.LongNegation() constant_folding (before)
74 /// CHECK-DAG: <<Const42:j\d+>> LongConstant 42
75 /// CHECK-DAG: <<Neg:j\d+>> Neg [<<Const42>>]
76 /// CHECK-DAG: Return [<<Neg>>]
77
78 /// CHECK-START: long Main.LongNegation() constant_folding (after)
79 /// CHECK-DAG: <<ConstN42:j\d+>> LongConstant -42
80 /// CHECK-DAG: Return [<<ConstN42>>]
81
82 /// CHECK-START: long Main.LongNegation() constant_folding (after)
83 /// CHECK-NOT: Neg
84
85 public static long LongNegation() {
86 long x, y;
87 x = 42L;
88 y = -x;
89 return y;
90 }
91
Roland Levillainb65eb502015-07-23 12:11:42 +010092
David Brazdilee690a32014-12-01 17:04:16 +000093 /**
Roland Levillainb65eb502015-07-23 12:11:42 +010094 * Exercise constant folding on addition.
David Brazdilee690a32014-12-01 17:04:16 +000095 */
96
David Brazdila06d66a2015-05-28 11:14:54 +010097 /// CHECK-START: int Main.IntAddition1() constant_folding (before)
98 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
99 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
100 /// CHECK-DAG: <<Add:i\d+>> Add [<<Const1>>,<<Const2>>]
101 /// CHECK-DAG: Return [<<Add>>]
David Brazdilee690a32014-12-01 17:04:16 +0000102
David Brazdila06d66a2015-05-28 11:14:54 +0100103 /// CHECK-START: int Main.IntAddition1() constant_folding (after)
104 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
105 /// CHECK-DAG: Return [<<Const3>>]
David Brazdilee690a32014-12-01 17:04:16 +0000106
Roland Levillainb65eb502015-07-23 12:11:42 +0100107 /// CHECK-START: int Main.IntAddition1() constant_folding (after)
108 /// CHECK-NOT: Add
109
David Brazdilee690a32014-12-01 17:04:16 +0000110 public static int IntAddition1() {
111 int a, b, c;
112 a = 1;
113 b = 2;
114 c = a + b;
115 return c;
116 }
117
David Brazdila06d66a2015-05-28 11:14:54 +0100118 /// CHECK-START: int Main.IntAddition2() constant_folding (before)
119 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
120 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
121 /// CHECK-DAG: <<Const5:i\d+>> IntConstant 5
122 /// CHECK-DAG: <<Const6:i\d+>> IntConstant 6
123 /// CHECK-DAG: <<Add1:i\d+>> Add [<<Const1>>,<<Const2>>]
124 /// CHECK-DAG: <<Add2:i\d+>> Add [<<Const5>>,<<Const6>>]
125 /// CHECK-DAG: <<Add3:i\d+>> Add [<<Add1>>,<<Add2>>]
126 /// CHECK-DAG: Return [<<Add3>>]
David Brazdilee690a32014-12-01 17:04:16 +0000127
David Brazdila06d66a2015-05-28 11:14:54 +0100128 /// CHECK-START: int Main.IntAddition2() constant_folding (after)
129 /// CHECK-DAG: <<Const14:i\d+>> IntConstant 14
130 /// CHECK-DAG: Return [<<Const14>>]
David Brazdilee690a32014-12-01 17:04:16 +0000131
Roland Levillainb65eb502015-07-23 12:11:42 +0100132 /// CHECK-START: int Main.IntAddition2() constant_folding (after)
133 /// CHECK-NOT: Add
134
David Brazdilee690a32014-12-01 17:04:16 +0000135 public static int IntAddition2() {
136 int a, b, c;
137 a = 1;
138 b = 2;
139 a += b;
140 b = 5;
141 c = 6;
142 b += c;
143 c = a + b;
144 return c;
145 }
146
Roland Levillainb65eb502015-07-23 12:11:42 +0100147 /// CHECK-START: long Main.LongAddition() constant_folding (before)
148 /// CHECK-DAG: <<Const1:j\d+>> LongConstant 1
149 /// CHECK-DAG: <<Const2:j\d+>> LongConstant 2
150 /// CHECK-DAG: <<Add:j\d+>> Add [<<Const1>>,<<Const2>>]
151 /// CHECK-DAG: Return [<<Add>>]
152
153 /// CHECK-START: long Main.LongAddition() constant_folding (after)
154 /// CHECK-DAG: <<Const3:j\d+>> LongConstant 3
155 /// CHECK-DAG: Return [<<Const3>>]
156
157 /// CHECK-START: long Main.LongAddition() constant_folding (after)
158 /// CHECK-NOT: Add
159
160 public static long LongAddition() {
161 long a, b, c;
162 a = 1L;
163 b = 2L;
164 c = a + b;
165 return c;
166 }
167
168
David Brazdilee690a32014-12-01 17:04:16 +0000169 /**
Roland Levillainb65eb502015-07-23 12:11:42 +0100170 * Exercise constant folding on subtraction.
David Brazdilee690a32014-12-01 17:04:16 +0000171 */
172
David Brazdila06d66a2015-05-28 11:14:54 +0100173 /// CHECK-START: int Main.IntSubtraction() constant_folding (before)
174 /// CHECK-DAG: <<Const6:i\d+>> IntConstant 6
175 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
176 /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Const6>>,<<Const2>>]
177 /// CHECK-DAG: Return [<<Sub>>]
David Brazdilee690a32014-12-01 17:04:16 +0000178
David Brazdila06d66a2015-05-28 11:14:54 +0100179 /// CHECK-START: int Main.IntSubtraction() constant_folding (after)
180 /// CHECK-DAG: <<Const4:i\d+>> IntConstant 4
181 /// CHECK-DAG: Return [<<Const4>>]
David Brazdilee690a32014-12-01 17:04:16 +0000182
Roland Levillainb65eb502015-07-23 12:11:42 +0100183 /// CHECK-START: int Main.IntSubtraction() constant_folding (after)
184 /// CHECK-NOT: Sub
185
David Brazdilee690a32014-12-01 17:04:16 +0000186 public static int IntSubtraction() {
187 int a, b, c;
David Brazdil4846d132015-01-15 19:07:08 +0000188 a = 6;
David Brazdilee690a32014-12-01 17:04:16 +0000189 b = 2;
190 c = a - b;
191 return c;
192 }
193
David Brazdila06d66a2015-05-28 11:14:54 +0100194 /// CHECK-START: long Main.LongSubtraction() constant_folding (before)
195 /// CHECK-DAG: <<Const6:j\d+>> LongConstant 6
196 /// CHECK-DAG: <<Const2:j\d+>> LongConstant 2
197 /// CHECK-DAG: <<Sub:j\d+>> Sub [<<Const6>>,<<Const2>>]
198 /// CHECK-DAG: Return [<<Sub>>]
David Brazdilee690a32014-12-01 17:04:16 +0000199
David Brazdila06d66a2015-05-28 11:14:54 +0100200 /// CHECK-START: long Main.LongSubtraction() constant_folding (after)
201 /// CHECK-DAG: <<Const4:j\d+>> LongConstant 4
202 /// CHECK-DAG: Return [<<Const4>>]
David Brazdilee690a32014-12-01 17:04:16 +0000203
Roland Levillainb65eb502015-07-23 12:11:42 +0100204 /// CHECK-START: long Main.LongSubtraction() constant_folding (after)
205 /// CHECK-NOT: Sub
206
David Brazdilee690a32014-12-01 17:04:16 +0000207 public static long LongSubtraction() {
208 long a, b, c;
David Brazdil4846d132015-01-15 19:07:08 +0000209 a = 6L;
David Brazdilee690a32014-12-01 17:04:16 +0000210 b = 2L;
211 c = a - b;
212 return c;
213 }
214
Roland Levillainb65eb502015-07-23 12:11:42 +0100215
David Brazdilee690a32014-12-01 17:04:16 +0000216 /**
Roland Levillainf7746ad2015-07-22 14:12:01 +0100217 * Exercise constant folding on multiplication.
218 */
219
220 /// CHECK-START: int Main.IntMultiplication() constant_folding (before)
221 /// CHECK-DAG: <<Const7:i\d+>> IntConstant 7
222 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
223 /// CHECK-DAG: <<Mul:i\d+>> Mul [<<Const7>>,<<Const3>>]
224 /// CHECK-DAG: Return [<<Mul>>]
225
226 /// CHECK-START: int Main.IntMultiplication() constant_folding (after)
227 /// CHECK-DAG: <<Const21:i\d+>> IntConstant 21
228 /// CHECK-DAG: Return [<<Const21>>]
229
230 /// CHECK-START: int Main.IntMultiplication() constant_folding (after)
231 /// CHECK-NOT: Mul
232
233 public static int IntMultiplication() {
234 int a, b, c;
235 a = 7;
236 b = 3;
237 c = a * b;
238 return c;
239 }
240
241 /// CHECK-START: long Main.LongMultiplication() constant_folding (before)
242 /// CHECK-DAG: <<Const7:j\d+>> LongConstant 7
243 /// CHECK-DAG: <<Const3:j\d+>> LongConstant 3
244 /// CHECK-DAG: <<Mul:j\d+>> Mul [<<Const7>>,<<Const3>>]
245 /// CHECK-DAG: Return [<<Mul>>]
246
247 /// CHECK-START: long Main.LongMultiplication() constant_folding (after)
248 /// CHECK-DAG: <<Const21:j\d+>> LongConstant 21
249 /// CHECK-DAG: Return [<<Const21>>]
250
251 /// CHECK-START: long Main.LongMultiplication() constant_folding (after)
252 /// CHECK-NOT: Mul
253
254 public static long LongMultiplication() {
255 long a, b, c;
256 a = 7L;
257 b = 3L;
258 c = a * b;
259 return c;
260 }
261
262
263 /**
264 * Exercise constant folding on division.
265 */
266
267 /// CHECK-START: int Main.IntDivision() constant_folding (before)
268 /// CHECK-DAG: <<Const8:i\d+>> IntConstant 8
269 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
270 /// CHECK-DAG: <<Div0Chk:i\d+>> DivZeroCheck [<<Const3>>]
271 /// CHECK-DAG: <<Div:i\d+>> Div [<<Const8>>,<<Div0Chk>>]
272 /// CHECK-DAG: Return [<<Div>>]
273
274 /// CHECK-START: int Main.IntDivision() constant_folding (after)
275 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
276 /// CHECK-DAG: Return [<<Const2>>]
277
278 /// CHECK-START: int Main.IntDivision() constant_folding (after)
279 /// CHECK-NOT: DivZeroCheck
280 /// CHECK-NOT: Div
281
282 public static int IntDivision() {
283 int a, b, c;
284 a = 8;
285 b = 3;
286 c = a / b;
287 return c;
288 }
289
290 /// CHECK-START: long Main.LongDivision() constant_folding (before)
291 /// CHECK-DAG: <<Const8:j\d+>> LongConstant 8
292 /// CHECK-DAG: <<Const3:j\d+>> LongConstant 3
293 /// CHECK-DAG: <<Div0Chk:j\d+>> DivZeroCheck [<<Const3>>]
294 /// CHECK-DAG: <<Div:j\d+>> Div [<<Const8>>,<<Div0Chk>>]
295 /// CHECK-DAG: Return [<<Div>>]
296
297 /// CHECK-START: long Main.LongDivision() constant_folding (after)
298 /// CHECK-DAG: <<Const2:j\d+>> LongConstant 2
299 /// CHECK-DAG: Return [<<Const2>>]
300
301 /// CHECK-START: long Main.LongDivision() constant_folding (after)
302 /// CHECK-NOT: DivZeroCheck
303 /// CHECK-NOT: Div
304
305 public static long LongDivision() {
306 long a, b, c;
307 a = 8L;
308 b = 3L;
309 c = a / b;
310 return c;
311 }
312
313
314 /**
315 * Exercise constant folding on remainder.
316 */
317
318 /// CHECK-START: int Main.IntRemainder() constant_folding (before)
319 /// CHECK-DAG: <<Const8:i\d+>> IntConstant 8
320 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
321 /// CHECK-DAG: <<Div0Chk:i\d+>> DivZeroCheck [<<Const3>>]
322 /// CHECK-DAG: <<Rem:i\d+>> Rem [<<Const8>>,<<Div0Chk>>]
323 /// CHECK-DAG: Return [<<Rem>>]
324
325 /// CHECK-START: int Main.IntRemainder() constant_folding (after)
326 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
327 /// CHECK-DAG: Return [<<Const2>>]
328
329 /// CHECK-START: int Main.IntRemainder() constant_folding (after)
330 /// CHECK-NOT: DivZeroCheck
331 /// CHECK-NOT: Rem
332
333 public static int IntRemainder() {
334 int a, b, c;
335 a = 8;
336 b = 3;
337 c = a % b;
338 return c;
339 }
340
341 /// CHECK-START: long Main.LongRemainder() constant_folding (before)
342 /// CHECK-DAG: <<Const8:j\d+>> LongConstant 8
343 /// CHECK-DAG: <<Const3:j\d+>> LongConstant 3
344 /// CHECK-DAG: <<Div0Chk:j\d+>> DivZeroCheck [<<Const3>>]
345 /// CHECK-DAG: <<Rem:j\d+>> Rem [<<Const8>>,<<Div0Chk>>]
346 /// CHECK-DAG: Return [<<Rem>>]
347
348 /// CHECK-START: long Main.LongRemainder() constant_folding (after)
349 /// CHECK-DAG: <<Const2:j\d+>> LongConstant 2
350 /// CHECK-DAG: Return [<<Const2>>]
351
352 /// CHECK-START: long Main.LongRemainder() constant_folding (after)
353 /// CHECK-NOT: DivZeroCheck
354 /// CHECK-NOT: Rem
355
356 public static long LongRemainder() {
357 long a, b, c;
358 a = 8L;
359 b = 3L;
360 c = a % b;
361 return c;
362 }
363
364
365 /**
Roland Levillain9867bc72015-08-05 10:21:34 +0100366 * Exercise constant folding on left shift.
367 */
368
369 /// CHECK-START: int Main.ShlIntLong() constant_folding (before)
370 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
371 /// CHECK-DAG: <<Const2L:j\d+>> LongConstant 2
372 /// CHECK-DAG: <<TypeConv:i\d+>> TypeConversion [<<Const2L>>]
373 /// CHECK-DAG: <<Shl:i\d+>> Shl [<<Const1>>,<<TypeConv>>]
374 /// CHECK-DAG: Return [<<Shl>>]
375
376 /// CHECK-START: int Main.ShlIntLong() constant_folding (after)
377 /// CHECK-DAG: <<Const4:i\d+>> IntConstant 4
378 /// CHECK-DAG: Return [<<Const4>>]
379
380 /// CHECK-START: int Main.ShlIntLong() constant_folding (after)
381 /// CHECK-NOT: Shl
382
383 public static int ShlIntLong() {
384 int lhs = 1;
385 long rhs = 2;
386 return lhs << rhs;
387 }
388
389 /// CHECK-START: long Main.ShlLongInt() constant_folding (before)
390 /// CHECK-DAG: <<Const3L:j\d+>> LongConstant 3
391 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
392 /// CHECK-DAG: <<Shl:j\d+>> Shl [<<Const3L>>,<<Const2>>]
393 /// CHECK-DAG: Return [<<Shl>>]
394
395 /// CHECK-START: long Main.ShlLongInt() constant_folding (after)
396 /// CHECK-DAG: <<Const12L:j\d+>> LongConstant 12
397 /// CHECK-DAG: Return [<<Const12L>>]
398
399 /// CHECK-START: long Main.ShlLongInt() constant_folding (after)
400 /// CHECK-NOT: Shl
401
402 public static long ShlLongInt() {
403 long lhs = 3;
404 int rhs = 2;
405 return lhs << rhs;
406 }
407
408
409 /**
410 * Exercise constant folding on right shift.
411 */
412
413 /// CHECK-START: int Main.ShrIntLong() constant_folding (before)
414 /// CHECK-DAG: <<Const7:i\d+>> IntConstant 7
415 /// CHECK-DAG: <<Const2L:j\d+>> LongConstant 2
416 /// CHECK-DAG: <<TypeConv:i\d+>> TypeConversion [<<Const2L>>]
417 /// CHECK-DAG: <<Shr:i\d+>> Shr [<<Const7>>,<<TypeConv>>]
418 /// CHECK-DAG: Return [<<Shr>>]
419
420 /// CHECK-START: int Main.ShrIntLong() constant_folding (after)
421 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
422 /// CHECK-DAG: Return [<<Const1>>]
423
424 /// CHECK-START: int Main.ShrIntLong() constant_folding (after)
425 /// CHECK-NOT: Shr
426
427 public static int ShrIntLong() {
428 int lhs = 7;
429 long rhs = 2;
430 return lhs >> rhs;
431 }
432
433 /// CHECK-START: long Main.ShrLongInt() constant_folding (before)
434 /// CHECK-DAG: <<Const9L:j\d+>> LongConstant 9
435 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
436 /// CHECK-DAG: <<Shr:j\d+>> Shr [<<Const9L>>,<<Const2>>]
437 /// CHECK-DAG: Return [<<Shr>>]
438
439 /// CHECK-START: long Main.ShrLongInt() constant_folding (after)
440 /// CHECK-DAG: <<Const2L:j\d+>> LongConstant 2
441 /// CHECK-DAG: Return [<<Const2L>>]
442
443 /// CHECK-START: long Main.ShrLongInt() constant_folding (after)
444 /// CHECK-NOT: Shr
445
446 public static long ShrLongInt() {
447 long lhs = 9;
448 int rhs = 2;
449 return lhs >> rhs;
450 }
451
452
453 /**
454 * Exercise constant folding on unsigned right shift.
455 */
456
457 /// CHECK-START: int Main.UShrIntLong() constant_folding (before)
458 /// CHECK-DAG: <<ConstM7:i\d+>> IntConstant -7
459 /// CHECK-DAG: <<Const2L:j\d+>> LongConstant 2
460 /// CHECK-DAG: <<TypeConv:i\d+>> TypeConversion [<<Const2L>>]
461 /// CHECK-DAG: <<UShr:i\d+>> UShr [<<ConstM7>>,<<TypeConv>>]
462 /// CHECK-DAG: Return [<<UShr>>]
463
464 /// CHECK-START: int Main.UShrIntLong() constant_folding (after)
465 /// CHECK-DAG: <<ConstRes:i\d+>> IntConstant 1073741822
466 /// CHECK-DAG: Return [<<ConstRes>>]
467
468 /// CHECK-START: int Main.UShrIntLong() constant_folding (after)
469 /// CHECK-NOT: UShr
470
471 public static int UShrIntLong() {
472 int lhs = -7;
473 long rhs = 2;
474 return lhs >>> rhs;
475 }
476
477 /// CHECK-START: long Main.UShrLongInt() constant_folding (before)
478 /// CHECK-DAG: <<ConstM9L:j\d+>> LongConstant -9
479 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
480 /// CHECK-DAG: <<UShr:j\d+>> UShr [<<ConstM9L>>,<<Const2>>]
481 /// CHECK-DAG: Return [<<UShr>>]
482
483 /// CHECK-START: long Main.UShrLongInt() constant_folding (after)
484 /// CHECK-DAG: <<ConstRes:j\d+>> LongConstant 4611686018427387901
485 /// CHECK-DAG: Return [<<ConstRes>>]
486
487 /// CHECK-START: long Main.UShrLongInt() constant_folding (after)
488 /// CHECK-NOT: UShr
489
490 public static long UShrLongInt() {
491 long lhs = -9;
492 int rhs = 2;
493 return lhs >>> rhs;
494 }
495
496
497 /**
498 * Exercise constant folding on logical and.
499 */
500
501 /// CHECK-START: long Main.AndIntLong() constant_folding (before)
502 /// CHECK-DAG: <<Const10:i\d+>> IntConstant 10
503 /// CHECK-DAG: <<Const3L:j\d+>> LongConstant 3
504 /// CHECK-DAG: <<TypeConv:j\d+>> TypeConversion [<<Const10>>]
505 /// CHECK-DAG: <<And:j\d+>> And [<<TypeConv>>,<<Const3L>>]
506 /// CHECK-DAG: Return [<<And>>]
507
508 /// CHECK-START: long Main.AndIntLong() constant_folding (after)
509 /// CHECK-DAG: <<Const2:j\d+>> LongConstant 2
510 /// CHECK-DAG: Return [<<Const2>>]
511
512 /// CHECK-START: long Main.AndIntLong() constant_folding (after)
513 /// CHECK-NOT: And
514
515 public static long AndIntLong() {
516 int lhs = 10;
517 long rhs = 3;
518 return lhs & rhs;
519 }
520
521 /// CHECK-START: long Main.AndLongInt() constant_folding (before)
522 /// CHECK-DAG: <<Const10L:j\d+>> LongConstant 10
523 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
524 /// CHECK-DAG: <<TypeConv:j\d+>> TypeConversion [<<Const3>>]
525 /// CHECK-DAG: <<And:j\d+>> And [<<Const10L>>,<<TypeConv>>]
526 /// CHECK-DAG: Return [<<And>>]
527
528 /// CHECK-START: long Main.AndLongInt() constant_folding (after)
529 /// CHECK-DAG: <<Const2:j\d+>> LongConstant 2
530 /// CHECK-DAG: Return [<<Const2>>]
531
532 /// CHECK-START: long Main.AndLongInt() constant_folding (after)
533 /// CHECK-NOT: And
534
535 public static long AndLongInt() {
536 long lhs = 10;
537 int rhs = 3;
538 return lhs & rhs;
539 }
540
541
542 /**
543 * Exercise constant folding on logical or.
544 */
545
546 /// CHECK-START: long Main.OrIntLong() constant_folding (before)
547 /// CHECK-DAG: <<Const10:i\d+>> IntConstant 10
548 /// CHECK-DAG: <<Const3L:j\d+>> LongConstant 3
549 /// CHECK-DAG: <<TypeConv:j\d+>> TypeConversion [<<Const10>>]
550 /// CHECK-DAG: <<Or:j\d+>> Or [<<TypeConv>>,<<Const3L>>]
551 /// CHECK-DAG: Return [<<Or>>]
552
553 /// CHECK-START: long Main.OrIntLong() constant_folding (after)
554 /// CHECK-DAG: <<Const11:j\d+>> LongConstant 11
555 /// CHECK-DAG: Return [<<Const11>>]
556
557 /// CHECK-START: long Main.OrIntLong() constant_folding (after)
558 /// CHECK-NOT: Or
559
560 public static long OrIntLong() {
561 int lhs = 10;
562 long rhs = 3;
563 return lhs | rhs;
564 }
565
566 /// CHECK-START: long Main.OrLongInt() constant_folding (before)
567 /// CHECK-DAG: <<Const10L:j\d+>> LongConstant 10
568 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
569 /// CHECK-DAG: <<TypeConv:j\d+>> TypeConversion [<<Const3>>]
570 /// CHECK-DAG: <<Or:j\d+>> Or [<<Const10L>>,<<TypeConv>>]
571 /// CHECK-DAG: Return [<<Or>>]
572
573 /// CHECK-START: long Main.OrLongInt() constant_folding (after)
574 /// CHECK-DAG: <<Const11:j\d+>> LongConstant 11
575 /// CHECK-DAG: Return [<<Const11>>]
576
577 /// CHECK-START: long Main.OrLongInt() constant_folding (after)
578 /// CHECK-NOT: Or
579
580 public static long OrLongInt() {
581 long lhs = 10;
582 int rhs = 3;
583 return lhs | rhs;
584 }
585
586
587 /**
588 * Exercise constant folding on logical exclusive or.
589 */
590
591 /// CHECK-START: long Main.XorIntLong() constant_folding (before)
592 /// CHECK-DAG: <<Const10:i\d+>> IntConstant 10
593 /// CHECK-DAG: <<Const3L:j\d+>> LongConstant 3
594 /// CHECK-DAG: <<TypeConv:j\d+>> TypeConversion [<<Const10>>]
595 /// CHECK-DAG: <<Xor:j\d+>> Xor [<<TypeConv>>,<<Const3L>>]
596 /// CHECK-DAG: Return [<<Xor>>]
597
598 /// CHECK-START: long Main.XorIntLong() constant_folding (after)
599 /// CHECK-DAG: <<Const9:j\d+>> LongConstant 9
600 /// CHECK-DAG: Return [<<Const9>>]
601
602 /// CHECK-START: long Main.XorIntLong() constant_folding (after)
603 /// CHECK-NOT: Xor
604
605 public static long XorIntLong() {
606 int lhs = 10;
607 long rhs = 3;
608 return lhs ^ rhs;
609 }
610
611 /// CHECK-START: long Main.XorLongInt() constant_folding (before)
612 /// CHECK-DAG: <<Const10L:j\d+>> LongConstant 10
613 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
614 /// CHECK-DAG: <<TypeConv:j\d+>> TypeConversion [<<Const3>>]
615 /// CHECK-DAG: <<Xor:j\d+>> Xor [<<Const10L>>,<<TypeConv>>]
616 /// CHECK-DAG: Return [<<Xor>>]
617
618 /// CHECK-START: long Main.XorLongInt() constant_folding (after)
619 /// CHECK-DAG: <<Const9:j\d+>> LongConstant 9
620 /// CHECK-DAG: Return [<<Const9>>]
621
622 /// CHECK-START: long Main.XorLongInt() constant_folding (after)
623 /// CHECK-NOT: Xor
624
625 public static long XorLongInt() {
626 long lhs = 10;
627 int rhs = 3;
628 return lhs ^ rhs;
629 }
630
631
632 /**
Roland Levillainb65eb502015-07-23 12:11:42 +0100633 * Exercise constant folding on constant (static) condition.
David Brazdilee690a32014-12-01 17:04:16 +0000634 */
635
David Brazdila06d66a2015-05-28 11:14:54 +0100636 /// CHECK-START: int Main.StaticCondition() constant_folding (before)
637 /// CHECK-DAG: <<Const7:i\d+>> IntConstant 7
638 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
639 /// CHECK-DAG: <<Cond:z\d+>> GreaterThanOrEqual [<<Const7>>,<<Const2>>]
640 /// CHECK-DAG: If [<<Cond>>]
David Brazdilee690a32014-12-01 17:04:16 +0000641
David Brazdila06d66a2015-05-28 11:14:54 +0100642 /// CHECK-START: int Main.StaticCondition() constant_folding (after)
643 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
644 /// CHECK-DAG: If [<<Const1>>]
David Brazdilee690a32014-12-01 17:04:16 +0000645
Roland Levillainb65eb502015-07-23 12:11:42 +0100646 /// CHECK-START: int Main.StaticCondition() constant_folding (after)
647 /// CHECK-NOT: GreaterThanOrEqual
648
David Brazdilee690a32014-12-01 17:04:16 +0000649 public static int StaticCondition() {
650 int a, b, c;
David Brazdil4846d132015-01-15 19:07:08 +0000651 a = 7;
David Brazdilee690a32014-12-01 17:04:16 +0000652 b = 2;
653 if (a < b)
654 c = a + b;
655 else
656 c = a - b;
657 return c;
658 }
659
Roland Levillainb65eb502015-07-23 12:11:42 +0100660
David Brazdilee690a32014-12-01 17:04:16 +0000661 /**
Vladimir Marko9e23df52015-11-10 17:14:35 +0000662 * Exercise constant folding on constant (static) condition for null references.
663 */
664
665 /// CHECK-START: int Main.StaticConditionNulls() constant_folding_after_inlining (before)
666 /// CHECK-DAG: <<Null:l\d+>> NullConstant
667 /// CHECK-DAG: <<Cond:z\d+>> NotEqual [<<Null>>,<<Null>>]
668 /// CHECK-DAG: If [<<Cond>>]
669
670 /// CHECK-START: int Main.StaticConditionNulls() constant_folding_after_inlining (after)
671 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
672 /// CHECK-DAG: If [<<Const0>>]
673
674 /// CHECK-START: int Main.StaticConditionNulls() constant_folding_after_inlining (after)
675 /// CHECK-NOT: NotEqual
676
677 private static Object getNull() {
678 return null;
679 }
680
681 public static int StaticConditionNulls() {
682 Object a = getNull();
683 Object b = getNull();
684 return (a == b) ? 5 : 2;
685 }
686
687
688 /**
Roland Levillainb65eb502015-07-23 12:11:42 +0100689 * Exercise constant folding on a program with condition
690 * (i.e. jumps) leading to the creation of many blocks.
David Brazdilee690a32014-12-01 17:04:16 +0000691 *
692 * The intent of this test is to ensure that all constant expressions
693 * are actually evaluated at compile-time, thanks to the reverse
694 * (forward) post-order traversal of the the dominator tree.
695 */
696
David Brazdila06d66a2015-05-28 11:14:54 +0100697 /// CHECK-START: int Main.JumpsAndConditionals(boolean) constant_folding (before)
698 /// CHECK-DAG: <<Const2:i\d+>> IntConstant 2
699 /// CHECK-DAG: <<Const5:i\d+>> IntConstant 5
700 /// CHECK-DAG: <<Add:i\d+>> Add [<<Const5>>,<<Const2>>]
701 /// CHECK-DAG: <<Sub:i\d+>> Sub [<<Const5>>,<<Const2>>]
702 /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Add>>,<<Sub>>]
703 /// CHECK-DAG: Return [<<Phi>>]
David Brazdilee690a32014-12-01 17:04:16 +0000704
David Brazdila06d66a2015-05-28 11:14:54 +0100705 /// CHECK-START: int Main.JumpsAndConditionals(boolean) constant_folding (after)
706 /// CHECK-DAG: <<Const3:i\d+>> IntConstant 3
707 /// CHECK-DAG: <<Const7:i\d+>> IntConstant 7
708 /// CHECK-DAG: <<Phi:i\d+>> Phi [<<Const7>>,<<Const3>>]
709 /// CHECK-DAG: Return [<<Phi>>]
David Brazdilee690a32014-12-01 17:04:16 +0000710
Roland Levillainb65eb502015-07-23 12:11:42 +0100711 /// CHECK-START: int Main.JumpsAndConditionals(boolean) constant_folding (after)
712 /// CHECK-NOT: Add
713 /// CHECK-NOT: Sub
714
David Brazdilee690a32014-12-01 17:04:16 +0000715 public static int JumpsAndConditionals(boolean cond) {
716 int a, b, c;
717 a = 5;
718 b = 2;
719 if (cond)
720 c = a + b;
721 else
722 c = a - b;
723 return c;
724 }
David Brazdil4846d132015-01-15 19:07:08 +0000725
Roland Levillainb65eb502015-07-23 12:11:42 +0100726
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000727 /**
728 * Test optimizations of arithmetic identities yielding a constant result.
729 */
730
David Brazdila06d66a2015-05-28 11:14:54 +0100731 /// CHECK-START: int Main.And0(int) constant_folding (before)
732 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
733 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
734 /// CHECK-DAG: <<And:i\d+>> And [<<Arg>>,<<Const0>>]
735 /// CHECK-DAG: Return [<<And>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000736
David Brazdila06d66a2015-05-28 11:14:54 +0100737 /// CHECK-START: int Main.And0(int) constant_folding (after)
738 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
739 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100740 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000741
Roland Levillainb65eb502015-07-23 12:11:42 +0100742 /// CHECK-START: int Main.And0(int) constant_folding (after)
743 /// CHECK-NOT: And
744
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000745 public static int And0(int arg) {
746 return arg & 0;
747 }
748
David Brazdila06d66a2015-05-28 11:14:54 +0100749 /// CHECK-START: long Main.Mul0(long) constant_folding (before)
750 /// CHECK-DAG: <<Arg:j\d+>> ParameterValue
751 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
752 /// CHECK-DAG: <<Mul:j\d+>> Mul [<<Arg>>,<<Const0>>]
753 /// CHECK-DAG: Return [<<Mul>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000754
David Brazdila06d66a2015-05-28 11:14:54 +0100755 /// CHECK-START: long Main.Mul0(long) constant_folding (after)
756 /// CHECK-DAG: <<Arg:j\d+>> ParameterValue
757 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100758 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000759
Roland Levillainb65eb502015-07-23 12:11:42 +0100760 /// CHECK-START: long Main.Mul0(long) constant_folding (after)
761 /// CHECK-NOT: Mul
762
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000763 public static long Mul0(long arg) {
764 return arg * 0;
765 }
766
David Brazdila06d66a2015-05-28 11:14:54 +0100767 /// CHECK-START: int Main.OrAllOnes(int) constant_folding (before)
768 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
769 /// CHECK-DAG: <<ConstF:i\d+>> IntConstant -1
770 /// CHECK-DAG: <<Or:i\d+>> Or [<<Arg>>,<<ConstF>>]
771 /// CHECK-DAG: Return [<<Or>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000772
David Brazdila06d66a2015-05-28 11:14:54 +0100773 /// CHECK-START: int Main.OrAllOnes(int) constant_folding (after)
774 /// CHECK-DAG: <<ConstF:i\d+>> IntConstant -1
David Brazdila06d66a2015-05-28 11:14:54 +0100775 /// CHECK-DAG: Return [<<ConstF>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000776
Roland Levillainb65eb502015-07-23 12:11:42 +0100777 /// CHECK-START: int Main.OrAllOnes(int) constant_folding (after)
778 /// CHECK-NOT: Or
779
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000780 public static int OrAllOnes(int arg) {
781 return arg | -1;
782 }
783
David Brazdila06d66a2015-05-28 11:14:54 +0100784 /// CHECK-START: long Main.Rem0(long) constant_folding (before)
785 /// CHECK-DAG: <<Arg:j\d+>> ParameterValue
786 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
787 /// CHECK-DAG: <<DivZeroCheck:j\d+>> DivZeroCheck [<<Arg>>]
788 /// CHECK-DAG: <<Rem:j\d+>> Rem [<<Const0>>,<<DivZeroCheck>>]
789 /// CHECK-DAG: Return [<<Rem>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000790
David Brazdila06d66a2015-05-28 11:14:54 +0100791 /// CHECK-START: long Main.Rem0(long) constant_folding (after)
792 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100793 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000794
Roland Levillainb65eb502015-07-23 12:11:42 +0100795 /// CHECK-START: long Main.Rem0(long) constant_folding (after)
796 /// CHECK-NOT: Rem
797
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000798 public static long Rem0(long arg) {
799 return 0 % arg;
800 }
801
David Brazdila06d66a2015-05-28 11:14:54 +0100802 /// CHECK-START: int Main.Rem1(int) constant_folding (before)
803 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
804 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
805 /// CHECK-DAG: <<Rem:i\d+>> Rem [<<Arg>>,<<Const1>>]
806 /// CHECK-DAG: Return [<<Rem>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000807
David Brazdila06d66a2015-05-28 11:14:54 +0100808 /// CHECK-START: int Main.Rem1(int) constant_folding (after)
809 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100810 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000811
Roland Levillainb65eb502015-07-23 12:11:42 +0100812 /// CHECK-START: int Main.Rem1(int) constant_folding (after)
813 /// CHECK-NOT: Rem
814
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000815 public static int Rem1(int arg) {
816 return arg % 1;
817 }
818
David Brazdila06d66a2015-05-28 11:14:54 +0100819 /// CHECK-START: long Main.RemN1(long) constant_folding (before)
820 /// CHECK-DAG: <<Arg:j\d+>> ParameterValue
821 /// CHECK-DAG: <<ConstN1:j\d+>> LongConstant -1
822 /// CHECK-DAG: <<DivZeroCheck:j\d+>> DivZeroCheck [<<ConstN1>>]
823 /// CHECK-DAG: <<Rem:j\d+>> Rem [<<Arg>>,<<DivZeroCheck>>]
824 /// CHECK-DAG: Return [<<Rem>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000825
David Brazdila06d66a2015-05-28 11:14:54 +0100826 /// CHECK-START: long Main.RemN1(long) constant_folding (after)
827 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100828 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000829
Roland Levillainb65eb502015-07-23 12:11:42 +0100830 /// CHECK-START: long Main.RemN1(long) constant_folding (after)
831 /// CHECK-NOT: Rem
832
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000833 public static long RemN1(long arg) {
834 return arg % -1;
835 }
836
David Brazdila06d66a2015-05-28 11:14:54 +0100837 /// CHECK-START: int Main.Shl0(int) constant_folding (before)
838 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
839 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
840 /// CHECK-DAG: <<Shl:i\d+>> Shl [<<Const0>>,<<Arg>>]
841 /// CHECK-DAG: Return [<<Shl>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000842
David Brazdila06d66a2015-05-28 11:14:54 +0100843 /// CHECK-START: int Main.Shl0(int) constant_folding (after)
844 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
845 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100846 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000847
Roland Levillainb65eb502015-07-23 12:11:42 +0100848 /// CHECK-START: int Main.Shl0(int) constant_folding (after)
849 /// CHECK-NOT: Shl
850
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000851 public static int Shl0(int arg) {
852 return 0 << arg;
853 }
854
Roland Levillain9867bc72015-08-05 10:21:34 +0100855 /// CHECK-START: long Main.ShlLong0WithInt(int) constant_folding (before)
856 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
857 /// CHECK-DAG: <<Const0L:j\d+>> LongConstant 0
858 /// CHECK-DAG: <<Shl:j\d+>> Shl [<<Const0L>>,<<Arg>>]
859 /// CHECK-DAG: Return [<<Shl>>]
860
861 /// CHECK-START: long Main.ShlLong0WithInt(int) constant_folding (after)
862 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
863 /// CHECK-DAG: <<Const0L:j\d+>> LongConstant 0
864 /// CHECK-DAG: Return [<<Const0L>>]
865
866 /// CHECK-START: long Main.ShlLong0WithInt(int) constant_folding (after)
867 /// CHECK-NOT: Shl
868
869 public static long ShlLong0WithInt(int arg) {
870 long long_zero = 0;
871 return long_zero << arg;
872 }
873
David Brazdila06d66a2015-05-28 11:14:54 +0100874 /// CHECK-START: long Main.Shr0(int) constant_folding (before)
875 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
876 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
877 /// CHECK-DAG: <<Shr:j\d+>> Shr [<<Const0>>,<<Arg>>]
878 /// CHECK-DAG: Return [<<Shr>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000879
David Brazdila06d66a2015-05-28 11:14:54 +0100880 /// CHECK-START: long Main.Shr0(int) constant_folding (after)
881 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
882 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100883 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000884
Roland Levillainb65eb502015-07-23 12:11:42 +0100885 /// CHECK-START: long Main.Shr0(int) constant_folding (after)
886 /// CHECK-NOT: Shr
887
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000888 public static long Shr0(int arg) {
889 return (long)0 >> arg;
890 }
891
David Brazdila06d66a2015-05-28 11:14:54 +0100892 /// CHECK-START: long Main.SubSameLong(long) constant_folding (before)
893 /// CHECK-DAG: <<Arg:j\d+>> ParameterValue
894 /// CHECK-DAG: <<Sub:j\d+>> Sub [<<Arg>>,<<Arg>>]
895 /// CHECK-DAG: Return [<<Sub>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000896
David Brazdila06d66a2015-05-28 11:14:54 +0100897 /// CHECK-START: long Main.SubSameLong(long) constant_folding (after)
898 /// CHECK-DAG: <<Arg:j\d+>> ParameterValue
899 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100900 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000901
Roland Levillainb65eb502015-07-23 12:11:42 +0100902 /// CHECK-START: long Main.SubSameLong(long) constant_folding (after)
903 /// CHECK-NOT: Sub
904
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000905 public static long SubSameLong(long arg) {
906 return arg - arg;
907 }
908
David Brazdila06d66a2015-05-28 11:14:54 +0100909 /// CHECK-START: int Main.UShr0(int) constant_folding (before)
910 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
911 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
912 /// CHECK-DAG: <<UShr:i\d+>> UShr [<<Const0>>,<<Arg>>]
913 /// CHECK-DAG: Return [<<UShr>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000914
David Brazdila06d66a2015-05-28 11:14:54 +0100915 /// CHECK-START: int Main.UShr0(int) constant_folding (after)
916 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
917 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100918 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000919
Roland Levillainb65eb502015-07-23 12:11:42 +0100920 /// CHECK-START: int Main.UShr0(int) constant_folding (after)
921 /// CHECK-NOT: UShr
922
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000923 public static int UShr0(int arg) {
924 return 0 >>> arg;
925 }
926
David Brazdila06d66a2015-05-28 11:14:54 +0100927 /// CHECK-START: int Main.XorSameInt(int) constant_folding (before)
928 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
929 /// CHECK-DAG: <<Xor:i\d+>> Xor [<<Arg>>,<<Arg>>]
930 /// CHECK-DAG: Return [<<Xor>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000931
David Brazdila06d66a2015-05-28 11:14:54 +0100932 /// CHECK-START: int Main.XorSameInt(int) constant_folding (after)
933 /// CHECK-DAG: <<Arg:i\d+>> ParameterValue
934 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
David Brazdila06d66a2015-05-28 11:14:54 +0100935 /// CHECK-DAG: Return [<<Const0>>]
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000936
Roland Levillainb65eb502015-07-23 12:11:42 +0100937 /// CHECK-START: int Main.XorSameInt(int) constant_folding (after)
938 /// CHECK-NOT: Xor
939
Alexandre Ramesb2fd7bc2015-03-11 16:48:16 +0000940 public static int XorSameInt(int arg) {
941 return arg ^ arg;
942 }
943
David Brazdila06d66a2015-05-28 11:14:54 +0100944 /// CHECK-START: boolean Main.CmpFloatGreaterThanNaN(float) constant_folding (before)
945 /// CHECK-DAG: <<Arg:f\d+>> ParameterValue
946 /// CHECK-DAG: <<ConstNan:f\d+>> FloatConstant nan
947 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
948 /// CHECK-DAG: IntConstant 1
949 /// CHECK-DAG: <<Cmp:i\d+>> Compare [<<Arg>>,<<ConstNan>>]
950 /// CHECK-DAG: <<Le:z\d+>> LessThanOrEqual [<<Cmp>>,<<Const0>>]
951 /// CHECK-DAG: If [<<Le>>]
Roland Levillain3b55ebb2015-05-08 13:13:19 +0100952
David Brazdila06d66a2015-05-28 11:14:54 +0100953 /// CHECK-START: boolean Main.CmpFloatGreaterThanNaN(float) constant_folding (after)
954 /// CHECK-DAG: ParameterValue
955 /// CHECK-DAG: FloatConstant nan
956 /// CHECK-DAG: IntConstant 0
957 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
958 /// CHECK-DAG: If [<<Const1>>]
Roland Levillain3b55ebb2015-05-08 13:13:19 +0100959
David Brazdila06d66a2015-05-28 11:14:54 +0100960 /// CHECK-START: boolean Main.CmpFloatGreaterThanNaN(float) constant_folding (after)
961 /// CHECK-NOT: Compare
962 /// CHECK-NOT: LessThanOrEqual
Roland Levillain3b55ebb2015-05-08 13:13:19 +0100963
964 public static boolean CmpFloatGreaterThanNaN(float arg) {
965 return arg > Float.NaN;
966 }
967
David Brazdila06d66a2015-05-28 11:14:54 +0100968 /// CHECK-START: boolean Main.CmpDoubleLessThanNaN(double) constant_folding (before)
969 /// CHECK-DAG: <<Arg:d\d+>> ParameterValue
970 /// CHECK-DAG: <<ConstNan:d\d+>> DoubleConstant nan
971 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
972 /// CHECK-DAG: IntConstant 1
973 /// CHECK-DAG: <<Cmp:i\d+>> Compare [<<Arg>>,<<ConstNan>>]
974 /// CHECK-DAG: <<Ge:z\d+>> GreaterThanOrEqual [<<Cmp>>,<<Const0>>]
975 /// CHECK-DAG: If [<<Ge>>]
Roland Levillain3b55ebb2015-05-08 13:13:19 +0100976
David Brazdila06d66a2015-05-28 11:14:54 +0100977 /// CHECK-START: boolean Main.CmpDoubleLessThanNaN(double) constant_folding (after)
978 /// CHECK-DAG: ParameterValue
979 /// CHECK-DAG: DoubleConstant nan
980 /// CHECK-DAG: IntConstant 0
981 /// CHECK-DAG: <<Const1:i\d+>> IntConstant 1
982 /// CHECK-DAG: If [<<Const1>>]
Roland Levillain3b55ebb2015-05-08 13:13:19 +0100983
David Brazdila06d66a2015-05-28 11:14:54 +0100984 /// CHECK-START: boolean Main.CmpDoubleLessThanNaN(double) constant_folding (after)
985 /// CHECK-NOT: Compare
986 /// CHECK-NOT: GreaterThanOrEqual
Roland Levillain3b55ebb2015-05-08 13:13:19 +0100987
988 public static boolean CmpDoubleLessThanNaN(double arg) {
989 return arg < Double.NaN;
990 }
991
Roland Levillainb65eb502015-07-23 12:11:42 +0100992
993 /**
994 * Exercise constant folding on type conversions.
995 */
996
David Brazdila06d66a2015-05-28 11:14:54 +0100997 /// CHECK-START: int Main.ReturnInt33() constant_folding (before)
998 /// CHECK-DAG: <<Const33:j\d+>> LongConstant 33
999 /// CHECK-DAG: <<Convert:i\d+>> TypeConversion [<<Const33>>]
1000 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001001
David Brazdila06d66a2015-05-28 11:14:54 +01001002 /// CHECK-START: int Main.ReturnInt33() constant_folding (after)
1003 /// CHECK-DAG: <<Const33:i\d+>> IntConstant 33
1004 /// CHECK-DAG: Return [<<Const33>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001005
Roland Levillainb65eb502015-07-23 12:11:42 +01001006 /// CHECK-START: int Main.ReturnInt33() constant_folding (after)
1007 /// CHECK-NOT: TypeConversion
1008
Mark Mendelle82549b2015-05-06 10:55:34 -04001009 public static int ReturnInt33() {
1010 long imm = 33L;
1011 return (int) imm;
1012 }
1013
David Brazdila06d66a2015-05-28 11:14:54 +01001014 /// CHECK-START: int Main.ReturnIntMax() constant_folding (before)
1015 /// CHECK-DAG: <<ConstMax:f\d+>> FloatConstant 1e+34
1016 /// CHECK-DAG: <<Convert:i\d+>> TypeConversion [<<ConstMax>>]
1017 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001018
David Brazdila06d66a2015-05-28 11:14:54 +01001019 /// CHECK-START: int Main.ReturnIntMax() constant_folding (after)
1020 /// CHECK-DAG: <<ConstMax:i\d+>> IntConstant 2147483647
1021 /// CHECK-DAG: Return [<<ConstMax>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001022
Roland Levillainb65eb502015-07-23 12:11:42 +01001023 /// CHECK-START: int Main.ReturnIntMax() constant_folding (after)
1024 /// CHECK-NOT: TypeConversion
1025
Mark Mendelle82549b2015-05-06 10:55:34 -04001026 public static int ReturnIntMax() {
1027 float imm = 1.0e34f;
1028 return (int) imm;
1029 }
1030
David Brazdila06d66a2015-05-28 11:14:54 +01001031 /// CHECK-START: int Main.ReturnInt0() constant_folding (before)
1032 /// CHECK-DAG: <<ConstNaN:d\d+>> DoubleConstant nan
1033 /// CHECK-DAG: <<Convert:i\d+>> TypeConversion [<<ConstNaN>>]
1034 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001035
David Brazdila06d66a2015-05-28 11:14:54 +01001036 /// CHECK-START: int Main.ReturnInt0() constant_folding (after)
1037 /// CHECK-DAG: <<Const0:i\d+>> IntConstant 0
1038 /// CHECK-DAG: Return [<<Const0>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001039
Roland Levillainb65eb502015-07-23 12:11:42 +01001040 /// CHECK-START: int Main.ReturnInt0() constant_folding (after)
1041 /// CHECK-NOT: TypeConversion
1042
Mark Mendelle82549b2015-05-06 10:55:34 -04001043 public static int ReturnInt0() {
1044 double imm = Double.NaN;
1045 return (int) imm;
1046 }
1047
David Brazdila06d66a2015-05-28 11:14:54 +01001048 /// CHECK-START: long Main.ReturnLong33() constant_folding (before)
1049 /// CHECK-DAG: <<Const33:i\d+>> IntConstant 33
1050 /// CHECK-DAG: <<Convert:j\d+>> TypeConversion [<<Const33>>]
1051 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001052
David Brazdila06d66a2015-05-28 11:14:54 +01001053 /// CHECK-START: long Main.ReturnLong33() constant_folding (after)
1054 /// CHECK-DAG: <<Const33:j\d+>> LongConstant 33
1055 /// CHECK-DAG: Return [<<Const33>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001056
Roland Levillainb65eb502015-07-23 12:11:42 +01001057 /// CHECK-START: long Main.ReturnLong33() constant_folding (after)
1058 /// CHECK-NOT: TypeConversion
1059
Mark Mendelle82549b2015-05-06 10:55:34 -04001060 public static long ReturnLong33() {
1061 int imm = 33;
1062 return (long) imm;
1063 }
1064
David Brazdila06d66a2015-05-28 11:14:54 +01001065 /// CHECK-START: long Main.ReturnLong34() constant_folding (before)
1066 /// CHECK-DAG: <<Const34:f\d+>> FloatConstant 34
1067 /// CHECK-DAG: <<Convert:j\d+>> TypeConversion [<<Const34>>]
1068 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001069
David Brazdila06d66a2015-05-28 11:14:54 +01001070 /// CHECK-START: long Main.ReturnLong34() constant_folding (after)
1071 /// CHECK-DAG: <<Const34:j\d+>> LongConstant 34
1072 /// CHECK-DAG: Return [<<Const34>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001073
Roland Levillainb65eb502015-07-23 12:11:42 +01001074 /// CHECK-START: long Main.ReturnLong34() constant_folding (after)
1075 /// CHECK-NOT: TypeConversion
1076
Mark Mendelle82549b2015-05-06 10:55:34 -04001077 public static long ReturnLong34() {
1078 float imm = 34.0f;
1079 return (long) imm;
1080 }
1081
David Brazdila06d66a2015-05-28 11:14:54 +01001082 /// CHECK-START: long Main.ReturnLong0() constant_folding (before)
1083 /// CHECK-DAG: <<ConstNaN:d\d+>> DoubleConstant nan
1084 /// CHECK-DAG: <<Convert:j\d+>> TypeConversion [<<ConstNaN>>]
1085 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001086
David Brazdila06d66a2015-05-28 11:14:54 +01001087 /// CHECK-START: long Main.ReturnLong0() constant_folding (after)
1088 /// CHECK-DAG: <<Const0:j\d+>> LongConstant 0
1089 /// CHECK-DAG: Return [<<Const0>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001090
Roland Levillainb65eb502015-07-23 12:11:42 +01001091 /// CHECK-START: long Main.ReturnLong0() constant_folding (after)
1092 /// CHECK-NOT: TypeConversion
1093
Mark Mendelle82549b2015-05-06 10:55:34 -04001094 public static long ReturnLong0() {
1095 double imm = -Double.NaN;
1096 return (long) imm;
1097 }
1098
David Brazdila06d66a2015-05-28 11:14:54 +01001099 /// CHECK-START: float Main.ReturnFloat33() constant_folding (before)
1100 /// CHECK-DAG: <<Const33:i\d+>> IntConstant 33
1101 /// CHECK-DAG: <<Convert:f\d+>> TypeConversion [<<Const33>>]
1102 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001103
David Brazdila06d66a2015-05-28 11:14:54 +01001104 /// CHECK-START: float Main.ReturnFloat33() constant_folding (after)
1105 /// CHECK-DAG: <<Const33:f\d+>> FloatConstant 33
1106 /// CHECK-DAG: Return [<<Const33>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001107
Roland Levillainb65eb502015-07-23 12:11:42 +01001108 /// CHECK-START: float Main.ReturnFloat33() constant_folding (after)
1109 /// CHECK-NOT: TypeConversion
1110
Mark Mendelle82549b2015-05-06 10:55:34 -04001111 public static float ReturnFloat33() {
1112 int imm = 33;
1113 return (float) imm;
1114 }
1115
David Brazdila06d66a2015-05-28 11:14:54 +01001116 /// CHECK-START: float Main.ReturnFloat34() constant_folding (before)
1117 /// CHECK-DAG: <<Const34:j\d+>> LongConstant 34
1118 /// CHECK-DAG: <<Convert:f\d+>> TypeConversion [<<Const34>>]
1119 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001120
David Brazdila06d66a2015-05-28 11:14:54 +01001121 /// CHECK-START: float Main.ReturnFloat34() constant_folding (after)
1122 /// CHECK-DAG: <<Const34:f\d+>> FloatConstant 34
1123 /// CHECK-DAG: Return [<<Const34>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001124
Roland Levillainb65eb502015-07-23 12:11:42 +01001125 /// CHECK-START: float Main.ReturnFloat34() constant_folding (after)
1126 /// CHECK-NOT: TypeConversion
1127
Mark Mendelle82549b2015-05-06 10:55:34 -04001128 public static float ReturnFloat34() {
1129 long imm = 34L;
1130 return (float) imm;
1131 }
1132
David Brazdila06d66a2015-05-28 11:14:54 +01001133 /// CHECK-START: float Main.ReturnFloat99P25() constant_folding (before)
1134 /// CHECK-DAG: <<Const:d\d+>> DoubleConstant 99.25
1135 /// CHECK-DAG: <<Convert:f\d+>> TypeConversion [<<Const>>]
1136 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001137
David Brazdila06d66a2015-05-28 11:14:54 +01001138 /// CHECK-START: float Main.ReturnFloat99P25() constant_folding (after)
1139 /// CHECK-DAG: <<Const:f\d+>> FloatConstant 99.25
1140 /// CHECK-DAG: Return [<<Const>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001141
Roland Levillainb65eb502015-07-23 12:11:42 +01001142 /// CHECK-START: float Main.ReturnFloat99P25() constant_folding (after)
1143 /// CHECK-NOT: TypeConversion
1144
Mark Mendelle82549b2015-05-06 10:55:34 -04001145 public static float ReturnFloat99P25() {
1146 double imm = 99.25;
1147 return (float) imm;
1148 }
1149
David Brazdila06d66a2015-05-28 11:14:54 +01001150 /// CHECK-START: double Main.ReturnDouble33() constant_folding (before)
1151 /// CHECK-DAG: <<Const33:i\d+>> IntConstant 33
1152 /// CHECK-DAG: <<Convert:d\d+>> TypeConversion [<<Const33>>]
1153 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001154
David Brazdila06d66a2015-05-28 11:14:54 +01001155 /// CHECK-START: double Main.ReturnDouble33() constant_folding (after)
1156 /// CHECK-DAG: <<Const33:d\d+>> DoubleConstant 33
1157 /// CHECK-DAG: Return [<<Const33>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001158
1159 public static double ReturnDouble33() {
1160 int imm = 33;
1161 return (double) imm;
1162 }
1163
David Brazdila06d66a2015-05-28 11:14:54 +01001164 /// CHECK-START: double Main.ReturnDouble34() constant_folding (before)
1165 /// CHECK-DAG: <<Const34:j\d+>> LongConstant 34
1166 /// CHECK-DAG: <<Convert:d\d+>> TypeConversion [<<Const34>>]
1167 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001168
David Brazdila06d66a2015-05-28 11:14:54 +01001169 /// CHECK-START: double Main.ReturnDouble34() constant_folding (after)
1170 /// CHECK-DAG: <<Const34:d\d+>> DoubleConstant 34
1171 /// CHECK-DAG: Return [<<Const34>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001172
Roland Levillainb65eb502015-07-23 12:11:42 +01001173 /// CHECK-START: double Main.ReturnDouble34() constant_folding (after)
1174 /// CHECK-NOT: TypeConversion
1175
Mark Mendelle82549b2015-05-06 10:55:34 -04001176 public static double ReturnDouble34() {
1177 long imm = 34L;
1178 return (double) imm;
1179 }
1180
David Brazdila06d66a2015-05-28 11:14:54 +01001181 /// CHECK-START: double Main.ReturnDouble99P25() constant_folding (before)
1182 /// CHECK-DAG: <<Const:f\d+>> FloatConstant 99.25
1183 /// CHECK-DAG: <<Convert:d\d+>> TypeConversion [<<Const>>]
1184 /// CHECK-DAG: Return [<<Convert>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001185
David Brazdila06d66a2015-05-28 11:14:54 +01001186 /// CHECK-START: double Main.ReturnDouble99P25() constant_folding (after)
1187 /// CHECK-DAG: <<Const:d\d+>> DoubleConstant 99.25
1188 /// CHECK-DAG: Return [<<Const>>]
Mark Mendelle82549b2015-05-06 10:55:34 -04001189
Roland Levillainb65eb502015-07-23 12:11:42 +01001190 /// CHECK-START: double Main.ReturnDouble99P25() constant_folding (after)
1191 /// CHECK-NOT: TypeConversion
1192
Mark Mendelle82549b2015-05-06 10:55:34 -04001193 public static double ReturnDouble99P25() {
1194 float imm = 99.25f;
1195 return (double) imm;
1196 }
1197
Roland Levillainb65eb502015-07-23 12:11:42 +01001198
David Brazdil4846d132015-01-15 19:07:08 +00001199 public static void main(String[] args) {
Roland Levillainb65eb502015-07-23 12:11:42 +01001200 assertIntEquals(-42, IntNegation());
Roland Levillainc90bc7c2014-12-11 12:14:33 +00001201 assertLongEquals(-42L, LongNegation());
Roland Levillainb65eb502015-07-23 12:11:42 +01001202
1203 assertIntEquals(3, IntAddition1());
1204 assertIntEquals(14, IntAddition2());
1205 assertLongEquals(3L, LongAddition());
1206
1207 assertIntEquals(4, IntSubtraction());
1208 assertLongEquals(4L, LongSubtraction());
1209
Roland Levillainf7746ad2015-07-22 14:12:01 +01001210 assertIntEquals(21, IntMultiplication());
1211 assertLongEquals(21L, LongMultiplication());
1212
1213 assertIntEquals(2, IntDivision());
1214 assertLongEquals(2L, LongDivision());
1215
1216 assertIntEquals(2, IntRemainder());
1217 assertLongEquals(2L, LongRemainder());
1218
Roland Levillain9867bc72015-08-05 10:21:34 +01001219 assertIntEquals(4, ShlIntLong());
1220 assertLongEquals(12L, ShlLongInt());
1221
1222 assertIntEquals(1, ShrIntLong());
1223 assertLongEquals(2L, ShrLongInt());
1224
1225 assertIntEquals(1073741822, UShrIntLong());
1226 assertLongEquals(4611686018427387901L, UShrLongInt());
1227
1228 assertLongEquals(2, AndIntLong());
1229 assertLongEquals(2, AndLongInt());
1230
1231 assertLongEquals(11, OrIntLong());
1232 assertLongEquals(11, OrLongInt());
1233
1234 assertLongEquals(9, XorIntLong());
1235 assertLongEquals(9, XorLongInt());
1236
Roland Levillainb65eb502015-07-23 12:11:42 +01001237 assertIntEquals(5, StaticCondition());
Vladimir Marko9e23df52015-11-10 17:14:35 +00001238 assertIntEquals(5, StaticConditionNulls());
Roland Levillainb65eb502015-07-23 12:11:42 +01001239
1240 assertIntEquals(7, JumpsAndConditionals(true));
1241 assertIntEquals(3, JumpsAndConditionals(false));
1242
Roland Levillain3b55ebb2015-05-08 13:13:19 +01001243 int arbitrary = 123456; // Value chosen arbitrarily.
Roland Levillainb65eb502015-07-23 12:11:42 +01001244
1245 assertIntEquals(0, And0(arbitrary));
1246 assertLongEquals(0, Mul0(arbitrary));
1247 assertIntEquals(-1, OrAllOnes(arbitrary));
1248 assertLongEquals(0, Rem0(arbitrary));
1249 assertIntEquals(0, Rem1(arbitrary));
1250 assertLongEquals(0, RemN1(arbitrary));
1251 assertIntEquals(0, Shl0(arbitrary));
Roland Levillain9867bc72015-08-05 10:21:34 +01001252 assertLongEquals(0, ShlLong0WithInt(arbitrary));
Roland Levillainb65eb502015-07-23 12:11:42 +01001253 assertLongEquals(0, Shr0(arbitrary));
1254 assertLongEquals(0, SubSameLong(arbitrary));
1255 assertIntEquals(0, UShr0(arbitrary));
1256 assertIntEquals(0, XorSameInt(arbitrary));
1257
Roland Levillain3b55ebb2015-05-08 13:13:19 +01001258 assertFalse(CmpFloatGreaterThanNaN(arbitrary));
1259 assertFalse(CmpDoubleLessThanNaN(arbitrary));
Roland Levillainb65eb502015-07-23 12:11:42 +01001260
1261 assertIntEquals(33, ReturnInt33());
1262 assertIntEquals(2147483647, ReturnIntMax());
1263 assertIntEquals(0, ReturnInt0());
1264
1265 assertLongEquals(33, ReturnLong33());
1266 assertLongEquals(34, ReturnLong34());
1267 assertLongEquals(0, ReturnLong0());
1268
1269 assertFloatEquals(33, ReturnFloat33());
1270 assertFloatEquals(34, ReturnFloat34());
1271 assertFloatEquals(99.25f, ReturnFloat99P25());
1272
1273 assertDoubleEquals(33, ReturnDouble33());
1274 assertDoubleEquals(34, ReturnDouble34());
1275 assertDoubleEquals(99.25, ReturnDouble99P25());
David Brazdil4846d132015-01-15 19:07:08 +00001276 }
David Brazdilee690a32014-12-01 17:04:16 +00001277}