1
2012-06-21 Joseph Myers <joseph@codesourcery.com>
4
* sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c (__ieee754_cosh):
5
Clear sign bit of 64-bit integer value before comparing against
8
2012-06-05 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
10
* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c: Fix for wrong ldbl128-ibm
13
2012-06-04 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
15
* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Fix
16
subnormal exponent extraction and add some __builtin_expect.
17
* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h (ldbl_extract_mantissa):
18
Fix for subnormal mantissa calculation.
20
2012-06-01 Joseph Myers <joseph@codesourcery.com>
23
* sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c (__ieee754_fmod):
24
Use int64_t for variable i.
26
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
27
index 41dc42c..b8aadab 100644
28
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
29
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_cosh.c
30
@@ -67,6 +67,7 @@ __ieee754_cosh (double x)
31
/* |x| in [log(maxdouble), overflowthresold] */
33
EXTRACT_WORDS64(fix, x);
34
+ fix &= UINT64_C(0x7fffffffffffffff);
35
if (fix <= UINT64_C(0x408633ce8fb9f87d)) {
36
w = __ieee754_exp(half*fabs(x));
38
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c b/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c
39
index 0e20571..5158196 100644
40
--- a/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c
41
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/e_fmod.c
42
@@ -24,8 +24,8 @@ static const double one = 1.0, Zero[] = {0.0, -0.0,};
44
__ieee754_fmod (double x, double y)
47
- int64_t hx,hy,hz,sx;
49
+ int64_t hx,hy,hz,sx,i;
51
EXTRACT_WORDS64(hx,x);
52
EXTRACT_WORDS64(hy,y);
53
diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
54
index 4ad59a0..033fde7 100644
55
--- a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
56
+++ b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c
57
@@ -27,7 +27,7 @@ static const long double one = 1.0, Zero[] = {0.0, -0.0,};
59
__ieee754_fmodl (long double x, long double y)
61
- int64_t n,hx,hy,hz,ix,iy,sx,i;
62
+ int64_t n,hx,hy,hz,ix,iy,sx, i;
66
@@ -38,41 +38,42 @@ __ieee754_fmodl (long double x, long double y)
67
hy &= 0x7fffffffffffffffLL; /* |y| */
69
/* purge off exception values */
70
- if((hy|(ly&0x7fffffffffffffff))==0||(hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
71
- (hy>0x7ff0000000000000LL)) /* or y is NaN */
72
+ if(__builtin_expect((hy|(ly&0x7fffffffffffffff))==0 ||
73
+ (hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */
74
+ (hy>0x7ff0000000000000LL),0)) /* or y is NaN */
77
+ if(__builtin_expect(hx<=hy,0)) {
78
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
80
return Zero[(u_int64_t)sx>>63]; /* |x|=|y| return x*0*/
83
/* determine ix = ilogb(x) */
84
- if(hx<0x0010000000000000LL) { /* subnormal x */
85
+ if(__builtin_expect(hx<0x0010000000000000LL,0)) { /* subnormal x */
87
for (ix = -1043, i=lx; i>0; i<<=1) ix -=1;
89
- for (ix = -1022, i=hx<<19; i>0; i<<=1) ix -=1;
90
+ for (ix = -1022, i=(hx<<11); i>0; i<<=1) ix -=1;
92
} else ix = (hx>>52)-0x3ff;
94
/* determine iy = ilogb(y) */
95
- if(hy<0x0010000000000000LL) { /* subnormal y */
96
+ if(__builtin_expect(hy<0x0010000000000000LL,0)) { /* subnormal y */
98
for (iy = -1043, i=ly; i>0; i<<=1) iy -=1;
100
- for (iy = -1022, i=hy<<19; i>0; i<<=1) iy -=1;
101
+ for (iy = -1022, i=(hy<<11); i>0; i<<=1) iy -=1;
103
} else iy = (hy>>52)-0x3ff;
105
/* Make the IBM extended format 105 bit mantissa look like the ieee854 112
106
- bit mantissa so the following operatations will give the correct
107
+ bit mantissa so the following operations will give the correct
109
ldbl_extract_mantissa(&hx, &lx, &temp, x);
110
ldbl_extract_mantissa(&hy, &ly, &temp, y);
112
/* set up {hx,lx}, {hy,ly} and align y to x */
114
+ if(__builtin_expect(ix >= -1022, 1))
115
hx = 0x0001000000000000LL|(0x0000ffffffffffffLL&hx);
116
else { /* subnormal x, shift x to normal */
118
@@ -84,7 +85,7 @@ __ieee754_fmodl (long double x, long double y)
123
+ if(__builtin_expect(iy >= -1022, 1))
124
hy = 0x0001000000000000LL|(0x0000ffffffffffffLL&hy);
125
else { /* subnormal y, shift y to normal */
127
@@ -118,7 +119,7 @@ __ieee754_fmodl (long double x, long double y)
128
hx = hx+hx+(lx>>63); lx = lx+lx;
131
- if(iy>= -1022) { /* normalize output */
132
+ if(__builtin_expect(iy>= -1022,0)) { /* normalize output */
133
x = ldbl_insert_mantissa((sx>>63), iy, hx, lx);
134
} else { /* subnormal output */
136
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
137
index d055d65..be9ac71 100644
138
--- a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
139
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
144
-ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
145
+ldbl_extract_mantissa (int64_t *hi64, uint64_t *lo64, int *exp, long double x)
147
/* We have 105 bits of mantissa plus one implicit digit. Since
148
106 bits are representable we use the first implicit digit for
149
the number before the decimal point and the second implicit bit
150
as bit 53 of the mantissa. */
151
- unsigned long long hi, lo;
154
union ibm_extended_long_double eldbl;
156
*exp = eldbl.ieee.exponent - IBM_EXTENDED_LONG_DOUBLE_BIAS;
158
- lo = ((long long)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
159
- hi = ((long long)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
160
+ lo = ((int64_t)eldbl.ieee.mantissa2 << 32) | eldbl.ieee.mantissa3;
161
+ hi = ((int64_t)eldbl.ieee.mantissa0 << 32) | eldbl.ieee.mantissa1;
162
/* If the lower double is not a denomal or zero then set the hidden
164
if (eldbl.ieee.exponent2 > 0x001)
165
@@ -31,8 +31,8 @@ ldbl_extract_mantissa (int64_t *hi64, u_int64_t *lo64, int *exp, long double x)
166
ediff = eldbl.ieee.exponent - eldbl.ieee.exponent2;
168
lo = lo >> (ediff-53);
169
+ hi |= (1ULL << 52);
171
- hi |= (1ULL << 52);
173
if ((eldbl.ieee.negative != eldbl.ieee.negative2)
174
&& ((eldbl.ieee.exponent2 != 0) && (lo != 0LL)))