Annotation of /trunk/glibc/patches/glibc-2.15-avx.patch
Parent Directory | Revision Log
Revision 1806 -
(hide annotations)
(download)
Tue Jun 12 12:33:27 2012 UTC (12 years, 3 months ago) by niro
File size: 7516 byte(s)
Tue Jun 12 12:33:27 2012 UTC (12 years, 3 months ago) by niro
File size: 7516 byte(s)
-added patches for 2.15-r1
1 | niro | 1806 | diff --git a/sysdeps/x86_64/fpu/multiarch/e_atan2.c b/sysdeps/x86_64/fpu/multiarch/e_atan2.c |
2 | index 6867c6e..3a615fc 100644 | ||
3 | --- a/sysdeps/x86_64/fpu/multiarch/e_atan2.c | ||
4 | +++ b/sysdeps/x86_64/fpu/multiarch/e_atan2.c | ||
5 | @@ -14,7 +14,7 @@ extern double __ieee754_atan2_fma4 (double, double); | ||
6 | |||
7 | libm_ifunc (__ieee754_atan2, | ||
8 | HAS_FMA4 ? __ieee754_atan2_fma4 | ||
9 | - : (HAS_AVX ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); | ||
10 | + : (HAS_YMM_USABLE ? __ieee754_atan2_avx : __ieee754_atan2_sse2)); | ||
11 | strong_alias (__ieee754_atan2, __atan2_finite) | ||
12 | |||
13 | # define __ieee754_atan2 __ieee754_atan2_sse2 | ||
14 | diff --git a/sysdeps/x86_64/fpu/multiarch/e_exp.c b/sysdeps/x86_64/fpu/multiarch/e_exp.c | ||
15 | index 3c65028..7b2320a 100644 | ||
16 | --- a/sysdeps/x86_64/fpu/multiarch/e_exp.c | ||
17 | +++ b/sysdeps/x86_64/fpu/multiarch/e_exp.c | ||
18 | @@ -14,7 +14,7 @@ extern double __ieee754_exp_fma4 (double); | ||
19 | |||
20 | libm_ifunc (__ieee754_exp, | ||
21 | HAS_FMA4 ? __ieee754_exp_fma4 | ||
22 | - : (HAS_AVX ? __ieee754_exp_avx : __ieee754_exp_sse2)); | ||
23 | + : (HAS_YMM_USABLE ? __ieee754_exp_avx : __ieee754_exp_sse2)); | ||
24 | strong_alias (__ieee754_exp, __exp_finite) | ||
25 | |||
26 | # define __ieee754_exp __ieee754_exp_sse2 | ||
27 | diff --git a/sysdeps/x86_64/fpu/multiarch/e_log.c b/sysdeps/x86_64/fpu/multiarch/e_log.c | ||
28 | index 3b468d0..ab277d6 100644 | ||
29 | --- a/sysdeps/x86_64/fpu/multiarch/e_log.c | ||
30 | +++ b/sysdeps/x86_64/fpu/multiarch/e_log.c | ||
31 | @@ -14,7 +14,7 @@ extern double __ieee754_log_fma4 (double); | ||
32 | |||
33 | libm_ifunc (__ieee754_log, | ||
34 | HAS_FMA4 ? __ieee754_log_fma4 | ||
35 | - : (HAS_AVX ? __ieee754_log_avx | ||
36 | + : (HAS_YMM_USABLE ? __ieee754_log_avx | ||
37 | : __ieee754_log_sse2)); | ||
38 | strong_alias (__ieee754_log, __log_finite) | ||
39 | |||
40 | diff --git a/sysdeps/x86_64/fpu/multiarch/s_atan.c b/sysdeps/x86_64/fpu/multiarch/s_atan.c | ||
41 | index 3160201..78c7e09 100644 | ||
42 | --- a/sysdeps/x86_64/fpu/multiarch/s_atan.c | ||
43 | +++ b/sysdeps/x86_64/fpu/multiarch/s_atan.c | ||
44 | @@ -12,7 +12,8 @@ extern double __atan_fma4 (double); | ||
45 | # define __atan_fma4 ((void *) 0) | ||
46 | # endif | ||
47 | |||
48 | -libm_ifunc (atan, HAS_FMA4 ? __atan_fma4 : HAS_AVX ? __atan_avx : __atan_sse2); | ||
49 | +libm_ifunc (atan, (HAS_FMA4 ? __atan_fma4 : | ||
50 | + HAS_YMM_USABLE ? __atan_avx : __atan_sse2)); | ||
51 | |||
52 | # define atan __atan_sse2 | ||
53 | #endif | ||
54 | diff --git a/sysdeps/x86_64/fpu/multiarch/s_sin.c b/sysdeps/x86_64/fpu/multiarch/s_sin.c | ||
55 | index 1ba9dbc..417acd0 100644 | ||
56 | --- a/sysdeps/x86_64/fpu/multiarch/s_sin.c | ||
57 | +++ b/sysdeps/x86_64/fpu/multiarch/s_sin.c | ||
58 | @@ -17,10 +17,12 @@ extern double __sin_fma4 (double); | ||
59 | # define __sin_fma4 ((void *) 0) | ||
60 | # endif | ||
61 | |||
62 | -libm_ifunc (__cos, HAS_FMA4 ? __cos_fma4 : HAS_AVX ? __cos_avx : __cos_sse2); | ||
63 | +libm_ifunc (__cos, (HAS_FMA4 ? __cos_fma4 : | ||
64 | + HAS_YMM_USABLE ? __cos_avx : __cos_sse2)); | ||
65 | weak_alias (__cos, cos) | ||
66 | |||
67 | -libm_ifunc (__sin, HAS_FMA4 ? __sin_fma4 : HAS_AVX ? __sin_avx : __sin_sse2); | ||
68 | +libm_ifunc (__sin, (HAS_FMA4 ? __sin_fma4 : | ||
69 | + HAS_YMM_USABLE ? __sin_avx : __sin_sse2)); | ||
70 | weak_alias (__sin, sin) | ||
71 | |||
72 | # define __cos __cos_sse2 | ||
73 | diff --git a/sysdeps/x86_64/fpu/multiarch/s_tan.c b/sysdeps/x86_64/fpu/multiarch/s_tan.c | ||
74 | index 8f6601e..3047155 100644 | ||
75 | --- a/sysdeps/x86_64/fpu/multiarch/s_tan.c | ||
76 | +++ b/sysdeps/x86_64/fpu/multiarch/s_tan.c | ||
77 | @@ -12,7 +12,8 @@ extern double __tan_fma4 (double); | ||
78 | # define __tan_fma4 ((void *) 0) | ||
79 | # endif | ||
80 | |||
81 | -libm_ifunc (tan, HAS_FMA4 ? __tan_fma4 : HAS_AVX ? __tan_avx : __tan_sse2); | ||
82 | +libm_ifunc (tan, (HAS_FMA4 ? __tan_fma4 : | ||
83 | + HAS_YMM_USABLE ? __tan_avx : __tan_sse2)); | ||
84 | |||
85 | # define tan __tan_sse2 | ||
86 | #endif | ||
87 | diff --git a/sysdeps/x86_64/multiarch/init-arch.c b/sysdeps/x86_64/multiarch/init-arch.c | ||
88 | index 65b0ee9..76d146c 100644 | ||
89 | --- a/sysdeps/x86_64/multiarch/init-arch.c | ||
90 | +++ b/sysdeps/x86_64/multiarch/init-arch.c | ||
91 | @@ -1,6 +1,6 @@ | ||
92 | /* Initialize CPU feature data. | ||
93 | This file is part of the GNU C Library. | ||
94 | - Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | ||
95 | + Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. | ||
96 | Contributed by Ulrich Drepper <drepper@redhat.com>. | ||
97 | |||
98 | The GNU C Library is free software; you can redistribute it and/or | ||
99 | @@ -144,6 +144,18 @@ __init_cpu_features (void) | ||
100 | else | ||
101 | kind = arch_kind_other; | ||
102 | |||
103 | + if (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_AVX) | ||
104 | + { | ||
105 | + /* Reset the AVX bit in case OSXSAVE is disabled. */ | ||
106 | + if ((__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx & bit_OSXSAVE) != 0 | ||
107 | + && ({ unsigned int xcrlow; | ||
108 | + unsigned int xcrhigh; | ||
109 | + asm ("xgetbv" | ||
110 | + : "=a" (xcrlow), "=d" (xcrhigh) : "c" (0)); | ||
111 | + (xcrlow & 6) == 6; })) | ||
112 | + __cpu_features.feature[index_YMM_Usable] |= bit_YMM_Usable; | ||
113 | + } | ||
114 | + | ||
115 | __cpu_features.family = family; | ||
116 | __cpu_features.model = model; | ||
117 | atomic_write_barrier (); | ||
118 | diff --git a/sysdeps/x86_64/multiarch/init-arch.h b/sysdeps/x86_64/multiarch/init-arch.h | ||
119 | index 2a1df39..2dc75ab 100644 | ||
120 | --- a/sysdeps/x86_64/multiarch/init-arch.h | ||
121 | +++ b/sysdeps/x86_64/multiarch/init-arch.h | ||
122 | @@ -1,5 +1,5 @@ | ||
123 | /* This file is part of the GNU C Library. | ||
124 | - Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | ||
125 | + Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. | ||
126 | |||
127 | The GNU C Library is free software; you can redistribute it and/or | ||
128 | modify it under the terms of the GNU Lesser General Public | ||
129 | @@ -22,11 +22,13 @@ | ||
130 | #define bit_Prefer_SSE_for_memop (1 << 3) | ||
131 | #define bit_Fast_Unaligned_Load (1 << 4) | ||
132 | #define bit_Prefer_PMINUB_for_stringop (1 << 5) | ||
133 | +#define bit_YMM_Usable (1 << 6) | ||
134 | |||
135 | #define bit_SSE2 (1 << 26) | ||
136 | #define bit_SSSE3 (1 << 9) | ||
137 | #define bit_SSE4_1 (1 << 19) | ||
138 | #define bit_SSE4_2 (1 << 20) | ||
139 | +#define bit_OSXSAVE (1 << 27) | ||
140 | #define bit_AVX (1 << 28) | ||
141 | #define bit_POPCOUNT (1 << 23) | ||
142 | #define bit_FMA (1 << 12) | ||
143 | @@ -48,6 +50,7 @@ | ||
144 | # define index_Prefer_SSE_for_memop FEATURE_INDEX_1*FEATURE_SIZE | ||
145 | # define index_Fast_Unaligned_Load FEATURE_INDEX_1*FEATURE_SIZE | ||
146 | # define index_Prefer_PMINUB_for_stringop FEATURE_INDEX_1*FEATURE_SIZE | ||
147 | +# define index_YMM_Usable FEATURE_INDEX_1*FEATURE_SIZE | ||
148 | |||
149 | #else /* __ASSEMBLER__ */ | ||
150 | |||
151 | @@ -92,7 +95,7 @@ extern struct cpu_features | ||
152 | |||
153 | |||
154 | extern void __init_cpu_features (void) attribute_hidden; | ||
155 | -#define INIT_ARCH()\ | ||
156 | +# define INIT_ARCH() \ | ||
157 | do \ | ||
158 | if (__cpu_features.kind == arch_kind_unknown) \ | ||
159 | __init_cpu_features (); \ | ||
160 | @@ -125,23 +128,21 @@ extern const struct cpu_features *__get_cpu_features (void) | ||
161 | # define index_Slow_BSF FEATURE_INDEX_1 | ||
162 | # define index_Prefer_SSE_for_memop FEATURE_INDEX_1 | ||
163 | # define index_Fast_Unaligned_Load FEATURE_INDEX_1 | ||
164 | +# define index_YMM_Usable FEATURE_INDEX_1 | ||
165 | |||
166 | -#define HAS_ARCH_FEATURE(idx, bit) \ | ||
167 | - ((__get_cpu_features ()->feature[idx] & (bit)) != 0) | ||
168 | +# define HAS_ARCH_FEATURE(name) \ | ||
169 | + ((__get_cpu_features ()->feature[index_##name] & (bit_##name)) != 0) | ||
170 | |||
171 | -#define HAS_FAST_REP_STRING \ | ||
172 | - HAS_ARCH_FEATURE (index_Fast_Rep_String, bit_Fast_Rep_String) | ||
173 | +# define HAS_FAST_REP_STRING HAS_ARCH_FEATURE (Fast_Rep_String) | ||
174 | |||
175 | -#define HAS_FAST_COPY_BACKWARD \ | ||
176 | - HAS_ARCH_FEATURE (index_Fast_Copy_Backward, bit_Fast_Copy_Backward) | ||
177 | +# define HAS_FAST_COPY_BACKWARD HAS_ARCH_FEATURE (Fast_Copy_Backward) | ||
178 | |||
179 | -#define HAS_SLOW_BSF \ | ||
180 | - HAS_ARCH_FEATURE (index_Slow_BSF, bit_Slow_BSF) | ||
181 | +# define HAS_SLOW_BSF HAS_ARCH_FEATURE (Slow_BSF) | ||
182 | |||
183 | -#define HAS_PREFER_SSE_FOR_MEMOP \ | ||
184 | - HAS_ARCH_FEATURE (index_Prefer_SSE_for_memop, bit_Prefer_SSE_for_memop) | ||
185 | +# define HAS_PREFER_SSE_FOR_MEMOP HAS_ARCH_FEATURE (Prefer_SSE_for_memop) | ||
186 | |||
187 | -#define HAS_FAST_UNALIGNED_LOAD \ | ||
188 | - HAS_ARCH_FEATURE (index_Fast_Unaligned_Load, bit_Fast_Unaligned_Load) | ||
189 | +# define HAS_FAST_UNALIGNED_LOAD HAS_ARCH_FEATURE (Fast_Unaligned_Load) | ||
190 | + | ||
191 | +# define HAS_YMM_USABLE HAS_ARCH_FEATURE (YMM_Usable) | ||
192 | |||
193 | #endif /* __ASSEMBLER__ */ | ||
194 | -- | ||
195 | 1.7.9 |