OSDN Git Service

PR tree-optimize/22348
[pf3gnuchains/gcc-fork.git] / gcc / libgcc2.c
index 9bdb1c7..3108bff 100644 (file)
@@ -26,27 +26,14 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
-
-/* We include auto-host.h here to get HAVE_GAS_HIDDEN.  This is
-   supposedly valid even though this is a "target" file.  */
-#include "auto-host.h"
-
-/* It is incorrect to include config.h here, because this file is being
-   compiled for the target, and hence definitions concerning only the host
-   do not apply.  */
 #include "tconfig.h"
 #include "tsystem.h"
 #include "coretypes.h"
 #include "tm.h"
 
-/* Don't use `fancy_abort' here even if config.h says to use it.  */
-#ifdef abort
-#undef abort
-#endif
-
 #ifdef HAVE_GAS_HIDDEN
 #define ATTRIBUTE_HIDDEN  __attribute__ ((__visibility__ ("hidden")))
 #else
@@ -1155,7 +1142,7 @@ __ucmpdi2 (DWtype a, DWtype b)
 }
 #endif
 \f
-#if defined(L_fixunstfdi) && defined(HAVE_TFMODE)
+#if defined(L_fixunstfdi) && LIBGCC2_HAS_TF_MODE
 DWtype
 __fixunstfDI (TFtype a)
 {
@@ -1181,7 +1168,7 @@ __fixunstfDI (TFtype a)
 }
 #endif
 
-#if defined(L_fixtfdi) && defined(HAVE_TFMODE)
+#if defined(L_fixtfdi) && LIBGCC2_HAS_TF_MODE
 DWtype
 __fixtfdi (TFtype a)
 {
@@ -1191,7 +1178,7 @@ __fixtfdi (TFtype a)
 }
 #endif
 
-#if defined(L_fixunsxfdi) && defined(HAVE_XFMODE)
+#if defined(L_fixunsxfdi) && LIBGCC2_HAS_XF_MODE
 DWtype
 __fixunsxfDI (XFtype a)
 {
@@ -1217,7 +1204,7 @@ __fixunsxfDI (XFtype a)
 }
 #endif
 
-#if defined(L_fixxfdi) && defined(HAVE_XFMODE)
+#if defined(L_fixxfdi) && LIBGCC2_HAS_XF_MODE
 DWtype
 __fixxfdi (XFtype a)
 {
@@ -1227,7 +1214,7 @@ __fixxfdi (XFtype a)
 }
 #endif
 
-#if defined(L_fixunsdfdi) && defined(HAVE_DFMODE)
+#if defined(L_fixunsdfdi) && LIBGCC2_HAS_DF_MODE
 DWtype
 __fixunsdfDI (DFtype a)
 {
@@ -1246,7 +1233,7 @@ __fixunsdfDI (DFtype a)
 }
 #endif
 
-#if defined(L_fixdfdi) && defined(HAVE_DFMODE)
+#if defined(L_fixdfdi) && LIBGCC2_HAS_DF_MODE
 DWtype
 __fixdfdi (DFtype a)
 {
@@ -1256,11 +1243,11 @@ __fixdfdi (DFtype a)
 }
 #endif
 
-#ifdef L_fixunssfdi
+#if defined(L_fixunssfdi) && LIBGCC2_HAS_SF_MODE
 DWtype
 __fixunssfDI (SFtype a)
 {
-#if defined(HAVE_DFMODE)
+#if LIBGCC2_HAS_DF_MODE
   /* Convert the SFtype to a DFtype, because that is surely not going
      to lose any bits.  Some day someone else can write a faster version
      that avoids converting to DFtype, and verify it really works right.  */
@@ -1287,7 +1274,7 @@ __fixunssfDI (SFtype a)
     {
       /* Since we know that there are fewer significant bits in the SFmode
         quantity than in a word, we know that we can convert out all the
-        signficant bits in one step, and thus avoid losing bits.  */
+        significant bits in one step, and thus avoid losing bits.  */
 
       /* ??? This following loop essentially performs frexpf.  If we could
         use the real libm function, or poke at the actual bits of the fp
@@ -1320,7 +1307,7 @@ __fixunssfDI (SFtype a)
 }
 #endif
 
-#ifdef L_fixsfdi
+#if defined(L_fixsfdi) && LIBGCC2_HAS_SF_MODE
 DWtype
 __fixsfdi (SFtype a)
 {
@@ -1330,7 +1317,7 @@ __fixsfdi (SFtype a)
 }
 #endif
 
-#if defined(L_floatdixf) && defined(HAVE_XFMODE)
+#if defined(L_floatdixf) && LIBGCC2_HAS_XF_MODE
 XFtype
 __floatdixf (DWtype u)
 {
@@ -1341,7 +1328,7 @@ __floatdixf (DWtype u)
 }
 #endif
 
-#if defined(L_floatditf) && defined(HAVE_TFMODE)
+#if defined(L_floatditf) && LIBGCC2_HAS_TF_MODE
 TFtype
 __floatditf (DWtype u)
 {
@@ -1352,7 +1339,7 @@ __floatditf (DWtype u)
 }
 #endif
 
-#if defined(L_floatdidf) && defined(HAVE_DFMODE)
+#if defined(L_floatdidf) && LIBGCC2_HAS_DF_MODE
 DFtype
 __floatdidf (DWtype u)
 {
@@ -1363,7 +1350,7 @@ __floatdidf (DWtype u)
 }
 #endif
 
-#ifdef L_floatdisf
+#if defined(L_floatdisf) && LIBGCC2_HAS_SF_MODE
 #define DI_SIZE (W_TYPE_SIZE * 2)
 #define SF_SIZE FLT_MANT_DIG
 
@@ -1376,7 +1363,7 @@ __floatdisf (DWtype u)
   f *= Wtype_MAXp1_F;
   f += (UWtype)u;
   return f;
-#elif defined(HAVE_DFMODE)
+#elif LIBGCC2_HAS_DF_MODE
 
 #if LIBGCC2_DOUBLE_TYPE_SIZE == 64
 #define DF_SIZE DBL_MANT_DIG
@@ -1451,7 +1438,7 @@ __floatdisf (DWtype u)
 }
 #endif
 
-#if defined(L_fixunsxfsi) && defined(HAVE_XFMODE)
+#if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
 /* Reenable the normal types, in case limits.h needs them.  */
 #undef char
 #undef short
@@ -1473,7 +1460,7 @@ __fixunsxfSI (XFtype a)
 }
 #endif
 
-#if defined(L_fixunsdfsi) && defined(HAVE_DFMODE)
+#if defined(L_fixunsdfsi) && LIBGCC2_HAS_DF_MODE
 /* Reenable the normal types, in case limits.h needs them.  */
 #undef char
 #undef short
@@ -1495,7 +1482,7 @@ __fixunsdfSI (DFtype a)
 }
 #endif
 
