< prev index next >

test/compiler/intrinsics/sha/cli/SHAOptionsBase.java

Print this page
rev 8431 : 8081790: aarch64: SHA tests fail
Summary: Fix SHA tests in JTReg so they recognize aarch64
Reviewed-by: duke
Contributed-by: alexander.alexeev@caviumnetworks.com


  54             + "is not available on this CPU\\.";
  55     protected static final String SHA512_INSTRUCTION_IS_NOT_AVAILABLE
  56             = "SHA512 instruction \\(for SHA-384 and SHA-512\\) "
  57             + "is not available on this CPU\\.";
  58     protected static final String SHA_INTRINSICS_ARE_NOT_AVAILABLE
  59             = "SHA intrinsics are not available on this CPU";
  60 
  61     private final TestCase[] testCases;
  62 
  63     /**
  64      * Returns warning message that should occur in VM output if an option with
  65      * the name {@code optionName} was turned on and CPU does not support
  66      * required instructions.
  67      *
  68      * @param optionName The name of the option for which warning message should
  69      *                   be returned.
  70      * @return A warning message that will be printed out to VM output if CPU
  71      *         instructions required by the option are not supported.
  72      */
  73     protected static String getWarningForUnsupportedCPU(String optionName) {
  74         if (Platform.isSparc()) {
  75             switch (optionName) {
  76                 case SHAOptionsBase.USE_SHA_OPTION:
  77                     return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
  78                 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
  79                     return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
  80                 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
  81                     return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
  82                 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
  83                     return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
  84                 default:
  85                     throw new Error("Unexpected option " + optionName);
  86             }
  87         } else if (Platform.isX64() || Platform.isX86()) {
  88             switch (optionName) {
  89                 case SHAOptionsBase.USE_SHA_OPTION:
  90                     return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
  91                 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
  92                 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
  93                 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
  94                     return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;




  54             + "is not available on this CPU\\.";
  55     protected static final String SHA512_INSTRUCTION_IS_NOT_AVAILABLE
  56             = "SHA512 instruction \\(for SHA-384 and SHA-512\\) "
  57             + "is not available on this CPU\\.";
  58     protected static final String SHA_INTRINSICS_ARE_NOT_AVAILABLE
  59             = "SHA intrinsics are not available on this CPU";
  60 
  61     private final TestCase[] testCases;
  62 
  63     /**
  64      * Returns warning message that should occur in VM output if an option with
  65      * the name {@code optionName} was turned on and CPU does not support
  66      * required instructions.
  67      *
  68      * @param optionName The name of the option for which warning message should
  69      *                   be returned.
  70      * @return A warning message that will be printed out to VM output if CPU
  71      *         instructions required by the option are not supported.
  72      */
  73     protected static String getWarningForUnsupportedCPU(String optionName) {
  74         if (Platform.isSparc() || Platform.isAArch64()) {
  75             switch (optionName) {
  76                 case SHAOptionsBase.USE_SHA_OPTION:
  77                     return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
  78                 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
  79                     return SHAOptionsBase.SHA1_INSTRUCTION_IS_NOT_AVAILABLE;
  80                 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
  81                     return SHAOptionsBase.SHA256_INSTRUCTION_IS_NOT_AVAILABLE;
  82                 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
  83                     return SHAOptionsBase.SHA512_INSTRUCTION_IS_NOT_AVAILABLE;
  84                 default:
  85                     throw new Error("Unexpected option " + optionName);
  86             }
  87         } else if (Platform.isX64() || Platform.isX86()) {
  88             switch (optionName) {
  89                 case SHAOptionsBase.USE_SHA_OPTION:
  90                     return SHAOptionsBase.SHA_INSTRUCTIONS_ARE_NOT_AVAILABLE;
  91                 case SHAOptionsBase.USE_SHA1_INTRINSICS_OPTION:
  92                 case SHAOptionsBase.USE_SHA256_INTRINSICS_OPTION:
  93                 case SHAOptionsBase.USE_SHA512_INTRINSICS_OPTION:
  94                     return SHAOptionsBase.SHA_INTRINSICS_ARE_NOT_AVAILABLE;


< prev index next >