x86_64 assembly pack: "optimize" for Knights Landing.
authorAndy Polyakov <appro@openssl.org>
Mon, 24 Jul 2017 19:50:52 +0000 (21:50 +0200)
committerAndy Polyakov <appro@openssl.org>
Tue, 25 Jul 2017 19:34:33 +0000 (21:34 +0200)
commit777cf0fbd47e12a0ff3eadf2ee8af773b8138c12
tree788f7b72824d70f5fa0b7e3a11f3caaf4470bbe9
parentf794476093342d021176ddac27270bd43ff2c804
x86_64 assembly pack: "optimize" for Knights Landing.

"Optimize" is in quotes because it's rather a "salvage operation"
for now. Idea is to identify processor capability flags that
drive Knights Landing to suboptimial code paths and mask them.
Two flags were identified, XSAVE and ADCX/ADOX. Former affects
choice of AES-NI code path specific for Silvermont (Knights Landing
is of Silvermont "ancestry"). And 64-bit ADCX/ADOX instructions are
effectively mishandled at decode time. In both cases we are looking
at ~2x improvement.

Hardware used for benchmarking courtesy of Atos, experiments run by
Romain Dolbeau <romain.dolbeau@atos.net>. Kudos!

This is minimalistic backpoint of 64d92d74985ebb3d0be58a9718f9e080a14a8e7f

Thanks to David Benjamin for spotting typo in Knights Landing detection!

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4006)

(cherry picked from commit 738a9dd53cacce593cd7d67e18e1273549640a79)
crypto/x86_64cpuid.pl