-#ifdef L_fixunssfsi
+#if defined(L_fixunssfsi) && LIBGCC2_HAS_SF_MODE
 /* Reenable the normal types, in case limits.h needs them.  */
 #undef char
 #undef short
@@ -1520,10 +1507,10 @@ __fixunssfSI (SFtype a)
 /* Integer power helper used from __builtin_powi for non-constant
    exponents.  */
 
-#if defined(L_powisf2) \
-    || (defined(L_powidf2) && defined(HAVE_DFMODE)) \
-    || (defined(L_powixf2) && defined(HAVE_XFMODE)) \
-    || (defined(L_powitf2) && defined(HAVE_TFMODE))
+#if (defined(L_powisf2) && LIBGCC2_HAS_SF_MODE) \
+    || (defined(L_powidf2) && LIBGCC2_HAS_DF_MODE) \
+    || (defined(L_powixf2) && LIBGCC2_HAS_XF_MODE) \
+    || (defined(L_powitf2) && LIBGCC2_HAS_TF_MODE)
 # if defined(L_powisf2)
 #  define TYPE SFtype
 #  define NAME __powisf2
@@ -1538,10 +1525,12 @@ __fixunssfSI (SFtype a)
 #  define NAME __powitf2
 # endif
 
+#undef int
+#undef unsigned
 TYPE
-NAME (TYPE x, Wtype m)
+NAME (TYPE x, int m)
 {
-  UWtype n = m < 0 ? -m : m;
+  unsigned int n = m < 0 ? -m : m;
   TYPE y = n % 2 ? x : 1;
   while (n >>= 1)
     {
@@ -1554,10 +1543,10 @@ NAME (TYPE x, Wtype m)
 
 #endif
 \f
-#if defined(L_mulsc3) || defined(L_divsc3) \
-    || ((defined(L_muldc3) || defined(L_divdc3)) && defined(HAVE_DFMODE)) \
-    || ((defined(L_mulxc3) || defined(L_divxc3)) && defined(HAVE_XFMODE)) \
-    || ((defined(L_multc3) || defined(L_divtc3)) && defined(HAVE_TFMODE))
+#if ((defined(L_mulsc3) || defined(L_divsc3)) && LIBGCC2_HAS_SF_MODE) \
+    || ((defined(L_muldc3) || defined(L_divdc3)) && LIBGCC2_HAS_DF_MODE) \
+    || ((defined(L_mulxc3) || defined(L_divxc3)) && LIBGCC2_HAS_XF_MODE) \
+    || ((defined(L_multc3) || defined(L_divtc3)) && LIBGCC2_HAS_TF_MODE)
 
 #undef float
 #undef double
@@ -1903,6 +1892,7 @@ TRANSFER_FROM_TRAMPOLINE
 #ifdef L__main
 
 #include "gbl-ctors.h"
+
 /* Some systems use __main in a way incompatible with its use in gcc, in these
    cases use the macros NAME__MAIN to give a quoted symbol and SYMBOL__MAIN to
    give the same symbol without quotes for an alternative entry point.  You
@@ -1912,7 +1902,7 @@ TRANSFER_FROM_TRAMPOLINE
 #define SYMBOL__MAIN __main
 #endif
 
-#ifdef INIT_SECTION_ASM_OP
+#if defined (INIT_SECTION_ASM_OP) || defined (INIT_ARRAY_SECTION_ASM_OP)
 #undef HAS_INIT_SECTION
 #define HAS_INIT_SECTION
 #endif