< prev index next >

test/hotspot/jtreg/compiler/testlibrary/sha/predicate/IntrinsicPredicates.java

Print this page
rev 60737 : 8252204: AArch64: Implement SHA3 accelerator/intrinsic
Reviewed-by: duke
Contributed-by: dongbo4@huawei.com

@@ -95,15 +95,18 @@
               new OrPredicate(new CPUSpecificPredicate("i386.*",    new String[] { "sha"          }, null),
               new OrPredicate(new CPUSpecificPredicate("x86.*",     new String[] { "sha"          }, null),
               new OrPredicate(new CPUSpecificPredicate("amd64.*",   new String[] { "avx2", "bmi2" }, null),
                               new CPUSpecificPredicate("x86_64",    new String[] { "avx2", "bmi2" }, null)))))))));
 
+    public static final BooleanSupplier SHA3_INSTRUCTION_AVAILABLE
+            // sha3 is only implemented on aarch64 for now
+            = new CPUSpecificPredicate("aarch64.*", new String[] {"sha3"          }, null);
+
     public static final BooleanSupplier ANY_SHA_INSTRUCTION_AVAILABLE
             = new OrPredicate(IntrinsicPredicates.SHA1_INSTRUCTION_AVAILABLE,
-                    new OrPredicate(
-                            IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE,
-                            IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE));
+              new OrPredicate(IntrinsicPredicates.SHA256_INSTRUCTION_AVAILABLE,
+              new OrPredicate(IntrinsicPredicates.SHA512_INSTRUCTION_AVAILABLE, IntrinsicPredicates.SHA3_INSTRUCTION_AVAILABLE)));
 
     public static BooleanSupplier isMD5IntrinsicAvailable() {
         return new AndPredicate(IntrinsicPredicates.COMPILABLE_BY_C2,
                                 IntrinsicPredicates.isIntrinsicAvailable("sun.security.provider.MD5", "implCompress0"));
     }

@@ -121,10 +124,15 @@
     public static BooleanSupplier isSHA512IntrinsicAvailable() {
         return new AndPredicate(IntrinsicPredicates.COMPILABLE_BY_C2,
                                 IntrinsicPredicates.isIntrinsicAvailable("sun.security.provider.SHA5", "implCompress0"));
     }
 
+    public static BooleanSupplier isSHA3IntrinsicAvailable() {
+        return new AndPredicate(IntrinsicPredicates.COMPILABLE_BY_C2,
+                                IntrinsicPredicates.isIntrinsicAvailable("sun.security.provider.SHA3", "implCompress0"));
+    }
+
     private static BooleanSupplier isIntrinsicAvailable(String klass, String method) {
         try {
             Method m = Class.forName(klass).getDeclaredMethod(method, byte[].class, int.class);
             return () -> WHITE_BOX.isIntrinsicAvailable(m, (int)IntrinsicPredicates.TIERED_MAX_LEVEL);
         } catch (Exception e) {
< prev index next >