OpenJDK / valhalla / valhalla10-old / hotspot
changeset 7440:2d697acc4e03
8062854: move compiler jtreg test to corresponding subfolders and use those in TEST.groups
Summary: move all test from <bug_id> directories to <functional_dir_name>/<bug_id>; update TEST.groups to execute more tests
Reviewed-by: drchase, kvn
line wrap: on
line diff
--- a/test/TEST.groups Mon Nov 17 23:11:40 2014 +0000 +++ b/test/TEST.groups Tue Nov 18 19:44:45 2014 +0100 @@ -107,8 +107,8 @@ # Tests that require the full JRE # needs_jre = \ - compiler/6852078/Test6852078.java \ - compiler/7047069/Test7047069.java \ + compiler/c2/6852078/Test6852078.java \ + compiler/c2/7047069/Test7047069.java \ runtime/6294277/SourceDebugExtension.java \ runtime/ClassFile/JsrRewriting.java \ runtime/ClassFile/OomWhileParsingRepeatedJsr.java @@ -325,245 +325,84 @@ sanity/ hotspot_compiler_1 = \ - compiler/5057225/Test5057225.java \ - compiler/5091921/Test5091921.java \ - compiler/5091921/Test6186134.java \ - compiler/5091921/Test6196102.java \ - compiler/5091921/Test6357214.java \ - compiler/5091921/Test6559156.java \ - compiler/5091921/Test6753639.java \ - compiler/5091921/Test6935022.java \ - compiler/5091921/Test6959129.java \ - compiler/5091921/Test6985295.java \ - compiler/5091921/Test6992759.java \ - compiler/5091921/Test7005594.java \ - compiler/5091921/Test7020614.java \ - compiler/6378821/Test6378821.java \ - compiler/6431242/Test.java \ - compiler/6443505/Test6443505.java \ - compiler/6478991/NullCheckTest.java \ - compiler/6539464/Test.java \ - compiler/6579789/Test6579789.java \ - compiler/6636138/ \ - compiler/6646019/Test.java \ - compiler/6659207/Test.java \ - compiler/6661247/Test.java \ - compiler/6663621/IVTest.java \ - compiler/6689060/Test.java \ - compiler/6695810/Test.java \ - compiler/6700047/Test6700047.java \ - compiler/6711100/Test.java \ - compiler/6724218/Test.java \ - compiler/6732154/Test6732154.java \ - compiler/6758234/Test6758234.java \ - compiler/6769124/ \ - compiler/6772683/InterruptedTest.java \ - compiler/6778657/Test.java \ - compiler/6795161/Test.java \ - compiler/6795362/Test6795362.java \ - compiler/6795465/Test6795465.java \ - compiler/6796786/Test6796786.java \ - compiler/6799693/Test.java \ - compiler/6805724/Test6805724.java \ - compiler/6814842/Test6814842.java \ - compiler/6823453/Test.java \ - compiler/6833129/Test.java \ - compiler/6837011/Test6837011.java \ - compiler/6843752/Test.java \ - compiler/6849574/Test.java \ - compiler/6855164/Test.java \ - compiler/6855215/Test6855215.java \ - compiler/6857159/Test6857159.java \ - compiler/6860469/Test.java \ - compiler/6863155/Test6863155.java \ - compiler/6863420/Test.java \ - compiler/6865265/StackOverflowBug.java \ - compiler/6879902/Test6879902.java \ - compiler/6880034/Test6880034.java \ - compiler/6891750/Test6891750.java \ - compiler/6892265/Test.java \ - compiler/6894807/IsInstanceTest.java \ - compiler/6901572/Test.java \ - compiler/6909839/Test6909839.java \ - compiler/6910484/Test.java \ - compiler/6910605/Test.java \ - compiler/6910618/Test.java \ - compiler/6916644/Test6916644.java \ - compiler/6921969/TestMultiplyLongHiZero.java \ - compiler/6930043/Test6930043.java \ - compiler/6932496/Test6932496.java \ - compiler/6956668/Test6956668.java \ - compiler/6968348/Test6968348.java \ - compiler/6973329/Test.java - + compiler/arraycopy/ \ + compiler/c1/ \ + compiler/c2/ \ + -compiler/c2/5091921/Test6850611.java \ + -compiler/c2/5091921/Test6890943.java \ + -compiler/c2/5091921/Test6905845.java \ + -compiler/c2/6340864 \ + -compiler/c2/6589834 \ + -compiler/c2/6603011 \ + -compiler/c2/6912517 \ + -compiler/c2/6792161 \ + -compiler/c2/7070134 \ + -compiler/c2/8004867 + hotspot_compiler_2 = \ - compiler/6982370/Test6982370.java \ - compiler/7009231/Test7009231.java \ - compiler/7009359/Test7009359.java \ - compiler/7017746/Test.java \ - compiler/7024475/Test7024475.java \ - compiler/7041100/Test7041100.java \ - compiler/7044738/Test7044738.java \ - compiler/7046096/Test7046096.java \ - compiler/7048332/Test7048332.java \ - compiler/7068051/Test7068051.java \ - compiler/7082949/Test7082949.java \ - compiler/7088020/Test7088020.java \ - compiler/7090976/Test7090976.java \ - compiler/7103261/Test7103261.java \ - compiler/7110586/Test7110586.java \ - compiler/7119644/ \ - compiler/7141637/SpreadNullArg.java \ - compiler/7169782/Test7169782.java \ - compiler/7174363/Test7174363.java \ - compiler/7179138/ \ - compiler/7190310/ \ - compiler/7192963/ \ - compiler/7200264/TestIntVect.java \ - compiler/8000805/Test8000805.java \ - compiler/8002069/Test8002069.java \ - compiler/8004741/Test8004741.java \ - compiler/8005033/Test8005033.java \ - compiler/8005419/Test8005419.java \ - compiler/8005956/PolynomialRoot.java \ - compiler/8007294/Test8007294.java \ - compiler/EliminateAutoBox/UnsignedLoads.java - + compiler/classUnloading/ \ + compiler/codecache/ \ + compiler/codegen/ \ + compiler/cpuflags/ \ + compiler/eliminateAutobox/ \ + compiler/escapeAnalysis/ \ + compiler/exceptions/ \ + compiler/floatingpoint/ \ + compiler/gcbarriers/ \ + compiler/inlining/ \ + compiler/integerArithmetic/ \ + compiler/interpreter/ \ + -compiler/codegen/7184394 + hotspot_compiler_3 = \ - compiler/8007722/Test8007722.java \ - compiler/8009761/Test8009761.java \ - compiler/8010927/Test8010927.java \ - compiler/8011706/Test8011706.java \ - compiler/8011771/Test8011771.java \ - compiler/8011901/Test8011901.java \ - compiler/arraycopy/TestMissingControl.java \ - compiler/ciReplay/TestVM_no_comp_level.sh \ - compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java \ - compiler/codecache/CheckSegmentedCodeCache.java \ - compiler/codecache/CheckUpperLimit.java \ - compiler/codegen/ \ - compiler/cpuflags/RestoreMXCSR.java \ - compiler/EscapeAnalysis/ \ - compiler/exceptions/ \ - compiler/floatingpoint/ModNaN.java \ - compiler/gcbarriers/G1CrashTest.java \ - compiler/inlining/ \ - compiler/IntegerArithmetic/TestIntegerComparison.java \ - compiler/intrinsics/bmi/TestAndnI.java \ - compiler/intrinsics/bmi/TestAndnI.java \ - compiler/intrinsics/bmi/TestAndnL.java \ - compiler/intrinsics/bmi/TestBlsiI.java \ - compiler/intrinsics/bmi/TestBlsiL.java \ - compiler/intrinsics/bmi/TestBlsmskI.java \ - compiler/intrinsics/bmi/TestBlsmskL.java \ - compiler/intrinsics/bmi/TestBlsrI.java \ - compiler/intrinsics/bmi/TestBlsrL.java \ - compiler/intrinsics/bmi/TestLzcntI.java \ - compiler/intrinsics/bmi/TestLzcntL.java \ - compiler/intrinsics/bmi/TestTzcntI.java \ - compiler/intrinsics/bmi/TestTzcntL.java \ - compiler/intrinsics/clone/TestObjectClone.java \ - compiler/intrinsics/hashcode/TestHashCode.java \ - compiler/intrinsics/mathexact/CompareTest.java \ - compiler/intrinsics/mathexact/GVNTest.java \ - compiler/intrinsics/mathexact/NegExactILoadTest.java \ - compiler/intrinsics/mathexact/NegExactILoopDependentTest.java \ - compiler/intrinsics/mathexact/NegExactINonConstantTest.java \ - compiler/intrinsics/mathexact/SubExactICondTest.java \ - compiler/intrinsics/mathexact/SubExactILoadTest.java \ - compiler/intrinsics/mathexact/SubExactILoopDependentTest.java \ - compiler/intrinsics/stringequals/TestStringEqualsBadLength.java \ - compiler/intrinsics/unsafe/UnsafeGetAddressTest.java \ - compiler/intrinsics/classcast/NullCheckDroppingsTest.java \ - compiler/jsr292/ConcurrentClassLoadingTest.java \ - compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java \ - compiler/loopopts/TestLogSum.java \ - compiler/macronodes/TestEliminateAllocationPhi.java \ - compiler/membars/TestMemBarAcquire.java \ - compiler/osr/TestOSRWithNonEmptyStack.java \ - compiler/profiling/TestMethodHandleInvokesIntrinsic.java \ - compiler/profiling/TestSpecTrapClassUnloading.java \ - compiler/profiling/TestUnexpectedProfilingMismatch.java \ - compiler/regalloc/C1ObjectSpillInLogicOp.java \ - compiler/startup/NumCompilerThreadsCheck.java \ - compiler/startup/SmallCodeCacheStartup.java \ - compiler/types/TestSpeculationFailedHigherEqual.java \ - compiler/types/TypeSpeculation.java \ - compiler/uncommontrap/StackOverflowGuardPagesOff.java \ - compiler/uncommontrap/TestStackBangMonitorOwned.java \ - compiler/uncommontrap/TestStackBangRbp.java \ - compiler/unsafe/GetUnsafeObjectG1PreBarrier.java - + compiler/intrinsics/ \ + compiler/jsr292/ \ + compiler/loopopts/ \ + compiler/macronodes/ \ + compiler/osr/ \ + compiler/regalloc/ \ + compiler/runtime/ \ + compiler/startup/ \ + compiler/types/ \ + compiler/uncommontrap/ \ + compiler/unsafe/ \ + -compiler/intrinsics/bmi/verifycode \ + -compiler/intrinsics/mathexact \ + -compiler/intrinsics/multiplytolen \ + -compiler/intrinsics/sha \ + -compiler/loopopts/7052494 \ + -compiler/runtime/6826736 hotspot_compiler_closed = \ - closed/compiler/4292742/Test.java \ - closed/compiler/4474154/Test4474154.java \ - closed/compiler/4482613/Test4482613.java \ - closed/compiler/4490177/tctest.java \ - closed/compiler/4495990/Application.java \ - closed/compiler/4522874/Test4522874.sh \ - closed/compiler/4629512/Test4629512.java \ - closed/compiler/4647299/Looper.java \ - closed/compiler/4655758/TestClass.java \ - closed/compiler/4671453/LongCompTest.java \ - closed/compiler/4671460/CharArrTest.java \ - closed/compiler/4709105/StringTest2.java \ - closed/compiler/4732721/Bug.java \ - closed/compiler/4750681/ReadTest.java \ - closed/compiler/4787943/LongCrash.java \ - closed/compiler/4819903/Base64Test.java \ - closed/compiler/4903383/Test.java \ - closed/compiler/4906393/Test.java \ - closed/compiler/4907999/Uidtest.java \ - closed/compiler/4917709/Tester.java \ - closed/compiler/4957832/Test.java \ - closed/compiler/4965430/LoopTest.java \ - closed/compiler/4979449/T4979449.java \ - closed/compiler/5031274/Test.java \ - closed/compiler/5043395/T5043395.java \ - closed/compiler/5049410/Test.java \ - closed/compiler/5098422/Test.java \ - closed/compiler/6173783/Test.java \ - closed/compiler/6272923/Test6272923.sh \ - closed/compiler/6290963/Test.java \ - closed/compiler/6305546/Test.java \ - closed/compiler/6309806/Test.java \ - closed/compiler/6311859/Test.java \ - closed/compiler/6321689/Test.java \ - closed/compiler/6326935/Test.java \ - closed/compiler/6367889/Test.java \ - closed/compiler/6371167/Test.java \ - closed/compiler/6389127/Test.java \ - closed/compiler/6397650/Test.java \ - closed/compiler/6414932/Test.java \ - closed/compiler/6421619/Test_6421619.java \ - closed/compiler/6427750/UnsafeVolatile.java \ - closed/compiler/6431243/Test.java \ - closed/compiler/6433572/TestSyncJSR.java \ - closed/compiler/6433840/clinit.java \ - closed/compiler/6457854/Test.java \ - closed/compiler/6476804/Test.java \ - closed/compiler/6512111/CorruptFinalLong.java \ - closed/compiler/6551887/Test.java \ - closed/compiler/6571539/Test.java \ - closed/compiler/6587132/Test.java \ - closed/compiler/6588045/Test.java \ - closed/compiler/6588598/etype.java \ - closed/compiler/6661918/Test6661918.java \ - closed/compiler/6707044/Test.java \ - closed/compiler/6730716/Test.java \ - closed/compiler/6772368/Test6772368.sh \ - closed/compiler/6897150/Test6897150.java \ - closed/compiler/6931567/Test6931567.java \ - closed/compiler/7196857/Test7196857.java \ - closed/compiler/8009699/Test8009699.java \ - closed/compiler/8009699/Test8009699B.java \ - closed/compiler/8014811/Test8014811.java \ - closed/compiler/8029507/InvokePrivate.java \ - closed/compiler/callingConvention/Arg9Double.java \ - closed/compiler/deoptimization/DeoptArithmetic.java \ - closed/compiler/deoptimization/TestDoubleLocals.java \ - closed/compiler/deoptimization/TestDoubleMerge.java + closed/compiler/c1/ \ + closed/compiler/c2/ \ + closed/compiler/codegen/ \ + closed/compiler/escapeAnalysis/ \ + closed/compiler/interpreter/ \ + closed/compiler/jsr292/ \ + closed/compiler/loopopts/ \ + closed/compiler/oracle/ \ + closed/compiler/runtime/ \ + closed/compiler/symantec/ \ + -closed/compiler/c1/4477197 \ + -closed/compiler/c1/5040872 \ + -closed/compiler/c1/6507107 \ + -closed/compiler/c2/4344895 \ + -closed/compiler/c2/4485006 \ + -closed/compiler/c2/4523683 \ + -closed/compiler/c2/4620290 \ + -closed/compiler/c2/4998314 \ + -closed/compiler/c2/6329104 \ + -closed/compiler/c2/6434117 \ + -closed/compiler/c2/6547163 \ + -closed/compiler/c2/6563987 \ + -closed/compiler/c2/6595044 \ + -closed/compiler/codegen/6440479 \ + -closed/compiler/codegen/6603011 \ + -closed/compiler/interpreter/5034475 \ + -closed/compiler/jsr292/LongLambdaFormDynamicStackDepth.java \ + -closed/compiler/loopopts/4463485 \ + -closed/compiler/loopopts/8021898 hotspot_gc = \ sanity/ExecuteInternalVMTests.java @@ -609,4 +448,4 @@ # not_needs_nashorn = \ :jdk \ - -:needs_nashorh + -:needs_nashorn
--- a/test/compiler/5057225/Test5057225.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test - * @bug 5057225 - * @summary Remove useless I2L conversions - * - * @run main/othervm -Xcomp -XX:CompileOnly=Test5057225.doload Test5057225 - */ - -import java.net.URLClassLoader; - -public class Test5057225 { - static byte[] ba = new byte[] { -1 }; - static short[] sa = new short[] { -1 }; - static int[] ia = new int[] { -1 }; - - static final long[] BYTE_MASKS = { - 0x0FL, - 0x7FL, // 7-bit - 0xFFL, - }; - - static final long[] SHORT_MASKS = { - 0x000FL, - 0x007FL, // 7-bit - 0x00FFL, - 0x0FFFL, - 0x3FFFL, // 14-bit - 0x7FFFL, // 15-bit - 0xFFFFL, - }; - - static final long[] INT_MASKS = { - 0x0000000FL, - 0x0000007FL, // 7-bit - 0x000000FFL, - 0x00000FFFL, - 0x00003FFFL, // 14-bit - 0x00007FFFL, // 15-bit - 0x0000FFFFL, - 0x00FFFFFFL, - 0x7FFFFFFFL, // 31-bit - 0xFFFFFFFFL, - }; - - public static void main(String[] args) throws Exception { - for (int i = 0; i < BYTE_MASKS.length; i++) { - System.setProperty("value", "" + BYTE_MASKS[i]); - loadAndRunClass("Test5057225$loadUB2L"); - } - - for (int i = 0; i < SHORT_MASKS.length; i++) { - System.setProperty("value", "" + SHORT_MASKS[i]); - loadAndRunClass("Test5057225$loadUS2L"); - } - - for (int i = 0; i < INT_MASKS.length; i++) { - System.setProperty("value", "" + INT_MASKS[i]); - loadAndRunClass("Test5057225$loadUI2L"); - } - } - - static void check(long result, long expected) { - if (result != expected) - throw new InternalError(result + " != " + expected); - } - - static void loadAndRunClass(String classname) throws Exception { - Class cl = Class.forName(classname); - URLClassLoader apploader = (URLClassLoader) cl.getClassLoader(); - ClassLoader loader = new URLClassLoader(apploader.getURLs(), apploader.getParent()); - Class c = loader.loadClass(classname); - Runnable r = (Runnable) c.newInstance(); - r.run(); - } - - public static class loadUB2L implements Runnable { - static final long MASK; - static { - long value = 0; - try { - value = Long.decode(System.getProperty("value")); - } catch (Throwable e) {} - MASK = value; - } - - public void run() { check(doload(ba), MASK); } - static long doload(byte[] ba) { return ba[0] & MASK; } - } - - public static class loadUS2L implements Runnable { - static final long MASK; - static { - long value = 0; - try { - value = Long.decode(System.getProperty("value")); - } catch (Throwable e) {} - MASK = value; - } - - public void run() { check(doload(sa), MASK); } - static long doload(short[] sa) { return sa[0] & MASK; } - } - - public static class loadUI2L implements Runnable { - static final long MASK; - static { - long value = 0; - try { - value = Long.decode(System.getProperty("value")); - } catch (Throwable e) {} - MASK = value; - } - - public void run() { check(doload(ia), MASK); } - static long doload(int[] ia) { return ia[0] & MASK; } - } -}
--- a/test/compiler/5091921/Test5091921.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2011 Hewlett-Packard Company. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 5091921 - * @summary Sign flip issues in loop optimizer - * - * @run main/othervm -Xcomp -XX:CompileOnly=Test5091921 -XX:MaxInlineSize=1 Test5091921 - */ - -public class Test5091921 { - private static int result = 0; - - - /* Test for the bug of transforming indx >= MININT to indx > MININT-1 */ - public static int test_ge1(int limit) { - int indx; - int sum = 0; - for (indx = 500; indx >= limit; indx -= 2) { - sum += 2000 / indx; - result = sum; - } - return sum; - } - - /* Test for the bug of transforming indx <= MAXINT to indx < MAXINT+1 */ - public static int test_le1(int limit) { - int indx; - int sum = 0; - for (indx = -500; indx <= limit; indx += 2) - { - sum += 3000 / indx; - result = sum; - } - return sum; - } - - /* Run with -Xcomp -XX:CompileOnly=wrap1.test1 -XX:MaxInlineSize=1 */ - /* limit reset to ((limit-init+stride-1)/stride)*stride+init */ - /* Calculation may overflow */ - public static volatile int c = 1; - public static int test_wrap1(int limit) - { - int indx; - int sum = 0; - for (indx = 0xffffffff; indx < limit; indx += 0x20000000) - { - sum += c; - } - return sum; - } - - /* Test for range check elimination with bit flip issue for - scale*i+offset<limit where offset is not 0 */ - static int[] box5 = {1,2,3,4,5,6,7,8,9}; - public static int test_rce5(int[] b, int limit) - { - int indx; - int sum = b[1]; - result = sum; - for (indx = 0x80000000; indx < limit; ++indx) - { - if (indx > 0x80000000) - { - // this test is not issued in pre-loop but issued in main loop - // trick rce into thinking expression is false when indx >= 0 - // in fact it is false when indx==0x80000001 - if (indx - 9 < -9) - { - sum += indx; - result = sum; - sum ^= b[indx & 7]; - result = sum; - } - else - break; - } - else - { - sum += b[indx & 3]; - result = sum; - } - } - return sum; - } - - /* Test for range check elimination with bit flip issue for - scale*i<limit where scale > 1 */ - static int[] box6 = {1,2,3,4,5,6,7,8,9}; - public static int test_rce6(int[] b, int limit) - { - int indx; - int sum = b[1]; - result = sum; - for (indx = 0x80000000; indx < limit; ++indx) - { - if (indx > 0x80000000) - { - // harmless rce target - if (indx < 0) - { - sum += result; - result = sum; - } - else - break; - // this test is not issued in pre-loop but issued in main loop - // trick rce into thinking expression is false when indx >= 0 - // in fact it is false when indx==0x80000001 - // In compilers that transform mulI to shiftI may mask this issue. - if (indx * 28 + 1 < 0) - { - sum += indx; - result = sum; - sum ^= b[indx & 7]; - result = sum; - } - else - break; - } - else - { - sum += b[indx & 3]; - result = sum; - } - } - return sum; - } - - /* Test for range check elimination with i <= limit */ - static int[] box7 = {1,2,3,4,5,6,7,8,9,0x7fffffff}; - public static int test_rce7(int[] b) - { - int indx; - int max = b[9]; - int sum = b[7]; - result = sum; - for (indx = 0; indx < b.length; ++indx) - { - if (indx <= max) - { - sum += (indx ^ 15) + ((result != 0) ? 0 : sum); - result = sum; - } - else - throw new RuntimeException(); - } - for (indx = -7; indx < b.length; ++indx) - { - if (indx <= 9) - { - sum += (sum ^ 15) + ((result != 0) ? 0 : sum); - result = sum; - } - else - throw new RuntimeException(); - } - return sum; - } - - /* Test for range check elimination with i >= limit */ - static int[] box8 = {-1,0,1,2,3,4,5,6,7,8,0x80000000}; - public static int test_rce8(int[] b) - { - int indx; - int sum = b[5]; - int min = b[10]; - result = sum; - for (indx = b.length-1; indx >= 0; --indx) - { - if (indx >= min) - { - sum += (sum ^ 9) + ((result != 0) ? 0 :sum); - result = sum; - } - else - throw new RuntimeException(); - } - return sum; - } - - public static void main(String[] args) - { - result=1; - int r = 0; - try { - r = test_ge1(0x80000000); - System.out.println(result); - System.out.println("test_ge1 FAILED"); - System.exit(1); - } - catch (ArithmeticException e1) { - System.out.println("test_ge1: Expected exception caught"); - if (result != 5986) { - System.out.println(result); - System.out.println("test_ge1 FAILED"); - System.exit(97); - } - } - System.out.println("test_ge1 WORKED"); - - result=0; - try - { - r = test_le1(0x7fffffff); - System.out.println(result); - System.out.println("test_le1 FAILED"); - System.exit(1); - } - catch (ArithmeticException e1) - { - System.out.println("test_le1: Expected exception caught"); - if (result != -9039) - { - System.out.println(result); - System.out.println("test_le1 FAILED"); - System.exit(97); - } - } - System.out.println("test_le1 WORKED"); - - result=0; - r = test_wrap1(0x7fffffff); - if (r != 4) - { - System.out.println(result); - System.out.println("test_wrap1 FAILED"); - System.exit(97); - } - else - { - System.out.println("test_wrap1 WORKED"); - } - - result=0; - r = test_rce5(box5,0x80000100); - if (result != 3) - { - System.out.println(result); - System.out.println("test_rce5 FAILED"); - System.exit(97); - } - else - { - System.out.println("test_rce5 WORKED"); - } - - result=0; - r = test_rce6(box6,0x80000100); - if (result != 6) - { - System.out.println(result); - System.out.println("test_rce6 FAILED"); - System.exit(97); - } - else - { - System.out.println("test_rce6 WORKED"); - } - - result=0; - r = test_rce7(box7); - if (result != 14680079) - { - System.out.println(result); - System.out.println("test_rce7 FAILED"); - System.exit(97); - } - else - { - System.out.println("test_rce7 WORKED"); - } - - result=0; - r = test_rce8(box8); - if (result != 16393) - { - System.out.println(result); - System.out.println("test_rce8 FAILED"); - System.exit(97); - } - else - { - System.out.println("test_rce8 WORKED"); - } - } -}
--- a/test/compiler/5091921/Test6186134.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6186134 - * @summary Server virtual machine produces/exeutes incorrect code. - * - * @run main Test6186134 100000 - */ -import java.util.ArrayList; - -public class Test6186134 { - - int num = 0; - - public Test6186134(int n) { - num = n; - } - - public boolean more() { - return num-- > 0; - } - - public ArrayList test1() { - ArrayList res = new ArrayList(); - int maxResults = Integer.MAX_VALUE; - int n = 0; - boolean more = more(); - while ((n++ < maxResults) && more) { - res.add(new Object()); - more = more(); - } - return res; - } - - public static void main(String[] pars) { - int n = Integer.parseInt(pars[0]); - for (int i=0; i<n; i++) { - Test6186134 t = new Test6186134(10); - int size = t.test1().size(); - if (size != 10) { - System.out.println("wrong size: " + size +", should be 10"); - System.exit(97); - } - } - System.out.println("Passed"); - } -} -
--- a/test/compiler/5091921/Test6196102.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6196102 - * @summary Integer seems to be greater than Integer.MAX_VALUE - * - * @run main Test6196102 - */ - -public class Test6196102 { - static public void main(String[] args) { - int i1 = 0; - int i2 = Integer.MAX_VALUE; - - while (i1 >= 0) { - i1++; - if (i1 > i2) { - System.out.println("E R R O R: " + i1); - System.exit(97); - } - } - } -} -
--- a/test/compiler/5091921/Test6357214.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,179 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6357214 - * @summary Hotspot server compiler gets integer comparison wrong - * - * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 Test6357214 - */ - -// The test hangs after few iterations before the fix. So it fails if timeout. -class MyResult { - public boolean next() { - return true; - } - - public String getString(String in) { - if (in.equals("id")) - return "idFoo"; - if (in.equals("contentKey")) - return "ckFoo"; - return "Foo"; - } - - public int getInt(String in) { - if (in.equals("processingComplete")) - return 0; - return 1; - } - - public byte[] getBytes(String in) { - byte[] arr = null; - if (in.equals("content")) { - arr = new byte[65536]; - byte j = 32; - for (int i=0; i<65536; i++) { - arr[i] = j; - if (++j == 127) - j=32; - } - } - return arr; - } -} - -public class Test6357214 { - public static volatile boolean bollocks = true; - public String create(String context) throws Exception { - - // - // Extract HTTP parameters - // - - boolean showAll = System.getProperty("showAll") != null; - String eventID = System.getProperty("eventID"); - String eventContentKey = System.getProperty("cKey"); - // - // Build ContentStaging query based on eventID or eventContentKey - // - - String sql = "select id, processingComplete, contentKey, content " - + "from ContentStaging cs, ContentStagingKey csk " - + "where cs.eventContentKey = csk.eventContentKey "; - - if (eventID != null) { - sql += "and id = " + eventID; - } - else if (eventContentKey != null) { - sql += "and cs.eventContentKey = '" - + eventContentKey - + "' having id = max(id)"; - } - else { - throw new Exception("Need eventID or eventContentKey"); - } - - // - // This factory builds a static panel, there is no JSP - // - - StringBuffer html = new StringBuffer(); - - try { - - MyResult result = new MyResult(); - if (result.next()) { - - eventID = result.getString("id"); - int processingComplete = result.getInt("processingComplete"); - String contentKey = result.getString("contentKey"); - byte[] bytes = result.getBytes("content"); - - // - // Print content status and associated controls - // - - html.append("<br/><font class=\"small\">"); - html.append("Status: "); - switch (processingComplete) { - case 0 : - case 1 : html.append("PENDING"); break; - case 2 : html.append(contentKey); break; - case 3 : html.append(eventID); break; - default : html.append("UNKNONW"); - } - html.append("</font><br/>"); - - // - // Print at most 20Kb of content unless "showAll" is set - // - - int limit = showAll ? Integer.MAX_VALUE : 1024 * 20; - System.out.println(limit); - html.append("<pre>"); - for (int i = 0; bytes != null && i < bytes.length; i++) { - char c = (char) bytes[i]; - switch (c) { - case '<' : html.append("<"); break; - case '>' : html.append(">"); break; - case '&' : html.append("&"); break; - default : html.append(c); - } - - if (i > limit) { - while (bollocks); - // System.out.println("i is " + i); - // System.out.println("limit is " + limit); - html.append("...\n</pre>"); - html.append(eventID); - html.append("<pre>"); - break; - } - } - html.append("</pre>"); - } - } - catch (Exception exception) { - throw exception; - } - finally { - html.append("Oof!!"); - } - String ret = html.toString(); - System.out.println("Returning string length = "+ ret.length()); - return ret; - } - - public static void main(String[] args) throws Exception { - int length=0; - - for (int i = 0; i < 100; i++) { - length = new Test6357214().create("boo").length(); - System.out.println(length); - } - } -} -
--- a/test/compiler/5091921/Test6559156.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6559156 - * @summary Server compiler generates bad code for "<= Integer.MAX_VALUE" expression - * - * @run main Test6559156 - */ - -public class Test6559156 { - - static final int N_TESTS = 1000000; - - public static void main(String[] args) throws Exception { - - /* - * If MAX_VALUE is changed to MAX_VALUE - 1 below, the test passes - * because (apparently) bad code is only generated when comparing - * <= MAX_VALUE in the doTest method. - */ - Test6559156 test = new Test6559156(); - for (int i = 0; i < N_TESTS; i += 1) { - test.doTest1(10, Integer.MAX_VALUE, i); - test.doTest2(10, Integer.MAX_VALUE, i); - } - System.out.println("No failure"); - } - - void doTest1(int expected, int max, int i) { - int counted; - for (counted = 0; - (counted <= max) && (counted < expected); - counted += 1) { - } - if (counted != expected) { - throw new RuntimeException("Failed test1 iteration=" + i + - " max=" + max + - " counted=" + counted + - " expected=" + expected); - } - } - - void doTest2(int expected, int max, int i) { - int counted; - for (counted = 0; - // change test sequence. - (counted < expected) && (counted <= max); - counted += 1) { - } - if (counted != expected) { - throw new RuntimeException("Failed test1 iteration=" + i + - " max=" + max + - " counted=" + counted + - " expected=" + expected); - } - } -} -
--- a/test/compiler/5091921/Test6753639.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6753639 - * @summary Strange optimisation in for loop with cyclic integer condition - * - * @run main/othervm -Xbatch Test6753639 - */ - -public class Test6753639 { - public static void main(String[] args) throws InterruptedException { - int END = Integer.MAX_VALUE; - int count = 0; - for(int i = Integer.MAX_VALUE - 5; i <= END; i++) { - count++; - if (count > 100000) { - System.out.println("Passed"); - System.exit(95); - } - } - System.out.println("broken " + count); - System.out.println("FAILED"); - System.exit(97); - } -} - -
--- a/test/compiler/5091921/Test6850611.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6850611 - * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP) - * - * @run main/timeout=480 Test6850611 - */ - -public class Test6850611 { - - public static void main(String[] args) { - test(); - } - - private static void test() { - for (int j = 0; j < 5; ++j) { - long x = 0; - for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; ++i) { - x += i; - } - System.out.println("sum: " + x); - if (x != -4294967295l) { - System.out.println("FAILED"); - System.exit(97); - } - } - } -} -
--- a/test/compiler/5091921/Test6890943.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6890943 - * @summary JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode. - * - * @run main/othervm/timeout=240 Test6890943 - */ - -import java.io.*; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.Scanner; - -public class Test6890943 { - public static final boolean AIR = true, ROCK = false; - private static final Path PATH = Paths.get(System.getProperty("test.src", ".")); - private static final Path INPUT_FILE = PATH.resolve("input6890943.txt"); - private static final Path GOLDEN_FILE = PATH.resolve("output6890943.txt"); - - public static void main(String[] args) { - new Test6890943().go(); - } - - int r, c, f, t; - boolean[][] grid; - - public void go() { - Scanner in, golden; - try { - in = new Scanner(new FileInputStream(INPUT_FILE.toFile())); - golden = new Scanner(new FileInputStream(GOLDEN_FILE.toFile())); - } catch (FileNotFoundException e) { - throw new RuntimeException("TEST failure: can't open test file", e); - } - in.useDelimiter("\\s+"); - golden.useDelimiter("\\s+"); - - int T = in.nextInt(); - for (t = 0; t < T; t++) { - r = in.nextInt(); - c = in.nextInt(); - f = in.nextInt(); - grid = new boolean[r][c]; - for (int x = 0; x < r; x++) { - String line = in.next(); - for (int y = 0; y < c; y++) { - grid[x][y] = line.charAt(y) == '.'; - } - } - int digs = solve(); - String result = "Case #" + (t + 1) + ": " + (digs == -1 ? "No" : "Yes " + digs); - System.out.println(result); - // Compare with golden string from the file - String goldenStr = golden.nextLine(); - if (!result.equals(goldenStr)) { - System.err.println("FAIL: strings are not equal\n" - + "-- Result: " + result + "\n" - + "-- Golden: " + goldenStr); - throw new RuntimeException("FAIL: Result string is not equal to the golden"); - } - } - } - - Map<Integer, Integer> M = new HashMap<Integer, Integer>(); - - private int solve() { - M = new HashMap<Integer, Integer>(); - M.put(calcWalkingRange(0, 0), 0); - for (int digDown = 0; digDown < r; digDown++) { - Map<Integer, Integer> tries = new HashMap<Integer, Integer>(); - for (Map.Entry<Integer, Integer> m : M.entrySet()) { - int q = m.getKey(); - if (depth(q) != (digDown)) continue; - if (stuck(q)) continue; - tries.put(q, m.getValue()); - } - - for (Map.Entry<Integer, Integer> m : tries.entrySet()) { - int q = m.getKey(); - int fallLeftDelta = 0, fallRightDelta = 0; - //fall left - int fallLeft = fall(digDown, start(q)); - if (fallLeft > 0) { - fallLeftDelta = 1; - if (fallLeft <= f) addToM(calcWalkingRange(digDown + fallLeft, start(q)), m.getValue()); - } - - //fall right - int fallRight = fall(digDown, end(q)); - if (fallRight > 0) { - fallRightDelta = 1; - - if (fallRight <= f) addToM(calcWalkingRange(digDown + fallRight, end(q)), m.getValue()); - } - - for (int p = start(q) + fallLeftDelta; p <= end(q) - fallRightDelta; p++) { - //goLeft - for (int digSpot = p; digSpot > start(q) + fallLeftDelta; digSpot--) { - int fallDown = 1 + fall(digDown + 1, digSpot); - if (fallDown <= f) { - if (fallDown == 1) { - addToM(calcWalkingRange(digDown + 1, digSpot, digSpot, p), - m.getValue() + Math.abs(digSpot - p) + 1); - } else { - addToM(calcWalkingRange(digDown + fallDown, digSpot), - m.getValue() + Math.abs(digSpot - p) + 1); - } - } - } - - //goRight - for (int digSpot = p; digSpot < end(q) - fallRightDelta; digSpot++) { - int fallDown = 1 + fall(digDown + 1, digSpot); - if (fallDown <= f) { - if (fallDown == 1) { - addToM(calcWalkingRange(digDown + 1, digSpot, p, digSpot), - m.getValue() + Math.abs(digSpot - p) + 1); - } else { - addToM(calcWalkingRange(digDown + fallDown, digSpot), - m.getValue() + Math.abs(digSpot - p) + 1); - } - } - } - } - } - } - - int result = Integer.MAX_VALUE; - for (Map.Entry<Integer, Integer> m : M.entrySet()) { - if (depth(m.getKey()) == r - 1) result = Math.min(m.getValue(), result); - } - - if (result == Integer.MAX_VALUE) return -1; - return result; - } - - private void addToM(int q, int i) { - Integer original = M.get(q); - if (original == null) M.put(q, i); - else M.put(q, Math.min(original, i)); - } - - private int fall(int row, int column) { - int res = 0; - for (int p = row + 1; p < r; p++) { - if (grid[p][column] == AIR) res++; - else break; - } - return res; - } - - private boolean stuck(int q) { - return start(q) == end(q); - } - - private int depth(int q) { - return q % 50; - } - - private int start(int q) { - return q / (50 * 50); - } - - private int end(int q) { - return (q / 50) % 50; - } - - private int calcWalkingRange(int depth, int pos) { - return calcWalkingRange(depth, pos, Integer.MAX_VALUE, Integer.MIN_VALUE); - } - - private int calcWalkingRange(int depth, int pos, int airOverrideStart, int airOverrideEnd) { - int left = pos, right = pos; - if (depth >= r) return (c - 1) * 50 + depth; - - while (left > 0) { - if (grid[depth][left - 1] == ROCK && (left - 1 < airOverrideStart || left - 1 > airOverrideEnd)) break; - if (depth < r - 1 && grid[depth + 1][left - 1] == AIR) { - left--; - break; - } - left--; - } - while (right < c - 1) { - if (grid[depth][right + 1] == ROCK && (right + 1 < airOverrideStart || right + 1 > airOverrideEnd)) break; - if (depth < r - 1 && grid[depth + 1][right + 1] == AIR) { - right++; - break; - } - right++; - } - - return left * 50 * 50 + right * 50 + depth; - } -}
--- a/test/compiler/5091921/Test6897150.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6897150 - * @summary Hotspot optimises away a valid loop - * - * @run main Test6897150 - */ - -// Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. -public class Test6897150 { - public static void main(String[] args) { - // This works - loopAndPrint(Integer.MAX_VALUE -1); - // This doesn't - loopAndPrint(Integer.MAX_VALUE); - } - - static void verify(int max, int a) { - if ( a != (max - 1)) { - System.out.println("Expected: " + (max - 1)); - System.out.println("Actual : " + a); - System.exit(97); - } - } - static void loopAndPrint(int max) { - int a = -1; - int i = 1; - for (; i < max; i++) { - a = i; - } - verify(max, a); - } -} -
--- a/test/compiler/5091921/Test6905845.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6905845 - * @summary Server VM improperly optimizing away loop. - * - * @run main/timeout=480 Test6905845 - */ - -public class Test6905845 { - - public static void main(String[] args){ - for (int asdf = 0; asdf < 5; asdf++){ - //test block - { - StringBuilder strBuf1 = new StringBuilder(65); - long start = System.currentTimeMillis(); - int count = 0; - - for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ - strBuf1.append(i); - count++; - strBuf1.delete(0, 65); - } - - System.out.println(count); - if (count != 54366674) { - System.out.println("wrong count: " + count +", should be 54366674"); - System.exit(97); - } - } - //test block - { - StringBuilder strBuf1 = new StringBuilder(65); - long start = System.currentTimeMillis(); - int count = 0; - - for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ - strBuf1.append(i); - count++; - strBuf1.delete(0, 65); - } - - System.out.println(count); - if (count != 54366674) { - System.out.println("wrong count: " + count +", should be 54366674"); - System.exit(97); - } - } - } - } -} -
--- a/test/compiler/5091921/Test6931567.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6931567 - * @summary JIT Error (on class file compiled with eclipse) on JVM x64 (but not on x32!). - * - * @run main Test6931567 - */ - -// Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. -public class Test6931567 { - - public static void main(final String[] args) { - booleanInvert(Integer.MAX_VALUE); - booleanInvert(Integer.MAX_VALUE - 1); - } - - private static void booleanInvert(final int max) { - boolean test1 = false; - boolean test2 = false; - - for (int i = 0; i < max; i++) { - test1 = !test1; - } - - for (int i = 0; i < max; i++) { - test2 ^= true; - } - - if (test1 != test2) { - System.out.println("ERROR: Boolean invert\n\ttest1=" + test1 - + "\n\ttest2=" + test2); - System.exit(97); - } else { - System.out.println("Passed!"); - } - } -} -
--- a/test/compiler/5091921/Test6935022.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6935022 - * @summary Server VM incorrectly breaks out of while loop - * - * @run main Test6935022 - */ - -public class Test6935022 { - public static final void main(String[] args) throws Exception { - Test6935022 test = new Test6935022(); - - int cnt = 0; - - while (cnt < 10000) { - try { - ++cnt; - if ((cnt&1023) == 0) - System.out.println("Thread="+Thread.currentThread().getName() + " iteration: " + cnt); - test.loop(2147483647, (cnt&1023)); - } - - catch (Exception e) { - System.out.println("Caught on iteration " + cnt); - e.printStackTrace(); - System.exit(97); - } - } - } - - private void loop(int endingRow, int mask) throws Exception { - int rows = 1; - boolean next = true; - - while(rows <= endingRow && next) { - rows++; - if (rows == mask) - System.out.println("Rows="+rows+", end="+endingRow+", next="+next); - next = next(rows); - } - - if (next) - throw new Exception("Ended on rows(no rs): " + rows); - } - - private boolean next(int rows) { - return rows < 12; - } -} -
--- a/test/compiler/5091921/Test6959129.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6959129 - * @summary COMPARISON WITH INTEGER.MAX_INT DOES NOT WORK CORRECTLY IN THE CLIENT VM. - * - * @run main/othervm -ea Test6959129 - */ - -public class Test6959129 { - - public static void main(String[] args) { - long start = System.currentTimeMillis(); - int min = Integer.MAX_VALUE-30000; - int max = Integer.MAX_VALUE; - long maxmoves = 0; - try { - maxmoves = maxMoves(min, max); - } catch (AssertionError e) { - System.out.println("Passed"); - System.exit(95); - } - System.out.println("maxMove:" + maxmoves); - System.out.println("FAILED"); - System.exit(97); - } - /** - * Imperative implementation that returns the length hailstone moves - * for a given number. - */ - public static long hailstoneLengthImp(long n) { - long moves = 0; - while (n != 1) { - assert n > 1; - if (isEven(n)) { - n = n / 2; - } else { - n = 3 * n + 1; - } - ++moves; - } - return moves; - } - - private static boolean isEven(long n) { - return n % 2 == 0; - } - - /** - * Returns the maximum length of the hailstone sequence for numbers - * between min to max. - * - * For rec1 - Assume that min is bigger than max. - */ - public static long maxMoves(int min, int max) { - long maxmoves = 0; - for (int n = min; n <= max; n++) { - if ((n & 1023) == 0) System.out.println(n); - long moves = hailstoneLengthImp(n); - if (moves > maxmoves) { - maxmoves = moves; - } - } - return maxmoves; - } -} -
--- a/test/compiler/5091921/Test6985295.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6985295 - * @summary JVM fails to evaluate condition randomly - * - * @run main/othervm -Xbatch Test6985295 - */ - -public class Test6985295 { - - public static void main(String[] args) { - int min = Integer.MAX_VALUE-50000; - int max = Integer.MAX_VALUE; - System.out.println("max = " + max); - long counter = 0; - int i; - for(i = min; i <= max; i++) { - counter++; - if (counter > 1000000) { - System.out.println("Passed"); - System.exit(95); - } - } - System.out.println("iteration went " + counter + " times (" + i + ")"); - System.out.println("FAILED"); - System.exit(97); - } -} -
--- a/test/compiler/5091921/Test6992759.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6992759 - * @summary Bad code generated for integer <= comparison, fails for Integer.MAX_VALUE - * - * @run main/timeout=240 Test6992759 - */ - -public class Test6992759 { - - static final int N_TESTS = 1000000000; - - public static void main(String[] args) throws Exception { - - /* - * If MAX_VALUE is changed to MAX_VALUE - 1 below, the test passes - * because (apparently) bad code is only generated when comparing - * <= MAX_VALUE in the doTest method. - */ - Test6992759 test = new Test6992759(); - for (int i = 0; i < N_TESTS; i += 1) { - test.doTest(10, Integer.MAX_VALUE, i); - //test.doTest(10, Integer.MAX_VALUE - 1, i); - } - System.out.println("No failure"); - } - - void doTest(int expected, int max, int i) { - int counted; - for (counted = 0; - (counted <= max) && (counted < expected); - counted += 1) { - } - if (counted != expected) { - throw new RuntimeException("Failed test iteration=" + i + - " max=" + max + - " counted=" + counted + - " expected=" + expected); - } - } -} -
--- a/test/compiler/5091921/Test7005594.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 7005594 - * @summary Array overflow not handled correctly with loop optimzations - * - * @run shell Test7005594.sh - */ - -public class Test7005594 { - - static int test(byte a[]){ - int result=0; - for( int i=0; i<a.length; i+=((0x7fffffff>>1)+1) ){ - result += a[i]; - } - return result; - } - - public static void main(String [] args){ - byte a[]=new byte[(0x7fffffff>>1)+2]; - int result = 0; - try { - result = test(a); - } catch (ArrayIndexOutOfBoundsException e) { - e.printStackTrace(System.out); - System.out.println("Passed"); - System.exit(95); - } - System.out.println(result); - System.out.println("FAILED"); - System.exit(97); - } - -} -
--- a/test/compiler/5091921/Test7005594.sh Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# This code is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 only, as -# published by the Free Software Foundation. -# -# This code is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -# version 2 for more details (a copy is included in the LICENSE file that -# accompanied this code). -# -# You should have received a copy of the GNU General Public License version -# 2 along with this work; if not, write to the Free Software Foundation, -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -# or visit www.oracle.com if you need additional information or have any -# questions. -# -# -## some tests require path to find test source dir -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -# Amount of physical memory in megabytes -MEM=0 -if [ -f "/proc/meminfo" ]; then - # Linux, Windows/Cygwin - MEM=`cat /proc/meminfo |grep ^MemTotal: | awk '{print $2}'` - MEM="$(($MEM / 1024))" -elif [ -x "/usr/sbin/prtconf" ]; then - # Solaris - MEM=`/usr/sbin/prtconf | grep "^Memory size" | awk '{print $3}'` -elif [ -x "/usr/sbin/system_profiler" ]; then - # MacOS - MEMo=`/usr/sbin/system_profiler SPHardwareDataType | grep Memory:` - MEM=`echo "$MEMo" | awk '{print $2}'` - MEMu=`echo "$MEMo" | awk '{print $3}'` - case $MEMu in - GB) - MEM="$(($MEM * 1024))" - ;; - MB) - ;; - *) - echo "Unknown memory unit in system_profile output: $MEMu" - ;; - esac -elif [ -n "$ROOTDIR" -a -x "$ROOTDIR/mksnt/sysinf" ]; then - # Windows/MKS - MEM=`"$ROOTDIR/mksnt/sysinf" memory -v | grep "Total Physical Memory: " | sed 's/Total Physical Memory: *//g'` - MEM="$(($machine_memory / 1024))" -else - echo "Unable to determine amount of physical memory on the machine" -fi - -if [ $MEM -lt 2000 ]; then - echo "Test skipped due to low (or unknown) memory on the system: $MEM Mb" - exit 0 -fi - -echo "MEMORY=$MEM Mb" - -set -x - -cp ${TESTSRC}/Test7005594.java . -cp ${TESTSRC}/Test7005594.sh . - -${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test7005594.java - -${TESTJAVA}/bin/java ${TESTOPTS} -Xmx1600m -Xms1600m -XX:+IgnoreUnrecognizedVMOptions -XX:-ZapUnusedHeapArea -Xcomp -XX:CompileOnly=Test7005594.test Test7005594 > test.out 2>&1 - -result=$? - -cat test.out - -if [ $result -eq 95 ] -then - echo "Passed" - exit 0 -fi - -if [ $result -eq 97 ] -then - echo "Failed" - exit 1 -fi - -# The test should pass when no enough space for object heap -grep "Could not reserve enough space for .*object heap" test.out -if [ $? = 0 ] -then - echo "Passed" - exit 0 -else - echo "Failed" - exit 1 -fi
--- a/test/compiler/5091921/Test7020614.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 7020614 - * @summary "-server" mode optimizer makes code hang - * - * @run main/othervm/timeout=30 -Xbatch Test7020614 - */ - -public class Test7020614 { - - private static final int ITERATIONS = 1000; - private static int doNotOptimizeOut = 0; - - public static long bitCountShort() { - long t0 = System.currentTimeMillis(); - int sum = 0; - for (int it = 0; it < ITERATIONS; ++it) { - short value = 0; - do { - sum += Integer.bitCount(value); - } while (++value != 0); - } - doNotOptimizeOut += sum; - return System.currentTimeMillis() - t0; - } - - public static void main(String[] args) { - for (int i = 0; i < 4; ++i) { - System.out.println((i + 1) + ": " + bitCountShort()); - } - System.out.println("doNotOptimizeOut value: " + doNotOptimizeOut); - } -} -
--- a/test/compiler/5091921/input6890943.txt Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1543 +0,0 @@ -50 -4 5 1 -..... -##### -..### -.#... -4 5 1 -..... -##### -###.. -...#. -5 4 2 -.... -#### -..## -.### -.#.# -6 10 5 -.......... -####.##### -####.##### -####.##### -####.##### -####.##### -6 10 4 -.......... -#....##### -#....##### -#....##### -#....##### -#....##### -6 10 1 -.......... -####.##### -####.##### -####.##### -####.##### -####.##### -6 10 2 -.......... -####.##### -####.##### -####.##### -####.##### -####.##### -6 11 2 -.....###### -########### -###.......# -###.#.#...# -###.#.##..# -###.#.###.# -6 11 1 -.....###### -########### -###.......# -###.#.#...# -###.#.##..# -###.#.###.# -6 11 2 -.......#### -########### -###.......# -###.#.#...# -###.#.##..# -###.#.###.# -7 11 1 -..#........ -##.#....... -###.#...... -####.#..... -#####.#.... -######.#... -#########.. -13 16 2 -................ -#.#.#.#.#.#.#.#. -................ -.#.#.#.#.#.#.#.# -................ -#.#.#.#.#.#.#.#. -................ -.#.#.#.#.#.#.#.# -................ -#.#.#.#.#.#.#.#. -................ -.#.#.#.#.#.#.#.# -................ -4 16 3 -................ -#.#.#.#.#.#.#.#. -.#.#.#.#.#.#.#.# -................ -50 50 1 -.................................................. -################################################.# -.#............#....#.......................#....## -..#.....#......#....#.....................#....#.. -...#.......#....#....#...................#....#... -#...#....#.......#....#.................#....#.... -##...#.......#....#....#...............#....#..... -###...#....#.......#....#.............#....#...... -####...#.......#....#....#...........#....#....... -.####...#....#.......#....#.........#....#........ -..####...#.......#....#....#.......#....#......... -...####...#....#.......#....#.....#....#.......... -....####...#.......#....#....#...#....#...###..... -.....####...#....#.......#....#.#....#..##..###... -......####...#.......#....#....#.............##... -.......####...#....#.......#...............##..... -........####...#.......#....#............##....... -.........####...#....#.......#.........#######.... -..###.....####...#.......#....#................... -.#..###....####...#....#.......#.........####..... -##...###....####...#.......#....#.......##..##.... -##...........####...#....#.......#......##..##.... -##..####......####...#.......#....##....##..##.... -##....##.......####...#....#......##....##..##.... -.###.##.........####.............##.....##..##.... -..###............#######........##.......####..... -.........###......######.......##................. -.......##..##..........#......##.........####..... -......##....##........#......##.........##..##.... -......##.............#......##..........##..##.... -......##............#......##...........##..##.... -......##....#......#......##............##..##.... -.......##..##.....#....########.........##..##.... -........####.....#.....###.#...#.........####..... -.#####..........#.....#..##.#...#................. -...##..........#.....#....##.#...#.........####... -...##.........#.....#..#...##.#...#.......##..##.. -...##........#.....#..##....##.#...#......##..##.. -...##.......#.....#....##....##.#...#.....##..##.. -##.##......#.....#...###......##.#...#.....#####.. -.###......#.....#..##..........##.#...#.......##.. -.........#.....#...##..####.....##.#...#.....##... -........#.....#...###..#.##......##.#...#...##.... -.......#.....#....##.....###......##.#...#........ -......#.....#..#.##...###..........##.#...#....... -.....#.....#...##..#..#..##.##.#....##.#...#...... -....#.....#........###.....##........##.#...#..... -...#.....#.......##...####..###.......##.#...#.... -..#.....#......##.#.#..#.#..##.........##.#...#... -.#..............#.#.#.#.#.#.#...........##.#...#.. -50 50 13 -.................................................. -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -################################################## -20 49 5 -................................................. -################################################# -################################################# -##################################.############## -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -############################.#################### -################################################# -######.########################################## -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -49 49 48 -................................................. -################################################# -################################################. -################################################# -####################################.############ -################################################# -##########.###################################### -#######.######################################### -################################################# -################################################# -################################################# -#######################################.######### -################################################# -################################################# -################################################# -################################################# -################################################# -###########################################.##### -################################################# -################################################# -###.############################################# -###############.################################# -################################################# -##.############################################## -################################################# -################################################# -################################################# -################################################# -################################################# -#####################################.########### -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -#####.########################################### -#####################.########################### -################################################# -###.############################################# -################################################# -################################################# -################################################# -#############.###########.####################### -###.##############.####.######################### -#########################################.####### -################################################# -########################################.######## -40 49 10 -................................................. -################################################# -..#..............#............................... -.......................#.......................#. -..#....#...................#.................#... -..........#...............................#...... -............#..................#.......#......... -........#............#............#.............. -...................#.....#....................... -....#..........#........................#........ -....#.................................#......#... -...........#..................................... -....................#............................ -.##........#................#.................... -..............#.................................. -........#......................................#. -.................................#....#........#. -................................................. -.............................#..##............... -...........................................#.#... -........#..........#........#.............#.....# -..........#.#.................................... -.............................#............#...... -.......#.......................#.........#....... -..............................#.................. -......#.......................................... -.............#................#.................. -......#.............................#............ -#.................#..................#......#.... -..............#.................................. -...........#...........................#.....#... -............#............#...#................... -.......................#.......................#. -............................#.................... -..........................#...................... -...........................#.............#...#... -.#............................................... -..................#.............................. -...#..............................#.............. -.....#..................#........................ -49 49 20 -.........................................##..#..# -########################################.##...#.# -#.##..#....#####..####...#..#.##.###.#..#..#..... -..#...#.##...##.#....#...##..#.#..###...###...... -..#..##.#.###......#.....##.....#.......##.#.#.#. -..##......###.#.##.....##.#..#.##.###..##.#.##### -#.#.##....#..#..#.....#.#.##.#.#.##.#.....###.#.# -..###.#..#..###...###..#.#.....#..######.#.#....# -..#...#...##.#..##.#.#.#..###.#..#..#...#....##.. -.#..#.#..##.#...##........##.##..#..........#.#.. -#.#.###.####...#.#...#..###..#.##....#........... -#..#.#######.#....#.#.##...#.#.............##.... -###..###....#..#....#.#.###...#..##.#.#..##.##### -....####...#.#...........##.#.#.#..#.#.#.##.#.#.. -##.#...##..#..#...#..##..####.##.#...#.....#...#. -...###.##.#..##.....#.#.##..#..###.#.###.#.#..#.# -###....##...#.#.##.##..#.#...#...##....#.###..... -##..#....###..#.....#..#....#.#.#.##.......##.### -.#.#....#.....####..##....##...##...#.##..##.#... -##....#....#.#.###.##...#..##.##...##....#.###### -..#....#..##.....##.##.#.........##..##...#.#.... -#..#..#.#....##.#.#...#.###..#...#..#.##.#.#....# -.....#..#...###.....##...###....###.##.....#...#. -#..#.#...###..#....#..####....#.#......#..##....# -.....#.#...###...###.#..#.#.#.........#.#.#..#.## -.#..##..##..#..#.#....##.........#..#.##.#..##... -##.#.#.....##.##..###...#.#.#..#.#.####.#.###.#.. -..#.#.......#.#.#...#####..#.##.#....#...#.#..... -..########.####.....#..#.........#..#####.##.#... -.#......##.####..###..#.####........#....#....#.# -#.....#....#...#...#..###......#.##..#..#...#.### -...#..###.....#....#..#..#......#.....#.#.#.#..## -....#.##..####.#..###...#...#...#######..#..#.... -.#..#...##...#...#......##...#####.##...#..##.... -..#.#.#######.#....#.#.###....#.##...#..#.##..#.. -#..#.##.#.#.##..###....#.##.#..#..#...##....##..# -.###.#.#..##.###...#..##.#.#...#.#.####....#..### -#.#......#...##.##...#.#.....##..#..##....#.##... -#.#...#.#.##...##.###.#..##..##..####..##.#.#...# -....#....#..####.##.....#.#....#..##..##....#..#. -....#...###.....##..#..###....#........###..##..# -.###....##...........#....#........####.#.####..# -.#........##...#.###..###.#...##.##..###..###..## -#.#######.#....###...#..##..#...#....##....#....# -#....#..#......#..#...##.....##.#.#.#..#......##. -#.##.##.#.#.##..#..##..######.##.###.#.#..#....#. -.###.##.....#.##.#..###....###..##....#.#..#..... -#####..#.#....#.#......##..##.#...........####.#. -..#..#.#..#...##....###.##.#.#...#..#..#....#..## -49 49 5 -.........................................#....### -#########################################..#..... -.....#.###...#...#...........##...#...#....#...#. -....#.....#..#....#....##...#..###.#...#..##.#.## -....#...###.##...........#.#.##.......#.#.#.#..#. -...........#..###..#..##.....#.........#.....#... -.....#......#.##.#..##.###.....#...###.#....#...# -.#......##.#.......##...##.....###..#......#.##.. -#.....#.#..#.#...#####...#.###.##.....#..#....... -........##....#....#....#.#.#....####....#.##.### -....#.#......#.##.....#..........##.............# -#..##....#.#....#..#.....#.#.#....#.#.#....##...# -...#..##..#...#....#.#....#..#....#..#..#.......# -......#...##.#.####.....####.###.#..#........#### -##..........#...........#..#.##......##......#.## -....###....##...#.####.....#............#..#..... -...#....#....##.....##.....#.#.....#..#.#..#..#.. -...........#...#.##..##..##.#......#..#.#..##.... -.#........##......#.........##..#..........#.#... -#....##.#.##..#.....#.....##.....##....#......... -.#.......###.......#..#.....#.....#..##.##...#..# -###......##.....##...##..#.#....#...####.##...... -....#..#....##...#.##.##.#.#...#...#.#..#.##.#..# -..........#.#..#####..####....##..#.#.#.........# -........##.#.###..###....#...#........##.#......# -...........##.##..#.....#.#.#..#....#.###..#.###. -#.#....#.#...##............#.#.....#....#...#.#.. -..###.#.##...#....#..##.##...#........#.......... -...........#...##...#..#..##.....#..#.......#..#. -#.#.#......##.#.....#...#.#.#.#...#..#######.#.## -...##..#.......###..#..#.##....#......####.#..... -....##......#.#......#....##..#...##.......#..#.. -#..###.##....##..##.#..#.###.##.....#...#........ -#......#....####....#.........#.........#.##.##.. -.#.#..###......#...##.#.##..#.#.....#...#.#...... -......#.#...##.#....#..#.#.......#.#.....#.#.###. -###..#.....#....#.#...##..#.#.....#.#.....#.#.#.. -..........#........#....#...#..#...#...#.#.#.#... -#..##..#...###....#.#..#....##....#...#..##....#. -.#.#.#....#..##.#...#.....#.##..#....##........#. -..#.##....###...#...#..#..#.....#..#..###..#...#. -##....#........#..#..#..#......#...#.##....#.#.## -....#.............#..#...#...#.#.#...##....#..#.# -...#.........#....###.....#.#..#..#...#..#...#... -.#.#.###..###..##.#.##...#...#..#................ -.#......#..#..#.#.#...#.....................#..#. -..#.....#.......#..##.......#...#...##.#.....#.#. -#..####.#....#......#.........#.#...###...#....#. -#.#.#.#....#......#..#.#........###..#....##..... -31 47 7 -.........................#.#..##.#..#...#.#...# -#########################.#.#...#...#.#........ -...#...........#...#...#...##...#..#.#.#...#.## -.#........#.......#.#.....#......#........#.... -#.#....###...#...#....#....#......##...#....... -#.#......##..##...#.....#.##.#.........#....... -.......#.....##........#..#.......#.##...#..... -..#.......##.#...#.#..#.#..#....#......#......# -#.##.........#####..###.......#........#......# -.#..#.#.#...#....####...#...........#....#..... -##..##..#..###..###....##......#....#..##...#.# -#......#........##...#.#.#..#..#....#..#...##.# -.#.#.##..........#.#..#...##.##................ -##.##.#...#....#.............#.#.....###...#.#. -..#..#.#..#..#.#....#....#............#.##..#.. -......###......#..##..#.#...##.........#.#.###. -..#.##.#..#......##....#.#........#....##..#..# -.........#.#.#.....##...#.#...#.##.....##.##... -.#........#...#.###.........#.#.#.............. -....##........#.....#....###....###.#..#....##. -..#..#....#....#.#.......#.#.#..........###.... -.#..###.#...#.###...##...#....#...#............ -##.....#..##.#.##.##.......#.##.....###...##.#. -.###.......#...#.....#.....###.........#...#... -#.....#..####.....##...#........####..........# -#..#...........##.#.#.#..............#....##... -..#.#..........#..##.#.##...##..##.#.#..##..#.. -#..........................###......#....##.... -.....#..........#..#......#...#.#..#....#...#.. -#......#....##.........#..#.......#..#.......#. -.#......#...###...##....##.#..........#...#..#. -44 35 13 -...........................##..#### -############################.....## -..###.#.##.#...#.##.####.###.###.## -#.##.#.#.#.#..###.#..#...###.##..## -.#.##.#.##..#.###.###.##.#.#...#.#. -##....##.#..#####.#.####..##.##...# -####.##..##.###.##.#.#...#.##.###.# -#.#######.#.#.#..#.#..#..#...###.#. -##.###.#..#.####.##.#.#########.##. -#.##.#######..#.#.####.#..#..###### -.#.##..########...##.###..#..##.##. -#.#######.###...##.#...#.####.#..#. -.###..###....#.#.##.###..##.##.##.# -...#.###.#.##.#.####.##.####.#.#... -#..#......##....#.##.#.#.###.#..#.. -...##.###.###.#.####..#.#.#..###.#. -.#####.#..#..##.#.#...##.#.#.##...# -..##..#.#....##.#.#.###.##.##...#.. -###.#..###....#######..#.#.###.##.# -##.##.#.#.##..#.#.#.#.#..##.####... -##.###...#.###.#.#.#..#####.###.#.. -...#.#...##......#.##..##.##.#.#.## -##..#..####..###...###.#........### -##..#....#..#.#..##.#####..###.#... -##...#.#####.###.##....###...####.. -#.####.#..#.##.#.#...#.###.#...##.. -####.#####.###.#.##...##...#...#.## -#..##.##....###..#..####.##..#.#.## -..#.###.##....####.##.#..###.#....# -#.#.###.#..#.##.##...###.##..###### -##.#.##.###.#..#...###.####..##.### -.########.#....#..#........#..##..# -####..#.##.#.##.####..#.###...##### -#..##..#..##.###....####.#.#...#.#. -.#...##.##.###.###...##..##..###... -###.##...#.##...####.#.#.##..#.#### -##.###..##.#....#.###..##.#...###.# -##..##.###..#..#.####.#.....##.#### -.#....##...#####.....####...#.##.#. -##.#.#.....##...#..#...#....#....## -#..#.#..#####.##..###.#.########### -.#.###.#..###.##.###.#.###.##.#.### -.###..####.#..##......#..##.######. -...##..###.#.....##.#.#..##......#. -6 10 2 -.......#.. -########## -##.#...#.. -.#..###... -#.##.##### -.####..#.# -7 9 4 -......##. -######### -.#.###.## -..#...#.. -.....##.# -####...## -.#..#.#.# -10 9 2 -......... -######### -..###.### -#..###.## -.....#.#. -..##..... -###.#.... -.##..#... -##...#..# -#..##..## -10 7 1 -....#.. -####..# -####..# -..#.#.. -...##.# -#....## -..#..## -#.#.... -.##.#.. -###...# -6 10 2 -.......#.. -#######.#. -..##.#.##. -..#..#.... -.#.#....## -..#....#.. -40 40 5 -........................................ -###############################..####### -#..##############.....################## -........................................ -...........................##########... -#####...################..############## -##################.##################### -.............................#####...... -#.............................########## -...............................####..... -.........#################.............. -..........................###........... -........................................ -....................#####............... -##########....................########## -.......##################............... -########........###############..####### -........................................ -..........#########################..... -#####................................... -.........................####........... -......................#####...######.... -######..................################ -........#########....................... -############.........................### -........####################............ -......................################## -....................######......#....... -............################............ -........................................ -......................#########......... -#######............##################### -........###############................. -........................................ -.........###################............ -.............................#.......... -######................................## -........................#############... -......##................................ -........................................ -30 20 11 -.................... -#################### -......##.##......... -#.....####....###### -...##............... -........#######.###. -.......##........... -....#####..##....... -........##.#........ -.....###...........# -..##########.....##. -..#........#.#...... -......##...##....... -....##...###..###... -.####...#####...#### -###................. -.......##........... -..........###..####. -..####..#####.#####. -..###....#.......##. -......##....##...... -....##.###.......... -.##.....#####..#.... -.................... -......###........... -####..###.#########. -.......#######...... -....###............. -.........###.#####.. -................#### -50 20 17 -.................... -###################. -#..##............... -.................... -............####.... -........#####....... -..............#..#.. -.........####...#### -.............####... -.....#....###....... -####...............# -.................... -.....######......... -......#............. -.####......#####.... -.............##..... -#####....#####...... -..#####............. -##..####....###..### -.................... -.................... -........######.###.. -....####....#####... -....########........ -...#####............ -.###................ -...............###.. -.......#########.... -..................## -.......####......... -..#####............. -...####............. -.##..........#####.. -.................... -...#.##.......###... -######.....##......# -......####.......... -......#............. -.................... -.................... -.................... -.....#.............. -.....####....###.... -......#.........#### -.......######...###. -.................... -.................... -##...........###...# -.###................ -......#######....... -45 25 10 -......................... -######################### -#...................#..## -....................#.... -......................... -......................... -...................#####. -##.....................## -.#.....................#. -##.....................## -......................... -.....####................ -.....##.#................ -.....##.#................ -.....##.#............#### -.....##.#.......###..#### -.....##.#.......#.#...... -.....##.######..#.#...... -.....####....#..#.#..###. -........#....#..#.#..###. -...##...#....#..#.#...... -...##...#....#..#.#...... -...##...#....#..#.#...... -...##...#....#..#.#...... -...########..#..###...... -##.##...#....#........### -.#.##...######..#####.#.. -.#.##...........#...#.#.. -.#.##...........#...#.#.. -.#..............#...#.#.. -.#..............#...#.#.. -.#.####.........#...#.#.. -.#.#..#.........#...#.#.. -.#.#..#.........#####.#.. -##.#.##########.......### -...#.####.....#.......... -..#####.#.....#..####.... -..#####.#.....#..#..#.... -..#..#..#.....#..#..#.... -..#..#..#.....#..#..#.... -#.#..#..#.....#..#..#..## -#.#..#..#######..#..#..#. -#.####.......#####..#..#. -#............#..##..#..#. -#............########..#. -25 45 5 -............................................. -############################################# -..........#...###################.#...#...... -#########.#....############################## -#########.#.............##################... -####################....##################### -#########..........#........################# -####################........################# -..................####################.....#. -####..............#...........############### -######################################.###### -#########################.....#...########### -###.###################.......#.....######### -#####.#.........#.....#.....################# -############################################# -###.#############...####............######### -......############################...#....#.. -....#########....................#...######.. -##########.##..............################## -#####################......################## -############################################# -############################################# -#######################################...### -############################################# -##########....############################### -40 40 5 -...............................######### -######################################## -######################################## -######################################## -#########....########################### -######################################## -######################################## -######################################## -######################################## -######################################## -######################################## -..#######.######################........ -######################################## -######################################## -######################################## -...........#####################........ -####.................################### -######################################## -######################################## -######################################## -######################################## -#####................################### -###################...........########## -######################################## -######################################## -.......##############################... -######################################## -######################################## -######################################## -##############..............############ -######################################## -######################################## -######################################## -######################################## -######################################## -######################################## -######################################## -######################################## -######################################## -######################################## -30 20 2 -.................... -#################### -#############.....## -##...############### -#################### -#################### -#################### -....##.....#...#.... -#################### -##########.######### -###....############# -#########....####### -###....############# -#################### -....#######.....###. -#################### -########.########### -#################### -#############.....## -....#####..######### -#################### -##..########.##.#### -########.########### -#########..######### -#........########### -#########..######.## -###.################ -#################### -#################### -##############...### -50 20 7 -...................# -#################### -#####...############ -#################### -#################### -#################### -#################### -#################### -#################### -.....##############. -#################### -#################### -.........########... -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#########.########## -#################### -#################### -#################### -....###########..... -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -##........########## -#################### -#################### -#################### -#################### -#################### -#################### -#################### -#################### -....##########...... -#################### -49 49 3 -................................................. -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -................................................. -................................................. -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -################################################# -........##########............................... -################################################# -###########..................#################### -################################################# -################################################# -################################################# -################################################# -................................................. -################################################# -################################################# -################################################# -################################################# -################################################# -.......#####..................................... -................................................. -################################################# -................................################. -..................................###########.... -################################################# -################################################# -################################################# -################################################# -45 25 4 -......................... -######################### -########............##### -######################### -......................... -###############.#######.# -###############.#######.# -############....#######.# -......................... -############.#.########## -############...########## -######################### -.................######.. -################.######.# -......................... -....................##... -......................... -######################### -######################### -######################### -######################### -######################### -######################### -..........####........... -##....................... -##....................... -#########.####.########## -..........####........... -######################### -######################### -######################### -######################### -######################### -######################### -......................... -##################.###### -##################.###### -##################.###### -......................... -######################### -######################### -######################### -......................... -......................... -......................... -25 45 5 -............................................. -############################################# -####################################.######## -###########.################################# -###########.################################# -###########.################################# -############################################# -############################################# -############################################# -############################################# -############################################# -############################################# -############################################# -############################################# -############################################# -#############################...############# -#############################.#.############# -#############################...############# -############################################# -############################################# -############################################# -###..######################################## -###..######################################## -#########################################.... -####################################.####.##. -50 50 18 -.................................................. -################################################## -..##..##..##..##..##..##..##..##..##..##..##..##.. -.###.###.###.###.###.###.###.###.###.###.###.###.# -....####....####....####....####....####....####.. -.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# -..######..######..######..######..######..######.. -.#######.#######.#######.#######.#######.#######.# -........########........########........########.. -.#.#.#.#########.#.#.#.#########.#.#.#.#########.# -..##..##########..##..##########..##..##########.. -.###.###########.###.###########.###.###########.# -....############....############....############.. -.#.#############.#.#############.#.#############.# -..##############..##############..##############.. -.###############.###############.###############.# -................################................## -.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### -..##..##..##..##################..##..##..##..#### -.###.###.###.###################.###.###.###.##### -....####....####################....####....###### -.#.#####.#.#####################.#.#####.#.####### -..######..######################..######..######## -.#######.#######################.#######.######### -........########################........########## -.#.#.#.#########################.#.#.#.########### -..##..##########################..##..############ -.###.###########################.###.############# -....############################....############## -.#.#############################.#.############### -..##############################..################ -.###############################.################# -................................################## -.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### -..##..##..##..##..##..##..##..#################### -.###.###.###.###.###.###.###.##################### -....####....####....####....###################### -.#.#####.#.#####.#.#####.#.####################### -..######..######..######..######################## -.#######.#######.#######.######################### -........########........########################## -.#.#.#.#########.#.#.#.########################### -..##..##########..##..############################ -.###.###########.###.############################# -....############....############################## -.#.#############.#.############################### -..##############..################################ -.###############.################################# -................################################## -.#.#.#.#.#.#.#.################################### -50 50 19 -.................................................. -################################################## -..##..##..##..##..##..##..##..##..##..##..##..##.. -.###.###.###.###.###.###.###.###.###.###.###.###.# -....####....####....####....####....####....####.. -.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# -..######..######..######..######..######..######.. -.#######.#######.#######.#######.#######.#######.# -........########........########........########.. -.#.#.#.#########.#.#.#.#########.#.#.#.#########.# -..##..##########..##..##########..##..##########.. -.###.###########.###.###########.###.###########.# -....############....############....############.. -.#.#############.#.#############.#.#############.# -..##############..##############..##############.. -.###############.###############.###############.# -................################................## -.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### -..##..##..##..##################..##..##..##..#### -.###.###.###.###################.###.###.###.##### -....####....####################....####....###### -.#.#####.#.#####################.#.#####.#.####### -..######..######################..######..######## -.#######.#######################.#######.######### -........########################........########## -.#.#.#.#########################.#.#.#.########### -..##..##########################..##..############ -.###.###########################.###.############# -....############################....############## -.#.#############################.#.############### -..##############################..################ -.###############################.################# -................................################## -.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### -..##..##..##..##..##..##..##..#################### -.###.###.###.###.###.###.###.##################### -....####....####....####....###################### -.#.#####.#.#####.#.#####.#.####################### -..######..######..######..######################## -.#######.#######.#######.######################### -........########........########################## -.#.#.#.#########.#.#.#.########################### -..##..##########..##..############################ -.###.###########.###.############################# -....############....############################## -.#.#############.#.############################### -..##############..################################ -.###############.################################# -................################################## -.#.#.#.#.#.#.#.################################### -50 50 20 -.................................................. -################################################## -..##..##..##..##..##..##..##..##..##..##..##..##.. -.###.###.###.###.###.###.###.###.###.###.###.###.# -....####....####....####....####....####....####.. -.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# -..######..######..######..######..######..######.. -.#######.#######.#######.#######.#######.#######.# -........########........########........########.. -.#.#.#.#########.#.#.#.#########.#.#.#.#########.# -..##..##########..##..##########..##..##########.. -.###.###########.###.###########.###.###########.# -....############....############....############.. -.#.#############.#.#############.#.#############.# -..##############..##############..##############.. -.###############.###############.###############.# -................################................## -.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### -..##..##..##..##################..##..##..##..#### -.###.###.###.###################.###.###.###.##### -....####....####################....####....###### -.#.#####.#.#####################.#.#####.#.####### -..######..######################..######..######## -.#######.#######################.#######.######### -........########################........########## -.#.#.#.#########################.#.#.#.########### -..##..##########################..##..############ -.###.###########################.###.############# -....############################....############## -.#.#############################.#.############### -..##############################..################ -.###############################.################# -................................################## -.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### -..##..##..##..##..##..##..##..#################### -.###.###.###.###.###.###.###.##################### -....####....####....####....###################### -.#.#####.#.#####.#.#####.#.####################### -..######..######..######..######################## -.#######.#######.#######.######################### -........########........########################## -.#.#.#.#########.#.#.#.########################### -..##..##########..##..############################ -.###.###########.###.############################# -....############....############################## -.#.#############.#.############################### -..##############..################################ -.###############.################################# -................################################## -.#.#.#.#.#.#.#.################################### -49 48 5 -................................................ -################################################ -################################.############### -###############################..##############. -##############################.#.#############.# -#############################....############... -############################.###.###########.### -###########################..##..##########..##. -##########################.#.#.#.#########.#.#.# -#########################........########....... -########################.#######.#######.####### -#######################..######..######..######. -######################.#.#####.#.#####.#.#####.# -#####################....####....####....####... -####################.###.###.###.###.###.###.### -###################..##..##..##..##..##..##..##. -##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# -#################............................... -################.############################### -###############..##############################. -##############.#.#############################.# -#############....############################... -############.###.###########################.### -###########..##..##########################..##. -##########.#.#.#.#########################.#.#.# -#########........########################....... -########.#######.#######################.####### -#######..######..######################..######. -######.#.#####.#.#####################.#.#####.# -#####....####....####################....####... -####.###.###.###.###################.###.###.### -###..##..##..##..##################..##..##..##. -##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# -#................################............... -.###############.###############.############### -.##############..##############..##############. -.#############.#.#############.#.#############.# -.############....############....############... -.###########.###.###########.###.###########.### -.##########..##..##########..##..##########..##. -.#########.#.#.#.#########.#.#.#.#########.#.#.# -.########........########........########....... -.#######.#######.#######.#######.#######.####### -.######..######..######..######..######..######. -.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# -.####....####....####....####....####....####... -.###.###.###.###.###.###.###.###.###.###.###.### -.##..##..##..##..##..##..##..##..##..##..##..##. -.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# -49 48 11 -................................................ -################################################ -################################.############### -###############################..##############. -##############################.#.#############.# -#############################....############... -############################.###.###########.### -###########################..##..##########..##. -##########################.#.#.#.#########.#.#.# -#########################........########....... -########################.#######.#######.####### -#######################..######..######..######. -######################.#.#####.#.#####.#.#####.# -#####################....####....####....####... -####################.###.###.###.###.###.###.### -###################..##..##..##..##..##..##..##. -##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# -#################............................... -################.############################### -###############..##############################. -##############.#.#############################.# -#############....############################... -############.###.###########################.### -###########..##..##########################..##. -##########.#.#.#.#########################.#.#.# -#########........########################....... -########.#######.#######################.####### -#######..######..######################..######. -######.#.#####.#.#####################.#.#####.# -#####....####....####################....####... -####.###.###.###.###################.###.###.### -###..##..##..##..##################..##..##..##. -##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# -#................################............... -.###############.###############.############### -.##############..##############..##############. -.#############.#.#############.#.#############.# -.############....############....############... -.###########.###.###########.###.###########.### -.##########..##..##########..##..##########..##. -.#########.#.#.#.#########.#.#.#.#########.#.#.# -.########........########........########....... -.#######.#######.#######.#######.#######.####### -.######..######..######..######..######..######. -.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# -.####....####....####....####....####....####... -.###.###.###.###.###.###.###.###.###.###.###.### -.##..##..##..##..##..##..##..##..##..##..##..##. -.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# -49 48 30 -................................................ -################################################ -################################.############### -###############################..##############. -##############################.#.#############.# -#############################....############... -############################.###.###########.### -###########################..##..##########..##. -##########################.#.#.#.#########.#.#.# -#########################........########....... -########################.#######.#######.####### -#######################..######..######..######. -######################.#.#####.#.#####.#.#####.# -#####################....####....####....####... -####################.###.###.###.###.###.###.### -###################..##..##..##..##..##..##..##. -##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# -#################............................... -################.############################### -###############..##############################. -##############.#.#############################.# -#############....############################... -############.###.###########################.### -###########..##..##########################..##. -##########.#.#.#.#########################.#.#.# -#########........########################....... -########.#######.#######################.####### -#######..######..######################..######. -######.#.#####.#.#####################.#.#####.# -#####....####....####################....####... -####.###.###.###.###################.###.###.### -###..##..##..##..##################..##..##..##. -##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# -#................################............... -.###############.###############.############### -.##############..##############..##############. -.#############.#.#############.#.#############.# -.############....############....############... -.###########.###.###########.###.###########.### -.##########..##..##########..##..##########..##. -.#########.#.#.#.#########.#.#.#.#########.#.#.# -.########........########........########....... -.#######.#######.#######.#######.#######.####### -.######..######..######..######..######..######. -.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# -.####....####....####....####....####....####... -.###.###.###.###.###.###.###.###.###.###.###.### -.##..##..##..##..##..##..##..##..##..##..##..##. -.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# -50 10 4 -.......... -#####..... -#####..... -.####..... -#.###..... -##.##..... -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -.......... -#####..... -#####..... -.####..... -#.###..... -##.##..... -.......... -#####..... -#......... -.#........ -..#....... -...#...... -.......... -....#..... -...#...... -..#....... -.#........ -.......... -#####..... -#####..... -.####..... -#.###..... -##.##..... -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -.......... -#####..... -#####..... -#####..... -#####..... -#####..... -.......... -#####..... -#####..... -50 10 5 -.......... -#####..... -...##..... -.......... -.......... -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -#......... -.#........ -..#....... -...#...... -.......... -....#..... -...#...... -..#....... -.#........ -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -.......... -#####..... -#####..... -.####..... -#.###..... -##.##..... -.......... -#####..... -#......... -.#........ -..#....... -...#...... -.......... -....#..... -...#...... -..#....... -.#........ -.......... -50 10 4 -.......... -#####..... -#......... -.#........ -..#....... -...#...... -.......... -....#..... -...#...... -..#....... -.#........ -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -.......... -#####..... -#####..... -#####..... -#####..... -#####..... -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -#####..... -#####..... -#####..... -#####..... -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -50 10 5 -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -#####..... -#####..... -#####..... -#####..... -.......... -#####..... -##........ -.......... -.......... -.......... -#####..... -#####..... -.####..... -#.###..... -##.##..... -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -.......... -#####..... -...##..... -.......... -.......... -.......... -#####..... -#####..... -#####..... -#####..... -#####..... -.......... -#####..... -#####..... -####...... -###.#..... -##.##..... -.......... -#####..... -#......... -.#........ -..#....... -35 41 11 -........................................# -######################################### -##.......####.#..######.##.###...#####.## -.##.#.#...#.###...##...#..#.#..##..###### -.#...##....#.###...##.#.##.#.###...####.. -.###...##.##..####..##.#.#####.#...#.#... -..#...#.##..#...##..###..##...###...#.#.. -.#.####.##.##.###.....#..#..##.###..#.##. -##..##..#...##.###.#...####...#..##....#. -#....#..##.#.#.#......####.#.....#...#.#. -#.##.#####......####......###.###..###.#. -##..######...######.##.#.##.......#...#.. -.#.....###......#####...#..#.#.###...##.# -...##.##.##..##...####.#.###...#..#.##..# -....###.#.#..#...###..###.###..#####...## -....##.##..#.#.#.#.#####...##..######.... -#.#.##.##.#...#####....##.#.#...#.##.#..# -#.##.##.##.#...#.#.####...#..#.......##.# -.##.#..###..####.#..###...#...###.##.##.. -.####.#.#######.#......##....#######..##. -.#..#...#.#.####..#.######.#.#..##.#.#### -...#.###..#.##.#.###.#.#....#.###.#.#...# -..#.#.####....###...#..##..#####.#.###### -#......####.#..##.....#####.##...###..... -##..##..####......#.#.##..##...###.#..... -#.#.####.####.......##......####.###..### -##...###.#...#.####.##.#........##..#.### -....#..#####.#....#.##...###..#####.#.### -####.#.###.........####..###.#..######.## -.#..########..###..#####.######.###.#...# -.##..#.##..#....####...#.###.....##.#...# -##.#..##.##..##.##...##.##.##.#.##.###### -..#..#..####..##...###.#...#.....###..#.. -####.#..####.###...##..#.#.###.#..#..#### -#...#..#..#.#...#...#.#.##.##.#...###.#.# -31 41 12 -......................................... -#################################.....#.. -.#..........#.......#....##....#...#..... -.........#......#.#...#...#..#........#.. -#......#.#......#...#.........#.........# -.................#....#...#...##......... -.......#.#..#.....#..#.....##........#..# -.....#..#..#......................#..#... -..............#....##....#...#..#..#....# -...#.#.#........##.#..#..........#......# -...#......#..#......#....#....#....#..... -......##.#...#.##..........#............. -.......##.#.#..#...#.....#.#..#.......... -.........#..........#.................#.. -.#....#..#......#.......#.#..#..####.##.. -#...#................##...#..........#... -..........#...#.#..#..###..#...#......... -........##.......#.....##.#......#...#.#. -.#.....#.#..#.....#.#..##.#.#...........# -.......####...#.#.........#...#.#........ -.##.................#.#.#................ -.....###.#...#..#.#..............#....... -.....#...#.....#........#....##.......#.. -.........#...........##.#..#.....##...... -...#....#.........#...#...#.#............ -.....#..............#..............#....# -#.##...#.............#....#.#..#......#.. -........#...#...##.............#.#....... -.......#.......#..............#.......... -.....#.........#.........#..#...#..#....# -####..#...#.#.....##...........#.#.#.#.#.
--- a/test/compiler/5091921/output6890943.txt Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -Case #1: Yes 2 -Case #2: Yes 2 -Case #3: Yes 1 -Case #4: Yes 0 -Case #5: No -Case #6: No -Case #7: Yes 6 -Case #8: Yes 6 -Case #9: No -Case #10: Yes 1 -Case #11: Yes 6 -Case #12: Yes 0 -Case #13: No -Case #14: Yes 22 -Case #15: Yes 1225 -Case #16: Yes 178 -Case #17: No -Case #18: Yes 1 -Case #19: Yes 7 -Case #20: Yes 2 -Case #21: Yes 1 -Case #22: No -Case #23: Yes 3 -Case #24: Yes 1 -Case #25: Yes 7 -Case #26: No -Case #27: Yes 2 -Case #28: Yes 4 -Case #29: Yes 2 -Case #30: Yes 1 -Case #31: Yes 2 -Case #32: Yes 20 -Case #33: Yes 161 -Case #34: Yes 48 -Case #35: No -Case #36: Yes 218 -Case #37: Yes 51 -Case #38: Yes 247 -Case #39: Yes 32 -Case #40: Yes 31 -Case #41: Yes 31 -Case #42: Yes 25 -Case #43: Yes 17 -Case #44: Yes 2 -Case #45: Yes 61 -Case #46: Yes 25 -Case #47: No -Case #48: No -Case #49: Yes 8 -Case #50: Yes 0
--- a/test/compiler/6340864/TestByteVect.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1487 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6340864 - * @summary Implement vectorization optimizations in hotspot-server - * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestByteVect - */ - -public class TestByteVect { - private static final int ARRLEN = 997; - private static final int ITERS = 11000; - private static final int ADD_INIT = 63; - private static final int BIT_MASK = 0xB7; - private static final int VALUE = 3; - private static final int SHIFT = 8; - - public static void main(String args[]) { - System.out.println("Testing Byte vectors"); - int errn = test(); - if (errn > 0) { - System.err.println("FAILED: " + errn + " errors"); - System.exit(97); - } - System.out.println("PASSED"); - } - - static int test() { - byte[] a0 = new byte[ARRLEN]; - byte[] a1 = new byte[ARRLEN]; - byte[] a2 = new byte[ARRLEN]; - byte[] a3 = new byte[ARRLEN]; - byte[] a4 = new byte[ARRLEN]; - short[] p2 = new short[ARRLEN/2]; - int[] p4 = new int[ARRLEN/4]; - long[] p8 = new long[ARRLEN/8]; - // Initialize - int gold_sum = 0; - for (int i=0; i<ARRLEN; i++) { - byte val = (byte)(ADD_INIT+i); - gold_sum += val; - a1[i] = val; - a2[i] = (byte)VALUE; - a3[i] = (byte)-VALUE; - a4[i] = (byte)BIT_MASK; - } - System.out.println("Warmup"); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - test_addc(a0, a1); - test_addv(a0, a1, (byte)VALUE); - test_adda(a0, a1, a2); - test_subc(a0, a1); - test_subv(a0, a1, (byte)VALUE); - test_suba(a0, a1, a2); - - test_mulc(a0, a1); - test_mulv(a0, a1, (byte)VALUE); - test_mula(a0, a1, a2); - test_divc(a0, a1); - test_divv(a0, a1, (byte)VALUE); - test_diva(a0, a1, a2); - test_mulc_n(a0, a1); - test_mulv(a0, a1, (byte)-VALUE); - test_mula(a0, a1, a3); - test_divc_n(a0, a1); - test_divv(a0, a1, (byte)-VALUE); - test_diva(a0, a1, a3); - - test_andc(a0, a1); - test_andv(a0, a1, (byte)BIT_MASK); - test_anda(a0, a1, a4); - test_orc(a0, a1); - test_orv(a0, a1, (byte)BIT_MASK); - test_ora(a0, a1, a4); - test_xorc(a0, a1); - test_xorv(a0, a1, (byte)BIT_MASK); - test_xora(a0, a1, a4); - - test_sllc(a0, a1); - test_sllv(a0, a1, VALUE); - test_srlc(a0, a1); - test_srlv(a0, a1, VALUE); - test_srac(a0, a1); - test_srav(a0, a1, VALUE); - - test_sllc_n(a0, a1); - test_sllv(a0, a1, -VALUE); - test_srlc_n(a0, a1); - test_srlv(a0, a1, -VALUE); - test_srac_n(a0, a1); - test_srav(a0, a1, -VALUE); - - test_sllc_o(a0, a1); - test_sllv(a0, a1, SHIFT); - test_srlc_o(a0, a1); - test_srlv(a0, a1, SHIFT); - test_srac_o(a0, a1); - test_srav(a0, a1, SHIFT); - - test_sllc_on(a0, a1); - test_sllv(a0, a1, -SHIFT); - test_srlc_on(a0, a1); - test_srlv(a0, a1, -SHIFT); - test_srac_on(a0, a1); - test_srav(a0, a1, -SHIFT); - - test_sllc_add(a0, a1); - test_sllv_add(a0, a1, ADD_INIT); - test_srlc_add(a0, a1); - test_srlv_add(a0, a1, ADD_INIT); - test_srac_add(a0, a1); - test_srav_add(a0, a1, ADD_INIT); - - test_sllc_and(a0, a1); - test_sllv_and(a0, a1, BIT_MASK); - test_srlc_and(a0, a1); - test_srlv_and(a0, a1, BIT_MASK); - test_srac_and(a0, a1); - test_srav_and(a0, a1, BIT_MASK); - - test_pack2(p2, a1); - test_unpack2(a0, p2); - test_pack2_swap(p2, a1); - test_unpack2_swap(a0, p2); - test_pack4(p4, a1); - test_unpack4(a0, p4); - test_pack4_swap(p4, a1); - test_unpack4_swap(a0, p4); - test_pack8(p8, a1); - test_unpack8(a0, p8); - test_pack8_swap(p8, a1); - test_unpack8_swap(a0, p8); - } - // Test and verify results - System.out.println("Verification"); - int errn = 0; - { - int sum = test_sum(a1); - if (sum != gold_sum) { - System.err.println("test_sum: " + sum + " != " + gold_sum); - errn++; - } - - test_addc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_addc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)+VALUE)); - } - test_addv(a0, a1, (byte)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_addv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)+VALUE)); - } - test_adda(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_adda: ", i, a0[i], (byte)((byte)(ADD_INIT+i)+VALUE)); - } - - test_subc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_subc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)-VALUE)); - } - test_subv(a0, a1, (byte)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_subv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)-VALUE)); - } - test_suba(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_suba: ", i, a0[i], (byte)((byte)(ADD_INIT+i)-VALUE)); - } - - test_mulc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)*VALUE)); - } - test_mulv(a0, a1, (byte)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)*VALUE)); - } - test_mula(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mula: ", i, a0[i], (byte)((byte)(ADD_INIT+i)*VALUE)); - } - - test_divc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)/VALUE)); - } - test_divv(a0, a1, (byte)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)/VALUE)); - } - test_diva(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_diva: ", i, a0[i], (byte)((byte)(ADD_INIT+i)/VALUE)); - } - - test_mulc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulc_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)*(-VALUE))); - } - test_mulv(a0, a1, (byte)-VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulv_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)*(-VALUE))); - } - test_mula(a0, a1, a3); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mula_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)*(-VALUE))); - } - - test_divc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divc_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)/(-VALUE))); - } - test_divv(a0, a1, (byte)-VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divv_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)/(-VALUE))); - } - test_diva(a0, a1, a3); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_diva_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)/(-VALUE))); - } - - test_andc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_andc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)&BIT_MASK)); - } - test_andv(a0, a1, (byte)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_andv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)&BIT_MASK)); - } - test_anda(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_anda: ", i, a0[i], (byte)((byte)(ADD_INIT+i)&BIT_MASK)); - } - - test_orc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_orc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)|BIT_MASK)); - } - test_orv(a0, a1, (byte)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_orv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)|BIT_MASK)); - } - test_ora(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_ora: ", i, a0[i], (byte)((byte)(ADD_INIT+i)|BIT_MASK)); - } - - test_xorc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xorc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)^BIT_MASK)); - } - test_xorv(a0, a1, (byte)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xorv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)^BIT_MASK)); - } - test_xora(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xora: ", i, a0[i], (byte)((byte)(ADD_INIT+i)^BIT_MASK)); - } - - test_sllc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<VALUE)); - } - test_sllv(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<VALUE)); - } - - test_srlc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>VALUE)); - } - test_srlv(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>VALUE)); - } - - test_srac(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>VALUE)); - } - test_srav(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>VALUE)); - } - - test_sllc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<(-VALUE))); - } - test_sllv(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<(-VALUE))); - } - - test_srlc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>(-VALUE))); - } - test_srlv(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>(-VALUE))); - } - - test_srac_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>(-VALUE))); - } - test_srav(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_n: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>(-VALUE))); - } - - test_sllc_o(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_o: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<SHIFT)); - } - test_sllv(a0, a1, SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_o: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<SHIFT)); - } - - test_srlc_o(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_o: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>SHIFT)); - } - test_srlv(a0, a1, SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_o: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>SHIFT)); - } - - test_srac_o(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_o: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>SHIFT)); - } - test_srav(a0, a1, SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_o: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>SHIFT)); - } - - test_sllc_on(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<(-SHIFT))); - } - test_sllv(a0, a1, -SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)<<(-SHIFT))); - } - - test_srlc_on(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>(-SHIFT))); - } - test_srlv(a0, a1, -SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>>(-SHIFT))); - } - - test_srac_on(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>(-SHIFT))); - } - test_srav(a0, a1, -SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_on: ", i, a0[i], (byte)((byte)(ADD_INIT+i)>>(-SHIFT))); - } - - test_sllc_add(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)<<VALUE)); - } - test_sllv_add(a0, a1, ADD_INIT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)<<VALUE)); - } - - test_srlc_add(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>>VALUE)); - } - test_srlv_add(a0, a1, ADD_INIT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>>VALUE)); - } - - test_srac_add(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>VALUE)); - } - test_srav_add(a0, a1, ADD_INIT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_add: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) + ADD_INIT)>>VALUE)); - } - - test_sllc_and(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)<<VALUE)); - } - test_sllv_and(a0, a1, BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)<<VALUE)); - } - - test_srlc_and(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>>VALUE)); - } - test_srlv_and(a0, a1, BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>>VALUE)); - } - - test_srac_and(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>VALUE)); - } - test_srav_and(a0, a1, BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_and: ", i, a0[i], (byte)(((byte)(ADD_INIT+i) & BIT_MASK)>>VALUE)); - } - - test_pack2(p2, a1); - for (int i=0; i<ARRLEN/2; i++) { - errn += verify("test_pack2: ", i, p2[i], (short)(((short)(ADD_INIT+2*i) & 0xFF) | ((short)(ADD_INIT+2*i+1) << 8))); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack2(a0, p2); - for (int i=0; i<(ARRLEN&(-2)); i++) { - errn += verify("test_unpack2: ", i, a0[i], (byte)(ADD_INIT+i)); - } - - test_pack2_swap(p2, a1); - for (int i=0; i<ARRLEN/2; i++) { - errn += verify("test_pack2_swap: ", i, p2[i], (short)(((short)(ADD_INIT+2*i+1) & 0xFF) | ((short)(ADD_INIT+2*i) << 8))); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack2_swap(a0, p2); - for (int i=0; i<(ARRLEN&(-2)); i++) { - errn += verify("test_unpack2_swap: ", i, a0[i], (byte)(ADD_INIT+i)); - } - - test_pack4(p4, a1); - for (int i=0; i<ARRLEN/4; i++) { - errn += verify("test_pack4: ", i, p4[i], ((int)(ADD_INIT+4*i+0) & 0xFF) | - (((int)(ADD_INIT+4*i+1) & 0xFF) << 8) | - (((int)(ADD_INIT+4*i+2) & 0xFF) << 16) | - (((int)(ADD_INIT+4*i+3) & 0xFF) << 24)); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack4(a0, p4); - for (int i=0; i<(ARRLEN&(-4)); i++) { - errn += verify("test_unpack4: ", i, a0[i], (byte)(ADD_INIT+i)); - } - - test_pack4_swap(p4, a1); - for (int i=0; i<ARRLEN/4; i++) { - errn += verify("test_pack4_swap: ", i, p4[i], ((int)(ADD_INIT+4*i+3) & 0xFF) | - (((int)(ADD_INIT+4*i+2) & 0xFF) << 8) | - (((int)(ADD_INIT+4*i+1) & 0xFF) << 16) | - (((int)(ADD_INIT+4*i+0) & 0xFF) << 24)); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack4_swap(a0, p4); - for (int i=0; i<(ARRLEN&(-4)); i++) { - errn += verify("test_unpack4_swap: ", i, a0[i], (byte)(ADD_INIT+i)); - } - - test_pack8(p8, a1); - for (int i=0; i<ARRLEN/8; i++) { - errn += verify("test_pack8: ", i, p8[i], ((long)(ADD_INIT+8*i+0) & 0xFFl) | - (((long)(ADD_INIT+8*i+1) & 0xFFl) << 8) | - (((long)(ADD_INIT+8*i+2) & 0xFFl) << 16) | - (((long)(ADD_INIT+8*i+3) & 0xFFl) << 24) | - (((long)(ADD_INIT+8*i+4) & 0xFFl) << 32) | - (((long)(ADD_INIT+8*i+5) & 0xFFl) << 40) | - (((long)(ADD_INIT+8*i+6) & 0xFFl) << 48) | - (((long)(ADD_INIT+8*i+7) & 0xFFl) << 56)); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack8(a0, p8); - for (int i=0; i<(ARRLEN&(-8)); i++) { - errn += verify("test_unpack8: ", i, a0[i], (byte)(ADD_INIT+i)); - } - - test_pack8_swap(p8, a1); - for (int i=0; i<ARRLEN/8; i++) { - errn += verify("test_pack8_swap: ", i, p8[i], ((long)(ADD_INIT+8*i+7) & 0xFFl) | - (((long)(ADD_INIT+8*i+6) & 0xFFl) << 8) | - (((long)(ADD_INIT+8*i+5) & 0xFFl) << 16) | - (((long)(ADD_INIT+8*i+4) & 0xFFl) << 24) | - (((long)(ADD_INIT+8*i+3) & 0xFFl) << 32) | - (((long)(ADD_INIT+8*i+2) & 0xFFl) << 40) | - (((long)(ADD_INIT+8*i+1) & 0xFFl) << 48) | - (((long)(ADD_INIT+8*i+0) & 0xFFl) << 56)); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack8_swap(a0, p8); - for (int i=0; i<(ARRLEN&(-8)); i++) { - errn += verify("test_unpack8_swap: ", i, a0[i], (byte)(ADD_INIT+i)); - } - - } - - if (errn > 0) - return errn; - - System.out.println("Time"); - long start, end; - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sum: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_addc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addv(a0, a1, (byte)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_addv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_adda(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_adda: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_subc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subv(a0, a1, (byte)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_subv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_suba(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_suba: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, (byte)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_mula: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, (byte)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_diva: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, (byte)-VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_mula_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, (byte)-VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_diva_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_andc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_andc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_andv(a0, a1, (byte)BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_andv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_anda(a0, a1, a4); - } - end = System.currentTimeMillis(); - System.out.println("test_anda: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_orc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_orc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_orv(a0, a1, (byte)BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_orv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_ora(a0, a1, a4); - } - end = System.currentTimeMillis(); - System.out.println("test_ora: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_xorc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_xorc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_xorv(a0, a1, (byte)BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_xorv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_xora(a0, a1, a4); - } - end = System.currentTimeMillis(); - System.out.println("test_xora: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srav: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_o(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_o: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_o: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_o(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_o: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_o: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_o(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_o: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_o: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_on(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_on: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, -SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_on: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_on(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_on: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, -SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_on: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_on(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_on: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, -SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_on: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_add(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_add: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv_add(a0, a1, ADD_INIT); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_add: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_add(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_add: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv_add(a0, a1, ADD_INIT); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_add: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_add(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_add: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav_add(a0, a1, ADD_INIT); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_add: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_and(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_and: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv_and(a0, a1, BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_and: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_and(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_and: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv_and(a0, a1, BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_and: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_and(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_and: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav_and(a0, a1, BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_and: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack2(p2, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack2: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack2(a0, p2); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack2: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack2_swap(p2, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack2_swap: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack2_swap(a0, p2); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack2_swap: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack4(p4, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack4: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack4(a0, p4); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack4: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack4_swap(p4, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack4_swap: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack4_swap(a0, p4); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack4_swap: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack8(p8, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack8: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack8(a0, p8); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack8: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack8_swap(p8, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack8_swap: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack8_swap(a0, p8); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack8_swap: " + (end - start)); - - return errn; - } - - static int test_sum(byte[] a1) { - int sum = 0; - for (int i = 0; i < a1.length; i+=1) { - sum += a1[i]; - } - return sum; - } - - static void test_addc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]+VALUE); - } - } - static void test_addv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]+b); - } - } - static void test_adda(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]+a2[i]); - } - } - - static void test_subc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]-VALUE); - } - } - static void test_subv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]-b); - } - } - static void test_suba(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]-a2[i]); - } - } - - static void test_mulc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]*VALUE); - } - } - static void test_mulc_n(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]*(-VALUE)); - } - } - static void test_mulv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]*b); - } - } - static void test_mula(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]*a2[i]); - } - } - - static void test_divc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]/VALUE); - } - } - static void test_divc_n(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]/(-VALUE)); - } - } - static void test_divv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]/b); - } - } - static void test_diva(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]/a2[i]); - } - } - - static void test_andc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]&BIT_MASK); - } - } - static void test_andv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]&b); - } - } - static void test_anda(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]&a2[i]); - } - } - - static void test_orc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]|BIT_MASK); - } - } - static void test_orv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]|b); - } - } - static void test_ora(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]|a2[i]); - } - } - - static void test_xorc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]^BIT_MASK); - } - } - static void test_xorv(byte[] a0, byte[] a1, byte b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]^b); - } - } - static void test_xora(byte[] a0, byte[] a1, byte[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]^a2[i]); - } - } - - static void test_sllc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]<<VALUE); - } - } - static void test_sllc_n(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]<<(-VALUE)); - } - } - static void test_sllc_o(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]<<SHIFT); - } - } - static void test_sllc_on(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]<<(-SHIFT)); - } - } - static void test_sllv(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]<<b); - } - } - static void test_sllc_add(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] + ADD_INIT)<<VALUE); - } - } - static void test_sllv_add(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] + b)<<VALUE); - } - } - static void test_sllc_and(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] & BIT_MASK)<<VALUE); - } - } - static void test_sllv_and(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] & b)<<VALUE); - } - } - - static void test_srlc(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>>VALUE); - } - } - static void test_srlc_n(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>>(-VALUE)); - } - } - static void test_srlc_o(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>>SHIFT); - } - } - static void test_srlc_on(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>>(-SHIFT)); - } - } - static void test_srlv(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>>b); - } - } - static void test_srlc_add(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] + ADD_INIT)>>>VALUE); - } - } - static void test_srlv_add(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] + b)>>>VALUE); - } - } - static void test_srlc_and(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] & BIT_MASK)>>>VALUE); - } - } - static void test_srlv_and(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] & b)>>>VALUE); - } - } - - static void test_srac(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>VALUE); - } - } - static void test_srac_n(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>(-VALUE)); - } - } - static void test_srac_o(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>SHIFT); - } - } - static void test_srac_on(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>(-SHIFT)); - } - } - static void test_srav(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)(a1[i]>>b); - } - } - static void test_srac_add(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] + ADD_INIT)>>VALUE); - } - } - static void test_srav_add(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] + b)>>VALUE); - } - } - static void test_srac_and(byte[] a0, byte[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] & BIT_MASK)>>VALUE); - } - } - static void test_srav_and(byte[] a0, byte[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (byte)((a1[i] & b)>>VALUE); - } - } - - static void test_pack2(short[] p2, byte[] a1) { - if (p2.length*2 > a1.length) return; - for (int i = 0; i < p2.length; i+=1) { - short l0 = (short)a1[i*2+0]; - short l1 = (short)a1[i*2+1]; - p2[i] = (short)((l1 << 8) | (l0 & 0xFF)); - } - } - static void test_unpack2(byte[] a0, short[] p2) { - if (p2.length*2 > a0.length) return; - for (int i = 0; i < p2.length; i+=1) { - short l = p2[i]; - a0[i*2+0] = (byte)(l & 0xFF); - a0[i*2+1] = (byte)(l >> 8); - } - } - static void test_pack2_swap(short[] p2, byte[] a1) { - if (p2.length*2 > a1.length) return; - for (int i = 0; i < p2.length; i+=1) { - short l0 = (short)a1[i*2+0]; - short l1 = (short)a1[i*2+1]; - p2[i] = (short)((l0 << 8) | (l1 & 0xFF)); - } - } - static void test_unpack2_swap(byte[] a0, short[] p2) { - if (p2.length*2 > a0.length) return; - for (int i = 0; i < p2.length; i+=1) { - short l = p2[i]; - a0[i*2+0] = (byte)(l >> 8); - a0[i*2+1] = (byte)(l & 0xFF); - } - } - - static void test_pack4(int[] p4, byte[] a1) { - if (p4.length*4 > a1.length) return; - for (int i = 0; i < p4.length; i+=1) { - int l0 = (int)a1[i*4+0]; - int l1 = (int)a1[i*4+1]; - int l2 = (int)a1[i*4+2]; - int l3 = (int)a1[i*4+3]; - p4[i] = (l0 & 0xFF) | - ((l1 & 0xFF) << 8) | - ((l2 & 0xFF) << 16) | - ((l3 & 0xFF) << 24); - } - } - static void test_unpack4(byte[] a0, int[] p4) { - if (p4.length*4 > a0.length) return; - for (int i = 0; i < p4.length; i+=1) { - int l = p4[i]; - a0[i*4+0] = (byte)(l & 0xFF); - a0[i*4+1] = (byte)(l >> 8); - a0[i*4+2] = (byte)(l >> 16); - a0[i*4+3] = (byte)(l >> 24); - } - } - static void test_pack4_swap(int[] p4, byte[] a1) { - if (p4.length*4 > a1.length) return; - for (int i = 0; i < p4.length; i+=1) { - int l0 = (int)a1[i*4+0]; - int l1 = (int)a1[i*4+1]; - int l2 = (int)a1[i*4+2]; - int l3 = (int)a1[i*4+3]; - p4[i] = (l3 & 0xFF) | - ((l2 & 0xFF) << 8) | - ((l1 & 0xFF) << 16) | - ((l0 & 0xFF) << 24); - } - } - static void test_unpack4_swap(byte[] a0, int[] p4) { - if (p4.length*4 > a0.length) return; - for (int i = 0; i < p4.length; i+=1) { - int l = p4[i]; - a0[i*4+0] = (byte)(l >> 24); - a0[i*4+1] = (byte)(l >> 16); - a0[i*4+2] = (byte)(l >> 8); - a0[i*4+3] = (byte)(l & 0xFF); - } - } - - static void test_pack8(long[] p8, byte[] a1) { - if (p8.length*8 > a1.length) return; - for (int i = 0; i < p8.length; i+=1) { - long l0 = (long)a1[i*8+0]; - long l1 = (long)a1[i*8+1]; - long l2 = (long)a1[i*8+2]; - long l3 = (long)a1[i*8+3]; - long l4 = (long)a1[i*8+4]; - long l5 = (long)a1[i*8+5]; - long l6 = (long)a1[i*8+6]; - long l7 = (long)a1[i*8+7]; - p8[i] = (l0 & 0xFFl) | - ((l1 & 0xFFl) << 8) | - ((l2 & 0xFFl) << 16) | - ((l3 & 0xFFl) << 24) | - ((l4 & 0xFFl) << 32) | - ((l5 & 0xFFl) << 40) | - ((l6 & 0xFFl) << 48) | - ((l7 & 0xFFl) << 56); - } - } - static void test_unpack8(byte[] a0, long[] p8) { - if (p8.length*8 > a0.length) return; - for (int i = 0; i < p8.length; i+=1) { - long l = p8[i]; - a0[i*8+0] = (byte)(l & 0xFFl); - a0[i*8+1] = (byte)(l >> 8); - a0[i*8+2] = (byte)(l >> 16); - a0[i*8+3] = (byte)(l >> 24); - a0[i*8+4] = (byte)(l >> 32); - a0[i*8+5] = (byte)(l >> 40); - a0[i*8+6] = (byte)(l >> 48); - a0[i*8+7] = (byte)(l >> 56); - } - } - static void test_pack8_swap(long[] p8, byte[] a1) { - if (p8.length*8 > a1.length) return; - for (int i = 0; i < p8.length; i+=1) { - long l0 = (long)a1[i*8+0]; - long l1 = (long)a1[i*8+1]; - long l2 = (long)a1[i*8+2]; - long l3 = (long)a1[i*8+3]; - long l4 = (long)a1[i*8+4]; - long l5 = (long)a1[i*8+5]; - long l6 = (long)a1[i*8+6]; - long l7 = (long)a1[i*8+7]; - p8[i] = (l7 & 0xFFl) | - ((l6 & 0xFFl) << 8) | - ((l5 & 0xFFl) << 16) | - ((l4 & 0xFFl) << 24) | - ((l3 & 0xFFl) << 32) | - ((l2 & 0xFFl) << 40) | - ((l1 & 0xFFl) << 48) | - ((l0 & 0xFFl) << 56); - } - } - static void test_unpack8_swap(byte[] a0, long[] p8) { - if (p8.length*8 > a0.length) return; - for (int i = 0; i < p8.length; i+=1) { - long l = p8[i]; - a0[i*8+0] = (byte)(l >> 56); - a0[i*8+1] = (byte)(l >> 48); - a0[i*8+2] = (byte)(l >> 40); - a0[i*8+3] = (byte)(l >> 32); - a0[i*8+4] = (byte)(l >> 24); - a0[i*8+5] = (byte)(l >> 16); - a0[i*8+6] = (byte)(l >> 8); - a0[i*8+7] = (byte)(l & 0xFFl); - } - } - - static int verify(String text, int i, byte elem, byte val) { - if (elem != val) { - System.err.println(text + "[" + i + "] = " + elem + " != " + val); - return 1; - } - return 0; - } - - static int verify(String text, int i, short elem, short val) { - if (elem != val) { - System.err.println(text + "[" + i + "] = " + elem + " != " + val); - return 1; - } - return 0; - } - - static int verify(String text, int i, int elem, int val) { - if (elem != val) { - System.err.println(text + "[" + i + "] = " + Integer.toHexString(elem) + " != " + Integer.toHexString(val)); - return 1; - } - return 0; - } - - static int verify(String text, int i, long elem, long val) { - if (elem != val) { - System.err.println(text + "[" + i + "] = " + Long.toHexString(elem) + " != " + Long.toHexString(val)); - return 1; - } - return 0; - } -}
--- a/test/compiler/6340864/TestDoubleVect.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,560 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6340864 - * @summary Implement vectorization optimizations in hotspot-server - * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestDoubleVect - */ - -public class TestDoubleVect { - private static final int ARRLEN = 997; - private static final int ITERS = 11000; - private static final double ADD_INIT = -7500.; - private static final double VALUE = 15.; - - public static void main(String args[]) { - System.out.println("Testing Double vectors"); - int errn = test(); - if (errn > 0) { - System.err.println("FAILED: " + errn + " errors"); - System.exit(97); - } - System.out.println("PASSED"); - } - - static int test() { - double[] a0 = new double[ARRLEN]; - double[] a1 = new double[ARRLEN]; - double[] a2 = new double[ARRLEN]; - double[] a3 = new double[ARRLEN]; - // Initialize - double gold_sum = 0; - for (int i=0; i<ARRLEN; i++) { - double val = ADD_INIT+(double)i; - gold_sum += val; - a1[i] = val; - a2[i] = VALUE; - a3[i] = -VALUE; - } - - System.out.println("Warmup"); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - test_addc(a0, a1); - test_addv(a0, a1, VALUE); - test_adda(a0, a1, a2); - test_subc(a0, a1); - test_subv(a0, a1, VALUE); - test_suba(a0, a1, a2); - test_mulc(a0, a1); - test_mulv(a0, a1, VALUE); - test_mula(a0, a1, a2); - test_divc(a0, a1); - test_divv(a0, a1, VALUE); - test_diva(a0, a1, a2); - test_mulc_n(a0, a1); - test_mulv(a0, a1, -VALUE); - test_mula(a0, a1, a3); - test_divc_n(a0, a1); - test_divv(a0, a1, -VALUE); - test_diva(a0, a1, a3); - } - // Test and verify results - System.out.println("Verification"); - int errn = 0; - { - double sum = test_sum(a1); - if (sum != gold_sum) { - System.err.println("test_sum: " + sum + " != " + gold_sum); - errn++; - } - // Overwrite with NaN values - a1[0] = Double.NaN; - a1[1] = Double.POSITIVE_INFINITY; - a1[2] = Double.NEGATIVE_INFINITY; - a1[3] = Double.MAX_VALUE; - a1[4] = Double.MIN_VALUE; - a1[5] = Double.MIN_NORMAL; - - a2[6] = a1[0]; - a2[7] = a1[1]; - a2[8] = a1[2]; - a2[9] = a1[3]; - a2[10] = a1[4]; - a2[11] = a1[5]; - - a3[6] = -a2[6]; - a3[7] = -a2[7]; - a3[8] = -a2[8]; - a3[9] = -a2[9]; - a3[10] = -a2[10]; - a3[11] = -a2[11]; - - test_addc(a0, a1); - errn += verify("test_addc: ", 0, a0[0], (Double.NaN+VALUE)); - errn += verify("test_addc: ", 1, a0[1], (Double.POSITIVE_INFINITY+VALUE)); - errn += verify("test_addc: ", 2, a0[2], (Double.NEGATIVE_INFINITY+VALUE)); - errn += verify("test_addc: ", 3, a0[3], (Double.MAX_VALUE+VALUE)); - errn += verify("test_addc: ", 4, a0[4], (Double.MIN_VALUE+VALUE)); - errn += verify("test_addc: ", 5, a0[5], (Double.MIN_NORMAL+VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_addc: ", i, a0[i], ((ADD_INIT+i)+VALUE)); - } - test_addv(a0, a1, VALUE); - errn += verify("test_addv: ", 0, a0[0], (Double.NaN+VALUE)); - errn += verify("test_addv: ", 1, a0[1], (Double.POSITIVE_INFINITY+VALUE)); - errn += verify("test_addv: ", 2, a0[2], (Double.NEGATIVE_INFINITY+VALUE)); - errn += verify("test_addv: ", 3, a0[3], (Double.MAX_VALUE+VALUE)); - errn += verify("test_addv: ", 4, a0[4], (Double.MIN_VALUE+VALUE)); - errn += verify("test_addv: ", 5, a0[5], (Double.MIN_NORMAL+VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_addv: ", i, a0[i], ((ADD_INIT+i)+VALUE)); - } - test_adda(a0, a1, a2); - errn += verify("test_adda: ", 0, a0[0], (Double.NaN+VALUE)); - errn += verify("test_adda: ", 1, a0[1], (Double.POSITIVE_INFINITY+VALUE)); - errn += verify("test_adda: ", 2, a0[2], (Double.NEGATIVE_INFINITY+VALUE)); - errn += verify("test_adda: ", 3, a0[3], (Double.MAX_VALUE+VALUE)); - errn += verify("test_adda: ", 4, a0[4], (Double.MIN_VALUE+VALUE)); - errn += verify("test_adda: ", 5, a0[5], (Double.MIN_NORMAL+VALUE)); - errn += verify("test_adda: ", 6, a0[6], ((ADD_INIT+6)+Double.NaN)); - errn += verify("test_adda: ", 7, a0[7], ((ADD_INIT+7)+Double.POSITIVE_INFINITY)); - errn += verify("test_adda: ", 8, a0[8], ((ADD_INIT+8)+Double.NEGATIVE_INFINITY)); - errn += verify("test_adda: ", 9, a0[9], ((ADD_INIT+9)+Double.MAX_VALUE)); - errn += verify("test_adda: ", 10, a0[10], ((ADD_INIT+10)+Double.MIN_VALUE)); - errn += verify("test_adda: ", 11, a0[11], ((ADD_INIT+11)+Double.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_adda: ", i, a0[i], ((ADD_INIT+i)+VALUE)); - } - - test_subc(a0, a1); - errn += verify("test_subc: ", 0, a0[0], (Double.NaN-VALUE)); - errn += verify("test_subc: ", 1, a0[1], (Double.POSITIVE_INFINITY-VALUE)); - errn += verify("test_subc: ", 2, a0[2], (Double.NEGATIVE_INFINITY-VALUE)); - errn += verify("test_subc: ", 3, a0[3], (Double.MAX_VALUE-VALUE)); - errn += verify("test_subc: ", 4, a0[4], (Double.MIN_VALUE-VALUE)); - errn += verify("test_subc: ", 5, a0[5], (Double.MIN_NORMAL-VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_subc: ", i, a0[i], ((ADD_INIT+i)-VALUE)); - } - test_subv(a0, a1, VALUE); - errn += verify("test_subv: ", 0, a0[0], (Double.NaN-VALUE)); - errn += verify("test_subv: ", 1, a0[1], (Double.POSITIVE_INFINITY-VALUE)); - errn += verify("test_subv: ", 2, a0[2], (Double.NEGATIVE_INFINITY-VALUE)); - errn += verify("test_subv: ", 3, a0[3], (Double.MAX_VALUE-VALUE)); - errn += verify("test_subv: ", 4, a0[4], (Double.MIN_VALUE-VALUE)); - errn += verify("test_subv: ", 5, a0[5], (Double.MIN_NORMAL-VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_subv: ", i, a0[i], ((ADD_INIT+i)-VALUE)); - } - test_suba(a0, a1, a2); - errn += verify("test_suba: ", 0, a0[0], (Double.NaN-VALUE)); - errn += verify("test_suba: ", 1, a0[1], (Double.POSITIVE_INFINITY-VALUE)); - errn += verify("test_suba: ", 2, a0[2], (Double.NEGATIVE_INFINITY-VALUE)); - errn += verify("test_suba: ", 3, a0[3], (Double.MAX_VALUE-VALUE)); - errn += verify("test_suba: ", 4, a0[4], (Double.MIN_VALUE-VALUE)); - errn += verify("test_suba: ", 5, a0[5], (Double.MIN_NORMAL-VALUE)); - errn += verify("test_suba: ", 6, a0[6], ((ADD_INIT+6)-Double.NaN)); - errn += verify("test_suba: ", 7, a0[7], ((ADD_INIT+7)-Double.POSITIVE_INFINITY)); - errn += verify("test_suba: ", 8, a0[8], ((ADD_INIT+8)-Double.NEGATIVE_INFINITY)); - errn += verify("test_suba: ", 9, a0[9], ((ADD_INIT+9)-Double.MAX_VALUE)); - errn += verify("test_suba: ", 10, a0[10], ((ADD_INIT+10)-Double.MIN_VALUE)); - errn += verify("test_suba: ", 11, a0[11], ((ADD_INIT+11)-Double.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_suba: ", i, a0[i], ((ADD_INIT+i)-VALUE)); - } - - test_mulc(a0, a1); - errn += verify("test_mulc: ", 0, a0[0], (Double.NaN*VALUE)); - errn += verify("test_mulc: ", 1, a0[1], (Double.POSITIVE_INFINITY*VALUE)); - errn += verify("test_mulc: ", 2, a0[2], (Double.NEGATIVE_INFINITY*VALUE)); - errn += verify("test_mulc: ", 3, a0[3], (Double.MAX_VALUE*VALUE)); - errn += verify("test_mulc: ", 4, a0[4], (Double.MIN_VALUE*VALUE)); - errn += verify("test_mulc: ", 5, a0[5], (Double.MIN_NORMAL*VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulc: ", i, a0[i], ((ADD_INIT+i)*VALUE)); - } - test_mulv(a0, a1, VALUE); - errn += verify("test_mulv: ", 0, a0[0], (Double.NaN*VALUE)); - errn += verify("test_mulv: ", 1, a0[1], (Double.POSITIVE_INFINITY*VALUE)); - errn += verify("test_mulv: ", 2, a0[2], (Double.NEGATIVE_INFINITY*VALUE)); - errn += verify("test_mulv: ", 3, a0[3], (Double.MAX_VALUE*VALUE)); - errn += verify("test_mulv: ", 4, a0[4], (Double.MIN_VALUE*VALUE)); - errn += verify("test_mulv: ", 5, a0[5], (Double.MIN_NORMAL*VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulv: ", i, a0[i], ((ADD_INIT+i)*VALUE)); - } - test_mula(a0, a1, a2); - errn += verify("test_mula: ", 0, a0[0], (Double.NaN*VALUE)); - errn += verify("test_mula: ", 1, a0[1], (Double.POSITIVE_INFINITY*VALUE)); - errn += verify("test_mula: ", 2, a0[2], (Double.NEGATIVE_INFINITY*VALUE)); - errn += verify("test_mula: ", 3, a0[3], (Double.MAX_VALUE*VALUE)); - errn += verify("test_mula: ", 4, a0[4], (Double.MIN_VALUE*VALUE)); - errn += verify("test_mula: ", 5, a0[5], (Double.MIN_NORMAL*VALUE)); - errn += verify("test_mula: ", 6, a0[6], ((ADD_INIT+6)*Double.NaN)); - errn += verify("test_mula: ", 7, a0[7], ((ADD_INIT+7)*Double.POSITIVE_INFINITY)); - errn += verify("test_mula: ", 8, a0[8], ((ADD_INIT+8)*Double.NEGATIVE_INFINITY)); - errn += verify("test_mula: ", 9, a0[9], ((ADD_INIT+9)*Double.MAX_VALUE)); - errn += verify("test_mula: ", 10, a0[10], ((ADD_INIT+10)*Double.MIN_VALUE)); - errn += verify("test_mula: ", 11, a0[11], ((ADD_INIT+11)*Double.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_mula: ", i, a0[i], ((ADD_INIT+i)*VALUE)); - } - - test_divc(a0, a1); - errn += verify("test_divc: ", 0, a0[0], (Double.NaN/VALUE)); - errn += verify("test_divc: ", 1, a0[1], (Double.POSITIVE_INFINITY/VALUE)); - errn += verify("test_divc: ", 2, a0[2], (Double.NEGATIVE_INFINITY/VALUE)); - errn += verify("test_divc: ", 3, a0[3], (Double.MAX_VALUE/VALUE)); - errn += verify("test_divc: ", 4, a0[4], (Double.MIN_VALUE/VALUE)); - errn += verify("test_divc: ", 5, a0[5], (Double.MIN_NORMAL/VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divc: ", i, a0[i], ((ADD_INIT+i)/VALUE)); - } - test_divv(a0, a1, VALUE); - errn += verify("test_divv: ", 0, a0[0], (Double.NaN/VALUE)); - errn += verify("test_divv: ", 1, a0[1], (Double.POSITIVE_INFINITY/VALUE)); - errn += verify("test_divv: ", 2, a0[2], (Double.NEGATIVE_INFINITY/VALUE)); - errn += verify("test_divv: ", 3, a0[3], (Double.MAX_VALUE/VALUE)); - errn += verify("test_divv: ", 4, a0[4], (Double.MIN_VALUE/VALUE)); - errn += verify("test_divv: ", 5, a0[5], (Double.MIN_NORMAL/VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divv: ", i, a0[i], ((ADD_INIT+i)/VALUE)); - } - test_diva(a0, a1, a2); - errn += verify("test_diva: ", 0, a0[0], (Double.NaN/VALUE)); - errn += verify("test_diva: ", 1, a0[1], (Double.POSITIVE_INFINITY/VALUE)); - errn += verify("test_diva: ", 2, a0[2], (Double.NEGATIVE_INFINITY/VALUE)); - errn += verify("test_diva: ", 3, a0[3], (Double.MAX_VALUE/VALUE)); - errn += verify("test_diva: ", 4, a0[4], (Double.MIN_VALUE/VALUE)); - errn += verify("test_diva: ", 5, a0[5], (Double.MIN_NORMAL/VALUE)); - errn += verify("test_diva: ", 6, a0[6], ((ADD_INIT+6)/Double.NaN)); - errn += verify("test_diva: ", 7, a0[7], ((ADD_INIT+7)/Double.POSITIVE_INFINITY)); - errn += verify("test_diva: ", 8, a0[8], ((ADD_INIT+8)/Double.NEGATIVE_INFINITY)); - errn += verify("test_diva: ", 9, a0[9], ((ADD_INIT+9)/Double.MAX_VALUE)); - errn += verify("test_diva: ", 10, a0[10], ((ADD_INIT+10)/Double.MIN_VALUE)); - errn += verify("test_diva: ", 11, a0[11], ((ADD_INIT+11)/Double.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_diva: ", i, a0[i], ((ADD_INIT+i)/VALUE)); - } - - test_mulc_n(a0, a1); - errn += verify("test_mulc_n: ", 0, a0[0], (Double.NaN*(-VALUE))); - errn += verify("test_mulc_n: ", 1, a0[1], (Double.POSITIVE_INFINITY*(-VALUE))); - errn += verify("test_mulc_n: ", 2, a0[2], (Double.NEGATIVE_INFINITY*(-VALUE))); - errn += verify("test_mulc_n: ", 3, a0[3], (Double.MAX_VALUE*(-VALUE))); - errn += verify("test_mulc_n: ", 4, a0[4], (Double.MIN_VALUE*(-VALUE))); - errn += verify("test_mulc_n: ", 5, a0[5], (Double.MIN_NORMAL*(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulc_n: ", i, a0[i], ((ADD_INIT+i)*(-VALUE))); - } - test_mulv(a0, a1, -VALUE); - errn += verify("test_mulv_n: ", 0, a0[0], (Double.NaN*(-VALUE))); - errn += verify("test_mulv_n: ", 1, a0[1], (Double.POSITIVE_INFINITY*(-VALUE))); - errn += verify("test_mulv_n: ", 2, a0[2], (Double.NEGATIVE_INFINITY*(-VALUE))); - errn += verify("test_mulv_n: ", 3, a0[3], (Double.MAX_VALUE*(-VALUE))); - errn += verify("test_mulv_n: ", 4, a0[4], (Double.MIN_VALUE*(-VALUE))); - errn += verify("test_mulv_n: ", 5, a0[5], (Double.MIN_NORMAL*(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulv_n: ", i, a0[i], ((ADD_INIT+i)*(-VALUE))); - } - test_mula(a0, a1, a3); - errn += verify("test_mula_n: ", 0, a0[0], (Double.NaN*(-VALUE))); - errn += verify("test_mula_n: ", 1, a0[1], (Double.POSITIVE_INFINITY*(-VALUE))); - errn += verify("test_mula_n: ", 2, a0[2], (Double.NEGATIVE_INFINITY*(-VALUE))); - errn += verify("test_mula_n: ", 3, a0[3], (Double.MAX_VALUE*(-VALUE))); - errn += verify("test_mula_n: ", 4, a0[4], (Double.MIN_VALUE*(-VALUE))); - errn += verify("test_mula_n: ", 5, a0[5], (Double.MIN_NORMAL*(-VALUE))); - errn += verify("test_mula_n: ", 6, a0[6], ((ADD_INIT+6)*(-Double.NaN))); - errn += verify("test_mula_n: ", 7, a0[7], ((ADD_INIT+7)*(-Double.POSITIVE_INFINITY))); - errn += verify("test_mula_n: ", 8, a0[8], ((ADD_INIT+8)*(-Double.NEGATIVE_INFINITY))); - errn += verify("test_mula_n: ", 9, a0[9], ((ADD_INIT+9)*(-Double.MAX_VALUE))); - errn += verify("test_mula_n: ", 10, a0[10], ((ADD_INIT+10)*(-Double.MIN_VALUE))); - errn += verify("test_mula_n: ", 11, a0[11], ((ADD_INIT+11)*(-Double.MIN_NORMAL))); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_mula_n: ", i, a0[i], ((ADD_INIT+i)*(-VALUE))); - } - - test_divc_n(a0, a1); - errn += verify("test_divc_n: ", 0, a0[0], (Double.NaN/(-VALUE))); - errn += verify("test_divc_n: ", 1, a0[1], (Double.POSITIVE_INFINITY/(-VALUE))); - errn += verify("test_divc_n: ", 2, a0[2], (Double.NEGATIVE_INFINITY/(-VALUE))); - errn += verify("test_divc_n: ", 3, a0[3], (Double.MAX_VALUE/(-VALUE))); - errn += verify("test_divc_n: ", 4, a0[4], (Double.MIN_VALUE/(-VALUE))); - errn += verify("test_divc_n: ", 5, a0[5], (Double.MIN_NORMAL/(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divc_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE))); - } - test_divv(a0, a1, -VALUE); - errn += verify("test_divv_n: ", 0, a0[0], (Double.NaN/(-VALUE))); - errn += verify("test_divv_n: ", 1, a0[1], (Double.POSITIVE_INFINITY/(-VALUE))); - errn += verify("test_divv_n: ", 2, a0[2], (Double.NEGATIVE_INFINITY/(-VALUE))); - errn += verify("test_divv_n: ", 3, a0[3], (Double.MAX_VALUE/(-VALUE))); - errn += verify("test_divv_n: ", 4, a0[4], (Double.MIN_VALUE/(-VALUE))); - errn += verify("test_divv_n: ", 5, a0[5], (Double.MIN_NORMAL/(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divv_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE))); - } - test_diva(a0, a1, a3); - errn += verify("test_diva_n: ", 0, a0[0], (Double.NaN/(-VALUE))); - errn += verify("test_diva_n: ", 1, a0[1], (Double.POSITIVE_INFINITY/(-VALUE))); - errn += verify("test_diva_n: ", 2, a0[2], (Double.NEGATIVE_INFINITY/(-VALUE))); - errn += verify("test_diva_n: ", 3, a0[3], (Double.MAX_VALUE/(-VALUE))); - errn += verify("test_diva_n: ", 4, a0[4], (Double.MIN_VALUE/(-VALUE))); - errn += verify("test_diva_n: ", 5, a0[5], (Double.MIN_NORMAL/(-VALUE))); - errn += verify("test_diva_n: ", 6, a0[6], ((ADD_INIT+6)/(-Double.NaN))); - errn += verify("test_diva_n: ", 7, a0[7], ((ADD_INIT+7)/(-Double.POSITIVE_INFINITY))); - errn += verify("test_diva_n: ", 8, a0[8], ((ADD_INIT+8)/(-Double.NEGATIVE_INFINITY))); - errn += verify("test_diva_n: ", 9, a0[9], ((ADD_INIT+9)/(-Double.MAX_VALUE))); - errn += verify("test_diva_n: ", 10, a0[10], ((ADD_INIT+10)/(-Double.MIN_VALUE))); - errn += verify("test_diva_n: ", 11, a0[11], ((ADD_INIT+11)/(-Double.MIN_NORMAL))); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_diva_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE))); - } - - } - - if (errn > 0) - return errn; - - System.out.println("Time"); - long start, end; - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sum: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_addc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_addv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_adda(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_adda: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_subc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_subv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_suba(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_suba: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_mula: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_diva: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_mula_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_diva_n: " + (end - start)); - - return errn; - } - - static double test_sum(double[] a1) { - double sum = 0; - for (int i = 0; i < a1.length; i+=1) { - sum += a1[i]; - } - return sum; - } - - static void test_addc(double[] a0, double[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]+VALUE); - } - } - static void test_addv(double[] a0, double[] a1, double b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]+b); - } - } - static void test_adda(double[] a0, double[] a1, double[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]+a2[i]); - } - } - - static void test_subc(double[] a0, double[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]-VALUE); - } - } - static void test_subv(double[] a0, double[] a1, double b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]-b); - } - } - static void test_suba(double[] a0, double[] a1, double[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]-a2[i]); - } - } - - static void test_mulc(double[] a0, double[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*VALUE); - } - } - static void test_mulc_n(double[] a0, double[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*(-VALUE)); - } - } - static void test_mulv(double[] a0, double[] a1, double b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*b); - } - } - static void test_mula(double[] a0, double[] a1, double[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*a2[i]); - } - } - - static void test_divc(double[] a0, double[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/VALUE); - } - } - static void test_divc_n(double[] a0, double[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/(-VALUE)); - } - } - static void test_divv(double[] a0, double[] a1, double b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/b); - } - } - static void test_diva(double[] a0, double[] a1, double[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/a2[i]); - } - } - - static int verify(String text, int i, double elem, double val) { - if (elem != val && !(Double.isNaN(elem) && Double.isNaN(val))) { - System.err.println(text + "[" + i + "] = " + elem + " != " + val); - return 1; - } - return 0; - } -}
--- a/test/compiler/6340864/TestFloatVect.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,560 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6340864 - * @summary Implement vectorization optimizations in hotspot-server - * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestFloatVect - */ - -public class TestFloatVect { - private static final int ARRLEN = 997; - private static final int ITERS = 11000; - private static final float ADD_INIT = -7500.f; - private static final float VALUE = 15.f; - - public static void main(String args[]) { - System.out.println("Testing Float vectors"); - int errn = test(); - if (errn > 0) { - System.err.println("FAILED: " + errn + " errors"); - System.exit(97); - } - System.out.println("PASSED"); - } - - static int test() { - float[] a0 = new float[ARRLEN]; - float[] a1 = new float[ARRLEN]; - float[] a2 = new float[ARRLEN]; - float[] a3 = new float[ARRLEN]; - // Initialize - float gold_sum = 0; - for (int i=0; i<ARRLEN; i++) { - float val = ADD_INIT+(float)i; - gold_sum += val; - a1[i] = val; - a2[i] = VALUE; - a3[i] = -VALUE; - } - - System.out.println("Warmup"); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - test_addc(a0, a1); - test_addv(a0, a1, VALUE); - test_adda(a0, a1, a2); - test_subc(a0, a1); - test_subv(a0, a1, VALUE); - test_suba(a0, a1, a2); - test_mulc(a0, a1); - test_mulv(a0, a1, VALUE); - test_mula(a0, a1, a2); - test_divc(a0, a1); - test_divv(a0, a1, VALUE); - test_diva(a0, a1, a2); - test_mulc_n(a0, a1); - test_mulv(a0, a1, -VALUE); - test_mula(a0, a1, a3); - test_divc_n(a0, a1); - test_divv(a0, a1, -VALUE); - test_diva(a0, a1, a3); - } - // Test and verify results - System.out.println("Verification"); - int errn = 0; - { - float sum = test_sum(a1); - if (sum != gold_sum) { - System.err.println("test_sum: " + sum + " != " + gold_sum); - errn++; - } - // Overwrite with NaN values - a1[0] = Float.NaN; - a1[1] = Float.POSITIVE_INFINITY; - a1[2] = Float.NEGATIVE_INFINITY; - a1[3] = Float.MAX_VALUE; - a1[4] = Float.MIN_VALUE; - a1[5] = Float.MIN_NORMAL; - - a2[6] = a1[0]; - a2[7] = a1[1]; - a2[8] = a1[2]; - a2[9] = a1[3]; - a2[10] = a1[4]; - a2[11] = a1[5]; - - a3[6] = -a2[6]; - a3[7] = -a2[7]; - a3[8] = -a2[8]; - a3[9] = -a2[9]; - a3[10] = -a2[10]; - a3[11] = -a2[11]; - - test_addc(a0, a1); - errn += verify("test_addc: ", 0, a0[0], (Float.NaN+VALUE)); - errn += verify("test_addc: ", 1, a0[1], (Float.POSITIVE_INFINITY+VALUE)); - errn += verify("test_addc: ", 2, a0[2], (Float.NEGATIVE_INFINITY+VALUE)); - errn += verify("test_addc: ", 3, a0[3], (Float.MAX_VALUE+VALUE)); - errn += verify("test_addc: ", 4, a0[4], (Float.MIN_VALUE+VALUE)); - errn += verify("test_addc: ", 5, a0[5], (Float.MIN_NORMAL+VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_addc: ", i, a0[i], ((ADD_INIT+i)+VALUE)); - } - test_addv(a0, a1, VALUE); - errn += verify("test_addv: ", 0, a0[0], (Float.NaN+VALUE)); - errn += verify("test_addv: ", 1, a0[1], (Float.POSITIVE_INFINITY+VALUE)); - errn += verify("test_addv: ", 2, a0[2], (Float.NEGATIVE_INFINITY+VALUE)); - errn += verify("test_addv: ", 3, a0[3], (Float.MAX_VALUE+VALUE)); - errn += verify("test_addv: ", 4, a0[4], (Float.MIN_VALUE+VALUE)); - errn += verify("test_addv: ", 5, a0[5], (Float.MIN_NORMAL+VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_addv: ", i, a0[i], ((ADD_INIT+i)+VALUE)); - } - test_adda(a0, a1, a2); - errn += verify("test_adda: ", 0, a0[0], (Float.NaN+VALUE)); - errn += verify("test_adda: ", 1, a0[1], (Float.POSITIVE_INFINITY+VALUE)); - errn += verify("test_adda: ", 2, a0[2], (Float.NEGATIVE_INFINITY+VALUE)); - errn += verify("test_adda: ", 3, a0[3], (Float.MAX_VALUE+VALUE)); - errn += verify("test_adda: ", 4, a0[4], (Float.MIN_VALUE+VALUE)); - errn += verify("test_adda: ", 5, a0[5], (Float.MIN_NORMAL+VALUE)); - errn += verify("test_adda: ", 6, a0[6], ((ADD_INIT+6)+Float.NaN)); - errn += verify("test_adda: ", 7, a0[7], ((ADD_INIT+7)+Float.POSITIVE_INFINITY)); - errn += verify("test_adda: ", 8, a0[8], ((ADD_INIT+8)+Float.NEGATIVE_INFINITY)); - errn += verify("test_adda: ", 9, a0[9], ((ADD_INIT+9)+Float.MAX_VALUE)); - errn += verify("test_adda: ", 10, a0[10], ((ADD_INIT+10)+Float.MIN_VALUE)); - errn += verify("test_adda: ", 11, a0[11], ((ADD_INIT+11)+Float.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_adda: ", i, a0[i], ((ADD_INIT+i)+VALUE)); - } - - test_subc(a0, a1); - errn += verify("test_subc: ", 0, a0[0], (Float.NaN-VALUE)); - errn += verify("test_subc: ", 1, a0[1], (Float.POSITIVE_INFINITY-VALUE)); - errn += verify("test_subc: ", 2, a0[2], (Float.NEGATIVE_INFINITY-VALUE)); - errn += verify("test_subc: ", 3, a0[3], (Float.MAX_VALUE-VALUE)); - errn += verify("test_subc: ", 4, a0[4], (Float.MIN_VALUE-VALUE)); - errn += verify("test_subc: ", 5, a0[5], (Float.MIN_NORMAL-VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_subc: ", i, a0[i], ((ADD_INIT+i)-VALUE)); - } - test_subv(a0, a1, VALUE); - errn += verify("test_subv: ", 0, a0[0], (Float.NaN-VALUE)); - errn += verify("test_subv: ", 1, a0[1], (Float.POSITIVE_INFINITY-VALUE)); - errn += verify("test_subv: ", 2, a0[2], (Float.NEGATIVE_INFINITY-VALUE)); - errn += verify("test_subv: ", 3, a0[3], (Float.MAX_VALUE-VALUE)); - errn += verify("test_subv: ", 4, a0[4], (Float.MIN_VALUE-VALUE)); - errn += verify("test_subv: ", 5, a0[5], (Float.MIN_NORMAL-VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_subv: ", i, a0[i], ((ADD_INIT+i)-VALUE)); - } - test_suba(a0, a1, a2); - errn += verify("test_suba: ", 0, a0[0], (Float.NaN-VALUE)); - errn += verify("test_suba: ", 1, a0[1], (Float.POSITIVE_INFINITY-VALUE)); - errn += verify("test_suba: ", 2, a0[2], (Float.NEGATIVE_INFINITY-VALUE)); - errn += verify("test_suba: ", 3, a0[3], (Float.MAX_VALUE-VALUE)); - errn += verify("test_suba: ", 4, a0[4], (Float.MIN_VALUE-VALUE)); - errn += verify("test_suba: ", 5, a0[5], (Float.MIN_NORMAL-VALUE)); - errn += verify("test_suba: ", 6, a0[6], ((ADD_INIT+6)-Float.NaN)); - errn += verify("test_suba: ", 7, a0[7], ((ADD_INIT+7)-Float.POSITIVE_INFINITY)); - errn += verify("test_suba: ", 8, a0[8], ((ADD_INIT+8)-Float.NEGATIVE_INFINITY)); - errn += verify("test_suba: ", 9, a0[9], ((ADD_INIT+9)-Float.MAX_VALUE)); - errn += verify("test_suba: ", 10, a0[10], ((ADD_INIT+10)-Float.MIN_VALUE)); - errn += verify("test_suba: ", 11, a0[11], ((ADD_INIT+11)-Float.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_suba: ", i, a0[i], ((ADD_INIT+i)-VALUE)); - } - - test_mulc(a0, a1); - errn += verify("test_mulc: ", 0, a0[0], (Float.NaN*VALUE)); - errn += verify("test_mulc: ", 1, a0[1], (Float.POSITIVE_INFINITY*VALUE)); - errn += verify("test_mulc: ", 2, a0[2], (Float.NEGATIVE_INFINITY*VALUE)); - errn += verify("test_mulc: ", 3, a0[3], (Float.MAX_VALUE*VALUE)); - errn += verify("test_mulc: ", 4, a0[4], (Float.MIN_VALUE*VALUE)); - errn += verify("test_mulc: ", 5, a0[5], (Float.MIN_NORMAL*VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulc: ", i, a0[i], ((ADD_INIT+i)*VALUE)); - } - test_mulv(a0, a1, VALUE); - errn += verify("test_mulv: ", 0, a0[0], (Float.NaN*VALUE)); - errn += verify("test_mulv: ", 1, a0[1], (Float.POSITIVE_INFINITY*VALUE)); - errn += verify("test_mulv: ", 2, a0[2], (Float.NEGATIVE_INFINITY*VALUE)); - errn += verify("test_mulv: ", 3, a0[3], (Float.MAX_VALUE*VALUE)); - errn += verify("test_mulv: ", 4, a0[4], (Float.MIN_VALUE*VALUE)); - errn += verify("test_mulv: ", 5, a0[5], (Float.MIN_NORMAL*VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulv: ", i, a0[i], ((ADD_INIT+i)*VALUE)); - } - test_mula(a0, a1, a2); - errn += verify("test_mula: ", 0, a0[0], (Float.NaN*VALUE)); - errn += verify("test_mula: ", 1, a0[1], (Float.POSITIVE_INFINITY*VALUE)); - errn += verify("test_mula: ", 2, a0[2], (Float.NEGATIVE_INFINITY*VALUE)); - errn += verify("test_mula: ", 3, a0[3], (Float.MAX_VALUE*VALUE)); - errn += verify("test_mula: ", 4, a0[4], (Float.MIN_VALUE*VALUE)); - errn += verify("test_mula: ", 5, a0[5], (Float.MIN_NORMAL*VALUE)); - errn += verify("test_mula: ", 6, a0[6], ((ADD_INIT+6)*Float.NaN)); - errn += verify("test_mula: ", 7, a0[7], ((ADD_INIT+7)*Float.POSITIVE_INFINITY)); - errn += verify("test_mula: ", 8, a0[8], ((ADD_INIT+8)*Float.NEGATIVE_INFINITY)); - errn += verify("test_mula: ", 9, a0[9], ((ADD_INIT+9)*Float.MAX_VALUE)); - errn += verify("test_mula: ", 10, a0[10], ((ADD_INIT+10)*Float.MIN_VALUE)); - errn += verify("test_mula: ", 11, a0[11], ((ADD_INIT+11)*Float.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_mula: ", i, a0[i], ((ADD_INIT+i)*VALUE)); - } - - test_divc(a0, a1); - errn += verify("test_divc: ", 0, a0[0], (Float.NaN/VALUE)); - errn += verify("test_divc: ", 1, a0[1], (Float.POSITIVE_INFINITY/VALUE)); - errn += verify("test_divc: ", 2, a0[2], (Float.NEGATIVE_INFINITY/VALUE)); - errn += verify("test_divc: ", 3, a0[3], (Float.MAX_VALUE/VALUE)); - errn += verify("test_divc: ", 4, a0[4], (Float.MIN_VALUE/VALUE)); - errn += verify("test_divc: ", 5, a0[5], (Float.MIN_NORMAL/VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divc: ", i, a0[i], ((ADD_INIT+i)/VALUE)); - } - test_divv(a0, a1, VALUE); - errn += verify("test_divv: ", 0, a0[0], (Float.NaN/VALUE)); - errn += verify("test_divv: ", 1, a0[1], (Float.POSITIVE_INFINITY/VALUE)); - errn += verify("test_divv: ", 2, a0[2], (Float.NEGATIVE_INFINITY/VALUE)); - errn += verify("test_divv: ", 3, a0[3], (Float.MAX_VALUE/VALUE)); - errn += verify("test_divv: ", 4, a0[4], (Float.MIN_VALUE/VALUE)); - errn += verify("test_divv: ", 5, a0[5], (Float.MIN_NORMAL/VALUE)); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divv: ", i, a0[i], ((ADD_INIT+i)/VALUE)); - } - test_diva(a0, a1, a2); - errn += verify("test_diva: ", 0, a0[0], (Float.NaN/VALUE)); - errn += verify("test_diva: ", 1, a0[1], (Float.POSITIVE_INFINITY/VALUE)); - errn += verify("test_diva: ", 2, a0[2], (Float.NEGATIVE_INFINITY/VALUE)); - errn += verify("test_diva: ", 3, a0[3], (Float.MAX_VALUE/VALUE)); - errn += verify("test_diva: ", 4, a0[4], (Float.MIN_VALUE/VALUE)); - errn += verify("test_diva: ", 5, a0[5], (Float.MIN_NORMAL/VALUE)); - errn += verify("test_diva: ", 6, a0[6], ((ADD_INIT+6)/Float.NaN)); - errn += verify("test_diva: ", 7, a0[7], ((ADD_INIT+7)/Float.POSITIVE_INFINITY)); - errn += verify("test_diva: ", 8, a0[8], ((ADD_INIT+8)/Float.NEGATIVE_INFINITY)); - errn += verify("test_diva: ", 9, a0[9], ((ADD_INIT+9)/Float.MAX_VALUE)); - errn += verify("test_diva: ", 10, a0[10], ((ADD_INIT+10)/Float.MIN_VALUE)); - errn += verify("test_diva: ", 11, a0[11], ((ADD_INIT+11)/Float.MIN_NORMAL)); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_diva: ", i, a0[i], ((ADD_INIT+i)/VALUE)); - } - - test_mulc_n(a0, a1); - errn += verify("test_mulc_n: ", 0, a0[0], (Float.NaN*(-VALUE))); - errn += verify("test_mulc_n: ", 1, a0[1], (Float.POSITIVE_INFINITY*(-VALUE))); - errn += verify("test_mulc_n: ", 2, a0[2], (Float.NEGATIVE_INFINITY*(-VALUE))); - errn += verify("test_mulc_n: ", 3, a0[3], (Float.MAX_VALUE*(-VALUE))); - errn += verify("test_mulc_n: ", 4, a0[4], (Float.MIN_VALUE*(-VALUE))); - errn += verify("test_mulc_n: ", 5, a0[5], (Float.MIN_NORMAL*(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulc_n: ", i, a0[i], ((ADD_INIT+i)*(-VALUE))); - } - test_mulv(a0, a1, -VALUE); - errn += verify("test_mulv_n: ", 0, a0[0], (Float.NaN*(-VALUE))); - errn += verify("test_mulv_n: ", 1, a0[1], (Float.POSITIVE_INFINITY*(-VALUE))); - errn += verify("test_mulv_n: ", 2, a0[2], (Float.NEGATIVE_INFINITY*(-VALUE))); - errn += verify("test_mulv_n: ", 3, a0[3], (Float.MAX_VALUE*(-VALUE))); - errn += verify("test_mulv_n: ", 4, a0[4], (Float.MIN_VALUE*(-VALUE))); - errn += verify("test_mulv_n: ", 5, a0[5], (Float.MIN_NORMAL*(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_mulv_n: ", i, a0[i], ((ADD_INIT+i)*(-VALUE))); - } - test_mula(a0, a1, a3); - errn += verify("test_mula_n: ", 0, a0[0], (Float.NaN*(-VALUE))); - errn += verify("test_mula_n: ", 1, a0[1], (Float.POSITIVE_INFINITY*(-VALUE))); - errn += verify("test_mula_n: ", 2, a0[2], (Float.NEGATIVE_INFINITY*(-VALUE))); - errn += verify("test_mula_n: ", 3, a0[3], (Float.MAX_VALUE*(-VALUE))); - errn += verify("test_mula_n: ", 4, a0[4], (Float.MIN_VALUE*(-VALUE))); - errn += verify("test_mula_n: ", 5, a0[5], (Float.MIN_NORMAL*(-VALUE))); - errn += verify("test_mula_n: ", 6, a0[6], ((ADD_INIT+6)*(-Float.NaN))); - errn += verify("test_mula_n: ", 7, a0[7], ((ADD_INIT+7)*(-Float.POSITIVE_INFINITY))); - errn += verify("test_mula_n: ", 8, a0[8], ((ADD_INIT+8)*(-Float.NEGATIVE_INFINITY))); - errn += verify("test_mula_n: ", 9, a0[9], ((ADD_INIT+9)*(-Float.MAX_VALUE))); - errn += verify("test_mula_n: ", 10, a0[10], ((ADD_INIT+10)*(-Float.MIN_VALUE))); - errn += verify("test_mula_n: ", 11, a0[11], ((ADD_INIT+11)*(-Float.MIN_NORMAL))); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_mula_n: ", i, a0[i], ((ADD_INIT+i)*(-VALUE))); - } - - test_divc_n(a0, a1); - errn += verify("test_divc_n: ", 0, a0[0], (Float.NaN/(-VALUE))); - errn += verify("test_divc_n: ", 1, a0[1], (Float.POSITIVE_INFINITY/(-VALUE))); - errn += verify("test_divc_n: ", 2, a0[2], (Float.NEGATIVE_INFINITY/(-VALUE))); - errn += verify("test_divc_n: ", 3, a0[3], (Float.MAX_VALUE/(-VALUE))); - errn += verify("test_divc_n: ", 4, a0[4], (Float.MIN_VALUE/(-VALUE))); - errn += verify("test_divc_n: ", 5, a0[5], (Float.MIN_NORMAL/(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divc_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE))); - } - test_divv(a0, a1, -VALUE); - errn += verify("test_divv_n: ", 0, a0[0], (Float.NaN/(-VALUE))); - errn += verify("test_divv_n: ", 1, a0[1], (Float.POSITIVE_INFINITY/(-VALUE))); - errn += verify("test_divv_n: ", 2, a0[2], (Float.NEGATIVE_INFINITY/(-VALUE))); - errn += verify("test_divv_n: ", 3, a0[3], (Float.MAX_VALUE/(-VALUE))); - errn += verify("test_divv_n: ", 4, a0[4], (Float.MIN_VALUE/(-VALUE))); - errn += verify("test_divv_n: ", 5, a0[5], (Float.MIN_NORMAL/(-VALUE))); - for (int i=6; i<ARRLEN; i++) { - errn += verify("test_divv_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE))); - } - test_diva(a0, a1, a3); - errn += verify("test_diva_n: ", 0, a0[0], (Float.NaN/(-VALUE))); - errn += verify("test_diva_n: ", 1, a0[1], (Float.POSITIVE_INFINITY/(-VALUE))); - errn += verify("test_diva_n: ", 2, a0[2], (Float.NEGATIVE_INFINITY/(-VALUE))); - errn += verify("test_diva_n: ", 3, a0[3], (Float.MAX_VALUE/(-VALUE))); - errn += verify("test_diva_n: ", 4, a0[4], (Float.MIN_VALUE/(-VALUE))); - errn += verify("test_diva_n: ", 5, a0[5], (Float.MIN_NORMAL/(-VALUE))); - errn += verify("test_diva_n: ", 6, a0[6], ((ADD_INIT+6)/(-Float.NaN))); - errn += verify("test_diva_n: ", 7, a0[7], ((ADD_INIT+7)/(-Float.POSITIVE_INFINITY))); - errn += verify("test_diva_n: ", 8, a0[8], ((ADD_INIT+8)/(-Float.NEGATIVE_INFINITY))); - errn += verify("test_diva_n: ", 9, a0[9], ((ADD_INIT+9)/(-Float.MAX_VALUE))); - errn += verify("test_diva_n: ", 10, a0[10], ((ADD_INIT+10)/(-Float.MIN_VALUE))); - errn += verify("test_diva_n: ", 11, a0[11], ((ADD_INIT+11)/(-Float.MIN_NORMAL))); - for (int i=12; i<ARRLEN; i++) { - errn += verify("test_diva_n: ", i, a0[i], ((ADD_INIT+i)/(-VALUE))); - } - - } - - if (errn > 0) - return errn; - - System.out.println("Time"); - long start, end; - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sum: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_addc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_addv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_adda(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_adda: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_subc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_subv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_suba(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_suba: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_mula: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_diva: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_mula_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_diva_n: " + (end - start)); - - return errn; - } - - static float test_sum(float[] a1) { - float sum = 0; - for (int i = 0; i < a1.length; i+=1) { - sum += a1[i]; - } - return sum; - } - - static void test_addc(float[] a0, float[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]+VALUE); - } - } - static void test_addv(float[] a0, float[] a1, float b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]+b); - } - } - static void test_adda(float[] a0, float[] a1, float[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]+a2[i]); - } - } - - static void test_subc(float[] a0, float[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]-VALUE); - } - } - static void test_subv(float[] a0, float[] a1, float b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]-b); - } - } - static void test_suba(float[] a0, float[] a1, float[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]-a2[i]); - } - } - - static void test_mulc(float[] a0, float[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*VALUE); - } - } - static void test_mulc_n(float[] a0, float[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*(-VALUE)); - } - } - static void test_mulv(float[] a0, float[] a1, float b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*b); - } - } - static void test_mula(float[] a0, float[] a1, float[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]*a2[i]); - } - } - - static void test_divc(float[] a0, float[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/VALUE); - } - } - static void test_divc_n(float[] a0, float[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/(-VALUE)); - } - } - static void test_divv(float[] a0, float[] a1, float b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/b); - } - } - static void test_diva(float[] a0, float[] a1, float[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (a1[i]/a2[i]); - } - } - - static int verify(String text, int i, float elem, float val) { - if (elem != val && !(Float.isNaN(elem) && Float.isNaN(val))) { - System.err.println(text + "[" + i + "] = " + elem + " != " + val); - return 1; - } - return 0; - } -}
--- a/test/compiler/6340864/TestIntVect.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1225 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6340864 - * @summary Implement vectorization optimizations in hotspot-server - * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestIntVect - */ - -public class TestIntVect { - private static final int ARRLEN = 997; - private static final int ITERS = 11000; - private static final int ADD_INIT = Integer.MAX_VALUE-500; - private static final int BIT_MASK = 0xEC80F731; - private static final int VALUE = 15; - private static final int SHIFT = 32; - - public static void main(String args[]) { - System.out.println("Testing Integer vectors"); - int errn = test(); - if (errn > 0) { - System.err.println("FAILED: " + errn + " errors"); - System.exit(97); - } - System.out.println("PASSED"); - } - - static int test() { - int[] a0 = new int[ARRLEN]; - int[] a1 = new int[ARRLEN]; - int[] a2 = new int[ARRLEN]; - int[] a3 = new int[ARRLEN]; - int[] a4 = new int[ARRLEN]; - long[] p2 = new long[ARRLEN/2]; - // Initialize - int gold_sum = 0; - for (int i=0; i<ARRLEN; i++) { - int val = (int)(ADD_INIT+i); - gold_sum += val; - a1[i] = val; - a2[i] = (int)VALUE; - a3[i] = (int)-VALUE; - a4[i] = (int)BIT_MASK; - } - System.out.println("Warmup"); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - test_addc(a0, a1); - test_addv(a0, a1, (int)VALUE); - test_adda(a0, a1, a2); - test_subc(a0, a1); - test_subv(a0, a1, (int)VALUE); - test_suba(a0, a1, a2); - - test_mulc(a0, a1); - test_mulv(a0, a1, (int)VALUE); - test_mula(a0, a1, a2); - test_divc(a0, a1); - test_divv(a0, a1, (int)VALUE); - test_diva(a0, a1, a2); - test_mulc_n(a0, a1); - test_mulv(a0, a1, (int)-VALUE); - test_mula(a0, a1, a3); - test_divc_n(a0, a1); - test_divv(a0, a1, (int)-VALUE); - test_diva(a0, a1, a3); - - test_andc(a0, a1); - test_andv(a0, a1, (int)BIT_MASK); - test_anda(a0, a1, a4); - test_orc(a0, a1); - test_orv(a0, a1, (int)BIT_MASK); - test_ora(a0, a1, a4); - test_xorc(a0, a1); - test_xorv(a0, a1, (int)BIT_MASK); - test_xora(a0, a1, a4); - - test_sllc(a0, a1); - test_sllv(a0, a1, VALUE); - test_srlc(a0, a1); - test_srlv(a0, a1, VALUE); - test_srac(a0, a1); - test_srav(a0, a1, VALUE); - - test_sllc_n(a0, a1); - test_sllv(a0, a1, -VALUE); - test_srlc_n(a0, a1); - test_srlv(a0, a1, -VALUE); - test_srac_n(a0, a1); - test_srav(a0, a1, -VALUE); - - test_sllc_o(a0, a1); - test_sllv(a0, a1, SHIFT); - test_srlc_o(a0, a1); - test_srlv(a0, a1, SHIFT); - test_srac_o(a0, a1); - test_srav(a0, a1, SHIFT); - - test_sllc_on(a0, a1); - test_sllv(a0, a1, -SHIFT); - test_srlc_on(a0, a1); - test_srlv(a0, a1, -SHIFT); - test_srac_on(a0, a1); - test_srav(a0, a1, -SHIFT); - - test_sllc_add(a0, a1); - test_sllv_add(a0, a1, ADD_INIT); - test_srlc_add(a0, a1); - test_srlv_add(a0, a1, ADD_INIT); - test_srac_add(a0, a1); - test_srav_add(a0, a1, ADD_INIT); - - test_sllc_and(a0, a1); - test_sllv_and(a0, a1, BIT_MASK); - test_srlc_and(a0, a1); - test_srlv_and(a0, a1, BIT_MASK); - test_srac_and(a0, a1); - test_srav_and(a0, a1, BIT_MASK); - - test_pack2(p2, a1); - test_unpack2(a0, p2); - test_pack2_swap(p2, a1); - test_unpack2_swap(a0, p2); - } - // Test and verify results - System.out.println("Verification"); - int errn = 0; - { - int sum = test_sum(a1); - if (sum != gold_sum) { - System.err.println("test_sum: " + sum + " != " + gold_sum); - errn++; - } - - test_addc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_addc: ", i, a0[i], (int)((int)(ADD_INIT+i)+VALUE)); - } - test_addv(a0, a1, (int)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_addv: ", i, a0[i], (int)((int)(ADD_INIT+i)+VALUE)); - } - test_adda(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_adda: ", i, a0[i], (int)((int)(ADD_INIT+i)+VALUE)); - } - - test_subc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_subc: ", i, a0[i], (int)((int)(ADD_INIT+i)-VALUE)); - } - test_subv(a0, a1, (int)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_subv: ", i, a0[i], (int)((int)(ADD_INIT+i)-VALUE)); - } - test_suba(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_suba: ", i, a0[i], (int)((int)(ADD_INIT+i)-VALUE)); - } - - test_mulc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulc: ", i, a0[i], (int)((int)(ADD_INIT+i)*VALUE)); - } - test_mulv(a0, a1, (int)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulv: ", i, a0[i], (int)((int)(ADD_INIT+i)*VALUE)); - } - test_mula(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mula: ", i, a0[i], (int)((int)(ADD_INIT+i)*VALUE)); - } - - test_divc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divc: ", i, a0[i], (int)((int)(ADD_INIT+i)/VALUE)); - } - test_divv(a0, a1, (int)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divv: ", i, a0[i], (int)((int)(ADD_INIT+i)/VALUE)); - } - test_diva(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_diva: ", i, a0[i], (int)((int)(ADD_INIT+i)/VALUE)); - } - - test_mulc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)*(-VALUE))); - } - test_mulv(a0, a1, (int)-VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)*(-VALUE))); - } - test_mula(a0, a1, a3); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mula_n: ", i, a0[i], (int)((int)(ADD_INIT+i)*(-VALUE))); - } - - test_divc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)/(-VALUE))); - } - test_divv(a0, a1, (int)-VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)/(-VALUE))); - } - test_diva(a0, a1, a3); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_diva_n: ", i, a0[i], (int)((int)(ADD_INIT+i)/(-VALUE))); - } - - test_andc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_andc: ", i, a0[i], (int)((int)(ADD_INIT+i)&BIT_MASK)); - } - test_andv(a0, a1, (int)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_andv: ", i, a0[i], (int)((int)(ADD_INIT+i)&BIT_MASK)); - } - test_anda(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_anda: ", i, a0[i], (int)((int)(ADD_INIT+i)&BIT_MASK)); - } - - test_orc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_orc: ", i, a0[i], (int)((int)(ADD_INIT+i)|BIT_MASK)); - } - test_orv(a0, a1, (int)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_orv: ", i, a0[i], (int)((int)(ADD_INIT+i)|BIT_MASK)); - } - test_ora(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_ora: ", i, a0[i], (int)((int)(ADD_INIT+i)|BIT_MASK)); - } - - test_xorc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xorc: ", i, a0[i], (int)((int)(ADD_INIT+i)^BIT_MASK)); - } - test_xorv(a0, a1, (int)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xorv: ", i, a0[i], (int)((int)(ADD_INIT+i)^BIT_MASK)); - } - test_xora(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xora: ", i, a0[i], (int)((int)(ADD_INIT+i)^BIT_MASK)); - } - - test_sllc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc: ", i, a0[i], (int)((int)(ADD_INIT+i)<<VALUE)); - } - test_sllv(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv: ", i, a0[i], (int)((int)(ADD_INIT+i)<<VALUE)); - } - - test_srlc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>VALUE)); - } - test_srlv(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>VALUE)); - } - - test_srac(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac: ", i, a0[i], (int)((int)(ADD_INIT+i)>>VALUE)); - } - test_srav(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav: ", i, a0[i], (int)((int)(ADD_INIT+i)>>VALUE)); - } - - test_sllc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-VALUE))); - } - test_sllv(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-VALUE))); - } - - test_srlc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-VALUE))); - } - test_srlv(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-VALUE))); - } - - test_srac_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-VALUE))); - } - test_srav(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_n: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-VALUE))); - } - - test_sllc_o(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_o: ", i, a0[i], (int)((int)(ADD_INIT+i)<<SHIFT)); - } - test_sllv(a0, a1, SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_o: ", i, a0[i], (int)((int)(ADD_INIT+i)<<SHIFT)); - } - - test_srlc_o(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>SHIFT)); - } - test_srlv(a0, a1, SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>SHIFT)); - } - - test_srac_o(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>SHIFT)); - } - test_srav(a0, a1, SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_o: ", i, a0[i], (int)((int)(ADD_INIT+i)>>SHIFT)); - } - - test_sllc_on(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_on: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-SHIFT))); - } - test_sllv(a0, a1, -SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_on: ", i, a0[i], (int)((int)(ADD_INIT+i)<<(-SHIFT))); - } - - test_srlc_on(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-SHIFT))); - } - test_srlv(a0, a1, -SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>>(-SHIFT))); - } - - test_srac_on(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-SHIFT))); - } - test_srav(a0, a1, -SHIFT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_on: ", i, a0[i], (int)((int)(ADD_INIT+i)>>(-SHIFT))); - } - - test_sllc_add(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)<<VALUE)); - } - test_sllv_add(a0, a1, ADD_INIT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)<<VALUE)); - } - - test_srlc_add(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>>VALUE)); - } - test_srlv_add(a0, a1, ADD_INIT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>>VALUE)); - } - - test_srac_add(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>VALUE)); - } - test_srav_add(a0, a1, ADD_INIT); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_add: ", i, a0[i], (int)(((int)(ADD_INIT+i) + ADD_INIT)>>VALUE)); - } - - test_sllc_and(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)<<VALUE)); - } - test_sllv_and(a0, a1, BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)<<VALUE)); - } - - test_srlc_and(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>>VALUE)); - } - test_srlv_and(a0, a1, BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>>VALUE)); - } - - test_srac_and(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>VALUE)); - } - test_srav_and(a0, a1, BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav_and: ", i, a0[i], (int)(((int)(ADD_INIT+i) & BIT_MASK)>>VALUE)); - } - - test_pack2(p2, a1); - for (int i=0; i<ARRLEN/2; i++) { - errn += verify("test_pack2: ", i, p2[i], ((long)(ADD_INIT+2*i) & 0xFFFFFFFFl) | ((long)(ADD_INIT+2*i+1) << 32)); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack2(a0, p2); - for (int i=0; i<(ARRLEN&(-2)); i++) { - errn += verify("test_unpack2: ", i, a0[i], (ADD_INIT+i)); - } - - test_pack2_swap(p2, a1); - for (int i=0; i<ARRLEN/2; i++) { - errn += verify("test_pack2_swap: ", i, p2[i], ((long)(ADD_INIT+2*i+1) & 0xFFFFFFFFl) | ((long)(ADD_INIT+2*i) << 32)); - } - for (int i=0; i<ARRLEN; i++) { - a0[i] = -1; - } - test_unpack2_swap(a0, p2); - for (int i=0; i<(ARRLEN&(-2)); i++) { - errn += verify("test_unpack2_swap: ", i, a0[i], (ADD_INIT+i)); - } - - } - - if (errn > 0) - return errn; - - System.out.println("Time"); - long start, end; - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sum: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_addc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_addv(a0, a1, (int)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_addv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_adda(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_adda: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_subc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_subv(a0, a1, (int)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_subv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_suba(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_suba: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, (int)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_mula: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, (int)VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a2); - } - end = System.currentTimeMillis(); - System.out.println("test_diva: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_mulc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mulv(a0, a1, (int)-VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_mulv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_mula(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_mula_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_divc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_divv(a0, a1, (int)-VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_divv_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_diva(a0, a1, a3); - } - end = System.currentTimeMillis(); - System.out.println("test_diva_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_andc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_andc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_andv(a0, a1, (int)BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_andv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_anda(a0, a1, a4); - } - end = System.currentTimeMillis(); - System.out.println("test_anda: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_orc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_orc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_orv(a0, a1, (int)BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_orv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_ora(a0, a1, a4); - } - end = System.currentTimeMillis(); - System.out.println("test_ora: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_xorc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_xorc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_xorv(a0, a1, (int)BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_xorv: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_xora(a0, a1, a4); - } - end = System.currentTimeMillis(); - System.out.println("test_xora: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srav: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_n(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_n: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, -VALUE); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_n: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_o(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_o: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_o: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_o(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_o: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_o: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_o(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_o: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_o: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_on(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_on: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv(a0, a1, -SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_on: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_on(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_on: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv(a0, a1, -SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_on: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_on(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_on: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav(a0, a1, -SHIFT); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_on: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_add(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_add: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv_add(a0, a1, ADD_INIT); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_add: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_add(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_add: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv_add(a0, a1, ADD_INIT); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_add: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_add(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_add: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav_add(a0, a1, ADD_INIT); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_add: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllc_and(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_sllc_and: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_sllv_and(a0, a1, BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_sllv_and: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlc_and(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srlc_and: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srlv_and(a0, a1, BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_srlv_and: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srac_and(a0, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_srac_and: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_srav_and(a0, a1, BIT_MASK); - } - end = System.currentTimeMillis(); - System.out.println("test_srav_and: " + (end - start)); - - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack2(p2, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack2: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack2(a0, p2); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack2: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_pack2_swap(p2, a1); - } - end = System.currentTimeMillis(); - System.out.println("test_pack2_swap: " + (end - start)); - start = System.currentTimeMillis(); - for (int i=0; i<ITERS; i++) { - test_unpack2_swap(a0, p2); - } - end = System.currentTimeMillis(); - System.out.println("test_unpack2_swap: " + (end - start)); - - return errn; - } - - static int test_sum(int[] a1) { - int sum = 0; - for (int i = 0; i < a1.length; i+=1) { - sum += a1[i]; - } - return sum; - } - - static void test_addc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]+VALUE); - } - } - static void test_addv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]+b); - } - } - static void test_adda(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]+a2[i]); - } - } - - static void test_subc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]-VALUE); - } - } - static void test_subv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]-b); - } - } - static void test_suba(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]-a2[i]); - } - } - - static void test_mulc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]*VALUE); - } - } - static void test_mulc_n(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]*(-VALUE)); - } - } - static void test_mulv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]*b); - } - } - static void test_mula(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]*a2[i]); - } - } - - static void test_divc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]/VALUE); - } - } - static void test_divc_n(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]/(-VALUE)); - } - } - static void test_divv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]/b); - } - } - static void test_diva(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]/a2[i]); - } - } - - static void test_andc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]&BIT_MASK); - } - } - static void test_andv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]&b); - } - } - static void test_anda(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]&a2[i]); - } - } - - static void test_orc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]|BIT_MASK); - } - } - static void test_orv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]|b); - } - } - static void test_ora(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]|a2[i]); - } - } - - static void test_xorc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]^BIT_MASK); - } - } - static void test_xorv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]^b); - } - } - static void test_xora(int[] a0, int[] a1, int[] a2) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]^a2[i]); - } - } - - static void test_sllc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]<<VALUE); - } - } - static void test_sllc_n(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]<<(-VALUE)); - } - } - static void test_sllc_o(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]<<SHIFT); - } - } - static void test_sllc_on(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]<<(-SHIFT)); - } - } - static void test_sllv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]<<b); - } - } - static void test_sllc_add(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] + ADD_INIT)<<VALUE); - } - } - static void test_sllv_add(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] + b)<<VALUE); - } - } - static void test_sllc_and(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] & BIT_MASK)<<VALUE); - } - } - static void test_sllv_and(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] & b)<<VALUE); - } - } - - static void test_srlc(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>>VALUE); - } - } - static void test_srlc_n(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>>(-VALUE)); - } - } - static void test_srlc_o(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>>SHIFT); - } - } - static void test_srlc_on(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>>(-SHIFT)); - } - } - static void test_srlv(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>>b); - } - } - static void test_srlc_add(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] + ADD_INIT)>>>VALUE); - } - } - static void test_srlv_add(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] + b)>>>VALUE); - } - } - static void test_srlc_and(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] & BIT_MASK)>>>VALUE); - } - } - static void test_srlv_and(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] & b)>>>VALUE); - } - } - - static void test_srac(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>VALUE); - } - } - static void test_srac_n(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>(-VALUE)); - } - } - static void test_srac_o(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>SHIFT); - } - } - static void test_srac_on(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>(-SHIFT)); - } - } - static void test_srav(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)(a1[i]>>b); - } - } - static void test_srac_add(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] + ADD_INIT)>>VALUE); - } - } - static void test_srav_add(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] + b)>>VALUE); - } - } - static void test_srac_and(int[] a0, int[] a1) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] & BIT_MASK)>>VALUE); - } - } - static void test_srav_and(int[] a0, int[] a1, int b) { - for (int i = 0; i < a0.length; i+=1) { - a0[i] = (int)((a1[i] & b)>>VALUE); - } - } - - static void test_pack2(long[] p2, int[] a1) { - if (p2.length*2 > a1.length) return; - for (int i = 0; i < p2.length; i+=1) { - long l0 = (long)a1[i*2+0]; - long l1 = (long)a1[i*2+1]; - p2[i] = (l1 << 32) | (l0 & 0xFFFFFFFFl); - } - } - static void test_unpack2(int[] a0, long[] p2) { - if (p2.length*2 > a0.length) return; - for (int i = 0; i < p2.length; i+=1) { - long l = p2[i]; - a0[i*2+0] = (int)(l & 0xFFFFFFFFl); - a0[i*2+1] = (int)(l >> 32); - } - } - static void test_pack2_swap(long[] p2, int[] a1) { - if (p2.length*2 > a1.length) return; - for (int i = 0; i < p2.length; i+=1) { - long l0 = (long)a1[i*2+0]; - long l1 = (long)a1[i*2+1]; - p2[i] = (l0 << 32) | (l1 & 0xFFFFFFFFl); - } - } - static void test_unpack2_swap(int[] a0, long[] p2) { - if (p2.length*2 > a0.length) return; - for (int i = 0; i < p2.length; i+=1) { - long l = p2[i]; - a0[i*2+0] = (int)(l >> 32); - a0[i*2+1] = (int)(l & 0xFFFFFFFFl); - } - } - - static int verify(String text, int i, int elem, int val) { - if (elem != val) { - System.err.println(text + "[" + i + "] = " + elem + " != " + val); - return 1; - } - return 0; - } - - static int verify(String text, int i, long elem, long val) { - if (elem != val) { - System.err.println(text + "[" + i + "] = " + Long.toHexString(elem) + " != " + Long.toHexString(val)); - return 1; - } - return 0; - } -}
--- a/test/compiler/6340864/TestLongVect.java Mon Nov 17 23:11:40 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1129 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -/** - * @test - * @bug 6340864 - * @summary Implement vectorization optimizations in hotspot-server - * - * @run main/othervm/timeout=400 -Xbatch -Xmx64m TestLongVect - */ - -public class TestLongVect { - private static final int ARRLEN = 997; - private static final int ITERS = 11000; - private static final long ADD_INIT = Long.MAX_VALUE-500; - private static final long BIT_MASK = 0xEC80F731EC80F731L; - private static final int VALUE = 31; - private static final int SHIFT = 64; - - public static void main(String args[]) { - System.out.println("Testing Long vectors"); - int errn = test(); - if (errn > 0) { - System.err.println("FAILED: " + errn + " errors"); - System.exit(97); - } - System.out.println("PASSED"); - } - - static int test() { - long[] a0 = new long[ARRLEN]; - long[] a1 = new long[ARRLEN]; - long[] a2 = new long[ARRLEN]; - long[] a3 = new long[ARRLEN]; - long[] a4 = new long[ARRLEN]; - // Initialize - long gold_sum = 0; - for (int i=0; i<ARRLEN; i++) { - long val = (long)(ADD_INIT+i); - gold_sum += val; - a1[i] = val; - a2[i] = (long)VALUE; - a3[i] = (long)-VALUE; - a4[i] = (long)BIT_MASK; - } - System.out.println("Warmup"); - for (int i=0; i<ITERS; i++) { - test_sum(a1); - test_addc(a0, a1); - test_addv(a0, a1, (long)VALUE); - test_adda(a0, a1, a2); - test_subc(a0, a1); - test_subv(a0, a1, (long)VALUE); - test_suba(a0, a1, a2); - - test_mulc(a0, a1); - test_mulv(a0, a1, (long)VALUE); - test_mula(a0, a1, a2); - test_divc(a0, a1); - test_divv(a0, a1, (long)VALUE); - test_diva(a0, a1, a2); - test_mulc_n(a0, a1); - test_mulv(a0, a1, (long)-VALUE); - test_mula(a0, a1, a3); - test_divc_n(a0, a1); - test_divv(a0, a1, (long)-VALUE); - test_diva(a0, a1, a3); - - test_andc(a0, a1); - test_andv(a0, a1, (long)BIT_MASK); - test_anda(a0, a1, a4); - test_orc(a0, a1); - test_orv(a0, a1, (long)BIT_MASK); - test_ora(a0, a1, a4); - test_xorc(a0, a1); - test_xorv(a0, a1, (long)BIT_MASK); - test_xora(a0, a1, a4); - - test_sllc(a0, a1); - test_sllv(a0, a1, VALUE); - test_srlc(a0, a1); - test_srlv(a0, a1, VALUE); - test_srac(a0, a1); - test_srav(a0, a1, VALUE); - - test_sllc_n(a0, a1); - test_sllv(a0, a1, -VALUE); - test_srlc_n(a0, a1); - test_srlv(a0, a1, -VALUE); - test_srac_n(a0, a1); - test_srav(a0, a1, -VALUE); - - test_sllc_o(a0, a1); - test_sllv(a0, a1, SHIFT); - test_srlc_o(a0, a1); - test_srlv(a0, a1, SHIFT); - test_srac_o(a0, a1); - test_srav(a0, a1, SHIFT); - - test_sllc_on(a0, a1); - test_sllv(a0, a1, -SHIFT); - test_srlc_on(a0, a1); - test_srlv(a0, a1, -SHIFT); - test_srac_on(a0, a1); - test_srav(a0, a1, -SHIFT); - - test_sllc_add(a0, a1); - test_sllv_add(a0, a1, ADD_INIT); - test_srlc_add(a0, a1); - test_srlv_add(a0, a1, ADD_INIT); - test_srac_add(a0, a1); - test_srav_add(a0, a1, ADD_INIT); - - test_sllc_and(a0, a1); - test_sllv_and(a0, a1, BIT_MASK); - test_srlc_and(a0, a1); - test_srlv_and(a0, a1, BIT_MASK); - test_srac_and(a0, a1); - test_srav_and(a0, a1, BIT_MASK); - } - // Test and verify results - System.out.println("Verification"); - int errn = 0; - { - long sum = test_sum(a1); - if (sum != gold_sum) { - System.err.println("test_sum: " + sum + " != " + gold_sum); - errn++; - } - - test_addc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_addc: ", i, a0[i], (long)((long)(ADD_INIT+i)+VALUE)); - } - test_addv(a0, a1, (long)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_addv: ", i, a0[i], (long)((long)(ADD_INIT+i)+VALUE)); - } - test_adda(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_adda: ", i, a0[i], (long)((long)(ADD_INIT+i)+VALUE)); - } - - test_subc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_subc: ", i, a0[i], (long)((long)(ADD_INIT+i)-VALUE)); - } - test_subv(a0, a1, (long)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_subv: ", i, a0[i], (long)((long)(ADD_INIT+i)-VALUE)); - } - test_suba(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_suba: ", i, a0[i], (long)((long)(ADD_INIT+i)-VALUE)); - } - - test_mulc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulc: ", i, a0[i], (long)((long)(ADD_INIT+i)*VALUE)); - } - test_mulv(a0, a1, (long)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulv: ", i, a0[i], (long)((long)(ADD_INIT+i)*VALUE)); - } - test_mula(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mula: ", i, a0[i], (long)((long)(ADD_INIT+i)*VALUE)); - } - - test_divc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divc: ", i, a0[i], (long)((long)(ADD_INIT+i)/VALUE)); - } - test_divv(a0, a1, (long)VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divv: ", i, a0[i], (long)((long)(ADD_INIT+i)/VALUE)); - } - test_diva(a0, a1, a2); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_diva: ", i, a0[i], (long)((long)(ADD_INIT+i)/VALUE)); - } - - test_mulc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulc_n: ", i, a0[i], (long)((long)(ADD_INIT+i)*(-VALUE))); - } - test_mulv(a0, a1, (long)-VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mulv_n: ", i, a0[i], (long)((long)(ADD_INIT+i)*(-VALUE))); - } - test_mula(a0, a1, a3); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_mula_n: ", i, a0[i], (long)((long)(ADD_INIT+i)*(-VALUE))); - } - - test_divc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divc_n: ", i, a0[i], (long)((long)(ADD_INIT+i)/(-VALUE))); - } - test_divv(a0, a1, (long)-VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_divv_n: ", i, a0[i], (long)((long)(ADD_INIT+i)/(-VALUE))); - } - test_diva(a0, a1, a3); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_diva_n: ", i, a0[i], (long)((long)(ADD_INIT+i)/(-VALUE))); - } - - test_andc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_andc: ", i, a0[i], (long)((long)(ADD_INIT+i)&BIT_MASK)); - } - test_andv(a0, a1, (long)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_andv: ", i, a0[i], (long)((long)(ADD_INIT+i)&BIT_MASK)); - } - test_anda(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_anda: ", i, a0[i], (long)((long)(ADD_INIT+i)&BIT_MASK)); - } - - test_orc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_orc: ", i, a0[i], (long)((long)(ADD_INIT+i)|BIT_MASK)); - } - test_orv(a0, a1, (long)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_orv: ", i, a0[i], (long)((long)(ADD_INIT+i)|BIT_MASK)); - } - test_ora(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_ora: ", i, a0[i], (long)((long)(ADD_INIT+i)|BIT_MASK)); - } - - test_xorc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xorc: ", i, a0[i], (long)((long)(ADD_INIT+i)^BIT_MASK)); - } - test_xorv(a0, a1, (long)BIT_MASK); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xorv: ", i, a0[i], (long)((long)(ADD_INIT+i)^BIT_MASK)); - } - test_xora(a0, a1, a4); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_xora: ", i, a0[i], (long)((long)(ADD_INIT+i)^BIT_MASK)); - } - - test_sllc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc: ", i, a0[i], (long)((long)(ADD_INIT+i)<<VALUE)); - } - test_sllv(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv: ", i, a0[i], (long)((long)(ADD_INIT+i)<<VALUE)); - } - - test_srlc(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc: ", i, a0[i], (long)((long)(ADD_INIT+i)>>>VALUE)); - } - test_srlv(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv: ", i, a0[i], (long)((long)(ADD_INIT+i)>>>VALUE)); - } - - test_srac(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srac: ", i, a0[i], (long)((long)(ADD_INIT+i)>>VALUE)); - } - test_srav(a0, a1, VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srav: ", i, a0[i], (long)((long)(ADD_INIT+i)>>VALUE)); - } - - test_sllc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllc_n: ", i, a0[i], (long)((long)(ADD_INIT+i)<<(-VALUE))); - } - test_sllv(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_sllv_n: ", i, a0[i], (long)((long)(ADD_INIT+i)<<(-VALUE))); - } - - test_srlc_n(a0, a1); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlc_n: ", i, a0[i], (long)((long)(ADD_INIT+i)>>>(-VALUE))); - } - test_srlv(a0, a1, -VALUE); - for (int i=0; i<ARRLEN; i++) { - errn += verify("test_srlv_n: ", i, a0[i], (long)((long)(ADD_INIT+i)>>>(-VALUE))); - } - - test_srac_n(a0, a1); - for (int i=0; i<ARRL