1 /* This file is distributed under the University of Illinois Open Source
2 * License. See LICENSE.TXT for details.
5 /* long double __gcc_qmul(long double x, long double y);
6 * This file implements the PowerPC 128-bit double-double multiply operation.
7 * This implementation is shamelessly cribbed from Apple's DDRT, circa 1993(!)
12 long double __gcc_qmul(long double x, long double y)
14 static const uint32_t infinityHi = UINT32_C(0x7ff00000);
15 DD dst = { .ld = x }, src = { .ld = y };
17 register double A = dst.s.hi, a = dst.s.lo,
18 B = src.s.hi, b = src.s.lo;
20 double aHi, aLo, bHi, bLo;
25 /* Detect special cases */
32 const doublebits abBits = { .d = ab };
33 if (((uint32_t)(abBits.x >> 32) & infinityHi) == infinityHi) {
39 /* Generic cases handled here. */
45 tmp = LOWORDER(ab, aHi, aLo, bHi, bLo);
46 tmp += (A * b + a * B);
49 dst.s.lo = (ab - tau) + tmp;