This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch hjl/hwcap/master created. glibc-2.25-184-g9652ee7
- From: hjl at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 6 Apr 2017 22:18:26 -0000
- Subject: GNU C Library master sources branch hjl/hwcap/master created. glibc-2.25-184-g9652ee7
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, hjl/hwcap/master has been created
at 9652ee708fe67aa6cfff1f39f05878ad11fbbe49 (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9652ee708fe67aa6cfff1f39f05878ad11fbbe49
commit 9652ee708fe67aa6cfff1f39f05878ad11fbbe49
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Wed Apr 5 15:24:30 2017 -0700
x86: Set dl_hwcap from CPU features
On x86, the usage of AT_HWCAP in glibc is obsolete since addition of
dl_x86_cpu_features. dl_hwcap, which was set from AT_HWCAP, is used by
dynamic linker to build an array of hardware capability names, which are
added to search path when loading shared object. dl_hwcap was unused on
x86-64 and only SSE2 was used on i386.
This patch sets dl_hwcap with new hardware capabilities from CPU
features. Currently, 2 capabilities, SSE2 and AVX2, are supported.
The maximum number of hardware capabilities is 64. Since x86-64
includes SSE2, SSE2 is skipped on x86-64. dl_x86_cap_flags is kepted
for i386 and is used by _dl_show_auxv. dl_x86_hwcap_flags is added
for new hardware capabilities.
* sysdeps/i386/dl-hwcap.h: New file.
* sysdeps/x86/dl-hwcap.h: Likewise.
* sysdeps/x86_64/dl-hwcap.h: Likewise.
* sysdeps/x86_64/dl-procinfo.h: Likewise.
* sysdeps/i386/dl-procinfo.c (_dl_x86_hwcap_flags): New.
* sysdeps/i386/dl-procinfo.h: Include <dl-hwcap.h>.
(_DL_HWCAP_COUNT): Removed.
(HWCAP_I386_XXX): Likewise.
(HWCAP_IMPORTANT): Likewise.
(_dl_procinfo): Likewise.
(_dl_hwcap_string): Likewise.
(_dl_string_hwcap): Likewise.
* sysdeps/unix/sysv/linux/i386/dl-procinfo.h (_dl_procinfo):
Replace _DL_HWCAP_COUNT with 32.
* sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h [!IS_IN (ldconfig)]:
Include <sysdeps/x86_64/dl-procinfo.h>.
* sysdeps/x86/cpu-features.c: Include <dl-hwcap.h>.
(init_cpu_features): Set dl_hwcap and dl_hwcap_mask.
* sysdeps/x86_64/dl-procinfo.c (_dl_x86_hwcap_flags): New.
diff --git a/sysdeps/i386/dl-hwcap.h b/sysdeps/i386/dl-hwcap.h
new file mode 100644
index 0000000..0e8d95f
--- /dev/null
+++ b/sysdeps/i386/dl-hwcap.h
@@ -0,0 +1,25 @@
+/* i386 version of hardware capability information handling macros.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _DL_HWCAP_H
+#define _DL_HWCAP_H
+#include <sysdeps/x86/dl-hwcap.h>
+
+#define HWCAP_IMPORTANT (HWCAP_X86_SSE2 | HWCAP_X86_AVX2)
+
+#endif /* dl-hwcap.h */
diff --git a/sysdeps/i386/dl-procinfo.c b/sysdeps/i386/dl-procinfo.c
index cec7dcc..acb800b 100644
--- a/sysdeps/i386/dl-procinfo.c
+++ b/sysdeps/i386/dl-procinfo.c
@@ -79,6 +79,22 @@ PROCINFO_CLASS const char _dl_x86_cap_flags[32][8]
#endif
#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_x86_hwcap_flags
+#else
+PROCINFO_CLASS const char _dl_x86_hwcap_flags[2][8]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "sse2", "avx2"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
+#if !defined PROCINFO_DECL && defined SHARED
._dl_x86_platforms
#else
PROCINFO_CLASS const char _dl_x86_platforms[4][5]
diff --git a/sysdeps/i386/dl-procinfo.h b/sysdeps/i386/dl-procinfo.h
index 9c38846..5b9bb4c 100644
--- a/sysdeps/i386/dl-procinfo.h
+++ b/sysdeps/i386/dl-procinfo.h
@@ -20,8 +20,7 @@
#ifndef _DL_PROCINFO_H
#define _DL_PROCINFO_H 1
#include <ldsodefs.h>
-
-#define _DL_HWCAP_COUNT 32
+#include <dl-hwcap.h>
#define _DL_PLATFORMS_COUNT 4
@@ -31,59 +30,6 @@
#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
<< _DL_FIRST_PLATFORM)
-enum
-{
- HWCAP_I386_FPU = 1 << 0,
- HWCAP_I386_VME = 1 << 1,
- HWCAP_I386_DE = 1 << 2,
- HWCAP_I386_PSE = 1 << 3,
- HWCAP_I386_TSC = 1 << 4,
- HWCAP_I386_MSR = 1 << 5,
- HWCAP_I386_PAE = 1 << 6,
- HWCAP_I386_MCE = 1 << 7,
- HWCAP_I386_CX8 = 1 << 8,
- HWCAP_I386_APIC = 1 << 9,
- HWCAP_I386_SEP = 1 << 11,
- HWCAP_I386_MTRR = 1 << 12,
- HWCAP_I386_PGE = 1 << 13,
- HWCAP_I386_MCA = 1 << 14,
- HWCAP_I386_CMOV = 1 << 15,
- HWCAP_I386_FCMOV = 1 << 16,
- HWCAP_I386_MMX = 1 << 23,
- HWCAP_I386_OSFXSR = 1 << 24,
- HWCAP_I386_XMM = 1 << 25,
- HWCAP_I386_XMM2 = 1 << 26,
- HWCAP_I386_AMD3D = 1 << 31,
-
- /* XXX Which others to add here? */
- HWCAP_IMPORTANT = (HWCAP_I386_XMM2)
-
-};
-
-/* We cannot provide a general printing function. */
-#define _dl_procinfo(type, word) -1
-
-static inline const char *
-__attribute__ ((unused))
-_dl_hwcap_string (int idx)
-{
- return GLRO(dl_x86_cap_flags)[idx];
-};
-
-static inline int
-__attribute__ ((unused, always_inline))
-_dl_string_hwcap (const char *str)
-{
- int i;
-
- for (i = 0; i < _DL_HWCAP_COUNT; i++)
- {
- if (strcmp (str, GLRO(dl_x86_cap_flags)[i]) == 0)
- return i;
- }
- return -1;
-};
-
static inline int
__attribute__ ((unused, always_inline))
_dl_string_platform (const char *str)
diff --git a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
index d49638c..c8196a8 100644
--- a/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/i386/dl-procinfo.h
@@ -36,7 +36,7 @@ _dl_procinfo (unsigned int type, unsigned long int word)
_dl_printf ("AT_HWCAP: ");
- for (i = 0; i < _DL_HWCAP_COUNT; ++i)
+ for (i = 0; i < 32; ++i)
if (word & (1 << i))
_dl_printf (" %s", GLRO(dl_x86_cap_flags)[i]);
diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
index 7829e1c..dba5cc9 100644
--- a/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
+++ b/sysdeps/unix/sysv/linux/x86_64/dl-procinfo.h
@@ -1,5 +1,5 @@
#if IS_IN (ldconfig)
# include <sysdeps/unix/sysv/linux/i386/dl-procinfo.h>
#else
-# include <sysdeps/generic/dl-procinfo.h>
+# include <sysdeps/x86_64/dl-procinfo.h>
#endif
diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index 33788ed..10fe2f3 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -18,6 +18,7 @@
#include <cpuid.h>
#include <cpu-features.h>
+#include <dl-hwcap.h>
static void
get_common_indeces (struct cpu_features *cpu_features,
@@ -302,4 +303,12 @@ no_cpuid:
cpu_features->family = family;
cpu_features->model = model;
cpu_features->kind = kind;
+
+ /* Reuse dl_hwcap and dl_hwcap_mask for x86. */
+ GLRO(dl_hwcap) = 0;
+ if (CPU_FEATURES_CPU_P (cpu_features, SSE2))
+ GLRO(dl_hwcap) |= HWCAP_X86_SSE2;
+ if (CPU_FEATURES_ARCH_P (cpu_features, AVX2_Usable))
+ GLRO(dl_hwcap) |= HWCAP_X86_AVX2;
+ GLRO(dl_hwcap_mask) = HWCAP_IMPORTANT;
}
diff --git a/sysdeps/x86/dl-hwcap.h b/sysdeps/x86/dl-hwcap.h
new file mode 100644
index 0000000..13ff32a
--- /dev/null
+++ b/sysdeps/x86/dl-hwcap.h
@@ -0,0 +1,48 @@
+/* x86 version of hardware capability information handling macros.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#define _DL_HWCAP_COUNT 2
+
+enum
+{
+ HWCAP_X86_SSE2 = 1 << 0,
+ HWCAP_X86_AVX2 = 1 << 1
+};
+
+static inline const char *
+__attribute__ ((unused))
+_dl_hwcap_string (int idx)
+{
+ return GLRO(dl_x86_hwcap_flags)[idx];
+};
+
+static inline int
+__attribute__ ((unused, always_inline))
+_dl_string_hwcap (const char *str)
+{
+ int i;
+
+ for (i = 0; i < _DL_HWCAP_COUNT; i++)
+ {
+ if (strcmp (str, GLRO(dl_x86_hwcap_flags)[i]) == 0)
+ return i;
+ }
+ return -1;
+};
+
+/* We cannot provide a general printing function. */
+#define _dl_procinfo(type, word) -1
diff --git a/sysdeps/x86_64/dl-hwcap.h b/sysdeps/x86_64/dl-hwcap.h
new file mode 100644
index 0000000..6e31fa9
--- /dev/null
+++ b/sysdeps/x86_64/dl-hwcap.h
@@ -0,0 +1,25 @@
+/* x86-64 version of hardware capability information handling macros.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _DL_HWCAP_H
+#define _DL_HWCAP_H
+#include <sysdeps/x86/dl-hwcap.h>
+
+#define HWCAP_IMPORTANT (HWCAP_X86_AVX2)
+
+#endif /* dl-hwcap.h */
diff --git a/sysdeps/x86_64/dl-procinfo.c b/sysdeps/x86_64/dl-procinfo.c
index a76624f..5ccdb7f 100644
--- a/sysdeps/x86_64/dl-procinfo.c
+++ b/sysdeps/x86_64/dl-procinfo.c
@@ -53,5 +53,21 @@ PROCINFO_CLASS struct cpu_features _dl_x86_cpu_features
,
#endif
+#if !defined PROCINFO_DECL && defined SHARED
+ ._dl_x86_hwcap_flags
+#else
+PROCINFO_CLASS const char _dl_x86_hwcap_flags[2][8]
+#endif
+#ifndef PROCINFO_DECL
+= {
+ "sse2", "avx2"
+ }
+#endif
+#if !defined SHARED || defined PROCINFO_DECL
+;
+#else
+,
+#endif
+
#undef PROCINFO_DECL
#undef PROCINFO_CLASS
diff --git a/sysdeps/x86_64/dl-procinfo.h b/sysdeps/x86_64/dl-procinfo.h
new file mode 100644
index 0000000..ddbde2d
--- /dev/null
+++ b/sysdeps/x86_64/dl-procinfo.h
@@ -0,0 +1,28 @@
+/* x86-64 version of processor capability information handling macros.
+ Copyright (C) 2017 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _DL_PROCINFO_H
+#define _DL_PROCINFO_H 1
+#include <dl-hwcap.h>
+
+/* There're no platforms to filter out. */
+#define _DL_HWCAP_PLATFORM 0
+
+#define _dl_string_platform(str) (-1)
+
+#endif /* dl-procinfo.h */
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=c5a40b6312b87bb8be36609a044f792249d85fa8
commit c5a40b6312b87bb8be36609a044f792249d85fa8
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Apr 6 08:09:34 2017 -0700
Check if SSE is available with HAS_CPU_FEATURE
Similar to other CPU feature checks, check if SSE is available with
HAS_CPU_FEATURE.
* sysdeps/i386/fpu/fclrexcpt.c (__feclearexcept): Use
HAS_CPU_FEATURE to check for SSE.
* sysdeps/i386/fpu/fedisblxcpt.c (fedisableexcept): Likewise.
* sysdeps/i386/fpu/feenablxcpt.c (feenableexcept): Likewise.
* sysdeps/i386/fpu/fegetenv.c (__fegetenv): Likewise.
* sysdeps/i386/fpu/fegetmode.c (fegetmode): Likewise.
* sysdeps/i386/fpu/feholdexcpt.c (__feholdexcept): Likewise.
* sysdeps/i386/fpu/fesetenv.c (__fesetenv): Likewise.
* sysdeps/i386/fpu/fesetmode.c (fesetmode): Likewise.
* sysdeps/i386/fpu/fesetround.c (__fesetround): Likewise.
* sysdeps/i386/fpu/feupdateenv.c (__feupdateenv): Likewise.
* sysdeps/i386/fpu/fgetexcptflg.c (__fegetexceptflag): Likewise.
* sysdeps/i386/fpu/fsetexcptflg.c (__fesetexceptflag): Likewise.
* sysdeps/i386/fpu/ftestexcept.c (fetestexcept): Likewise.
* sysdeps/i386/setfpucw.c (__setfpucw): Likewise.
* sysdeps/x86/cpu-features.h (bit_cpu_SSE): New.
(index_cpu_SSE): Likewise.
(reg_SSE): Likewise.
diff --git a/sysdeps/i386/fpu/fclrexcpt.c b/sysdeps/i386/fpu/fclrexcpt.c
index c89fe5b..5d85969 100644
--- a/sysdeps/i386/fpu/fclrexcpt.c
+++ b/sysdeps/i386/fpu/fclrexcpt.c
@@ -41,7 +41,7 @@ __feclearexcept (int excepts)
__asm__ ("fldenv %0" : : "m" (*&temp));
/* If the CPU supports SSE, we clear the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xnew_exc;
diff --git a/sysdeps/i386/fpu/fedisblxcpt.c b/sysdeps/i386/fpu/fedisblxcpt.c
index a12fcaf..f8db665 100644
--- a/sysdeps/i386/fpu/fedisblxcpt.c
+++ b/sysdeps/i386/fpu/fedisblxcpt.c
@@ -38,7 +38,7 @@ fedisableexcept (int excepts)
__asm__ ("fldcw %0" : : "m" (*&new_exc));
/* If the CPU supports SSE we set the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xnew_exc;
diff --git a/sysdeps/i386/fpu/feenablxcpt.c b/sysdeps/i386/fpu/feenablxcpt.c
index 8336c1f..f1c42d7 100644
--- a/sysdeps/i386/fpu/feenablxcpt.c
+++ b/sysdeps/i386/fpu/feenablxcpt.c
@@ -38,7 +38,7 @@ feenableexcept (int excepts)
__asm__ ("fldcw %0" : : "m" (*&new_exc));
/* If the CPU supports SSE we set the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xnew_exc;
diff --git a/sysdeps/i386/fpu/fegetenv.c b/sysdeps/i386/fpu/fegetenv.c
index 9ce890e..983f6af 100644
--- a/sysdeps/i386/fpu/fegetenv.c
+++ b/sysdeps/i386/fpu/fegetenv.c
@@ -31,7 +31,7 @@ __fegetenv (fenv_t *envp)
would block all exceptions. */
__asm__ ("fldenv %0" : : "m" (*envp));
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
__asm__ ("stmxcsr %0" : "=m" (envp->__eip));
/* Success. */
diff --git a/sysdeps/i386/fpu/fegetmode.c b/sysdeps/i386/fpu/fegetmode.c
index 3785851..abbce30 100644
--- a/sysdeps/i386/fpu/fegetmode.c
+++ b/sysdeps/i386/fpu/fegetmode.c
@@ -26,7 +26,7 @@ int
fegetmode (femode_t *modep)
{
_FPU_GETCW (modep->__control_word);
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
__asm__ ("stmxcsr %0" : "=m" (modep->__mxcsr));
return 0;
}
diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c
index cce883c..d327358 100644
--- a/sysdeps/i386/fpu/feholdexcpt.c
+++ b/sysdeps/i386/fpu/feholdexcpt.c
@@ -30,7 +30,7 @@ __feholdexcept (fenv_t *envp)
__asm__ volatile ("fnstenv %0; fnclex" : "=m" (*envp));
/* If the CPU supports SSE we set the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xwork;
diff --git a/sysdeps/i386/fpu/fesetenv.c b/sysdeps/i386/fpu/fesetenv.c
index 18fca30..a338e5d 100644
--- a/sysdeps/i386/fpu/fesetenv.c
+++ b/sysdeps/i386/fpu/fesetenv.c
@@ -79,7 +79,7 @@ __fesetenv (const fenv_t *envp)
__asm__ ("fldenv %0" : : "m" (temp));
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int mxcsr;
__asm__ ("stmxcsr %0" : "=m" (mxcsr));
diff --git a/sysdeps/i386/fpu/fesetmode.c b/sysdeps/i386/fpu/fesetmode.c
index 2d03846..bd9f74c 100644
--- a/sysdeps/i386/fpu/fesetmode.c
+++ b/sysdeps/i386/fpu/fesetmode.c
@@ -35,7 +35,7 @@ fesetmode (const femode_t *modep)
else
cw = modep->__control_word;
_FPU_SETCW (cw);
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int mxcsr;
__asm__ ("stmxcsr %0" : "=m" (mxcsr));
diff --git a/sysdeps/i386/fpu/fesetround.c b/sysdeps/i386/fpu/fesetround.c
index fabf0b1..a3fa623 100644
--- a/sysdeps/i386/fpu/fesetround.c
+++ b/sysdeps/i386/fpu/fesetround.c
@@ -37,7 +37,7 @@ __fesetround (int round)
__asm__ ("fldcw %0" : : "m" (*&cw));
/* If the CPU supports SSE we set the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xcw;
diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c
index 4b46868..b610289 100644
--- a/sysdeps/i386/fpu/feupdateenv.c
+++ b/sysdeps/i386/fpu/feupdateenv.c
@@ -32,7 +32,7 @@ __feupdateenv (const fenv_t *envp)
__asm__ ("fnstsw %0" : "=m" (*&temp));
/* If the CPU supports SSE we test the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
__asm__ ("stmxcsr %0" : "=m" (*&xtemp));
temp = (temp | xtemp) & FE_ALL_EXCEPT;
diff --git a/sysdeps/i386/fpu/fgetexcptflg.c b/sysdeps/i386/fpu/fgetexcptflg.c
index bf3c73c..954e5f6 100644
--- a/sysdeps/i386/fpu/fgetexcptflg.c
+++ b/sysdeps/i386/fpu/fgetexcptflg.c
@@ -34,7 +34,7 @@ __fegetexceptflag (fexcept_t *flagp, int excepts)
*flagp = temp & excepts & FE_ALL_EXCEPT;
/* If the CPU supports SSE, we clear the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int sse_exc;
diff --git a/sysdeps/i386/fpu/fsetexcptflg.c b/sysdeps/i386/fpu/fsetexcptflg.c
index efea610..efa64aa 100644
--- a/sysdeps/i386/fpu/fsetexcptflg.c
+++ b/sysdeps/i386/fpu/fsetexcptflg.c
@@ -41,7 +41,7 @@ __fesetexceptflag (const fexcept_t *flagp, int excepts)
__asm__ ("fldenv %0" : : "m" (*&temp));
/* If the CPU supports SSE, we set the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xnew_exc;
diff --git a/sysdeps/i386/fpu/ftestexcept.c b/sysdeps/i386/fpu/ftestexcept.c
index 476db1e..f523f9e 100644
--- a/sysdeps/i386/fpu/ftestexcept.c
+++ b/sysdeps/i386/fpu/ftestexcept.c
@@ -32,7 +32,7 @@ fetestexcept (int excepts)
__asm__ ("fnstsw %0" : "=a" (temp));
/* If the CPU supports SSE we test the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
__asm__ ("stmxcsr %0" : "=m" (*&xtemp));
return (temp | xtemp) & excepts & FE_ALL_EXCEPT;
diff --git a/sysdeps/i386/setfpucw.c b/sysdeps/i386/setfpucw.c
index 7c41486..40b995f 100644
--- a/sysdeps/i386/setfpucw.c
+++ b/sysdeps/i386/setfpucw.c
@@ -39,7 +39,7 @@ __setfpucw (fpu_control_t set)
__asm__ ("fldcw %0" : : "m" (*&cw));
/* If the CPU supports SSE, we set the MXCSR as well. */
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
+ if (HAS_CPU_FEATURE (SSE))
{
unsigned int xnew_exc;
diff --git a/sysdeps/x86/cpu-features.h b/sysdeps/x86/cpu-features.h
index 95f0fcf..8ec1562 100644
--- a/sysdeps/x86/cpu-features.h
+++ b/sysdeps/x86/cpu-features.h
@@ -45,6 +45,7 @@
/* COMMON_CPUID_INDEX_1. */
#define bit_cpu_CX8 (1 << 8)
#define bit_cpu_CMOV (1 << 15)
+#define bit_cpu_SSE (1 << 25)
#define bit_cpu_SSE2 (1 << 26)
#define bit_cpu_SSSE3 (1 << 9)
#define bit_cpu_SSE4_1 (1 << 19)
@@ -82,6 +83,7 @@
# define index_cpu_CX8 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
# define index_cpu_CMOV COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
+# define index_cpu_SSE COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
# define index_cpu_SSE2 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
# define index_cpu_SSSE3 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
# define index_cpu_SSE4_1 COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
@@ -228,6 +230,7 @@ extern const struct cpu_features *__get_cpu_features (void)
# define index_cpu_CX8 COMMON_CPUID_INDEX_1
# define index_cpu_CMOV COMMON_CPUID_INDEX_1
+# define index_cpu_SSE COMMON_CPUID_INDEX_1
# define index_cpu_SSE2 COMMON_CPUID_INDEX_1
# define index_cpu_SSSE3 COMMON_CPUID_INDEX_1
# define index_cpu_SSE4_1 COMMON_CPUID_INDEX_1
@@ -246,6 +249,7 @@ extern const struct cpu_features *__get_cpu_features (void)
# define reg_CX8 edx
# define reg_CMOV edx
+# define reg_SSE edx
# define reg_SSE2 edx
# define reg_SSSE3 ecx
# define reg_SSE4_1 ecx
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources