| 1 |
/* { dg-options "-msoft-float -mips2" } */ |
| 2 |
|
| 3 |
typedef long int __int32_t; |
| 4 |
typedef long unsigned int __uint32_t; |
| 5 |
typedef union |
| 6 |
{ |
| 7 |
double value; |
| 8 |
struct |
| 9 |
{ |
| 10 |
__uint32_t msw; |
| 11 |
__uint32_t lsw; |
| 12 |
} |
| 13 |
parts; |
| 14 |
} |
| 15 |
ieee_double_shape_type; |
| 16 |
double |
| 17 |
__ieee754_fmod (double x, double y, int z, int xx) |
| 18 |
{ |
| 19 |
__int32_t n, hx, hy, hz, ix, iy, sx, i; |
| 20 |
__uint32_t lx, ly, lz; |
| 21 |
ieee_double_shape_type ew_u; |
| 22 |
ew_u.value = (x); |
| 23 |
(lx) = ew_u.parts.lsw; |
| 24 |
ew_u.value = (y); |
| 25 |
(hy) = ew_u.parts.msw; |
| 26 |
(ly) = ew_u.parts.lsw; |
| 27 |
if (hy == 0 || hx >= 0x7ff00000) |
| 28 |
return (x * y); |
| 29 |
if (z) |
| 30 |
{ |
| 31 |
if ((hx < hy) || (lx < ly)) |
| 32 |
return x; |
| 33 |
lz = lx - ly; |
| 34 |
lx = lz + lz; |
| 35 |
} |
| 36 |
ieee_double_shape_type iw_u; |
| 37 |
iw_u.parts.lsw = (lx); |
| 38 |
return iw_u.value; |
| 39 |
} |