comparison test/compiler/6909839/Test6909839.java @ 1160:f24201449cac

6909839: missing unsigned compare cases for some cmoves in sparc.ad Reviewed-by: kvn, jrose
author never
date Sat, 09 Jan 2010 00:59:35 -0800
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
1159:5b06c5db3e89 1160:f24201449cac
1 /*
2 * Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
23 */
24
25 /**
26 * @test
27 * @bug 6909839
28 * @summary missing unsigned compare cases for some cmoves in sparc.ad
29 *
30 * @run main/othervm -XX:+AggressiveOpts -Xbatch Test6909839
31 */
32
33 public class Test6909839 {
34 public static void main(String[] args) {
35 testi();
36 testi();
37 testi();
38 testui();
39 testui();
40 testui();
41 testdi();
42 testdi();
43 testdi();
44 testfi();
45 testfi();
46 testfi();
47
48 testl();
49 testl();
50 testl();
51 testul();
52 testul();
53 testul();
54 testdl();
55 testdl();
56 testdl();
57 testfl();
58 testfl();
59 testfl();
60
61 testf();
62 testf();
63 testf();
64 testuf();
65 testuf();
66 testuf();
67 testdf();
68 testdf();
69 testdf();
70 testff();
71 testff();
72 testff();
73
74 testd();
75 testd();
76 testd();
77 testud();
78 testud();
79 testud();
80 testdd();
81 testdd();
82 testdd();
83 testfd();
84 testfd();
85 testfd();
86
87 testp();
88 testp();
89 testp();
90 testup();
91 testup();
92 testup();
93 testdp();
94 testdp();
95 testdp();
96 testfp();
97 testfp();
98 testfp();
99 }
100
101 static void testui() {
102 int total = 0;
103 for (int i = 0 ; i < 10000; i++) {
104 int v = i % 4;
105 total += ((v >= 1 && v < 3) ? 1 : 2);
106 }
107 System.out.println(total);
108 }
109
110 static void testdi() {
111 int total = 0;
112 for (int i = 0 ; i < 10000; i++) {
113 int v = i % 4;
114 total += (v > 1.0) ? 1 : 2;
115 }
116 System.out.println(total);
117 }
118
119 static void testfi() {
120 int total = 0;
121 for (int i = 0 ; i < 10000; i++) {
122 int v = i % 4;
123 total += (v > 1.0f) ? 1 : 2;
124 }
125 System.out.println(total);
126 }
127
128 static void testi() {
129 int total = 0;
130 for (int i = 0 ; i < 10000; i++) {
131 total += (i % 4 != 0) ? 1 : 2;
132 }
133 System.out.println(total);
134 }
135
136 static void testul() {
137 long total = 0;
138 for (int i = 0 ; i < 10000; i++) {
139 int v = i % 4;
140 total += ((v >= 1 && v < 3) ? 1L : 2L);
141 }
142 System.out.println(total);
143 }
144
145 static void testdl() {
146 long total = 0;
147 for (int i = 0 ; i < 10000; i++) {
148 int v = i % 4;
149 total += (v > 1.0) ? 1L : 2L;
150 }
151 System.out.println(total);
152 }
153
154 static void testfl() {
155 long total = 0;
156 for (int i = 0 ; i < 10000; i++) {
157 int v = i % 4;
158 total += (v > 1.0f) ? 1L : 2L;
159 }
160 System.out.println(total);
161 }
162
163 static void testl() {
164 long total = 0;
165 for (int i = 0 ; i < 10000; i++) {
166 total += (i % 4 != 0) ? 1L : 2L;
167 }
168 System.out.println(total);
169 }
170
171 static void testuf() {
172 float total = 0;
173 for (int i = 0 ; i < 10000; i++) {
174 int v = i % 4;
175 total += ((v >= 1 && v < 3) ? 1.0f : 2.0f);
176 }
177 System.out.println(total);
178 }
179
180 static void testdf() {
181 float total = 0;
182 for (int i = 0 ; i < 10000; i++) {
183 int v = i % 4;
184 total += (v > 0.0) ? 1.0f : 2.0f;
185 }
186 System.out.println(total);
187 }
188
189 static void testff() {
190 float total = 0;
191 for (int i = 0 ; i < 10000; i++) {
192 int v = i % 4;
193 total += (v > 0.0f) ? 1.0f : 2.0f;
194 }
195 System.out.println(total);
196 }
197
198 static void testf() {
199 float total = 0;
200 for (int i = 0 ; i < 10000; i++) {
201 total += (i % 4 != 0) ? 1.0f : 2.0f;
202 }
203 System.out.println(total);
204 }
205
206 static void testud() {
207 double total = 0;
208 for (int i = 0 ; i < 10000; i++) {
209 int v = i % 4;
210 total += ((v >= 1 && v < 3) ? 1.0d : 2.0d);
211 }
212 System.out.println(total);
213 }
214
215 static void testdd() {
216 double total = 0;
217 for (int i = 0 ; i < 10000; i++) {
218 int v = i % 4;
219 total += (v > 1.0) ? 1.0d : 2.0d;
220 }
221 System.out.println(total);
222 }
223
224 static void testfd() {
225 double total = 0;
226 for (int i = 0 ; i < 10000; i++) {
227 int v = i % 4;
228 total += (v > 1.0f) ? 1.0d : 2.0d;
229 }
230 System.out.println(total);
231 }
232
233 static void testd() {
234 double total = 0;
235 for (int i = 0 ; i < 10000; i++) {
236 total += (i % 4 != 0) ? 1.0d : 2.0d;
237 }
238 System.out.println(total);
239 }
240
241 static void testp() {
242 Object a = new Object();
243 Object b = new Object();;
244 int total = 0;
245 for (int i = 0 ; i < 10000; i++) {
246 total += ((i % 4 != 0) ? a : b).hashCode();
247 }
248 System.out.println(total);
249 }
250
251 static void testup() {
252 Object a = new Object();
253 Object b = new Object();;
254 int total = 0;
255 for (int i = 0 ; i < 10000; i++) {
256 int v = i % 4;
257 total += ((v >= 1 && v < 3) ? a : b).hashCode();
258 }
259 System.out.println(total);
260 }
261
262 static void testdp() {
263 Object a = new Object();
264 Object b = new Object();;
265 int total = 0;
266 for (int i = 0 ; i < 10000; i++) {
267 int v = i % 4;
268 total += ((v > 1.0) ? a : b).hashCode();
269 }
270 System.out.println(total);
271 }
272 static void testfp() {
273 Object a = new Object();
274 Object b = new Object();;
275 int total = 0;
276 for (int i = 0 ; i < 10000; i++) {
277 int v = i % 4;
278 total += ((v > 1.0f) ? a : b).hashCode();
279 }
280 System.out.println(total);
281 }
282 }