about summary refs log tree commit diff
path: root/sysdeps/x86_64/multiarch/init-arch.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-10-25 21:34:55 -0400
committerUlrich Drepper <drepper@gmail.com>2011-10-25 21:34:55 -0400
commite0016b11d6186a7003d7204cb100acab9bbcd940 (patch)
tree8c702a330664d113edbdaff9ba4ec67e266bbb80 /sysdeps/x86_64/multiarch/init-arch.h
parentffb124cc518c182e238c20abb0ff8bdeaefefd66 (diff)
downloadglibc-e0016b11d6186a7003d7204cb100acab9bbcd940.tar.gz
glibc-e0016b11d6186a7003d7204cb100acab9bbcd940.tar.xz
glibc-e0016b11d6186a7003d7204cb100acab9bbcd940.zip
Add AVX optimized versions for some x86-64 math functions
Diffstat (limited to 'sysdeps/x86_64/multiarch/init-arch.h')
-rw-r--r--sysdeps/x86_64/multiarch/init-arch.h32
1 files changed, 18 insertions, 14 deletions
diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h
index 2fb6f75b66..2a1df393c4 100644
--- a/sysdeps/x86_64/multiarch/init-arch.h
+++ b/sysdeps/x86_64/multiarch/init-arch.h
@@ -23,16 +23,19 @@
 #define bit_Fast_Unaligned_Load		(1 << 4)
 #define bit_Prefer_PMINUB_for_stringop	(1 << 5)
 
+#define bit_SSE2	(1 << 26)
+#define bit_SSSE3	(1 << 9)
+#define bit_SSE4_1	(1 << 19)
+#define bit_SSE4_2	(1 << 20)
+#define bit_AVX		(1 << 28)
+#define bit_POPCOUNT	(1 << 23)
+#define bit_FMA		(1 << 12)
+#define bit_FMA4	(1 << 16)
+
 #ifdef	__ASSEMBLER__
 
 # include <ifunc-defines.h>
 
-# define bit_SSE2	(1 << 26)
-# define bit_SSSE3	(1 << 9)
-# define bit_SSE4_1	(1 << 19)
-# define bit_SSE4_2	(1 << 20)
-# define bit_AVX	(1 << 28)
-
 # define index_SSE2	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_EDX_OFFSET
 # define index_SSSE3	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
 # define index_SSE4_1	COMMON_CPUID_INDEX_1*CPUID_SIZE+CPUID_ECX_OFFSET
@@ -104,17 +107,18 @@ extern const struct cpu_features *__get_cpu_features (void)
 # endif
 
 # define HAS_CPU_FEATURE(idx, reg, bit) \
-  ((__get_cpu_features ()->cpuid[idx].reg & (1 << (bit))) != 0)
+  ((__get_cpu_features ()->cpuid[idx].reg & (bit)) != 0)
 
 /* Following are the feature tests used throughout libc.  */
 
-# define HAS_SSE2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, 26)
-# define HAS_POPCOUNT	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 23)
-# define HAS_SSSE3	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 9)
-# define HAS_SSE4_1	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 19)
-# define HAS_SSE4_2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 20)
-# define HAS_FMA	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, 12)
-# define HAS_FMA4	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_80000001, ecx, 16)
+# define HAS_SSE2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, edx, bit_SSE2)
+# define HAS_POPCOUNT	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_POPCOUNT)
+# define HAS_SSSE3	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSSE3)
+# define HAS_SSE4_1	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_1)
+# define HAS_SSE4_2	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_SSE4_2)
+# define HAS_FMA	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_FMA)
+# define HAS_AVX	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_1, ecx, bit_AVX)
+# define HAS_FMA4	HAS_CPU_FEATURE (COMMON_CPUID_INDEX_80000001, ecx, bit_FMA4)
 
 # define index_Fast_Rep_String		FEATURE_INDEX_1
 # define index_Fast_Copy_Backward	FEATURE_INDEX_1