1 /* 2 * Copyright (c) 2010, 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 */ 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 compiler.codegen.Test6909839 31 */ 32 33 package compiler.codegen; 34 35 public class Test6909839 { 36 public static void main(String[] args) { 37 testi(); 38 testi(); 39 testi(); 40 testui(); 41 testui(); 42 testui(); 43 testdi(); 44 testdi(); 45 testdi(); 46 testfi(); 47 testfi(); 48 testfi(); 49 50 testl(); 51 testl(); 52 testl(); 53 testul(); 54 testul(); 55 testul(); 56 testdl(); 57 testdl(); 58 testdl(); 59 testfl(); 60 testfl(); 61 testfl(); 62 63 testf(); 64 testf(); 65 testf(); 66 testuf(); 67 testuf(); 68 testuf(); 69 testdf(); 70 testdf(); 71 testdf(); 72 testff(); 73 testff(); 74 testff(); 75 76 testd(); 77 testd(); 78 testd(); 79 testud(); 80 testud(); 81 testud(); 82 testdd(); 83 testdd(); 84 testdd(); 85 testfd(); 86 testfd(); 87 testfd(); 88 89 testp(); 90 testp(); 91 testp(); 92 testup(); 93 testup(); 94 testup(); 95 testdp(); 96 testdp(); 97 testdp(); 98 testfp(); 99 testfp(); 100 testfp(); 101 } 102 103 static void testui() { 104 int total = 0; 105 for (int i = 0 ; i < 10000; i++) { 106 int v = i % 4; 107 total += ((v >= 1 && v < 3) ? 1 : 2); 108 } 109 System.out.println(total); 110 } 111 112 static void testdi() { 113 int total = 0; 114 for (int i = 0 ; i < 10000; i++) { 115 int v = i % 4; 116 total += (v > 1.0) ? 1 : 2; 117 } 118 System.out.println(total); 119 } 120 121 static void testfi() { 122 int total = 0; 123 for (int i = 0 ; i < 10000; i++) { 124 int v = i % 4; 125 total += (v > 1.0f) ? 1 : 2; 126 } 127 System.out.println(total); 128 } 129 130 static void testi() { 131 int total = 0; 132 for (int i = 0 ; i < 10000; i++) { 133 total += (i % 4 != 0) ? 1 : 2; 134 } 135 System.out.println(total); 136 } 137 138 static void testul() { 139 long total = 0; 140 for (int i = 0 ; i < 10000; i++) { 141 int v = i % 4; 142 total += ((v >= 1 && v < 3) ? 1L : 2L); 143 } 144 System.out.println(total); 145 } 146 147 static void testdl() { 148 long total = 0; 149 for (int i = 0 ; i < 10000; i++) { 150 int v = i % 4; 151 total += (v > 1.0) ? 1L : 2L; 152 } 153 System.out.println(total); 154 } 155 156 static void testfl() { 157 long total = 0; 158 for (int i = 0 ; i < 10000; i++) { 159 int v = i % 4; 160 total += (v > 1.0f) ? 1L : 2L; 161 } 162 System.out.println(total); 163 } 164 165 static void testl() { 166 long total = 0; 167 for (int i = 0 ; i < 10000; i++) { 168 total += (i % 4 != 0) ? 1L : 2L; 169 } 170 System.out.println(total); 171 } 172 173 static void testuf() { 174 float total = 0; 175 for (int i = 0 ; i < 10000; i++) { 176 int v = i % 4; 177 total += ((v >= 1 && v < 3) ? 1.0f : 2.0f); 178 } 179 System.out.println(total); 180 } 181 182 static void testdf() { 183 float total = 0; 184 for (int i = 0 ; i < 10000; i++) { 185 int v = i % 4; 186 total += (v > 0.0) ? 1.0f : 2.0f; 187 } 188 System.out.println(total); 189 } 190 191 static void testff() { 192 float total = 0; 193 for (int i = 0 ; i < 10000; i++) { 194 int v = i % 4; 195 total += (v > 0.0f) ? 1.0f : 2.0f; 196 } 197 System.out.println(total); 198 } 199 200 static void testf() { 201 float total = 0; 202 for (int i = 0 ; i < 10000; i++) { 203 total += (i % 4 != 0) ? 1.0f : 2.0f; 204 } 205 System.out.println(total); 206 } 207 208 static void testud() { 209 double total = 0; 210 for (int i = 0 ; i < 10000; i++) { 211 int v = i % 4; 212 total += ((v >= 1 && v < 3) ? 1.0d : 2.0d); 213 } 214 System.out.println(total); 215 } 216 217 static void testdd() { 218 double total = 0; 219 for (int i = 0 ; i < 10000; i++) { 220 int v = i % 4; 221 total += (v > 1.0) ? 1.0d : 2.0d; 222 } 223 System.out.println(total); 224 } 225 226 static void testfd() { 227 double total = 0; 228 for (int i = 0 ; i < 10000; i++) { 229 int v = i % 4; 230 total += (v > 1.0f) ? 1.0d : 2.0d; 231 } 232 System.out.println(total); 233 } 234 235 static void testd() { 236 double total = 0; 237 for (int i = 0 ; i < 10000; i++) { 238 total += (i % 4 != 0) ? 1.0d : 2.0d; 239 } 240 System.out.println(total); 241 } 242 243 static void testp() { 244 Object a = new Object(); 245 Object b = new Object();; 246 int total = 0; 247 for (int i = 0 ; i < 10000; i++) { 248 total += ((i % 4 != 0) ? a : b).hashCode(); 249 } 250 System.out.println(total); 251 } 252 253 static void testup() { 254 Object a = new Object(); 255 Object b = new Object();; 256 int total = 0; 257 for (int i = 0 ; i < 10000; i++) { 258 int v = i % 4; 259 total += ((v >= 1 && v < 3) ? a : b).hashCode(); 260 } 261 System.out.println(total); 262 } 263 264 static void testdp() { 265 Object a = new Object(); 266 Object b = new Object();; 267 int total = 0; 268 for (int i = 0 ; i < 10000; i++) { 269 int v = i % 4; 270 total += ((v > 1.0) ? a : b).hashCode(); 271 } 272 System.out.println(total); 273 } 274 static void testfp() { 275 Object a = new Object(); 276 Object b = new Object();; 277 int total = 0; 278 for (int i = 0 ; i < 10000; i++) { 279 int v = i % 4; 280 total += ((v > 1.0f) ? a : b).hashCode(); 281 } 282 System.out.println(total); 283 } 284 }