Fix problem with calling powi* builtins.
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 30 Mar 2005 20:59:21 +0000 (20:59 +0000)
committerFariborz Jahanian <fjahanian@gcc.gnu.org>
Wed, 30 Mar 2005 20:59:21 +0000 (20:59 +0000)
OKed by Richard Henderson.

From-SVN: r97278

gcc/ChangeLog
gcc/builtins.c
gcc/libgcc2.c
gcc/libgcc2.h

index 1d20452dc322a6246445af38dc3eae348c26451f..384e48e8cdc0ef0ac44ea867c916ef0f42122fa2 100644 (file)
@@ -1,3 +1,12 @@
+2005-03-30 Fariborz Jahanian <fjahanian@apple.com>
+
+       * builtins.c (expand_builtin_powi): Fix mode of
+       2nd argument to match int.
+       * libgcc2.h (__powisf2, __powidf2, __powixf2, __powitf2): Change
+       2nd argument type to int.
+       * libgcc2.c: Change prototype of __powi* functions to use 
+       int.
+
 2005-03-30  Dale Johannesen  <dalej@apple.com>
 
        PR middle-end/19225
index 68b91c56772b55a6c607666801e328f35b072690..fb044de52ac9be952ce564abc2953bb7c3c1e7c6 100644 (file)
@@ -2380,6 +2380,7 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget)
   tree arg0, arg1;
   rtx op0, op1;
   enum machine_mode mode;
+  enum machine_mode mode2;
 
   if (! validate_arglist (arglist, REAL_TYPE, INTEGER_TYPE, VOID_TYPE))
     return 0;
@@ -2411,19 +2412,22 @@ expand_builtin_powi (tree exp, rtx target, rtx subtarget)
 
   /* Emit a libcall to libgcc.  */
 
+  /* Mode of the 2nd argument must match that of an int. */
+  mode2 = mode_for_size (INT_TYPE_SIZE, MODE_INT, 0);
+
   if (target == NULL_RTX)
     target = gen_reg_rtx (mode);
 
   op0 = expand_expr (arg0, subtarget, mode, 0);
   if (GET_MODE (op0) != mode)
     op0 = convert_to_mode (mode, op0, 0);
-  op1 = expand_expr (arg1, 0, word_mode, 0);
-  if (GET_MODE (op1) != word_mode)
-    op1 = convert_to_mode (word_mode, op1, 0);
+  op1 = expand_expr (arg1, 0, mode2, 0);
+  if (GET_MODE (op1) != mode2)
+    op1 = convert_to_mode (mode2, op1, 0);
 
   target = emit_library_call_value (powi_optab->handlers[(int) mode].libfunc,
                                    target, LCT_CONST_MAKE_BLOCK, mode, 2,
-                                   op0, mode, op1, word_mode);
+                                   op0, mode, op1, mode2);
 
   return target;
 }
index c8f6e51b043e67118d4f92b148eed5c5a06332f0..e1b2c45af2d8ae58c3212d93fc6a12a1f0c24ade 100644 (file)
@@ -1538,10 +1538,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)
     {
index 11444ed9e4538a70a0ea0963f8ff953cefe385c1..cc4c13f7902ef82d1858357f50559d5ae4138ffb 100644 (file)
@@ -314,12 +314,13 @@ extern SItype __mulvsi3 (SItype, SItype);
 extern SItype __negvsi2 (SItype);
 #endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */
 
+#undef int
 #if LIBGCC2_HAS_SF_MODE
 extern DWtype __fixsfdi (SFtype);
 extern SFtype __floatdisf (DWtype);
 extern UWtype __fixunssfSI (SFtype);
 extern DWtype __fixunssfDI (SFtype);
-extern SFtype __powisf2 (SFtype, Wtype);
+extern SFtype __powisf2 (SFtype, int);
 extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype);
 extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype);
 #endif
@@ -328,7 +329,7 @@ extern DWtype __fixdfdi (DFtype);
 extern DFtype __floatdidf (DWtype);
 extern UWtype __fixunsdfSI (DFtype);
 extern DWtype __fixunsdfDI (DFtype);
-extern DFtype __powidf2 (DFtype, Wtype);
+extern DFtype __powidf2 (DFtype, int);
 extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype);
 extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype);
 #endif
@@ -338,7 +339,7 @@ extern DWtype __fixxfdi (XFtype);
 extern DWtype __fixunsxfDI (XFtype);
 extern XFtype __floatdixf (DWtype);
 extern UWtype __fixunsxfSI (XFtype);
-extern XFtype __powixf2 (XFtype, Wtype);
+extern XFtype __powixf2 (XFtype, int);
 extern XCtype __divxc3 (XFtype, XFtype, XFtype, XFtype);
 extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
 #endif
@@ -347,10 +348,11 @@ extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
 extern DWtype __fixunstfDI (TFtype);
 extern DWtype __fixtfdi (TFtype);
 extern TFtype __floatditf (DWtype);
-extern TFtype __powitf2 (TFtype, Wtype);
+extern TFtype __powitf2 (TFtype, int);
 extern TCtype __divtc3 (TFtype, TFtype, TFtype, TFtype);
 extern TCtype __multc3 (TFtype, TFtype, TFtype, TFtype);
 #endif
+#define int bogus_type
 
 /* DWstructs are pairs of Wtype values in the order determined by
    LIBGCC2_WORDS_BIG_ENDIAN.  */