Path: blob/master/test/hotspot/jtreg/compiler/codegen/Test6909839.java
41149 views
/*1* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 690983926* @summary missing unsigned compare cases for some cmoves in sparc.ad27*28* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox -XX:AutoBoxCacheMax=20000 -Xbatch compiler.codegen.Test690983929*/3031package compiler.codegen;3233public class Test6909839 {34public static void main(String[] args) {35testi();36testi();37testi();38testui();39testui();40testui();41testdi();42testdi();43testdi();44testfi();45testfi();46testfi();4748testl();49testl();50testl();51testul();52testul();53testul();54testdl();55testdl();56testdl();57testfl();58testfl();59testfl();6061testf();62testf();63testf();64testuf();65testuf();66testuf();67testdf();68testdf();69testdf();70testff();71testff();72testff();7374testd();75testd();76testd();77testud();78testud();79testud();80testdd();81testdd();82testdd();83testfd();84testfd();85testfd();8687testp();88testp();89testp();90testup();91testup();92testup();93testdp();94testdp();95testdp();96testfp();97testfp();98testfp();99}100101static void testui() {102int total = 0;103for (int i = 0 ; i < 10000; i++) {104int v = i % 4;105total += ((v >= 1 && v < 3) ? 1 : 2);106}107System.out.println(total);108}109110static void testdi() {111int total = 0;112for (int i = 0 ; i < 10000; i++) {113int v = i % 4;114total += (v > 1.0) ? 1 : 2;115}116System.out.println(total);117}118119static void testfi() {120int total = 0;121for (int i = 0 ; i < 10000; i++) {122int v = i % 4;123total += (v > 1.0f) ? 1 : 2;124}125System.out.println(total);126}127128static void testi() {129int total = 0;130for (int i = 0 ; i < 10000; i++) {131total += (i % 4 != 0) ? 1 : 2;132}133System.out.println(total);134}135136static void testul() {137long total = 0;138for (int i = 0 ; i < 10000; i++) {139int v = i % 4;140total += ((v >= 1 && v < 3) ? 1L : 2L);141}142System.out.println(total);143}144145static void testdl() {146long total = 0;147for (int i = 0 ; i < 10000; i++) {148int v = i % 4;149total += (v > 1.0) ? 1L : 2L;150}151System.out.println(total);152}153154static void testfl() {155long total = 0;156for (int i = 0 ; i < 10000; i++) {157int v = i % 4;158total += (v > 1.0f) ? 1L : 2L;159}160System.out.println(total);161}162163static void testl() {164long total = 0;165for (int i = 0 ; i < 10000; i++) {166total += (i % 4 != 0) ? 1L : 2L;167}168System.out.println(total);169}170171static void testuf() {172float total = 0;173for (int i = 0 ; i < 10000; i++) {174int v = i % 4;175total += ((v >= 1 && v < 3) ? 1.0f : 2.0f);176}177System.out.println(total);178}179180static void testdf() {181float total = 0;182for (int i = 0 ; i < 10000; i++) {183int v = i % 4;184total += (v > 0.0) ? 1.0f : 2.0f;185}186System.out.println(total);187}188189static void testff() {190float total = 0;191for (int i = 0 ; i < 10000; i++) {192int v = i % 4;193total += (v > 0.0f) ? 1.0f : 2.0f;194}195System.out.println(total);196}197198static void testf() {199float total = 0;200for (int i = 0 ; i < 10000; i++) {201total += (i % 4 != 0) ? 1.0f : 2.0f;202}203System.out.println(total);204}205206static void testud() {207double total = 0;208for (int i = 0 ; i < 10000; i++) {209int v = i % 4;210total += ((v >= 1 && v < 3) ? 1.0d : 2.0d);211}212System.out.println(total);213}214215static void testdd() {216double total = 0;217for (int i = 0 ; i < 10000; i++) {218int v = i % 4;219total += (v > 1.0) ? 1.0d : 2.0d;220}221System.out.println(total);222}223224static void testfd() {225double total = 0;226for (int i = 0 ; i < 10000; i++) {227int v = i % 4;228total += (v > 1.0f) ? 1.0d : 2.0d;229}230System.out.println(total);231}232233static void testd() {234double total = 0;235for (int i = 0 ; i < 10000; i++) {236total += (i % 4 != 0) ? 1.0d : 2.0d;237}238System.out.println(total);239}240241static void testp() {242Object a = new Object();243Object b = new Object();;244int total = 0;245for (int i = 0 ; i < 10000; i++) {246total += ((i % 4 != 0) ? a : b).hashCode();247}248System.out.println(total);249}250251static void testup() {252Object a = new Object();253Object b = new Object();;254int total = 0;255for (int i = 0 ; i < 10000; i++) {256int v = i % 4;257total += ((v >= 1 && v < 3) ? a : b).hashCode();258}259System.out.println(total);260}261262static void testdp() {263Object a = new Object();264Object b = new Object();;265int total = 0;266for (int i = 0 ; i < 10000; i++) {267int v = i % 4;268total += ((v > 1.0) ? a : b).hashCode();269}270System.out.println(total);271}272static void testfp() {273Object a = new Object();274Object b = new Object();;275int total = 0;276for (int i = 0 ; i < 10000; i++) {277int v = i % 4;278total += ((v > 1.0f) ? a : b).hashCode();279}280System.out.println(total);281}282}283284285