#if defined(__powerpc64__)
#include "config/fp-bit.h"
extern DItype __fixtfdi (TFtype);
extern DItype __fixdfdi (DFtype);
extern DItype __fixsfdi (SFtype);
extern USItype __fixunsdfsi (DFtype);
extern USItype __fixunssfsi (SFtype);
extern TFtype __floatditf (DItype);
extern DFtype __floatdidf (DItype);
extern SFtype __floatdisf (DItype);
extern DItype __fixunstfdi (TFtype);
static DItype local_fixunssfdi (SFtype);
static DItype local_fixunsdfdi (DFtype);
DItype
__fixtfdi (TFtype a)
{
if (a < 0)
return - __fixunstfdi (-a);
return __fixunstfdi (a);
}
DItype
__fixdfdi (DFtype a)
{
if (a < 0)
return - local_fixunsdfdi (-a);
return local_fixunsdfdi (a);
}
DItype
__fixsfdi (SFtype a)
{
if (a < 0)
return - local_fixunssfdi (-a);
return local_fixunssfdi (a);
}
USItype
__fixunsdfsi (DFtype a)
{
if (a >= - (DFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
- (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1);
return (SItype) a;
}
USItype
__fixunssfsi (SFtype a)
{
if (a >= - (SFtype) (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
return (SItype) (a + (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1))
- (- ((SItype)(((USItype)1 << ((4 * 8) - 1)) - 1)) - 1);
return (SItype) a;
}
TFtype
__floatditf (DItype u)
{
DFtype dh, dl;
dh = (SItype) (u >> (sizeof (SItype) * 8));
dh *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
dl = (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
return (TFtype) dh + (TFtype) dl;
}
DFtype
__floatdidf (DItype u)
{
DFtype d;
d = (SItype) (u >> (sizeof (SItype) * 8));
d *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
d += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
return d;
}
SFtype
__floatdisf (DItype u)
{
DFtype f;
if (53 < (sizeof (DItype) * 8)
&& 53 > ((sizeof (DItype) * 8) - 53 + 24))
{
if (! (- ((DItype) 1 << 53) < u
&& u < ((DItype) 1 << 53)))
{
if ((UDItype) u & (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1))
{
u &= ~ (((UDItype) 1 << ((sizeof (DItype) * 8) - 53)) - 1);
u |= ((UDItype) 1 << ((sizeof (DItype) * 8) - 53));
}
}
}
f = (SItype) (u >> (sizeof (SItype) * 8));
f *= 2.0 * (((UDItype) 1) << ((sizeof (SItype) * 8) - 1));
f += (USItype) (u & ((((UDItype) 1) << (sizeof (SItype) * 8)) - 1));
return (SFtype) f;
}
DItype
__fixunstfdi (TFtype a)
{
if (a < 0)
return 0;
const TFtype b = (a / (((UDItype) 1) << (sizeof (SItype) * 8)));
UDItype v = (USItype) b;
v <<= (sizeof (SItype) * 8);
a -= (TFtype) v;
if (a < 0)
v -= (USItype) (-a);
else
v += (USItype) a;
return v;
}
static DItype
local_fixunsdfdi (DFtype a)
{
USItype hi, lo;
hi = a / (((UDItype) 1) << (sizeof (SItype) * 8));
lo = (a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (SItype) * 8)));
return ((UDItype) hi << (sizeof (SItype) * 8)) | lo;
}
static DItype
local_fixunssfdi (SFtype original_a)
{
DFtype a = original_a;
USItype hi, lo;
hi = a / (((UDItype) 1) << (sizeof (SItype) * 8));
lo = (a - ((DFtype) hi) * (((UDItype) 1) << (sizeof (SItype) * 8)));
return ((UDItype) hi << (sizeof (SItype) * 8)) | lo;
}
#endif