Thu Oct 1 20:07:09 2009 UTC ()
If TARGET_FLOAT_FORMAT is not IEEE_FLOAT_FORMAT (i.e. we have no NaNs),
do not compile special code to fix up different NaN values.
Re-enable complex support functions in libgcc for vax.


(martin)
diff -r1.1.1.3 -r1.2 src/gnu/dist/gcc4/gcc/libgcc2.c
diff -r1.13 -r1.14 src/gnu/lib/libgcc4/Makefile.inc

cvs diff -r1.1.1.3 -r1.2 src/gnu/dist/gcc4/gcc/Attic/libgcc2.c (expand / switch to unified diff)

--- src/gnu/dist/gcc4/gcc/Attic/libgcc2.c 2007/01/11 02:35:28 1.1.1.3
+++ src/gnu/dist/gcc4/gcc/Attic/libgcc2.c 2009/10/01 20:07:09 1.2
@@ -1608,35 +1608,39 @@ NAME (TYPE x, int m) @@ -1608,35 +1608,39 @@ NAME (TYPE x, int m)
1608#define CONCAT2(A,B) _CONCAT2(A,B) 1608#define CONCAT2(A,B) _CONCAT2(A,B)
1609#define _CONCAT2(A,B) A##B 1609#define _CONCAT2(A,B) A##B
1610 1610
1611/* All of these would be present in a full C99 implementation of <math.h> 1611/* All of these would be present in a full C99 implementation of <math.h>
1612 and <complex.h>. Our problem is that only a few systems have such full 1612 and <complex.h>. Our problem is that only a few systems have such full
1613 implementations. Further, libgcc_s.so isn't currently linked against 1613 implementations. Further, libgcc_s.so isn't currently linked against
1614 libm.so, and even for systems that do provide full C99, the extra overhead 1614 libm.so, and even for systems that do provide full C99, the extra overhead
1615 of all programs using libgcc having to link against libm. So avoid it. */ 1615 of all programs using libgcc having to link against libm. So avoid it. */
1616 1616
1617#define isnan(x) __builtin_expect ((x) != (x), 0) 1617#define isnan(x) __builtin_expect ((x) != (x), 0)
1618#define isfinite(x) __builtin_expect (!isnan((x) - (x)), 1) 1618#define isfinite(x) __builtin_expect (!isnan((x) - (x)), 1)
1619#define isinf(x) __builtin_expect (!isnan(x) & !isfinite(x), 0) 1619#define isinf(x) __builtin_expect (!isnan(x) & !isfinite(x), 0)
1620 1620
 1621#if TARGET_FLOAT_FORMAT == IEEE_FLOAT_FORMAT
1621#define INFINITY CONCAT2(__builtin_inf, CEXT) () 1622#define INFINITY CONCAT2(__builtin_inf, CEXT) ()
 1623#endif
1622#define I 1i 1624#define I 1i
1623 1625
1624/* Helpers to make the following code slightly less gross. */ 1626/* Helpers to make the following code slightly less gross. */
1625#define COPYSIGN CONCAT2(__builtin_copysign, CEXT) 1627#define COPYSIGN CONCAT2(__builtin_copysign, CEXT)
1626#define FABS CONCAT2(__builtin_fabs, CEXT) 1628#define FABS CONCAT2(__builtin_fabs, CEXT)
1627 1629
1628/* Verify that MTYPE matches up with CEXT. */ 1630/* Verify that MTYPE matches up with CEXT. */
 1631#ifdef INFINITY
1629extern void *compile_type_assert[sizeof(INFINITY) == sizeof(MTYPE) ? 1 : -1]; 1632extern void *compile_type_assert[sizeof(INFINITY) == sizeof(MTYPE) ? 1 : -1];
 1633#endif
1630 1634
1631/* Ensure that we've lost any extra precision. */ 1635/* Ensure that we've lost any extra precision. */
1632#if NOTRUNC 1636#if NOTRUNC
1633# define TRUNC(x) 1637# define TRUNC(x)
1634#else 1638#else
1635# define TRUNC(x) __asm__ ("" : "=m"(x) : "m"(x)) 1639# define TRUNC(x) __asm__ ("" : "=m"(x) : "m"(x))
1636#endif 1640#endif
1637 1641
1638#if defined(L_mulsc3) || defined(L_muldc3) \ 1642#if defined(L_mulsc3) || defined(L_muldc3) \
1639 || defined(L_mulxc3) || defined(L_multc3) 1643 || defined(L_mulxc3) || defined(L_multc3)
1640 1644
1641CTYPE 1645CTYPE
1642CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d) 1646CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
@@ -1646,26 +1650,27 @@ CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, @@ -1646,26 +1650,27 @@ CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b,
1646 ac = a * c; 1650 ac = a * c;
1647 bd = b * d; 1651 bd = b * d;
1648 ad = a * d; 1652 ad = a * d;
1649 bc = b * c; 1653 bc = b * c;
1650 1654
1651 TRUNC (ac); 1655 TRUNC (ac);
1652 TRUNC (bd); 1656 TRUNC (bd);
1653 TRUNC (ad); 1657 TRUNC (ad);
1654 TRUNC (bc); 1658 TRUNC (bc);
1655 1659
1656 x = ac - bd; 1660 x = ac - bd;
1657 y = ad + bc; 1661 y = ad + bc;
1658 1662
 1663#ifdef INFINITY
