Fix problem with calling powi* builtins.

OKed by Richard Henderson.

From-SVN: r97278
This commit is contained in:
Fariborz Jahanian 2005-03-30 20:59:21 +00:00 committed by Fariborz Jahanian
parent 63579539f1
commit 0b8495ae45
4 changed files with 27 additions and 10 deletions

View 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

View 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;
}

View 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)
{

View 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. */