Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/t/t040/t040.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/t040.27* VM Testbase keywords: [jit, quick]28*29* @library /vmTestbase30* /test/lib31* @run main/othervm jit.t.t040.t04032*/3334package jit.t.t040;3536import nsk.share.TestFailure;37import nsk.share.GoldChecker;383940// opc_multianewarray4142public class t04043{44public static final GoldChecker goldChecker = new GoldChecker( "t040" );4546private static int id(int i)47{48return i;49}50private static double sqrt(double x)51{52double q;53double qsquared;54if(x == 0.0)55return 0.0;56q = x;57for(int i=0; i<6; i+=1)58{59qsquared = q * q;60q += (x - qsquared) / (2.0 * q);61}62return q;63}6465private static double abs(double x)66{67return x >= 0.0 ? x : -x;68}6970public static void main(String argv[])71{72int c[][][] = null;7374c = new int[id(2)][id(2)][id(2)];75for(int i1=id(0); i1<id(2); i1+=id(1))76{77for(int j1=id(0); j1<id(2); j1+=id(1))78{79for(int i2=id(0); i2<id(2); i2+=id(1))80{81for(int j2=id(0); j2<id(2); j2+=id(1))82{83for(int i3=id(0); i3<id(2); i3+=id(1))84{85for(int j3=id(0); j3<id(2); j3+=id(1))86{87double d;88int d1,d2,d3;89t040.goldChecker.print(i1 + "," + i2 + "," + i3 + " <-> ");90t040.goldChecker.print(j1 + "," + j2 + "," + j3 +": ");91d1 = j1 - i1;92d2 = j2 - i2;93d3 = j3 - i3;94d = sqrt(d1*d1 + d2*d2 + d3*d3);95t040.goldChecker.println(d);96}97}98}99}100}101}102t040.goldChecker.check();103}104}105106107