Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/t/t048/t048.java
40948 views
/*1* Copyright (c) 2008, 2020, 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*26* @summary converted from VM Testbase jit/t/t048.27* VM Testbase keywords: [jit, quick]28*29* @library /vmTestbase30* /test/lib31* @run main/othervm jit.t.t048.t04832*/3334package jit.t.t048;3536import nsk.share.TestFailure;37import nsk.share.GoldChecker;3839// Register jams and spills4041public class t04842{43public static final GoldChecker goldChecker = new GoldChecker( "t048" );4445static int idiv(int i, int j)46{47int res = i / j;48t048.goldChecker.println("i: " + i + ", j: " + j + ", res: " + res);49return res;50}5152static void intDivs()53{54int a, b, c, d, e, f, g, h, i, j, k, l, z;55int t1, t2, t3, t4, t5, t6, t7;5657a=13; b=12; c=11; d=10; e=9; f=8; g=7; h=6; i=5; j=4; k=3; l=2;5859t1 = a/b;60t2 = c/d;61t3 = e/f;62t4 = g/h;63t5 = i/j;64t6 = k/l;65t048.goldChecker.println("t6 = " + t6);66t048.goldChecker.println("t5 = " + t5);67t5 /= t6;68t048.goldChecker.println("t5 = " + t5);69t048.goldChecker.println("t4 = " + t4);70t4 /= t5;71t3 /= t4;72t2 /= t3;73t1 /= t2;7475t048.goldChecker.println("t1 == " + t1);76z = idiv77(78idiv(a,b),79idiv80(81idiv(c,d),82idiv83(84idiv(e,f),85idiv86(87idiv(g,h),88idiv89(90idiv(i,j),91idiv(k, l)92)93)94)95)96);97z = (a/b) /98((c/d) /99((e/f) /100((g/h) /101((i/j) / (k/l)))));102t048.goldChecker.println("Int: " + z);103}104105static void longDivs()106{107long a, b, c, d, e, f, g, h, i, j, k, l, z;108109a=13; b=12; c=11; d=10; e=9; f=8; g=7; h=6; i=5; j=4; k=3; l=2;110111z = (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / (k/l)))));112t048.goldChecker.println("Long: " + z);113}114115static void floatDivs()116{117float a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, z;118119a=1; b=2; c=3; d=4; e=5; f=6; g=7; h=8; i=9; j=10; k=11; l=12;120m=13; n=14; o=15; p=16; q=17; r=18; s=19; t=20;121z = (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /122((o/p) / ((q/r) / (s/t)))))))));123t048.goldChecker.println("Float: " + z);124z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /125((o/p) / ((q/r) / (s/t)))))))));126t048.goldChecker.println("Float: " + z);127z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /128((o/p) / ((q/r) / (s/t)))))))));129t048.goldChecker.println("Float: " + z);130z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /131((o/p) / ((q/r) / (s/t)))))))));132t048.goldChecker.println("Float: " + z);133z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /134((o/p) / ((q/r) / (s/t)))))))));135t048.goldChecker.println("Float: " + z);136z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /137((o/p) / ((q/r) / (s/t)))))))));138t048.goldChecker.println("Float: " + z);139z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /140((o/p) / ((q/r) / (s/t)))))))));141t048.goldChecker.println("Float: " + z);142z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /143((o/p) / ((q/r) / (s/t)))))))));144t048.goldChecker.println("Float: " + z);145z /= (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /146((o/p) / ((q/r) / (s/t)))))))));147t048.goldChecker.println("Float: " + z);148}149150static void doubleDivs()151{152double a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, z;153154a=1; b=2; c=3; d=4; e=5; f=6; g=7; h=8; i=9; j=10; k=11; l=12;155m=13; n=14; o=15; p=16; q=17; r=18; s=19; t=20;156z = (a/b) / ((c/d) / ((e/f) / ((g/h) / ((i/j) / ((k/l) / ((m/n) /157((o/p) / ((q/r) / (s/t)))))))));158t048.goldChecker.println("Double: " + z);159}160161public static void main(String argv[])162{163intDivs();164longDivs();165floatDivs();166doubleDivs();167t048.goldChecker.check();168}169}170171172