comparison graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Float02.java @ 5061:e808627bd16f

Renamed projects.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 08 Mar 2012 19:24:17 +0100
parents graal/com.oracle.max.graal.jtt/src/com/oracle/graal/jtt/optimize/Fold_Float02.java@4ed4295ce15f
children 390448a6b535
comparison
equal deleted inserted replaced
5060:4ed4295ce15f 5061:e808627bd16f
1 /*
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package com.oracle.graal.jtt.optimize;
24
25 import org.junit.*;
26
27 /*
28 * Tests constant folding of integer comparisons.
29 */
30 public class Fold_Float02 {
31
32 public static boolean test(int arg) {
33 if (arg == 0) {
34 return equ();
35 }
36 if (arg == 1) {
37 return neq();
38 }
39 if (arg == 2) {
40 return geq();
41 }
42 if (arg == 3) {
43 return ge();
44 }
45 if (arg == 4) {
46 return ltq();
47 }
48 if (arg == 5) {
49 return lt();
50 }
51 return false;
52 }
53
54 static boolean equ() {
55 float x = 34;
56 return x == 34;
57 }
58
59 static boolean neq() {
60 float x = 34;
61 return x != 33;
62 }
63
64 static boolean geq() {
65 float x = 34;
66 return x >= 33;
67 }
68
69 static boolean ge() {
70 float x = 34;
71 return x > 35;
72 }
73
74 static boolean ltq() {
75 float x = 34;
76 return x <= 32;
77 }
78
79 static boolean lt() {
80 float x = 34;
81 return x < 31;
82 }
83
84 @Test
85 public void run0() throws Throwable {
86 Assert.assertEquals(true, test(0));
87 }
88
89 @Test
90 public void run1() throws Throwable {
91 Assert.assertEquals(true, test(1));
92 }
93
94 @Test
95 public void run2() throws Throwable {
96 Assert.assertEquals(true, test(2));
97 }
98
99 @Test
100 public void run3() throws Throwable {
101 Assert.assertEquals(false, test(3));
102 }
103
104 @Test
105 public void run4() throws Throwable {
106 Assert.assertEquals(false, test(4));
107 }
108
109 @Test
110 public void run5() throws Throwable {
111 Assert.assertEquals(false, test(5));
112 }
113
114 }