1659 if (isnan (x) && isnan (y)) 1664 if (isnan (x) && isnan (y))
1660 { 1665 {
1661 /* Recover infinities that computed as NaN + iNaN. */ 1666 /* Recover infinities that computed as NaN + iNaN. */
1662 _Bool recalc = 0; 1667 _Bool recalc = 0;
1663 if (isinf (a) || isinf (b)) 1668 if (isinf (a) || isinf (b))
1664 { 1669 {
1665 /* z is infinite. "Box" the infinity and change NaNs in 1670 /* z is infinite. "Box" the infinity and change NaNs in
1666 the other factor to 0. */ 1671 the other factor to 0. */
1667 a = COPYSIGN (isinf (a) ? 1 : 0, a); 1672 a = COPYSIGN (isinf (a) ? 1 : 0, a);
1668 b = COPYSIGN (isinf (b) ? 1 : 0, b); 1673 b = COPYSIGN (isinf (b) ? 1 : 0, b);
1669 if (isnan (c)) c = COPYSIGN (0, c); 1674 if (isnan (c)) c = COPYSIGN (0, c);
1670 if (isnan (d)) d = COPYSIGN (0, d); 1675 if (isnan (d)) d = COPYSIGN (0, d);
1671 recalc = 1; 1676 recalc = 1;
@@ -1687,26 +1692,27 @@ CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b, @@ -1687,26 +1692,27 @@ CONCAT3(__mul,MODE,3) (MTYPE a, MTYPE b,
1687 /* Recover infinities from overflow by changing NaNs to 0. */ 1692 /* Recover infinities from overflow by changing NaNs to 0. */
1688 if (isnan (a)) a = COPYSIGN (0, a); 1693 if (isnan (a)) a = COPYSIGN (0, a);
1689 if (isnan (b)) b = COPYSIGN (0, b); 1694 if (isnan (b)) b = COPYSIGN (0, b);
1690 if (isnan (c)) c = COPYSIGN (0, c); 1695 if (isnan (c)) c = COPYSIGN (0, c);
1691 if (isnan (d)) d = COPYSIGN (0, d); 1696 if (isnan (d)) d = COPYSIGN (0, d);
1692 recalc = 1; 1697 recalc = 1;
1693 } 1698 }
1694 if (recalc) 1699 if (recalc)
1695 { 1700 {
1696 x = INFINITY * (a * c - b * d); 1701 x = INFINITY * (a * c - b * d);
1697 y = INFINITY * (a * d + b * c); 1702 y = INFINITY * (a * d + b * c);
1698 } 1703 }
1699 } 1704 }
 1705#endif
1700 1706
1701 return x + I * y; 1707 return x + I * y;
1702} 1708}
1703#endif /* complex multiply */ 1709#endif /* complex multiply */
1704 1710
1705#if defined(L_divsc3) || defined(L_divdc3) \ 1711#if defined(L_divsc3) || defined(L_divdc3) \
1706 || defined(L_divxc3) || defined(L_divtc3) 1712 || defined(L_divxc3) || defined(L_divtc3)
1707 1713
1708CTYPE 1714CTYPE
1709CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d) 1715CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, MTYPE c, MTYPE d)
1710{ 1716{
1711 MTYPE denom, ratio, x, y; 1717 MTYPE denom, ratio, x, y;
1712 1718
@@ -1721,53 +1727,55 @@ CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b, @@ -1721,53 +1727,55 @@ CONCAT3(__div,MODE,3) (MTYPE a, MTYPE b,
1721 x = ((a * ratio) + b) / denom; 1727 x = ((a * ratio) + b) / denom;
1722 y = ((b * ratio) - a) / denom; 1728 y = ((b * ratio) - a) / denom;
1723 } 1729 }
1724 else 1730 else
1725 { 1731 {
1726 ratio = d / c; 1732 ratio = d / c;
1727 denom = (d * ratio) + c; 1733 denom = (d * ratio) + c;
1728 x = ((b * ratio) + a) / denom; 1734 x = ((b * ratio) + a) / denom;
1729 y = (b - (a * ratio)) / denom; 1735 y = (b - (a * ratio)) / denom;
1730 } 1736 }
1731 1737
1732 /* Recover infinities and zeros that computed as NaN+iNaN; the only cases 1738 /* Recover infinities and zeros that computed as NaN+iNaN; the only cases
1733 are nonzero/zero, infinite/finite, and finite/infinite. */ 1739 are nonzero/zero, infinite/finite, and finite/infinite. */
 1740#ifdef INFINITY
1734 if (isnan (x) && isnan (y)) 1741 if (isnan (x) && isnan (y))
1735 { 1742 {
1736 if (c == 0.0 && d == 0.0 && (!isnan (a) || !isnan (b))) 1743 if (c == 0.0 && d == 0.0 && (!isnan (a) || !isnan (b)))
1737 { 1744 {
1738 x = COPYSIGN (INFINITY, c) * a; 1745 x = COPYSIGN (INFINITY, c) * a;
1739 y = COPYSIGN (INFINITY, c) * b; 1746 y = COPYSIGN (INFINITY, c) * b;
1740 } 1747 }
1741 else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d)) 1748 else if ((isinf (a) || isinf (b)) && isfinite (c) && isfinite (d))
1742 { 1749 {
1743 a = COPYSIGN (isinf (a) ? 1 : 0, a); 1750 a = COPYSIGN (isinf (a) ? 1 : 0, a);
1744 b = COPYSIGN (isinf (b) ? 1 : 0, b); 1751 b = COPYSIGN (isinf (b) ? 1 : 0, b);
1745 x = INFINITY * (a * c + b * d); 1752 x = INFINITY * (a * c + b * d);
1746 y = INFINITY * (b * c - a * d); 1753 y = INFINITY * (b * c - a * d);
1747 } 1754 }
1748 else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b)) 1755 else if ((isinf (c) || isinf (d)) && isfinite (a) && isfinite (b))
1749 { 1756 {
1750 c = COPYSIGN (isinf (c) ? 1 : 0, c); 1757 c = COPYSIGN (isinf (c) ? 1 : 0, c);
1751 d = COPYSIGN (isinf (d) ? 1 : 0, d); 1758 d = COPYSIGN (isinf (d) ? 1 : 0, d);
1752 x = 0.0 * (a * c + b * d); 1759 x = 0.0 * (a * c + b * d);
1753 y = 0.0 * (b * c - a * d); 1760 y = 0.0 * (b * c - a * d);
1754 } 1761 }
1755 } 1762 }
 1763#endif
