8081790: aarch64: SHA tests fail
Summary: Fix SHA tests in JTReg so they recognize aarch64
Reviewed-by: duke
Contributed-by: alexander.alexeev@caviumnetworks.com
--- a/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/vm_version_aarch64.cpp Wed Jun 03 08:23:09 2015 +0000
@@ -228,6 +228,9 @@
warning("SHA512 instruction (for SHA-384 and SHA-512) is not available on this CPU.");
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
}
+ if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
+ FLAG_SET_DEFAULT(UseSHA, false);
+ }
}
// This machine allows unaligned memory accesses
--- a/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/SHAOptionsBase.java Wed Jun 03 08:23:09 2015 +0000
@@ -71,7 +71,7 @@
* instructions required by the option are not supported.
*/
protected static String getWarningForUnsupportedCPU(String optionName) {
- if (Platform.isSparc()) {
+ if (Platform.isSparc() || Platform.isAArch64()) {
switch (optionName) {
case SHAOptionsBase.USE_SHA_OPTION:
return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -36,7 +36,7 @@
*/
public class TestUseSHA1IntrinsicsOptionOnSupportedCPU {
public static void main(String args[]) throws Throwable {
- new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
+ new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
}
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -40,9 +40,11 @@
new SHAOptionsBase(
new GenericTestCaseForUnsupportedSparcCPU(
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
- new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
+ new GenericTestCaseForUnsupportedX86CPU(
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
- new GenericTestCaseForUnsupportedX86CPU(
+ new GenericTestCaseForUnsupportedAArch64CPU(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
+ new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION),
new GenericTestCaseForOtherCPU(
SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION)).test();
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -37,7 +37,7 @@
*/
public class TestUseSHA256IntrinsicsOptionOnSupportedCPU {
public static void main(String args[]) throws Throwable {
- new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
+ new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
}
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -40,9 +40,11 @@
new SHAOptionsBase(
new GenericTestCaseForUnsupportedSparcCPU(
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
- new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
+ new GenericTestCaseForUnsupportedX86CPU(
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
- new GenericTestCaseForUnsupportedX86CPU(
+ new GenericTestCaseForUnsupportedAArch64CPU(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
+ new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION),
new GenericTestCaseForOtherCPU(
SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION)).test();
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -37,7 +37,7 @@
*/
public class TestUseSHA512IntrinsicsOptionOnSupportedCPU {
public static void main(String args[]) throws Throwable {
- new SHAOptionsBase(new GenericTestCaseForSupportedSparcCPU(
+ new SHAOptionsBase(new GenericTestCaseForSupportedCPU(
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
}
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -40,9 +40,11 @@
new SHAOptionsBase(
new GenericTestCaseForUnsupportedSparcCPU(
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
- new UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
+ new GenericTestCaseForUnsupportedX86CPU(
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
- new GenericTestCaseForUnsupportedX86CPU(
+ new GenericTestCaseForUnsupportedAArch64CPU(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
+ new UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION),
new GenericTestCaseForOtherCPU(
SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION)).test();
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -37,9 +37,9 @@
public class TestUseSHAOptionOnSupportedCPU {
public static void main(String args[]) throws Throwable {
new SHAOptionsBase(
- new GenericTestCaseForSupportedSparcCPU(
+ new GenericTestCaseForSupportedCPU(
SHAOptionsBase.USE_SHA_OPTION),
- new UseSHASpecificTestCaseForSupportedSparcCPU(
+ new UseSHASpecificTestCaseForSupportedCPU(
SHAOptionsBase.USE_SHA_OPTION)).test();
}
}
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -39,9 +39,11 @@
new SHAOptionsBase(
new GenericTestCaseForUnsupportedSparcCPU(
SHAOptionsBase.USE_SHA_OPTION),
- new UseSHASpecificTestCaseForUnsupportedSparcCPU(
+ new GenericTestCaseForUnsupportedX86CPU(
SHAOptionsBase.USE_SHA_OPTION),
- new GenericTestCaseForUnsupportedX86CPU(
+ new GenericTestCaseForUnsupportedAArch64CPU(
+ SHAOptionsBase.USE_SHA_OPTION),
+ new UseSHASpecificTestCaseForUnsupportedCPU(
SHAOptionsBase.USE_SHA_OPTION),
new GenericTestCaseForOtherCPU(
SHAOptionsBase.USE_SHA_OPTION)).test();
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForOtherCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -35,16 +35,18 @@
SHAOptionsBase.TestCase {
public GenericTestCaseForOtherCPU(String optionName) {
// Execute the test case on any CPU except SPARC and X86
- super(optionName, new NotPredicate(new OrPredicate(Platform::isSparc,
- new OrPredicate(Platform::isX64, Platform::isX86))));
+ super(optionName, new NotPredicate(
+ new OrPredicate(
+ new OrPredicate(Platform::isSparc, Platform::isAArch64),
+ new OrPredicate(Platform::isX64, Platform::isX86))));
}
@Override
protected void verifyWarnings() throws Throwable {
String shouldPassMessage = String.format("JVM should start with "
+ "option '%s' without any warnings", optionName);
- // Verify that on non-x86 and non-SPARC CPU usage of SHA-related
- // options will not cause any warnings.
+ // Verify that on non-x86, non-SPARC and non-AArch64 CPU usage of
+ // SHA-related options will not cause any warnings.
CommandLineOptionTest.verifySameJVMStartup(null,
new String[] { ".*" + optionName + ".*" }, shouldPassMessage,
shouldPassMessage, ExitCode.OK,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2014, 2015, 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.
+ */
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.OrPredicate;
+
+/**
+ * Generic test case for SHA-related options targeted to CPUs which
+ * support instructions required by the tested option.
+ */
+public class GenericTestCaseForSupportedCPU extends
+ SHAOptionsBase.TestCase {
+ public GenericTestCaseForSupportedCPU(String optionName) {
+ super(optionName,
+ new AndPredicate(
+ new OrPredicate(Platform::isSparc, Platform::isAArch64),
+ SHAOptionsBase.getPredicateForOption(optionName)));
+ }
+
+ @Override
+ protected void verifyWarnings() throws Throwable {
+
+ String shouldPassMessage = String.format("JVM should start with option"
+ + " '%s' without any warnings", optionName);
+ // Verify that there are no warning when option is explicitly enabled.
+ CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, shouldPassMessage, shouldPassMessage, ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+
+ // Verify that option could be disabled even if +UseSHA was passed to
+ // JVM.
+ CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, shouldPassMessage, String.format("It should be able to "
+ + "disable option '%s' even if %s was passed to JVM",
+ optionName, CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true)),
+ ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, false));
+
+ // Verify that it is possible to enable the tested option and disable
+ // all SHA intrinsics via -UseSHA without any warnings.
+ CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, shouldPassMessage, String.format("It should be able to "
+ + "enable option '%s' even if %s was passed to JVM",
+ optionName, CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, false)),
+ ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+ }
+
+ @Override
+ protected void verifyOptionValues() throws Throwable {
+ // Verify that "It should be able to disable option "
+
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
+ String.format("Option '%s' should be enabled by default",
+ optionName));
+
+ // Verify that it is possible to explicitly enable the option.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
+ String.format("Option '%s' was set to have value 'true'",
+ optionName),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+
+ // Verify that it is possible to explicitly disable the option.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' was set to have value 'false'",
+ optionName),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, false));
+
+ // verify that option is disabled when -UseSHA was passed to JVM.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' should have value 'false' when %s"
+ + " flag set to JVM", optionName,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, false)),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, false));
+
+ // Verify that it is possible to explicitly disable the tested option
+ // even if +UseSHA was passed to JVM.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' should have value 'false' if set so"
+ + " even if %s flag set to JVM", optionName,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true)),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, false));
+ }
+}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForSupportedSparcCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- */
-
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.Platform;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-
-/**
- * Generic test case for SHA-related options targeted to SPARC CPUs which
- * support instructions required by the tested option.
- */
-public class GenericTestCaseForSupportedSparcCPU extends
- SHAOptionsBase.TestCase {
- public GenericTestCaseForSupportedSparcCPU(String optionName) {
- super(optionName, new AndPredicate(Platform::isSparc,
- SHAOptionsBase.getPredicateForOption(optionName)));
- }
-
- @Override
- protected void verifyWarnings() throws Throwable {
-
- String shouldPassMessage = String.format("JVM should start with option"
- + " '%s' without any warnings", optionName);
- // Verify that there are no warning when option is explicitly enabled.
- CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
- SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
- }, shouldPassMessage, shouldPassMessage, ExitCode.OK,
- CommandLineOptionTest.prepareBooleanFlag(optionName, true));
-
- // Verify that option could be disabled even if +UseSHA was passed to
- // JVM.
- CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
- SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
- }, shouldPassMessage, String.format("It should be able to "
- + "disable option '%s' even if %s was passed to JVM",
- optionName, CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true)),
- ExitCode.OK,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(optionName, false));
-
- // Verify that it is possible to enable the tested option and disable
- // all SHA intrinsics via -UseSHA without any warnings.
- CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
- SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
- }, shouldPassMessage, String.format("It should be able to "
- + "enable option '%s' even if %s was passed to JVM",
- optionName, CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, false)),
- ExitCode.OK,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(optionName, true));
- }
-
- @Override
- protected void verifyOptionValues() throws Throwable {
- // Verify that "It should be able to disable option "
-
- CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
- String.format("Option '%s' should be enabled by default",
- optionName));
-
- // Verify that it is possible to explicitly enable the option.
- CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "true",
- String.format("Option '%s' was set to have value 'true'",
- optionName),
- CommandLineOptionTest.prepareBooleanFlag(optionName, true));
-
- // Verify that it is possible to explicitly disable the option.
- CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
- String.format("Option '%s' was set to have value 'false'",
- optionName),
- CommandLineOptionTest.prepareBooleanFlag(optionName, false));
-
- // verify that option is disabled when -UseSHA was passed to JVM.
- CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
- String.format("Option '%s' should have value 'false' when %s"
- + " flag set to JVM", optionName,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, false)),
- CommandLineOptionTest.prepareBooleanFlag(optionName, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, false));
-
- // Verify that it is possible to explicitly disable the tested option
- // even if +UseSHA was passed to JVM.
- CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
- String.format("Option '%s' should have value 'false' if set so"
- + " even if %s flag set to JVM", optionName,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true)),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(optionName, false));
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/GenericTestCaseForUnsupportedAArch64CPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 2015, 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.
+ */
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
+
+/**
+ * Generic test case for SHA-related options targeted to AArch64 CPUs
+ * which don't support instruction required by the tested option.
+ */
+public class GenericTestCaseForUnsupportedAArch64CPU extends
+ SHAOptionsBase.TestCase {
+ public GenericTestCaseForUnsupportedAArch64CPU(String optionName) {
+ super(optionName, new AndPredicate(Platform::isAArch64,
+ new NotPredicate(SHAOptionsBase.getPredicateForOption(
+ optionName))));
+ }
+
+ @Override
+ protected void verifyWarnings() throws Throwable {
+ String shouldPassMessage = String.format("JVM startup should pass with"
+ + "option '-XX:-%s' without any warnings", optionName);
+ //Verify that option could be disabled without any warnings.
+ CommandLineOptionTest.verifySameJVMStartup(null, new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, shouldPassMessage, shouldPassMessage, ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(optionName, false));
+
+ shouldPassMessage = String.format("JVM should start with '-XX:+"
+ + "%s' flag, but output should contain warning.", optionName);
+ // Verify that when the tested option is explicitly enabled, then
+ // a warning will occur in VM output.
+ CommandLineOptionTest.verifySameJVMStartup(new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+ }
+
+ @Override
+ protected void verifyOptionValues() throws Throwable {
+ // Verify that option is disabled by default.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' should be disabled by default",
+ optionName));
+
+ // Verify that option is disabled even if it was explicitly enabled
+ // using CLI options.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' should be off on unsupported "
+ + "AArch64CPU even if set to true directly", optionName),
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+
+ // Verify that option is disabled when +UseSHA was passed to JVM.
+ CommandLineOptionTest.verifyOptionValueForSameVM(optionName, "false",
+ String.format("Option '%s' should be off on unsupported "
+ + "AArch64CPU even if %s flag set to JVM",
+ optionName, CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true)),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 2015, 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.
+ */
+
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.OrPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
+import sha.predicate.IntrinsicPredicates;
+
+/**
+ * Test case specific to UseSHA*Intrinsics options targeted to SPARC and AArch64
+ * CPUs which don't support required instruction, but support other SHA-related
+ * instructions.
+ *
+ * For example, CPU support sha1 instruction, but don't support sha256 or
+ * sha512.
+ */
+public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU
+ extends SHAOptionsBase.TestCase {
+ public UseSHAIntrinsicsSpecificTestCaseForUnsupportedCPU(
+ String optionName) {
+ // execute test case on SPARC CPU that support any sha* instructions,
+ // but does not support sha* instruction required by the tested option.
+ super(optionName, new AndPredicate(
+ new OrPredicate(Platform::isSparc, Platform::isAArch64),
+ new AndPredicate(
+ IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE,
+ new NotPredicate(SHAOptionsBase.getPredicateForOption(
+ optionName)))));
+ }
+ @Override
+ protected void verifyWarnings() throws Throwable {
+ String shouldPassMessage = String.format("JVM should start with "
+ + "'-XX:+%s' flag, but output should contain warning.",
+ optionName);
+ // Verify that attempt to enable the tested option will cause a warning
+ CommandLineOptionTest.verifySameJVMStartup(new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+ }
+}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- */
-
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.Platform;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
-import sha.predicate.IntrinsicPredicates;
-
-/**
- * Test case specific to UseSHA*Intrinsics options targeted to SPARC CPUs which
- * don't support required instruction, but support other SHA-related
- * instructions.
- *
- * For example, CPU support sha1 instruction, but don't support sha256 or
- * sha512.
- */
-public class UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU
- extends SHAOptionsBase.TestCase {
- public UseSHAIntrinsicsSpecificTestCaseForUnsupportedSparcCPU(
- String optionName) {
- // execute test case on SPARC CPU that support any sha* instructions,
- // but does not support sha* instruction required by the tested option.
- super(optionName, new AndPredicate(Platform::isSparc,
- new AndPredicate(
- IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE,
- new NotPredicate(SHAOptionsBase.getPredicateForOption(
- optionName)))));
- }
- @Override
- protected void verifyWarnings() throws Throwable {
- String shouldPassMessage = String.format("JVM should start with "
- + "'-XX:+%s' flag, but output should contain warning.",
- optionName);
- // Verify that attempt to enable the tested option will cause a warning
- CommandLineOptionTest.verifySameJVMStartup(new String[] {
- SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
- }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
- CommandLineOptionTest.prepareBooleanFlag(optionName, true));
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, 2015, 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.
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.OrPredicate;
+import sha.predicate.IntrinsicPredicates;
+
+/**
+ * UseSHA specific test case targeted to SPARC and AArch64 CPUs which
+ * support any sha* instruction.
+ */
+public class UseSHASpecificTestCaseForSupportedCPU
+ extends SHAOptionsBase.TestCase {
+ public UseSHASpecificTestCaseForSupportedCPU(String optionName) {
+ super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
+ new OrPredicate(Platform::isSparc, Platform::isAArch64),
+ IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE));
+
+ Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
+ String.format("Test case should be used for '%s' option only.",
+ SHAOptionsBase.USE_SHA_OPTION));
+ }
+
+ @Override
+ protected void verifyWarnings() throws Throwable {
+ String shouldPassMessage = String.format("JVM startup should pass when"
+ + " %s was passed and all UseSHA*Intrinsics options "
+ + "were disabled",
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true));
+ // Verify that there will be no warnings when +UseSHA was passed and
+ // all UseSHA*Intrinsics options were disabled.
+ CommandLineOptionTest.verifySameJVMStartup(
+ null, new String[] { ".*UseSHA.*" }, shouldPassMessage,
+ shouldPassMessage, ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
+ }
+
+ @Override
+ protected void verifyOptionValues() throws Throwable {
+ // Verify that UseSHA is disabled when all UseSHA*Intrinsics are
+ // disabled.
+ CommandLineOptionTest.verifyOptionValueForSameVM(
+ SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
+ "'%s' option should be disabled when all UseSHA*Intrinsics are"
+ + " disabled", SHAOptionsBase.USE_SHA_OPTION),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
+
+ CommandLineOptionTest.verifyOptionValueForSameVM(
+ // Verify that UseSHA is disabled when all UseSHA*Intrinsics are
+ // disabled even if it was explicitly enabled.
+ SHAOptionsBase.USE_SHA_OPTION, "false",
+ String.format("'%s' option should be disabled when all "
+ + "UseSHA*Intrinsics are disabled even if %s flag set "
+ + "to JVM", SHAOptionsBase.USE_SHA_OPTION,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true)),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
+
+ // Verify that explicitly disabled UseSHA option remains disabled even
+ // if all UseSHA*Intrinsics options were enabled.
+ CommandLineOptionTest.verifyOptionValueForSameVM(
+ SHAOptionsBase.USE_SHA_OPTION, "false",
+ String.format("'%s' option should be disabled if %s flag "
+ + "set even if all UseSHA*Intrinsics were enabled",
+ SHAOptionsBase.USE_SHA_OPTION,
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, false)),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, false),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
+ }
+}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForSupportedSparcCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- */
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.Platform;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import sha.predicate.IntrinsicPredicates;
-
-/**
- * UseSHA specific test case targeted to SPARC CPUs which support any sha*
- * instruction.
- */
-public class UseSHASpecificTestCaseForSupportedSparcCPU
- extends SHAOptionsBase.TestCase {
- public UseSHASpecificTestCaseForSupportedSparcCPU(String optionName) {
- super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc,
- IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE));
-
- Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
- String.format("Test case should be used for '%s' option only.",
- SHAOptionsBase.USE_SHA_OPTION));
- }
-
- @Override
- protected void verifyWarnings() throws Throwable {
- String shouldPassMessage = String.format("JVM startup should pass when"
- + " %s was passed and all UseSHA*Intrinsics options "
- + "were disabled",
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true));
- // Verify that there will be no warnings when +UseSHA was passed and
- // all UseSHA*Intrinsics options were disabled.
- CommandLineOptionTest.verifySameJVMStartup(
- null, new String[] { ".*UseSHA.*" }, shouldPassMessage,
- shouldPassMessage, ExitCode.OK,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
- }
-
- @Override
- protected void verifyOptionValues() throws Throwable {
- // Verify that UseSHA is disabled when all UseSHA*Intrinsics are
- // disabled.
- CommandLineOptionTest.verifyOptionValueForSameVM(
- SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
- "'%s' option should be disabled when all UseSHA*Intrinsics are"
- + " disabled", SHAOptionsBase.USE_SHA_OPTION),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
-
- CommandLineOptionTest.verifyOptionValueForSameVM(
- // Verify that UseSHA is disabled when all UseSHA*Intrinsics are
- // disabled even if it was explicitly enabled.
- SHAOptionsBase.USE_SHA_OPTION, "false",
- String.format("'%s' option should be disabled when all "
- + "UseSHA*Intrinsics are disabled even if %s flag set "
- + "to JVM", SHAOptionsBase.USE_SHA_OPTION,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true)),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, false));
-
- // Verify that explicitly disabled UseSHA option remains disabled even
- // if all UseSHA*Intrinsics options were enabled.
- CommandLineOptionTest.verifyOptionValueForSameVM(
- SHAOptionsBase.USE_SHA_OPTION, "false",
- String.format("'%s' option should be disabled if %s flag "
- + "set even if all UseSHA*Intrinsics were enabled",
- SHAOptionsBase.USE_SHA_OPTION,
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, false)),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, false),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedCPU.java Wed Jun 03 08:23:09 2015 +0000
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 2015, 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.
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.ExitCode;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cli.CommandLineOptionTest;
+import jdk.test.lib.cli.predicate.AndPredicate;
+import jdk.test.lib.cli.predicate.OrPredicate;
+import jdk.test.lib.cli.predicate.NotPredicate;
+import sha.predicate.IntrinsicPredicates;
+
+/**
+ * UseSHA specific test case targeted to SPARC and AArch64 CPUs which don't
+ * support all sha* instructions./
+ */
+public class UseSHASpecificTestCaseForUnsupportedCPU
+ extends SHAOptionsBase.TestCase {
+ public UseSHASpecificTestCaseForUnsupportedCPU(String optionName) {
+ super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(
+ new OrPredicate(Platform::isSparc, Platform::isAArch64),
+ new NotPredicate(
+ IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
+
+ Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
+ "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION
+ + " option only.");
+ }
+
+ @Override
+ protected void verifyWarnings() throws Throwable {
+ // Verify that attempt to use UseSHA option will cause a warning.
+ String shouldPassMessage = String.format("JVM startup should pass with"
+ + " '%s' option on unsupported CPU, but there should be"
+ + "the message shown.", optionName);
+ CommandLineOptionTest.verifySameJVMStartup(new String[] {
+ SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
+ }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
+ CommandLineOptionTest.prepareBooleanFlag(optionName, true));
+ }
+
+ @Override
+ protected void verifyOptionValues() throws Throwable {
+ // Verify that UseSHA option remains disabled even if all
+ // UseSHA*Intrinsics were enabled.
+ CommandLineOptionTest.verifyOptionValueForSameVM(
+ SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
+ "%s option should be disabled on unsupported CPU"
+ + " even if all UseSHA*Intrinsics options were enabled.",
+ SHAOptionsBase.USE_SHA_OPTION),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
+
+ // Verify that UseSHA option remains disabled even if all
+ // UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
+ CommandLineOptionTest.verifyOptionValueForSameVM(
+ SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
+ "%s option should be disabled on unsupported CPU"
+ + " even if all UseSHA*Intrinsics options were enabled"
+ + " and %s was enabled as well",
+ SHAOptionsBase.USE_SHA_OPTION,
+ SHAOptionsBase.USE_SHA_OPTION),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
+ CommandLineOptionTest.prepareBooleanFlag(
+ SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
+ }
+}
--- a/hotspot/test/compiler/intrinsics/sha/cli/testcases/UseSHASpecificTestCaseForUnsupportedSparcCPU.java Fri Jun 12 09:59:51 2015 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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.
- */
-
-import jdk.test.lib.Asserts;
-import jdk.test.lib.ExitCode;
-import jdk.test.lib.Platform;
-import jdk.test.lib.cli.CommandLineOptionTest;
-import jdk.test.lib.cli.predicate.AndPredicate;
-import jdk.test.lib.cli.predicate.NotPredicate;
-import sha.predicate.IntrinsicPredicates;
-
-/**
- * UseSHA specific test case targeted to SPARC CPUs which don't support all sha*
- * instructions.
- */
-public class UseSHASpecificTestCaseForUnsupportedSparcCPU
- extends SHAOptionsBase.TestCase {
- public UseSHASpecificTestCaseForUnsupportedSparcCPU(String optionName) {
- super(SHAOptionsBase.USE_SHA_OPTION, new AndPredicate(Platform::isSparc,
- new NotPredicate(
- IntrinsicPredicates.ANY_SHA_INSTRUCTION_AVAILABLE)));
-
- Asserts.assertEQ(optionName, SHAOptionsBase.USE_SHA_OPTION,
- "Test case should be used for " + SHAOptionsBase.USE_SHA_OPTION
- + " option only.");
- }
-
- @Override
- protected void verifyWarnings() throws Throwable {
- // Verify that attempt to use UseSHA option will cause a warning.
- String shouldPassMessage = String.format("JVM startup should pass with"
- + " '%s' option on unsupported SparcCPU, but there should be"
- + "the message shown.", optionName);
- CommandLineOptionTest.verifySameJVMStartup(new String[] {
- SHAOptionsBase.getWarningForUnsupportedCPU(optionName)
- }, null, shouldPassMessage, shouldPassMessage, ExitCode.OK,
- CommandLineOptionTest.prepareBooleanFlag(optionName, true));
- }
-
- @Override
- protected void verifyOptionValues() throws Throwable {
- // Verify that UseSHA option remains disabled even if all
- // UseSHA*Intrinsics were enabled.
- CommandLineOptionTest.verifyOptionValueForSameVM(
- SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
- "%s option should be disabled on unsupported SparcCPU"
- + " even if all UseSHA*Intrinsics options were enabled.",
- SHAOptionsBase.USE_SHA_OPTION),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
-
- // Verify that UseSHA option remains disabled even if all
- // UseSHA*Intrinsics options were enabled and UseSHA was enabled as well.
- CommandLineOptionTest.verifyOptionValueForSameVM(
- SHAOptionsBase.USE_SHA_OPTION, "false", String.format(
- "%s option should be disabled on unsupported SparcCPU"
- + " even if all UseSHA*Intrinsics options were enabled"
- + " and %s was enabled as well",
- SHAOptionsBase.USE_SHA_OPTION,
- SHAOptionsBase.USE_SHA_OPTION),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION, true),
- CommandLineOptionTest.prepareBooleanFlag(
- SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION, true));
- }
-}
--- a/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java Fri Jun 12 09:59:51 2015 -0700
+++ b/hotspot/test/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java Wed Jun 03 08:23:09 2015 +0000
@@ -59,16 +59,19 @@
};
public static final BooleanSupplier SHA1_INSTRUCTION_AVAILABLE
- = new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },
- null);
+ = new OrPredicate(
+ new CPUSpecificPredicate("sparc.*", new String[] { "sha1" },null),
+ new CPUSpecificPredicate("aarch64.*", new String[] { "sha1" },null));
public static final BooleanSupplier SHA256_INSTRUCTION_AVAILABLE
- = new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },
- null);
+ = new OrPredicate(
+ new CPUSpecificPredicate("sparc.*", new String[] { "sha256" },null),
+ new CPUSpecificPredicate("aarch64.*", new String[] { "sha256" },null));
public static final BooleanSupplier SHA512_INSTRUCTION_AVAILABLE
- = new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },
- null);
+ = new OrPredicate(
+ new CPUSpecificPredicate("sparc.*", new String[] { "sha512" },null),
+ new CPUSpecificPredicate("aarch64.*", new String[] { "sha512" },null));
public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
= new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,