1 /* This file is distributed under the University of Illinois Open Source
2 * License. See LICENSE.TXT for details.
5 /* long double __gcc_qdiv(long double x, long double y);
6 * This file implements the PowerPC 128-bit double-double division operation.
7 * This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
12 long double __gcc_qdiv(long double a
, long double b
)
14 static const uint32_t infinityHi
= UINT32_C(0x7ff00000);
15 DD dst
= { .ld
= a
}, src
= { .ld
= b
};
17 register double x
= dst
.s
.hi
, x1
= dst
.s
.lo
,
18 y
= src
.s
.hi
, y1
= src
.s
.lo
;
20 double yHi
, yLo
, qHi
, qLo
;
25 /* Detect special cases */
32 const doublebits qBits
= { .d
= q
};
33 if (((uint32_t)(qBits
.x
>> 32) & infinityHi
) == infinityHi
) {
46 tmp
= LOWORDER(yq
, yHi
, yLo
, qHi
, qLo
);
48 tmp
= ((tmp
+ x1
) - y1
* q
) / y
;
51 dst
.s
.lo
= (q
- x
) + tmp
;