1756 1764
1757 return x + I * y; 1765 return x + I * y;
1758} 1766}
1759#endif /* complex divide */ 1767#endif /* complex divide */
1760 1768#undef INFINITY
1761#endif /* all complex float routines */ 1769#endif /* all complex float routines */
1762  1770
1763/* From here on down, the routines use normal data types. */ 1771/* From here on down, the routines use normal data types. */
1764 1772
1765#define SItype bogus_type 1773#define SItype bogus_type
1766#define USItype bogus_type 1774#define USItype bogus_type
1767#define DItype bogus_type 1775#define DItype bogus_type
1768#define UDItype bogus_type 1776#define UDItype bogus_type
1769#define SFtype bogus_type 1777#define SFtype bogus_type
1770#define DFtype bogus_type 1778#define DFtype bogus_type
1771#undef Wtype 1779#undef Wtype
1772#undef UWtype 1780#undef UWtype
1773#undef HWtype 1781#undef HWtype

cvs diff -r1.13 -r1.14 src/gnu/lib/libgcc4/Attic/Makefile.inc (expand / switch to unified diff)

--- src/gnu/lib/libgcc4/Attic/Makefile.inc 2008/09/18 12:20:19 1.13
+++ src/gnu/lib/libgcc4/Attic/Makefile.inc 2009/10/01 20:07:09 1.14
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile.inc,v 1.13 2008/09/18 12:20:19 skrll Exp $ 1# $NetBSD: Makefile.inc,v 1.14 2009/10/01 20:07:09 martin Exp $
2 2
3.if exists(${.CURDIR}/../arch/${MACHINE_ARCH}.mk) && ${MKGCC} != "no" 3.if exists(${.CURDIR}/../arch/${MACHINE_ARCH}.mk) && ${MKGCC} != "no"
4.include "${.CURDIR}/../arch/${MACHINE_ARCH}.mk" 4.include "${.CURDIR}/../arch/${MACHINE_ARCH}.mk"
5.endif 5.endif
6 6
7DIST= ${NETBSDSRCDIR}/gnu/dist/gcc4 7DIST= ${NETBSDSRCDIR}/gnu/dist/gcc4
8GNUHOSTDIST= ${DIST} 8GNUHOSTDIST= ${DIST}
9GCCARCH= ${NETBSDSRCDIR}/gnu/usr.bin/gcc4/arch/${MACHINE_ARCH} 9GCCARCH= ${NETBSDSRCDIR}/gnu/usr.bin/gcc4/arch/${MACHINE_ARCH}
10GCCARCHLIBGCC= ${NETBSDSRCDIR}/gnu/lib/libgcc4/arch/${MACHINE_ARCH} 10GCCARCHLIBGCC= ${NETBSDSRCDIR}/gnu/lib/libgcc4/arch/${MACHINE_ARCH}
11GCCARCHXX= ${NETBSDSRCDIR}/gnu/lib/libstdc++-v3_4/arch/${MACHINE_ARCH} 11GCCARCHXX= ${NETBSDSRCDIR}/gnu/lib/libstdc++-v3_4/arch/${MACHINE_ARCH}
12 12
13GCPPFLAGS= ${G_LIBGCC2_CFLAGS} ${G_USE_COLLECT2} ${G_INCLUDES} 13GCPPFLAGS= ${G_LIBGCC2_CFLAGS} ${G_USE_COLLECT2} ${G_INCLUDES}
14CPPFLAGS+= -I${.CURDIR} -I${GCCARCHLIBGCC} 14CPPFLAGS+= -I${.CURDIR} -I${GCCARCHLIBGCC}
@@ -17,30 +17,28 @@ CPPFLAGS+= -I${G_EXTRA_HEADERS:M/*:H:u} @@ -17,30 +17,28 @@ CPPFLAGS+= -I${G_EXTRA_HEADERS:M/*:H:u}
17CPPFLAGS+= -I${DIST}/gcc/cp -I${DIST}/gcc/config -I${GCCARCHXX} -I. 17CPPFLAGS+= -I${DIST}/gcc/cp -I${DIST}/gcc/config -I${GCCARCHXX} -I.
18 18
19# This is copied from gcc/mklibgcc.in:$lib2funcs 19# This is copied from gcc/mklibgcc.in:$lib2funcs
20LIB2FUNCS_ALL= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \ 20LIB2FUNCS_ALL= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 \
21 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \ 21 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi \
22 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi \ 22 _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi \
23 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache \ 23 _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache \
24 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \ 24 _enable_execute_stack _trampoline __main _absvsi2 _absvdi2 _addvsi3 \
25 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \ 25 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors \
26 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \ 26 _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab \
27 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \ 27 _popcountsi2 _popcountdi2 _paritysi2 _paritydi2 _powisf2 _powidf2 \
28 _powixf2 _powitf2 \ 28 _powixf2 _powitf2 \
29 29
30.if ${MACHINE_ARCH} != "vax" 
31LIB2FUNCS_ALL+= \ 30LIB2FUNCS_ALL+= \
32 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 _divtc3 31 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 _divtc3
33.endif 
34 32
35LIB2FUNCS_SHORT:=${LIB2FUNCS_ALL} 33LIB2FUNCS_SHORT:=${LIB2FUNCS_ALL}
36LIB2_DIVMOD_FUNCS:=${G_LIB2_DIVMOD_FUNCS} 34LIB2_DIVMOD_FUNCS:=${G_LIB2_DIVMOD_FUNCS}
37.for f in ${G_LIB1ASMFUNCS}; do 35.for f in ${G_LIB1ASMFUNCS}; do
38LIB2FUNCS_SHORT:=${LIB2FUNCS_SHORT:N${f}} 36LIB2FUNCS_SHORT:=${LIB2FUNCS_SHORT:N${f}}
39LIB2_DIVMOD_FUNCS:=${LIB2_DIVMOD_FUNCS:N${f}} 37LIB2_DIVMOD_FUNCS:=${LIB2_DIVMOD_FUNCS:N${f}}
40.endfor 38.endfor
41 39
42LIB2FUNCS= ${LIB2FUNCS_SHORT:=.c} 40LIB2FUNCS= ${LIB2FUNCS_SHORT:=.c}
43LIB2FUNCS_ST= ${G_LIB2FUNCS_ST:=.c} 41LIB2FUNCS_ST= ${G_LIB2FUNCS_ST:=.c}
44LIB2DIVMOD= ${LIB2_DIVMOD_FUNCS:=.c} 42LIB2DIVMOD= ${LIB2_DIVMOD_FUNCS:=.c}
45LIB2_EH= ${G_LIB2ADDEH:M*.c:T} 43LIB2_EH= ${G_LIB2ADDEH:M*.c:T}
46.if !empty(G_LIB1ASMFUNCS) 44.if !empty(G_LIB1ASMFUNCS)