RFR (M): 8150767: Update for x86 SHA Extensions enabling
Vladimir Kozlov
vladimir.kozlov at oracle.com
Sat Feb 27 02:50:22 UTC 2016
Very nice, Vivek!!!
Did you run tests with both 32- and 64-bit VMs?
Small notes:
In vm_version_x86.hpp spacing are not aligned in next line:
static bool supports_avxonly() { return ((supports_avx2() ||
supports_avx()) && !supports_evex()); }
+ static bool supports_sha() { return (_features & CPU_SHA) != 0; }
Flags setting code in vm_version_x86.cpp should be like this (you can
check supports_sha() only once, don't split '} else {' line, set UseSHA
false if all intrinsics flags are false (I included UseSHA512Intrinsics
for future) ):
if (supports_sha()) {
if (FLAG_IS_DEFAULT(UseSHA)) {
UseSHA = true;
}
} else if (UseSHA) {
warning("SHA instructions are not available on this CPU");
FLAG_SET_DEFAULT(UseSHA, false);
}
if (UseSHA) {
if (FLAG_IS_DEFAULT(UseSHA1Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA1Intrinsics, true);
}
} else if (UseSHA1Intrinsics) {
warning("Intrinsics for SHA-1 crypto hash functions not available
on this CPU.");
FLAG_SET_DEFAULT(UseSHA1Intrinsics, false);
}
if (UseSHA) {
if (FLAG_IS_DEFAULT(UseSHA256Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA256Intrinsics, true);
}
} else if (UseSHA256Intrinsics) {
warning("Intrinsics for SHA-224 and SHA-256 crypto hash functions
not available on this CPU.");
FLAG_SET_DEFAULT(UseSHA256Intrinsics, false);
}
if (UseSHA512Intrinsics) {
warning("Intrinsics for SHA-384 and SHA-512 crypto hash functions
not available on this CPU.");
FLAG_SET_DEFAULT(UseSHA512Intrinsics, false);
}
if (!(UseSHA1Intrinsics || UseSHA256Intrinsics || UseSHA512Intrinsics)) {
FLAG_SET_DEFAULT(UseSHA, false);
}
Thanks,
Vladimir
On 2/26/16 4:37 PM, Deshpande, Vivek R wrote:
> Hi all
>
> I would like to contribute a patch which optimizesSHA-1 andSHA-256 for
> 64 and 32 bitX86architecture using Intel SHA extensions.
>
> Could you please review and sponsor this patch.
>
> Bug-id:
>
> https://bugs.openjdk.java.net/browse/JDK-8150767
> webrev:
>
> http://cr.openjdk.java.net/~vdeshpande/SHANI/8150767/webrev.00/
>
> Thanks and regards,
>
> Vivek
>
More information about the hotspot-compiler-dev
mailing list