summaryrefslogtreecommitdiff
path: root/config.guess
diff options
context:
space:
mode:
authorTorbjorn Granlund <tege@gmplib.org>2014-02-27 17:13:42 +0100
committerTorbjorn Granlund <tege@gmplib.org>2014-02-27 17:13:42 +0100
commita8dcfdc1baad8d776661123d422a8410a71c55fe (patch)
treea109a56a890d2b48fabb5ada85fe9c5ebbc20e80 /config.guess
parent6ef447ff6d18c1c635f62aaaa3cf05a9b5612f80 (diff)
downloadgmp-a8dcfdc1baad8d776661123d422a8410a71c55fe.tar.gz
Revert "coreihwl" to "coreisbr" if cpuid indicates that BMI2 is missing.
Diffstat (limited to 'config.guess')
-rwxr-xr-xconfig.guess15
1 files changed, 15 insertions, 0 deletions
diff --git a/config.guess b/config.guess
index ad74bda5a..02b61f45a 100755
--- a/config.guess
+++ b/config.guess
@@ -814,6 +814,16 @@ main ()
else if (model == 0x4f) cpu_64bit = 1, modelstr = "coreibwl"; /* Broadwell server */
else if (model == 0x56) cpu_64bit = 1, modelstr = "coreibwl"; /* Broadwell microserver */
else cpu_64bit = 1, modelstr = "corei"; /* default */
+
+ if (strcmp (modelstr, "coreihwl") == 0)
+ {
+ /* Some Haswells lack BMI2. Let them appear as Sandybridges for
+ now. */
+ CPUID (dummy_string, 7);
+ if ((dummy_string[0 + 8 / 8] & (1 << (8 % 8))) == 0)
+ modelstr = "coreisbr";
+ }
+
break;
case 15:
cpu_64bit = 1, modelstr = "pentium4";
@@ -900,6 +910,9 @@ main ()
}
EOF
+# The rcx/ecx zeroing here and in the variant below is needed for the BMI2
+# check.
+
cat <<EOF >${dummy}0.s
.globl cpuid
.globl _cpuid
@@ -908,6 +921,7 @@ _cpuid:
push %rbx
mov %rdx, %r8
mov %ecx, %eax
+ xor %ecx, %ecx
.byte 0x0f
.byte 0xa2
mov %ebx, (%r8)
@@ -939,6 +953,7 @@ _cpuid:
pushl %esi
pushl %ebx
movl 24(%esp),%eax
+ xor %ecx, %ecx
.byte 0x0f
.byte 0xa2
movl 20(%esp),%esi