This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] Fix soft-fp compilation failures with GCC 3.2
- From: Roger Sayle <roger at eyesopen dot com>
- To: <libc-alpha at sources dot redhat dot com>
- Date: Thu, 31 Oct 2002 21:19:20 -0700 (MST)
- Subject: [PATCH] Fix soft-fp compilation failures with GCC 3.2
This is the fourth instalment in my series of patches to soft-fp.
Many of the files in libc/soft-fp fail to compile with gcc 3.2
because their implementations make use of non standard macro
argument pasting semantics.
For example,
buttress% gcc -O2 -I../ -c negtf2.c
negtf2.c:34:17: macro "__FP_FRAC_SET_4" requires 5 arguments, but only 2 given
negtf2.c: In function `__negtf2':
negtf2.c:34: `__FP_FRAC_SET_4' undeclared (first use in this function)
negtf2.c:34: (Each undeclared identifier is reported only once
negtf2.c:34: for each function it appears in.)
The problem is caused by code such as
#define _FP_ZEROFRAC_4 0,0,0,0
#define __FP_FRAC_SET_4(X, I3, I2, I1, I0) ...
#define _FP_FRAC_SET_4(X, I) __FP_FRAC_SET_4(X, I)
when invoked as
_FP_FRAC_SET_4(X,_FP_ZEROFRAC_4)
Obviously recent modifications to tighten up the C preprocessor now
cause this "dubious" style of macro invocation to fail to compile.
Fortunately, a solution is straight forward: the _FP_FRAC_SET_x
macros as only called with one of four possible values. These
are _FP_ZEROFRAC_x, _FP_MINFRAC_x, _FP_MAXFRAC_x and _FP_NANFRAC_x,
where x is "1", "2" or "4". Rather than define these constants
as different number of arguments to _FP_FRAC_SET_x, its far more
portable to combine the functionality into four function macros,
_FP_FRAC_SET_ZERO_x, _FP_FRAC_SET_MIN_x, _FP_FRAC_SET_MAX_x and
_FP_FRAC_SET_NAN_x.
There is however one minor problem. The _FP_NANFRAC_x macros are
actually defined in the target's sfp-machine.h file. The change
above introduces a new API, where each sfp-machine now needs to
define the macros _FP_FRAC_SET_NAN_x, instead of _FP_NANFRAC_x.
To avoid breaking backwards compatibility (for users with an old
version of gcc and their own sfp-machine.h), I provide a default
_FP_FRAC_SET_NAN_x definition if one isn't provided. One major
advantage of this is that I can submit a patch to all of glibc's
sfp-machine.h files as a separate follow-up patch.
With this patch, and those posted earlier, and a suitable
sfp-machine.h, I can now get all but two of the files in
libc/soft-fp to compile with only warnings using gcc 3.2 on
i686-pc-linux-gnu. The remaining two failures are due to
incomplete TFmode support on x86 in my sfp-machine.h.
Is this patch OK?
2002-10-31 Roger Sayle <roger@eyesopen.com>
* soft-fp/op1.h (_FP_ZEROFRAC_1, _FP_MINFRAC_1, _FP_MAXFRAC_1):
Delete macros.
(_FP_FRAC_SET_ZERO_1, _FP_FRAC_SET_MIN_1 and _FP_FRAC_SET_MAX_1):
New function macros to replace the old forms above.
(_FP_FRAC_SET_NAN_1): Provide default based upon _FP_NANFRAC_S,
if not already defined, for backwards compatibility.
* soft-fp/op2.h (_FP_FRAC_SET_2): Copy implementation from
__FP_FRAC_SET_2, to take three arguments.
(__FP_FRAC_SET_2): Delete.
(_FP_ZEROFRAC_2, _FP_MINFRAC_2, _FP_MAXFRAC_2): Delete macros.
(_FP_FRAC_SET_ZERO_2, _FP_FRAC_SET_MIN_2 and _FP_FRAC_SET_MAX_2):
New function macros to replace the old forms above.
(_FP_FRAC_SET_NAN_2): Provide default based upon _FP_NANFRAC_D,
if not already defined, for backwards compatibility.
* soft-fp/op4.h (_FP_FRAC_SET_4): Copy implementation from
__FP_FRAC_SET_4, to take five arguments.
(__FP_FRAC_SET_4): Delete.
(_FP_ZEROFRAC_4, _FP_MINFRAC_4, _FP_MAXFRAC_4): Delete macros.
(_FP_FRAC_SET_ZERO_4, _FP_FRAC_SET_MIN_4 and _FP_FRAC_SET_MAX_4):
New function macros to replace the old forms above.
(_FP_FRAC_SET_NAN_4): Provide default based upon _FP_NANFRAC_Q,
if not already defined, for backwards compatibility.
* soft-fp/op-common.h: Replace all occurances of _FP_FRAC_SET_x
with the appropriate calls to either _FP_FRAC_SET_ZERO_x,
_FP_FRAC_SET_MIN_x, _FP_FRAC_SET_MAX_x or _FP_FRAC_SET_NAN_x.
* soft-fp/testit.c (gen_special_double): Replace calls to
__FP_FRAC_SET_2 with calls to _FP_FRAC_SET_2.
Index: op-1.h
===================================================================
RCS file: /cvs/glibc/libc/soft-fp/op-1.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 op-1.h
*** op-1.h 21 May 2002 02:10:25 -0000 1.4
--- op-1.h 1 Nov 2002 03:42:35 -0000
***************
*** 1,6 ****
/* Software floating-point emulation.
Basic one-word fraction declaration and manipulation.
! Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
--- 1,6 ----
/* Software floating-point emulation.
Basic one-word fraction declaration and manipulation.
! Copyright (C) 1997,1998,1999,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
***************
*** 60,68 ****
#define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f)
#define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f)
! #define _FP_ZEROFRAC_1 0
! #define _FP_MINFRAC_1 1
! #define _FP_MAXFRAC_1 (~(_FP_WS_TYPE)0)
/*
* Unpack the raw bits of a native fp value. Do not classify or
--- 60,73 ----
#define _FP_FRAC_GE_1(X, Y) (X##_f >= Y##_f)
#define _FP_FRAC_GT_1(X, Y) (X##_f > Y##_f)
! #define _FP_FRAC_SET_ZERO_1(X) _FP_FRAC_SET_1(X, 0)
! #define _FP_FRAC_SET_MIN_1(X) _FP_FRAC_SET_1(X, 1)
! #define _FP_FRAC_SET_MAX_1(X) _FP_FRAC_SET_1(X, ~(_FP_WS_TYPE)0)
!
! /* Deprecated old-style sfp-machine.h interface. */
! #ifndef _FP_FRAC_SET_NAN_1
! #define _FP_FRAC_SET_NAN_1(X) _FP_FRAC_SET_1(X, _FP_NANFRAC_S)
! #endif
/*
* Unpack the raw bits of a native fp value. Do not classify or
Index: op-2.h
===================================================================
RCS file: /cvs/glibc/libc/soft-fp/op-2.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 op-2.h
*** op-2.h 21 May 2002 02:11:05 -0000 1.4
--- op-2.h 1 Nov 2002 03:42:35 -0000
***************
*** 1,6 ****
/* Software floating-point emulation.
Basic two-word fraction declaration and manipulation.
! Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
--- 1,6 ----
/* Software floating-point emulation.
Basic two-word fraction declaration and manipulation.
! Copyright (C) 1997,1998,1999,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
***************
*** 24,30 ****
#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1
#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
! #define _FP_FRAC_SET_2(X,I) __FP_FRAC_SET_2(X, I)
#define _FP_FRAC_HIGH_2(X) (X##_f1)
#define _FP_FRAC_LOW_2(X) (X##_f0)
#define _FP_FRAC_WORD_2(X,w) (X##_f##w)
--- 24,30 ----
#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1
#define _FP_FRAC_COPY_2(D,S) (D##_f0 = S##_f0, D##_f1 = S##_f1)
! #define _FP_FRAC_SET_2(X,I1,I0) (X##_f0 = I0, X##_f1 = I1)
#define _FP_FRAC_HIGH_2(X) (X##_f1)
#define _FP_FRAC_LOW_2(X) (X##_f0)
#define _FP_FRAC_WORD_2(X,w) (X##_f##w)
***************
*** 119,133 ****
#define _FP_FRAC_GE_2(X, Y) \
(X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 >= Y##_f0)
! #define _FP_ZEROFRAC_2 0, 0
! #define _FP_MINFRAC_2 0, 1
! #define _FP_MAXFRAC_2 (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)
/*
* Internals
*/
-
- #define __FP_FRAC_SET_2(X,I1,I0) (X##_f0 = I0, X##_f1 = I1)
#define __FP_CLZ_2(R, xh, xl) \
do { \
--- 119,137 ----
#define _FP_FRAC_GE_2(X, Y) \
(X##_f1 > Y##_f1 || X##_f1 == Y##_f1 && X##_f0 >= Y##_f0)
! #define _FP_FRAC_SET_ZERO_2(X) _FP_FRAC_SET_2(X, 0, 0)
! #define _FP_FRAC_SET_MIN_2(X) _FP_FRAC_SET_2(X, 0, 1)
! #define _FP_FRAC_SET_MAX_2(X) \
! _FP_FRAC_SET_2(X, ~(_FP_WS_TYPE)0, ~(_FP_WS_TYPE)0)
!
! /* Deprecated old-style sfp-machine.h interface. */
! #ifndef _FP_FRAC_SET_NAN_2
! #define _FP_FRAC_SET_NAN_2(X) _FP_FRAC_SET_2(X, _FP_NANFRAC_D)
! #endif
/*
* Internals
*/
#define __FP_CLZ_2(R, xh, xl) \
do { \
Index: op-4.h
===================================================================
RCS file: /cvs/glibc/libc/soft-fp/op-4.h,v
retrieving revision 1.5
diff -c -3 -p -r1.5 op-4.h
*** op-4.h 17 Oct 2002 23:15:54 -0000 1.5
--- op-4.h 1 Nov 2002 03:42:35 -0000
***************
*** 1,6 ****
/* Software floating-point emulation.
Basic four-word fraction declaration and manipulation.
! Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
--- 1,6 ----
/* Software floating-point emulation.
Basic four-word fraction declaration and manipulation.
! Copyright (C) 1997,1998,1999,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
***************
*** 26,32 ****
#define _FP_FRAC_COPY_4(D,S) \
(D##_f[0] = S##_f[0], D##_f[1] = S##_f[1], \
D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
! #define _FP_FRAC_SET_4(X,I) __FP_FRAC_SET_4(X, I)
#define _FP_FRAC_HIGH_4(X) (X##_f[3])
#define _FP_FRAC_LOW_4(X) (X##_f[0])
#define _FP_FRAC_WORD_4(X,w) (X##_f[w])
--- 26,33 ----
#define _FP_FRAC_COPY_4(D,S) \
(D##_f[0] = S##_f[0], D##_f[1] = S##_f[1], \
D##_f[2] = S##_f[2], D##_f[3] = S##_f[3])
! #define _FP_FRAC_SET_4(X,I3,I2,I1,I0) \
! (X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
#define _FP_FRAC_HIGH_4(X) (X##_f[3])
#define _FP_FRAC_LOW_4(X) (X##_f[0])
#define _FP_FRAC_WORD_4(X,w) (X##_f[w])
***************
*** 122,130 ****
#define _FP_FRAC_ADDI_4(X,I) \
__FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
! #define _FP_ZEROFRAC_4 0,0,0,0
! #define _FP_MINFRAC_4 0,0,0,1
! #define _FP_MAXFRAC_4 (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0), (~(_FP_WS_TYPE)0)
#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)
#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)
--- 123,138 ----
#define _FP_FRAC_ADDI_4(X,I) \
__FP_FRAC_ADDI_4(X##_f[3], X##_f[2], X##_f[1], X##_f[0], I)
! #define _FP_FRAC_SET_ZERO_4(X) _FP_FRAC_SET_4(X,0,0,0,0)
! #define _FP_FRAC_SET_MIN_4(X) _FP_FRAC_SET_4(X,0,0,0,1)
! #define _FP_FRAC_SET_MAX_4(X) \
! _FP_FRAC_SET_4(X, ~(_FP_WS_TYPE)0, ~(_FP_WS_TYPE)0, \
! ~(_FP_WS_TYPE)0, ~(_FP_WS_TYPE)0)
!
! /* Deprecated old-style sfp-machine.h interface. */
! #ifndef _FP_FRAC_SET_NAN_4
! #define _FP_FRAC_SET_NAN_4(X) _FP_FRAC_SET_4(X, _FP_NANFRAC_Q)
! #endif
#define _FP_FRAC_ZEROP_4(X) ((X##_f[0] | X##_f[1] | X##_f[2] | X##_f[3]) == 0)
#define _FP_FRAC_NEGP_4(X) ((_FP_WS_TYPE)X##_f[3] < 0)
***************
*** 313,319 ****
were (bit B), we know that the msb of the of the product is \
at either 2B or 2B-1. */ \
_FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
! __FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
_FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
} while (0)
--- 321,327 ----
were (bit B), we know that the msb of the of the product is \
at either 2B or 2B-1. */ \
_FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
! _FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
_FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
} while (0)
***************
*** 327,333 ****
were (bit B), we know that the msb of the of the product is \
at either 2B or 2B-1. */ \
_FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
! __FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
_FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
} while (0)
--- 335,341 ----
were (bit B), we know that the msb of the of the product is \
at either 2B or 2B-1. */ \
_FP_FRAC_SRS_8(_z, wfracbits-1, 2*wfracbits); \
! _FP_FRAC_SET_4(R, _FP_FRAC_WORD_8(_z,3), _FP_FRAC_WORD_8(_z,2), \
_FP_FRAC_WORD_8(_z,1), _FP_FRAC_WORD_8(_z,0)); \
} while (0)
***************
*** 353,359 ****
do { \
int _i; \
_FP_FRAC_DECL_4(_n); _FP_FRAC_DECL_4(_m); \
! _FP_FRAC_SET_4(_n, _FP_ZEROFRAC_4); \
if (_FP_FRAC_GT_4(X, Y)) \
{ \
_n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1); \
--- 361,367 ----
do { \
int _i; \
_FP_FRAC_DECL_4(_n); _FP_FRAC_DECL_4(_m); \
! _FP_FRAC_SET_ZERO_4(_n); \
if (_FP_FRAC_GT_4(X, Y)) \
{ \
_n_f[3] = X##_f[0] << (_FP_W_TYPE_SIZE - 1); \
***************
*** 505,513 ****
/*
* Internals
*/
-
- #define __FP_FRAC_SET_4(X,I3,I2,I1,I0) \
- (X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
#ifndef __FP_FRAC_ADD_3
#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \
--- 513,518 ----
Index: op-common.h
===================================================================
RCS file: /cvs/glibc/libc/soft-fp/op-common.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 op-common.h
*** op-common.h 17 Oct 2002 23:16:13 -0000 1.4
--- op-common.h 1 Nov 2002 03:42:35 -0000
***************
*** 1,5 ****
/* Software floating-point emulation. Common operations.
! Copyright (C) 1997,1998,1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
--- 1,5 ----
/* Software floating-point emulation. Common operations.
! Copyright (C) 1997,1998,1999,2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson (rth@cygnus.com),
Jakub Jelinek (jj@ultra.linux.cz),
*************** do { \
*** 112,124 ****
{ \
/* Overflow to infinity */ \
X##_e = _FP_EXPMAX_##fs; \
! _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
} \
else \
{ \
/* Overflow to maximum normal */ \
X##_e = _FP_EXPMAX_##fs - 1; \
! _FP_FRAC_SET_##wc(X, _FP_MAXFRAC_##wc); \
} \
FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
FP_SET_EXCEPTION(FP_EX_INEXACT); \
--- 112,124 ----
{ \
/* Overflow to infinity */ \
X##_e = _FP_EXPMAX_##fs; \
! _FP_FRAC_SET_ZERO_##wc(X); \
} \
else \
{ \
/* Overflow to maximum normal */ \
X##_e = _FP_EXPMAX_##fs - 1; \
! _FP_FRAC_SET_MAX_##wc(X); \
} \
FP_SET_EXCEPTION(FP_EX_OVERFLOW); \
FP_SET_EXCEPTION(FP_EX_INEXACT); \
*************** do { \
*** 136,142 ****
& (_FP_OVERFLOW_##fs >> 1)) \
{ \
X##_e = 1; \
! _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
} \
else \
{ \
--- 136,142 ----
& (_FP_OVERFLOW_##fs >> 1)) \
{ \
X##_e = 1; \
! _FP_FRAC_SET_ZERO_##wc(X); \
} \
else \
{ \
*************** do { \
*** 151,157 ****
X##_e = 0; \
if (!_FP_FRAC_ZEROP_##wc(X)) \
{ \
! _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
_FP_ROUND(wc, X); \
_FP_FRAC_LOW_##wc(X) >>= (_FP_WORKBITS); \
} \
--- 151,157 ----
X##_e = 0; \
if (!_FP_FRAC_ZEROP_##wc(X)) \
{ \
! _FP_FRAC_SET_MIN_##wc(X); \
_FP_ROUND(wc, X); \
_FP_FRAC_LOW_##wc(X) >>= (_FP_WORKBITS); \
} \
*************** do { \
*** 162,180 ****
\
case FP_CLS_ZERO: \
X##_e = 0; \
! _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
break; \
\
case FP_CLS_INF: \
X##_e = _FP_EXPMAX_##fs; \
! _FP_FRAC_SET_##wc(X, _FP_ZEROFRAC_##wc); \
break; \
\
case FP_CLS_NAN: \
X##_e = _FP_EXPMAX_##fs; \
if (!_FP_KEEPNANFRACP) \
{ \
! _FP_FRAC_SET_##wc(X, _FP_NANFRAC_##fs); \
X##_s = _FP_NANSIGN_##fs; \
} \
else \
--- 162,180 ----
\
case FP_CLS_ZERO: \
X##_e = 0; \
! _FP_FRAC_SET_ZERO_##wc(X); \
break; \
\
case FP_CLS_INF: \
X##_e = _FP_EXPMAX_##fs; \
! _FP_FRAC_SET_ZERO_##wc(X); \
break; \
\
case FP_CLS_NAN: \
X##_e = _FP_EXPMAX_##fs; \
if (!_FP_KEEPNANFRACP) \
{ \
! _FP_FRAC_SET_NAN_##wc(X); \
X##_s = _FP_NANSIGN_##fs; \
} \
else \
*************** do { \
*** 221,227 ****
if (diff <= _FP_WFRACBITS_##fs) \
_FP_FRAC_SRS_##wc(X, diff, _FP_WFRACBITS_##fs); \
else if (!_FP_FRAC_ZEROP_##wc(X)) \
! _FP_FRAC_SET_##wc(X, _FP_MINFRAC_##wc); \
R##_e = Y##_e; \
} \
else \
--- 221,227 ----
if (diff <= _FP_WFRACBITS_##fs) \
_FP_FRAC_SRS_##wc(X, diff, _FP_WFRACBITS_##fs); \
else if (!_FP_FRAC_ZEROP_##wc(X)) \
! _FP_FRAC_SET_MIN_##wc(X); \
R##_e = Y##_e; \
} \
else \
*************** do { \
*** 231,237 ****
if (diff <= _FP_WFRACBITS_##fs) \
_FP_FRAC_SRS_##wc(Y, diff, _FP_WFRACBITS_##fs); \
else if (!_FP_FRAC_ZEROP_##wc(Y)) \
! _FP_FRAC_SET_##wc(Y, _FP_MINFRAC_##wc); \
} \
R##_e = X##_e; \
} \
--- 231,237 ----
if (diff <= _FP_WFRACBITS_##fs) \
_FP_FRAC_SRS_##wc(Y, diff, _FP_WFRACBITS_##fs); \
else if (!_FP_FRAC_ZEROP_##wc(Y)) \
! _FP_FRAC_SET_MIN_##wc(Y); \
} \
R##_e = X##_e; \
} \
*************** do { \
*** 310,316 ****
if (X##_s != Y##_s) \
{ \
/* +INF + -INF => NAN */ \
! _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; \
FP_SET_EXCEPTION(FP_EX_INVALID); \
--- 310,316 ----
if (X##_s != Y##_s) \
{ \
/* +INF + -INF => NAN */ \
! _FP_FRAC_SET_NAN_##wc(R); \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; \
FP_SET_EXCEPTION(FP_EX_INVALID); \
*************** do { \
*** 419,425 ****
case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; \
! _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
break; \
\
--- 419,425 ----
case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_INF): \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; \
! _FP_FRAC_SET_NAN_##wc(R); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
break; \
\
*************** do { \
*** 482,488 ****
case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; \
! _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
break; \
\
--- 482,488 ----
case _FP_CLS_COMBINE(FP_CLS_ZERO,FP_CLS_ZERO): \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; \
! _FP_FRAC_SET_NAN_##wc(R); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
break; \
\
*************** do { \
*** 573,579 ****
{ \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; /* NAN */ \
! _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
} \
else \
--- 573,579 ----
{ \
R##_s = _FP_NANSIGN_##fs; \
R##_c = FP_CLS_NAN; /* NAN */ \
! _FP_FRAC_SET_NAN_##wc(R); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
} \
else \
*************** do { \
*** 592,598 ****
{ \
R##_c = FP_CLS_NAN; /* sNAN */ \
R##_s = _FP_NANSIGN_##fs; \
! _FP_FRAC_SET_##wc(R, _FP_NANFRAC_##fs); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
break; \
} \
--- 592,598 ----
{ \
R##_c = FP_CLS_NAN; /* sNAN */ \
R##_s = _FP_NANSIGN_##fs; \
! _FP_FRAC_SET_NAN_##wc(R); \
FP_SET_EXCEPTION(FP_EX_INVALID); \
break; \
} \
*************** do { \
*** 600,607 ****
if (X##_e & 1) \
_FP_FRAC_SLL_##wc(X, 1); \
R##_e = X##_e >> 1; \
! _FP_FRAC_SET_##wc(S, _FP_ZEROFRAC_##wc); \
! _FP_FRAC_SET_##wc(R, _FP_ZEROFRAC_##wc); \
q = _FP_OVERFLOW_##fs >> 1; \
_FP_SQRT_MEAT_##wc(R, S, T, X, q); \
} \
--- 600,607 ----
if (X##_e & 1) \
_FP_FRAC_SLL_##wc(X, 1); \
R##_e = X##_e >> 1; \
! _FP_FRAC_SET_ZERO_##wc(S); \
! _FP_FRAC_SET_ZERO_##wc(R); \
q = _FP_OVERFLOW_##fs >> 1; \
_FP_SQRT_MEAT_##wc(R, S, T, X, q); \
} \
*************** do { \
*** 776,782 ****
_FP_FRAC_DECL_##wc (v); \
_FP_FRAC_COPY_##wc (u, X); \
_FP_FRAC_COPY_##wc (v, Y); \
! _FP_FRAC_SET_##wc (R, _FP_ZEROFRAC_##wc); \
/* Normalize U and V. */ \
_FP_FRAC_SLL_##wc (u, _FP_WFRACXBITS_##fs); \
_FP_FRAC_SLL_##wc (v, _FP_WFRACXBITS_##fs); \
--- 776,782 ----
_FP_FRAC_DECL_##wc (v); \
_FP_FRAC_COPY_##wc (u, X); \
_FP_FRAC_COPY_##wc (v, Y); \
! _FP_FRAC_SET_ZERO_##wc (R); \
/* Normalize U and V. */ \
_FP_FRAC_SLL_##wc (u, _FP_WFRACXBITS_##fs); \
_FP_FRAC_SLL_##wc (v, _FP_WFRACXBITS_##fs); \
Index: testit.c
===================================================================
RCS file: /cvs/glibc/libc/soft-fp/testit.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 testit.c
*** testit.c 29 Dec 1999 18:08:14 -0000 1.1
--- testit.c 1 Nov 2002 03:42:35 -0000
*************** double gen_special_double(int i)
*** 200,206 ****
case 0:
X_c = FP_CLS_NAN;
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
! __FP_FRAC_SET_2(X, _FP_QNANBIT_D, 0x1234);
#else
_FP_FRAC_SET_1(X, _FP_QNANBIT_D | 0x1234);
#endif
--- 200,206 ----
case 0:
X_c = FP_CLS_NAN;
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
! _FP_FRAC_SET_2(X, _FP_QNANBIT_D, 0x1234);
#else
_FP_FRAC_SET_1(X, _FP_QNANBIT_D | 0x1234);
#endif
*************** double gen_special_double(int i)
*** 208,214 ****
case 2:
X_c = FP_CLS_NAN;
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
! __FP_FRAC_SET_2(X, _FP_QNANBIT_D, 0x1);
#else
_FP_FRAC_SET_1(X, _FP_QNANBIT_D | 0x1);
#endif
--- 208,214 ----
case 2:
X_c = FP_CLS_NAN;
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
! _FP_FRAC_SET_2(X, _FP_QNANBIT_D, 0x1);
#else
_FP_FRAC_SET_1(X, _FP_QNANBIT_D | 0x1);
#endif
*************** double gen_special_double(int i)
*** 222,228 ****
case 8:
X_c = FP_CLS_NORMAL; X_e = 0;
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
! __FP_FRAC_SET_2(X, 0, 0x87654321);
#else
_FP_FRAC_SET_1(X, 0x87654321);
#endif
--- 222,228 ----
case 8:
X_c = FP_CLS_NORMAL; X_e = 0;
#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
! _FP_FRAC_SET_2(X, 0, 0x87654321);
#else
_FP_FRAC_SET_1(X, 0x87654321);
#endif
Roger
--
Roger Sayle, E-mail: roger@eyesopen.com
OpenEye Scientific Software, WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road, Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507. Fax: (+1) 505-473-0833