Pretend AMD XOP was never a thing.
It's not clear that any AMD XOP code paths are being properly tested.
AMD dropped XOP starting in Zen.
Here's the one place I found (without looking too hard) where it seems
there is a XOP code path in BoringSSL, in sha512-x86_64.pl. Most of the
other XOP code was removed.
```
$code.=<<___ if ($avx && $SZ==8);
test \$`1<<11`,%r10d # check for XOP
jnz .Lxop_shortcut
```
Change-Id: Id3301b2c84648790d010dae546b8e21ece1c528d
Reviewed-on: https://boringssl-review.googlesource.com/c/33405
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
diff --git a/crypto/cpu-intel.c b/crypto/cpu-intel.c
index 5c21f4a..98d8d4e 100644
--- a/crypto/cpu-intel.c
+++ b/crypto/cpu-intel.c
@@ -148,23 +148,6 @@
int is_intel = ebx == 0x756e6547 /* Genu */ &&
edx == 0x49656e69 /* ineI */ &&
ecx == 0x6c65746e /* ntel */;
- int is_amd = ebx == 0x68747541 /* Auth */ &&
- edx == 0x69746e65 /* enti */ &&
- ecx == 0x444d4163 /* cAMD */;
-
- int has_amd_xop = 0;
- if (is_amd) {
- // AMD-specific logic.
- // See http://developer.amd.com/wordpress/media/2012/10/254811.pdf
- OPENSSL_cpuid(&eax, &ebx, &ecx, &edx, 0x80000000);
- uint32_t num_extended_ids = eax;
- if (num_extended_ids >= 0x80000001) {
- OPENSSL_cpuid(&eax, &ebx, &ecx, &edx, 0x80000001);
- if (ecx & (1u << 11)) {
- has_amd_xop = 1;
- }
- }
- }
uint32_t extended_features[2] = {0};
if (num_ids >= 7) {
@@ -198,12 +181,9 @@
edx &= ~(1u << 30);
}
- // The SDBG bit is repurposed to denote AMD XOP support.
- if (has_amd_xop) {
- ecx |= (1u << 11);
- } else {
- ecx &= ~(1u << 11);
- }
+ // The SDBG bit is repurposed to denote AMD XOP support. Don't ever use AMD
+ // XOP code paths.
+ ecx &= ~(1u << 11);
uint64_t xcr0 = 0;
if (ecx & (1u << 27)) {