Commit f0c2df63 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/46625 (libquadmath: Mangle internal symbols; rename __float128 <-> string functions)

2010-12-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/46625
        * gdtoa/gdtoaimp.h: Mangle internal functions by
        prefixing them with __quadmath. Don't use gdtoa's strcp(y).
        * gdtoa/g_Qfmt.c (g_Qfmt): Use strcpy instead of strcp.
        * gdtoa/misc.c (strcpy): Renamed from strcp and only use
        if NO_STRING_H is set.
        * quadmath-imp.h (__quadmath_rem_pio2q,
        * __quadmath_kernel_sincosq
        __quadmath_kernel_sinq, __quadmath_kernel_cosq): Added
        __quadmath prefix to internal functions.
        * math/cosq.c (cosq): Ditto.
        * math/sinq.c (cosq): Ditto.
        * math/tanq.c (tanq,__quadmath_kernel_tanq): Ditto.
        * math/rem_pio2q.c (rem_pio2, __quadmath_kernel_rem_pio2):
        * Ditto.
        * math/sinq_kernel.c (__quadmath_kernel_sinq): Ditto.
        * math/cosq_kernel.c (__quadmath_kernel_cosq): Ditto.

From-SVN: r167768
parent c58bb30d
2010-12-13 Tobias Burnus <burnus@net-b.de>
PR fortran/46625
* gdtoa/gdtoaimp.h: Mangle internal functions by
prefixing them with __quadmath. Don't use gdtoa's strcp(y).
* gdtoa/g_Qfmt.c (g_Qfmt): Use strcpy instead of strcp.
* gdtoa/misc.c (strcpy): Renamed from strcp and only use
if NO_STRING_H is set.
* quadmath-imp.h (__quadmath_rem_pio2q, __quadmath_kernel_sincosq
__quadmath_kernel_sinq, __quadmath_kernel_cosq): Added
__quadmath prefix to internal functions.
* math/cosq.c (cosq): Ditto.
* math/sinq.c (cosq): Ditto.
* math/tanq.c (tanq,__quadmath_kernel_tanq): Ditto.
* math/rem_pio2q.c (rem_pio2, __quadmath_kernel_rem_pio2): Ditto.
* math/sinq_kernel.c (__quadmath_kernel_sinq): Ditto.
* math/cosq_kernel.c (__quadmath_kernel_cosq): Ditto.
2010-12-08 Tobias Burnus <burnus@net-b.de> 2010-12-08 Tobias Burnus <burnus@net-b.de>
PR fortran/46772 PR fortran/46772
......
...@@ -82,12 +82,12 @@ g_Qfmt(char *buf, void *V, int ndig, size_t bufsize) ...@@ -82,12 +82,12 @@ g_Qfmt(char *buf, void *V, int ndig, size_t bufsize)
if (ex == 0x7fff) { if (ex == 0x7fff) {
/* Infinity or NaN */ /* Infinity or NaN */
if (bits[0] | bits[1] | bits[2] | bits[3]) if (bits[0] | bits[1] | bits[2] | bits[3])
b = strcp(b, "NaN"); b = strcpy(b, "NaN");
else { else {
b = buf; b = buf;
if (sign) if (sign)
*b++ = '-'; *b++ = '-';
b = strcp(b, "Infinity"); b = strcpy(b, "Infinity");
} }
return b; return b;
} }
......
...@@ -472,51 +472,54 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t)); ...@@ -472,51 +472,54 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
#define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int)) #define Bcopy(x,y) memcpy(&x->sign,&y->sign,y->wds*sizeof(ULong) + 2*sizeof(int))
#endif /* NO_STRING_H */ #endif /* NO_STRING_H */
#define Balloc Balloc_D2A #define Balloc __quadmath_Balloc_D2A
#define Bfree Bfree_D2A #define Bfree __quadmath_Bfree_D2A
#define ULtoQ ULtoQ_D2A #define ULtoQ __quadmath_ULtoQ_D2A
#define ULtof ULtof_D2A #define ULtof __quadmath_ULtof_D2A
#define ULtod ULtod_D2A #define ULtod __quadmath_ULtod_D2A
#define ULtodd ULtodd_D2A #define ULtodd __quadmath_ULtodd_D2A
#define ULtox ULtox_D2A #define ULtox __quadmath_ULtox_D2A
#define ULtoxL ULtoxL_D2A #define ULtoxL __quadmath_ULtoxL_D2A
#define any_on any_on_D2A #define any_on __quadmath_any_on_D2A
#define b2d b2d_D2A #define b2d __quadmath_b2d_D2A
#define bigtens bigtens_D2A #define bigtens __quadmath_bigtens_D2A
#define cmp cmp_D2A #define cmp __quadmath_cmp_D2A
#define copybits copybits_D2A #define copybits __quadmath_copybits_D2A
#define d2b d2b_D2A #define d2b __quadmath_d2b_D2A
#define decrement decrement_D2A #define decrement __quadmath_decrement_D2A
#define diff diff_D2A #define diff __quadmath_diff_D2A
#define dtoa_result dtoa_result_D2A #define dtoa_result __quadmath_dtoa_result_D2A
#define g__fmt g__fmt_D2A #define g__fmt __quadmath_g__fmt_D2A
#define gethex gethex_D2A #define gethex __quadmath_gethex_D2A
#define hexdig hexdig_D2A #define hexdig __quadmath_hexdig_D2A
#define hexnan hexnan_D2A #define hexnan __quadmath_hexnan_D2A
#define hi0bits(x) hi0bits_D2A((ULong)(x)) #define hi0bits_D2A __quadmath_hi0bits_D2A
#define i2b i2b_D2A #define hi0bits(x) __quadmath_hi0bits_D2A((ULong)(x))
#define increment increment_D2A #define i2b __quadmath_i2b_D2A
#define lo0bits lo0bits_D2A #define increment __quadmath_increment_D2A
#define lshift lshift_D2A #define lo0bits __quadmath_lo0bits_D2A
#define match match_D2A #define lshift __quadmath_lshift_D2A
#define mult mult_D2A #define match __quadmath_match_D2A
#define multadd multadd_D2A #define mult __quadmath_mult_D2A
#define nrv_alloc nrv_alloc_D2A #define multadd __quadmath_multadd_D2A
#define pow5mult pow5mult_D2A #define nrv_alloc __quadmath_nrv_alloc_D2A
#define quorem quorem_D2A #define pow5mult __quadmath_pow5mult_D2A
#define ratio ratio_D2A #define quorem __quadmath_quorem_D2A
#define rshift rshift_D2A #define ratio __quadmath_ratio_D2A
#define rv_alloc rv_alloc_D2A #define rshift __quadmath_rshift_D2A
#define s2b s2b_D2A #define rv_alloc __quadmath_rv_alloc_D2A
#define set_ones set_ones_D2A #define s2b __quadmath_s2b_D2A
#define strcp strcp_D2A #define set_ones __quadmath_set_ones_D2A
#define strtoIg strtoIg_D2A #ifdef NO_STRING_H
#define sum sum_D2A #define strcp __quadmath_strcp_D2A
#define tens tens_D2A #endif
#define tinytens tinytens_D2A #define strtoIg __quadmath_strtoIg_D2A
#define tinytens tinytens_D2A #define sum __quadmath_sum_D2A
#define trailz trailz_D2A #define tens __quadmath_tens_D2A
#define ulp ulp_D2A #define tinytens __quadmath_tinytens_D2A
#define tinytens __quadmath_tinytens_D2A
#define trailz __quadmath_trailz_D2A
#define ulp __quadmath_ulp_D2A
extern char *dtoa_result; extern char *dtoa_result;
extern CONST double bigtens[], tens[], tinytens[]; extern CONST double bigtens[], tens[], tinytens[];
...@@ -559,7 +562,9 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t)); ...@@ -559,7 +562,9 @@ extern void memcpy_D2A ANSI((void*, const void*, size_t));
extern char *rv_alloc ANSI((int)); extern char *rv_alloc ANSI((int));
extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int)); extern Bigint *s2b ANSI((CONST char*, int, int, ULong, int));
extern Bigint *set_ones ANSI((Bigint*, int)); extern Bigint *set_ones ANSI((Bigint*, int));
extern char *strcp ANSI((char*, const char*)); #ifdef NO_STRING_H
extern char *strcpy ANSI((char*, const char*));
#endif
extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*)); extern int strtoIg ANSI((CONST char*, char**, FPI*, Long*, Bigint**, int*));
extern Bigint *sum ANSI((Bigint*, Bigint*)); extern Bigint *sum ANSI((Bigint*, Bigint*));
extern int trailz ANSI((Bigint*)); extern int trailz ANSI((Bigint*));
......
...@@ -844,11 +844,12 @@ tens[] = { ...@@ -844,11 +844,12 @@ tens[] = {
#endif #endif
}; };
#ifdef NO_STRING_H
char * char *
#ifdef KR_headers #ifdef KR_headers
strcp_D2A(a, b) char *a; char *b; strcpy_D2A(a, b) char *a; char *b;
#else #else
strcp_D2A(char *a, CONST char *b) strcpy_D2A(char *a, CONST char *b)
#endif #endif
{ {
while((*a = *b++)) while((*a = *b++))
...@@ -856,7 +857,6 @@ strcp_D2A(char *a, CONST char *b) ...@@ -856,7 +857,6 @@ strcp_D2A(char *a, CONST char *b)
return a; return a;
} }
#ifdef NO_STRING_H
Char * Char *
#ifdef KR_headers #ifdef KR_headers
......
...@@ -58,7 +58,7 @@ cosq (__float128 x) ...@@ -58,7 +58,7 @@ cosq (__float128 x)
/* |x| ~< pi/4 */ /* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL; ix &= 0x7fffffffffffffffLL;
if(ix <= 0x3ffe921fb54442d1LL) if(ix <= 0x3ffe921fb54442d1LL)
return __kernel_cosq(x,z); return __quadmath_kernel_cosq(x,z);
/* cos(Inf or NaN) is NaN */ /* cos(Inf or NaN) is NaN */
else if (ix>=0x7fff000000000000LL) { else if (ix>=0x7fff000000000000LL) {
...@@ -70,13 +70,13 @@ cosq (__float128 x) ...@@ -70,13 +70,13 @@ cosq (__float128 x)
/* argument reduction needed */ /* argument reduction needed */
else { else {
n = rem_pio2q(x,y); n = __quadmath_rem_pio2q(x,y);
switch(n&3) { switch(n&3) {
case 0: return __kernel_cosq(y[0],y[1]); case 0: return __quadmath_kernel_cosq(y[0],y[1]);
case 1: return -__kernel_sinq(y[0],y[1],1); case 1: return -__quadmath_kernel_sinq(y[0],y[1],1);
case 2: return -__kernel_cosq(y[0],y[1]); case 2: return -__quadmath_kernel_cosq(y[0],y[1]);
default: default:
return __kernel_sinq(y[0],y[1],1); return __quadmath_kernel_sinq(y[0],y[1],1);
} }
} }
} }
...@@ -77,7 +77,7 @@ static const __float128 c[] = { ...@@ -77,7 +77,7 @@ static const __float128 c[] = {
extern const __float128 __sincosq_table[]; extern const __float128 __sincosq_table[];
__float128 __float128
__kernel_cosq (__float128 x, __float128 y) __quadmath_kernel_cosq (__float128 x, __float128 y)
{ {
__float128 h, l, z, sin_l, cos_l_m1; __float128 h, l, z, sin_l, cos_l_m1;
int64_t ix; int64_t ix;
......
...@@ -151,7 +151,7 @@ static const double ...@@ -151,7 +151,7 @@ static const double
static int static int
__kernel_rem_pio2 (double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) __quadmath_kernel_rem_pio2 (double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
{ {
int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
double z,fw,f[20],fq[20],q[20]; double z,fw,f[20],fq[20],q[20];
...@@ -500,7 +500,7 @@ static const __float128 c[] = { ...@@ -500,7 +500,7 @@ static const __float128 c[] = {
int32_t int32_t
rem_pio2q (__float128 x, __float128 *y) __quadmath_rem_pio2q (__float128 x, __float128 *y)
{ {
__float128 z, w, t; __float128 z, w, t;
double tx[8]; double tx[8];
...@@ -557,8 +557,9 @@ rem_pio2q (__float128 x, __float128 *y) ...@@ -557,8 +557,9 @@ rem_pio2q (__float128 x, __float128 *y)
tx [3] = (double)((lx >> 17) & 0xffffff); tx [3] = (double)((lx >> 17) & 0xffffff);
tx [4] = (double)((lx << 7) & 0xffffff); tx [4] = (double)((lx << 7) & 0xffffff);
n = __kernel_rem_pio2 (tx, tx + 5, exp, ((lx << 7) & 0xffffff) ? 5 : 4, n = __quadmath_kernel_rem_pio2 (tx, tx + 5, exp,
3, two_over_pi); ((lx << 7) & 0xffffff) ? 5 : 4,
3, two_over_pi);
/* The result is now stored in 3 double values, we need to convert it into /* The result is now stored in 3 double values, we need to convert it into
two __float128 values. */ two __float128 values. */
......
...@@ -32,7 +32,7 @@ sincosq (__float128 x, __float128 *sinx, __float128 *cosx) ...@@ -32,7 +32,7 @@ sincosq (__float128 x, __float128 *sinx, __float128 *cosx)
/* |x| ~< pi/4 */ /* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL; ix &= 0x7fffffffffffffffLL;
if (ix <= 0x3ffe921fb54442d1LL) if (ix <= 0x3ffe921fb54442d1LL)
__kernel_sincosq (x, 0.0Q, sinx, cosx, 0); __quadmath_kernel_sincosq (x, 0.0Q, sinx, cosx, 0);
else if (ix >= 0x7fff000000000000LL) else if (ix >= 0x7fff000000000000LL)
{ {
/* sin(Inf or NaN) is NaN */ /* sin(Inf or NaN) is NaN */
...@@ -44,23 +44,23 @@ sincosq (__float128 x, __float128 *sinx, __float128 *cosx) ...@@ -44,23 +44,23 @@ sincosq (__float128 x, __float128 *sinx, __float128 *cosx)
__float128 y[2]; __float128 y[2];
int n; int n;
n = rem_pio2q (x, y); n = __quadmath_rem_pio2q (x, y);
switch (n & 3) switch (n & 3)
{ {
case 0: case 0:
__kernel_sincosq (y[0], y[1], sinx, cosx, 1); __quadmath_kernel_sincosq (y[0], y[1], sinx, cosx, 1);
break; break;
case 1: case 1:
__kernel_sincosq (y[0], y[1], cosx, sinx, 1); __quadmath_kernel_sincosq (y[0], y[1], cosx, sinx, 1);
*cosx = -*cosx; *cosx = -*cosx;
break; break;
case 2: case 2:
__kernel_sincosq (y[0], y[1], sinx, cosx, 1); __quadmath_kernel_sincosq (y[0], y[1], sinx, cosx, 1);
*sinx = -*sinx; *sinx = -*sinx;
*cosx = -*cosx; *cosx = -*cosx;
break; break;
default: default:
__kernel_sincosq (y[0], y[1], cosx, sinx, 1); __quadmath_kernel_sincosq (y[0], y[1], cosx, sinx, 1);
*sinx = -*sinx; *sinx = -*sinx;
break; break;
} }
......
...@@ -96,7 +96,8 @@ static const __float128 c[] = { ...@@ -96,7 +96,8 @@ static const __float128 c[] = {
extern const __float128 __sincosq_table[]; extern const __float128 __sincosq_table[];
void void
__kernel_sincosq(__float128 x, __float128 y, __float128 *sinx, __float128 *cosx, int iy) __quadmath_kernel_sincosq(__float128 x, __float128 y, __float128 *sinx,
__float128 *cosx, int iy)
{ {
__float128 h, l, z, sin_l, cos_l_m1; __float128 h, l, z, sin_l, cos_l_m1;
int64_t ix; int64_t ix;
......
...@@ -58,7 +58,7 @@ sinq (__float128 x) ...@@ -58,7 +58,7 @@ sinq (__float128 x)
/* |x| ~< pi/4 */ /* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL; ix &= 0x7fffffffffffffffLL;
if(ix <= 0x3ffe921fb54442d1LL) if(ix <= 0x3ffe921fb54442d1LL)
return __kernel_sinq(x,z,0); return __quadmath_kernel_sinq(x,z,0);
/* sin(Inf or NaN) is NaN */ /* sin(Inf or NaN) is NaN */
else if (ix>=0x7fff000000000000LL) { else if (ix>=0x7fff000000000000LL) {
...@@ -70,13 +70,13 @@ sinq (__float128 x) ...@@ -70,13 +70,13 @@ sinq (__float128 x)
/* argument reduction needed */ /* argument reduction needed */
else { else {
n = rem_pio2q(x,y); n = __quadmath_rem_pio2q(x,y);
switch(n&3) { switch(n&3) {
case 0: return __kernel_sinq(y[0],y[1],1); case 0: return __quadmath_kernel_sinq(y[0],y[1],1);
case 1: return __kernel_cosq(y[0],y[1]); case 1: return __quadmath_kernel_cosq(y[0],y[1]);
case 2: return -__kernel_sinq(y[0],y[1],1); case 2: return -__quadmath_kernel_sinq(y[0],y[1],1);
default: default:
return -__kernel_cosq(y[0],y[1]); return -__quadmath_kernel_cosq(y[0],y[1]);
} }
} }
} }
...@@ -77,7 +77,7 @@ static const __float128 c[] = { ...@@ -77,7 +77,7 @@ static const __float128 c[] = {
extern const __float128 __sincosq_table[]; extern const __float128 __sincosq_table[];
__float128 __float128
__kernel_sinq (__float128 x, __float128 y, int iy) __quadmath_kernel_sinq (__float128 x, __float128 y, int iy)
{ {
__float128 h, l, z, sin_l, cos_l_m1; __float128 h, l, z, sin_l, cos_l_m1;
int64_t ix; int64_t ix;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* __kernel_tanq( x, y, k ) /* __quadmath_kernel_tanq( x, y, k )
* kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854
* Input x is assumed to be bounded by ~pi/4 in magnitude. * Input x is assumed to be bounded by ~pi/4 in magnitude.
* Input y is the tail of x. * Input y is the tail of x.
...@@ -84,7 +84,7 @@ static const __float128 ...@@ -84,7 +84,7 @@ static const __float128
static __float128 static __float128
__kernel_tanq (__float128 x, __float128 y, int iy) __quadmath_kernel_tanq (__float128 x, __float128 y, int iy)
{ {
__float128 z, r, v, w, s; __float128 z, r, v, w, s;
int32_t ix, sign = 1; int32_t ix, sign = 1;
...@@ -218,7 +218,7 @@ tanq (__float128 x) ...@@ -218,7 +218,7 @@ tanq (__float128 x)
/* |x| ~< pi/4 */ /* |x| ~< pi/4 */
ix &= 0x7fffffffffffffffLL; ix &= 0x7fffffffffffffffLL;
if(ix <= 0x3ffe921fb54442d1LL) return __kernel_tanq(x,z,1); if(ix <= 0x3ffe921fb54442d1LL) return __quadmath_kernel_tanq(x,z,1);
/* tanl(Inf or NaN) is NaN */ /* tanl(Inf or NaN) is NaN */
else if (ix>=0x7fff000000000000LL) { else if (ix>=0x7fff000000000000LL) {
...@@ -230,8 +230,8 @@ tanq (__float128 x) ...@@ -230,8 +230,8 @@ tanq (__float128 x)
/* argument reduction needed */ /* argument reduction needed */
else { else {
n = rem_pio2q(x,y); n = __quadmath_rem_pio2q(x,y);
return __kernel_tanq(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even /* 1 -- n even, -1 -- n odd */
-1 -- n odd */ return __quadmath_kernel_tanq(y[0],y[1],1-((n&1)<<1));
} }
} }
...@@ -27,10 +27,11 @@ Boston, MA 02110-1301, USA. */ ...@@ -27,10 +27,11 @@ Boston, MA 02110-1301, USA. */
// Prototypes for internal functions // Prototypes for internal functions
extern int32_t rem_pio2q (__float128, __float128 *); extern int32_t __quadmath_rem_pio2q (__float128, __float128 *);
extern void __kernel_sincosq (__float128, __float128, __float128 *, __float128 *, int); extern void __quadmath_kernel_sincosq (__float128, __float128, __float128 *,
extern __float128 __kernel_sinq (__float128, __float128, int); __float128 *, int);
extern __float128 __kernel_cosq (__float128, __float128); extern __float128 __quadmath_kernel_sinq (__float128, __float128, int);
extern __float128 __quadmath_kernel_cosq (__float128, __float128);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment