hwf-x86: add detection for Intel CPUs with fast SHLD instruction
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Fri, 23 Oct 2015 19:39:47 +0000 (22:39 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Wed, 28 Oct 2015 18:08:54 +0000 (20:08 +0200)
commit909644ef5883927262366c356eed530e55aba478
tree71c03dfeae98a5a7ab1118663a877cd3941f1dba
parent16fd540f4d01eb6dc23d9509ae549353617c7a67
hwf-x86: add detection for Intel CPUs with fast SHLD instruction

* cipher/sha1.c (sha1_init): Use HWF_INTEL_FAST_SHLD instead of
HWF_INTEL_CPU.
* cipher/sha256.c (sha256_init, sha224_init): Ditto.
* cipher/sha512.c (sha512_init, sha384_init): Ditto.
* src/g10lib.h (HWF_INTEL_FAST_SHLD): New.
(HWF_INTEL_BMI2, HWF_INTEL_SSSE3, HWF_INTEL_PCLMUL, HWF_INTEL_AESNI)
(HWF_INTEL_RDRAND, HWF_INTEL_AVX, HWF_INTEL_AVX2)
(HWF_ARM_NEON): Update.
* src/hwf-x86.c (detect_x86_gnuc): Add detection of Intel Core
CPUs with fast SHLD/SHRD instruction.
* src/hwfeatures.c (hwflist): Add "intel-fast-shld".
--

Intel Core CPUs since codename sandy-bridge have been able to
execute SHLD/SHRD instructions faster than rotate instructions
ROL/ROR. Since SHLD/SHRD can be used to do rotation, some
optimized implementations (SHA1/SHA256/SHA512) use SHLD/SHRD
instructions in-place of ROL/ROR.

This patch provides more accurate detection of CPUs with
fast SHLD implementation.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
cipher/sha1.c
cipher/sha256.c
cipher/sha512.c
src/g10lib.h
src/hwf-x86.c
src/hwfeatures.c