[Gmp-commit] /var/hg/gmp: 4 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Thu Feb 27 16:17:54 UTC 2014
details: /var/hg/gmp/rev/49e3af448fb6
changeset: 16314:49e3af448fb6
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 27 17:13:42 2014 +0100
description:
Revert "coreihwl" to "coreisbr" if cpuid indicates that BMI2 is missing.
details: /var/hg/gmp/rev/10fb7d0dbd3d
changeset: 16315:10fb7d0dbd3d
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 27 17:15:55 2014 +0100
description:
Zero ecx for the benefit of new BMI2 feature test.
details: /var/hg/gmp/rev/775b88c58942
changeset: 16316:775b88c58942
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 27 17:17:33 2014 +0100
description:
(__gmpn_cpuvec_init): Run CPUVEC_SETUP_coreihwl conditionally on BMI2 availability.
details: /var/hg/gmp/rev/07a2dde2c971
changeset: 16317:07a2dde2c971
user: Torbjorn Granlund <tege at gmplib.org>
date: Thu Feb 27 17:17:50 2014 +0100
description:
ChangeLog
diffstat:
ChangeLog | 13 +++++++++++++
config.guess | 15 +++++++++++++++
mpn/x86_64/fat/fat.c | 6 +++++-
mpn/x86_64/fat/fat_entry.asm | 6 ++++--
4 files changed, 37 insertions(+), 3 deletions(-)
diffs (112 lines):
diff -r 8b074a2e0134 -r 07a2dde2c971 ChangeLog
--- a/ChangeLog Thu Feb 27 10:43:48 2014 +0100
+++ b/ChangeLog Thu Feb 27 17:17:50 2014 +0100
@@ -1,3 +1,16 @@
+2014-02-27 Torbjorn Granlund <tege at gmplib.org>
+
+ * mpn/x86_64/fat/fat_entry.asm: Zero ecx for the benefit of new BMI2
+ feature test.
+
+ * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Run CPUVEC_SETUP_coreihwl
+ conditionally on BMI2 availability.
+
+ * config.guess: Revert "coreihwl" to "coreisbr" if cpuid indicates that
+ BMI2 is missing.
+ (x86 cpuid, 2 variants): Zero ecx for the benefit of new BMI2 feature
+ test.
+
2014-02-21 Marco Bodrato <bodrato at mail.dm.unipi.it>
* mini-gmp/mini-gmp.c (mpn_sqrtrem): New function.
diff -r 8b074a2e0134 -r 07a2dde2c971 config.guess
--- a/config.guess Thu Feb 27 10:43:48 2014 +0100
+++ b/config.guess Thu Feb 27 17:17:50 2014 +0100
@@ -814,6 +814,16 @@
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 @@
}
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 @@
push %rbx
mov %rdx, %r8
mov %ecx, %eax
+ xor %ecx, %ecx
.byte 0x0f
.byte 0xa2
mov %ebx, (%r8)
@@ -939,6 +953,7 @@
pushl %esi
pushl %ebx
movl 24(%esp),%eax
+ xor %ecx, %ecx
.byte 0x0f
.byte 0xa2
movl 20(%esp),%esi
diff -r 8b074a2e0134 -r 07a2dde2c971 mpn/x86_64/fat/fat.c
--- a/mpn/x86_64/fat/fat.c Thu Feb 27 10:43:48 2014 +0100
+++ b/mpn/x86_64/fat/fat.c Thu Feb 27 17:17:50 2014 +0100
@@ -292,7 +292,11 @@
CPUVEC_SETUP_core2;
CPUVEC_SETUP_coreinhm;
CPUVEC_SETUP_coreisbr;
- CPUVEC_SETUP_coreihwl;
+ /* Some Haswells lack BMI2. Let them appear as Sandybridges for
+ now. */
+ __gmpn_cpuid (dummy_string, 7);
+ if ((dummy_string[0 + 8 / 8] & (1 << (8 % 8))) != 0)
+ CPUVEC_SETUP_coreihwl;
break;
}
break;
diff -r 8b074a2e0134 -r 07a2dde2c971 mpn/x86_64/fat/fat_entry.asm
--- a/mpn/x86_64/fat/fat_entry.asm Thu Feb 27 10:43:48 2014 +0100
+++ b/mpn/x86_64/fat/fat_entry.asm Thu Feb 27 17:17:50 2014 +0100
@@ -3,7 +3,7 @@
dnl Contributed to the GNU project by Kevin Ryde (original x86_32 code) and
dnl Torbjorn Granlund (port to x86_64)
-dnl Copyright 2003, 2009, 2011-2013 Free Software Foundation, Inc.
+dnl Copyright 2003, 2009, 2011-2014 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
@@ -183,7 +183,8 @@
C long __gmpn_cpuid (char dst[12], int id);
C
C This is called only 3 times, so just something simple and compact is fine.
-
+C
+C The rcx/ecx zeroing here is needed for the BMI2 check.
define(`rp', `%rdi')
define(`idx', `%rsi')
@@ -192,6 +193,7 @@
FUNC_ENTRY(2)
mov %rbx, %r8
mov R32(idx), R32(%rax)
+ xor %ecx, %ecx
cpuid
mov %ebx, (rp)
mov %edx, 4(rp)
More information about the gmp-commit
mailing list