src/cpu/ppc/vm/vm_version_ppc.cpp

changeset 9713
c4567d28f31f
parent 9684
69f33959c27f
child 9730
42118db355f5
     1.1 --- a/src/cpu/ppc/vm/vm_version_ppc.cpp	Mon Jun 17 17:20:10 2019 +0100
     1.2 +++ b/src/cpu/ppc/vm/vm_version_ppc.cpp	Tue Jun 18 09:33:34 2019 -0400
     1.3 @@ -110,7 +110,7 @@
     1.4    // Create and print feature-string.
     1.5    char buf[(num_features+1) * 16]; // Max 16 chars per feature.
     1.6    jio_snprintf(buf, sizeof(buf),
     1.7 -               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s",
     1.8 +               "ppc64%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
     1.9                 (has_fsqrt()   ? " fsqrt"   : ""),
    1.10                 (has_isel()    ? " isel"    : ""),
    1.11                 (has_lxarxeh() ? " lxarxeh" : ""),
    1.12 @@ -124,7 +124,8 @@
    1.13                 (has_vcipher() ? " aes"     : ""),
    1.14                 (has_vpmsumb() ? " vpmsumb" : ""),
    1.15                 (has_mfdscr()  ? " mfdscr"  : ""),
    1.16 -               (has_vsx()     ? " vsx"     : "")
    1.17 +               (has_vsx()     ? " vsx"     : ""),
    1.18 +               (has_vshasig() ? " sha"     : "")
    1.19                 // Make sure number of %s matches num_features!
    1.20                );
    1.21    _features_str = strdup(buf);
    1.22 @@ -206,17 +207,43 @@
    1.23    }
    1.24  #endif
    1.25  
    1.26 -  if (UseSHA) {
    1.27 -    warning("SHA instructions are not available on this CPU");
    1.28 +  if (has_vshasig()) {
    1.29 +    if (FLAG_IS_DEFAULT(UseSHA)) {
    1.30 +      UseSHA = true;
    1.31 +    }
    1.32 +  } else if (UseSHA) {
    1.33 +    if (!FLAG_IS_DEFAULT(UseSHA))
    1.34 +      warning("SHA instructions are not available on this CPU");
    1.35      FLAG_SET_DEFAULT(UseSHA, false);
    1.36    }
    1.37 -  if (UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics) {
    1.38 -    warning("SHA intrinsics are not available on this CPU");
    1.39 +
    1.40 +  if (UseSHA1Intrinsics) {
    1.41 +    warning("Intrinsics for SHA-1 crypto hash functions not available on this CPU.");
    1.42      FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
    1.43 +  }
    1.44 +
    1.45 +  if (UseSHA && has_vshasig()) {
    1.46 +    if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
    1.47 +      FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
    1.48 +    }
    1.49 +  } else if (UseSHA256Intrinsics) {
    1.50 +    warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions not available on this CPU.");
    1.51      FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
    1.52 +  }
    1.53 +
    1.54 +  if (UseSHA && has_vshasig()) {
    1.55 +    if (FLAG_IS_DEFAULT(UseSHA512Intrinsics)) {
    1.56 +      FLAG_SET_DEFAULT(UseSHA512Intrinsics, true);
    1.57 +    }
    1.58 +  } else if (UseSHA512Intrinsics) {
    1.59 +    warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions not available on this CPU.");
    1.60      FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
    1.61    }
    1.62  
    1.63 +  if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
    1.64 +    FLAG_SET_DEFAULT(UseSHA, false);
    1.65 +  }
    1.66 +
    1.67    if (FLAG_IS_DEFAULT(UseMontgomeryMultiplyIntrinsic)) {
    1.68      UseMontgomeryMultiplyIntrinsic = true;
    1.69    }
    1.70 @@ -503,6 +530,7 @@
    1.71    a->vpmsumb(VR0, VR1, VR2);                   // code[12] -> vpmsumb
    1.72    a->mfdscr(R0);                               // code[13] -> mfdscr
    1.73    a->lxvd2x(VSR0, R3_ARG1);                    // code[14] -> vsx
    1.74 +  a->vshasigmaw(VR0, VR1, 1, 0xF);             // code[15] -> vshasig
    1.75    a->blr();
    1.76  
    1.77    // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
    1.78 @@ -551,6 +579,7 @@
    1.79    if (code[feature_cntr++]) features |= vpmsumb_m;
    1.80    if (code[feature_cntr++]) features |= mfdscr_m;
    1.81    if (code[feature_cntr++]) features |= vsx_m;
    1.82 +  if (code[feature_cntr++]) features |= vshasig_m;
    1.83  
    1.84    // Print the detection code.
    1.85    if (PrintAssembly) {

mercurial