1 http://sources.redhat.com/bugzilla/show_bug.cgi?id=5350
2 https://bugs.gentoo.org/264335
4 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c
5 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c 2009-05-16 10:36:20.000000000 +0200
6 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceil.c 2009-11-13 00:50:59.000000000 +0100
11 - double two52 = copysign (0x1.0p52, x);
15 + if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
21 #ifdef _IEEE_FP_INEXACT
22 - "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
23 + "cvttq/svim %2,%1\n\t"
25 - "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
26 + "cvttq/svm %2,%1\n\t"
28 - : "=&f"(r), "=&f"(tmp)
29 - : "f"(-x), "f"(-two52));
31 + : "=f"(new_x), "=&f"(tmp1)
34 - /* Fix up the negation we did above, as well as handling -0 properly. */
35 - return copysign (r, x);
36 + /* Fix up the negation we did above, as well as handling -0 properly. */
37 + x = copysign(new_x, x);
42 weak_alias (__ceil, ceil)
43 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c
44 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c 2009-05-16 10:36:20.000000000 +0200
45 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_ceilf.c 2009-11-13 00:50:59.000000000 +0100
50 - float two23 = copysignf (0x1.0p23, x);
54 + if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
56 + /* Note that Alpha S_Floating is stored in registers in a
57 + restricted T_Floating format, so we don't even need to
58 + convert back to S_Floating in the end. The initial
59 + conversion to T_Floating is needed to handle denormals. */
61 + float tmp1, tmp2, new_x;
64 + __asm ("cvtst/s %3,%2\n\t"
65 #ifdef _IEEE_FP_INEXACT
66 - "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
67 + "cvttq/svim %2,%1\n\t"
69 - "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
70 + "cvttq/svm %2,%1\n\t"
72 - : "=&f"(r), "=&f"(tmp)
73 - : "f"(-x), "f"(-two23));
75 + : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
78 - /* Fix up the negation we did above, as well as handling -0 properly. */
79 - return copysignf (r, x);
80 + /* Fix up the negation we did above, as well as handling -0 properly. */
81 + x = copysignf(new_x, x);
86 weak_alias (__ceilf, ceilf)
87 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c
88 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c 2009-05-16 10:36:20.000000000 +0200
89 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floor.c 2009-11-13 00:50:59.000000000 +0100
91 #include <math_ldbl_opt.h>
94 -/* Use the -inf rounding mode conversion instructions to implement floor. */
95 +/* Use the -inf rounding mode conversion instructions to implement
96 + floor. We note when the exponent is large enough that the value
97 + must be integral, as this avoids unpleasant integer overflows. */
102 - double two52 = copysign (0x1.0p52, x);
106 + if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
108 + double tmp1, new_x;
111 #ifdef _IEEE_FP_INEXACT
112 - "addt/suim %2, %3, %1\n\tsubt/suim %1, %3, %0"
113 + "cvttq/svim %2,%1\n\t"
115 - "addt/sum %2, %3, %1\n\tsubt/sum %1, %3, %0"
116 + "cvttq/svm %2,%1\n\t"
118 - : "=&f"(r), "=&f"(tmp)
119 - : "f"(x), "f"(two52));
120 + "cvtqt/m %1,%0\n\t"
121 + : "=f"(new_x), "=&f"(tmp1)
124 - /* floor(-0) == -0, and in general we'll always have the same
125 - sign as our input. */
126 - return copysign (r, x);
127 + /* floor(-0) == -0, and in general we'll always have the same
128 + sign as our input. */
129 + x = copysign(new_x, x);
134 weak_alias (__floor, floor)
135 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c
136 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c 2009-05-16 10:36:20.000000000 +0200
137 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_floorf.c 2009-11-13 00:50:59.000000000 +0100
142 -/* Use the -inf rounding mode conversion instructions to implement floor. */
143 +/* Use the -inf rounding mode conversion instructions to implement
144 + floor. We note when the exponent is large enough that the value
145 + must be integral, as this avoids unpleasant integer overflows. */
150 - float two23 = copysignf (0x1.0p23, x);
154 + if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
156 + /* Note that Alpha S_Floating is stored in registers in a
157 + restricted T_Floating format, so we don't even need to
158 + convert back to S_Floating in the end. The initial
159 + conversion to T_Floating is needed to handle denormals. */
161 + float tmp1, tmp2, new_x;
163 + __asm ("cvtst/s %3,%2\n\t"
164 #ifdef _IEEE_FP_INEXACT
165 - "adds/suim %2, %3, %1\n\tsubs/suim %1, %3, %0"
166 + "cvttq/svim %2,%1\n\t"
168 - "adds/sum %2, %3, %1\n\tsubs/sum %1, %3, %0"
169 + "cvttq/svm %2,%1\n\t"
171 - : "=&f"(r), "=&f"(tmp)
172 - : "f"(x), "f"(two23));
173 + "cvtqt/m %1,%0\n\t"
174 + : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
177 - /* floor(-0) == -0, and in general we'll always have the same
178 - sign as our input. */
179 - return copysignf (r, x);
180 + /* floor(-0) == -0, and in general we'll always have the same
181 + sign as our input. */
182 + x = copysignf(new_x, x);
187 weak_alias (__floorf, floorf)
188 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c
189 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c 2009-05-16 10:36:20.000000000 +0200
190 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rint.c 2009-11-13 00:50:59.000000000 +0100
195 - double two52 = copysign (0x1.0p52, x);
200 + if (isless (fabs (x), 9007199254740992.0)) /* 1 << DBL_MANT_DIG */
202 + double tmp1, new_x;
204 +#ifdef _IEEE_FP_INEXACT
205 + "cvttq/svid %2,%1\n\t"
207 + "cvttq/svd %2,%1\n\t"
209 + "cvtqt/d %1,%0\n\t"
210 + : "=f"(new_x), "=&f"(tmp1)
213 - /* rint(-0.1) == -0, and in general we'll always have the same sign
215 - return copysign (r, x);
216 + /* rint(-0.1) == -0, and in general we'll always have the same
217 + sign as our input. */
218 + x = copysign(new_x, x);
223 weak_alias (__rint, rint)
224 diff -durN glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c
225 --- glibc-2.10.1.orig/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c 2009-05-16 10:36:20.000000000 +0200
226 +++ glibc-2.10.1/glibc-ports-2.10.1/sysdeps/alpha/fpu/s_rintf.c 2009-11-13 00:50:59.000000000 +0100
231 - float two23 = copysignf (0x1.0p23, x);
233 + if (isless (fabsf (x), 16777216.0f)) /* 1 << FLT_MANT_DIG */
235 + /* Note that Alpha S_Floating is stored in registers in a
236 + restricted T_Floating format, so we don't even need to
237 + convert back to S_Floating in the end. The initial
238 + conversion to T_Floating is needed to handle denormals. */
242 + float tmp1, tmp2, new_x;
244 - /* rint(-0.1) == -0, and in general we'll always have the same sign
246 - return copysign (r, x);
247 + __asm ("cvtst/s %3,%2\n\t"
248 +#ifdef _IEEE_FP_INEXACT
249 + "cvttq/svid %2,%1\n\t"
251 + "cvttq/svd %2,%1\n\t"
253 + "cvtqt/d %1,%0\n\t"
254 + : "=f"(new_x), "=&f"(tmp1), "=&f"(tmp2)
257 + /* rint(-0.1) == -0, and in general we'll always have the same
258 + sign as our input. */
259 + x = copysignf(new_x, x);
264 weak_alias (__rintf, rintf)
265 diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_ceil.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_ceil.c
266 diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_ceilf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_ceilf.c
267 diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_floor.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_floor.c
268 diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_floorf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_floorf.c
269 diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_rint.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_rint.c
270 diff -durN glibc-2.10.1.orig/ports/sysdeps/alpha/fpu/s_rintf.c glibc-2.10.1/ports/sysdeps/alpha/fpu/s_rintf.c