aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/Dist1
-rw-r--r--sysdeps/powerpc/Makefile10
-rw-r--r--sysdeps/powerpc/bits/mathinline.h12
-rw-r--r--sysdeps/powerpc/q_addsub.c549
-rw-r--r--sysdeps/powerpc/q_dtoq.c66
-rw-r--r--sysdeps/powerpc/q_feq.c65
-rw-r--r--sysdeps/powerpc/q_fne.c70
-rw-r--r--sysdeps/powerpc/q_itoq.c50
-rw-r--r--sysdeps/powerpc/q_lltoq.c52
-rw-r--r--sysdeps/powerpc/q_neg.c38
-rw-r--r--sysdeps/powerpc/q_qtoi.c65
-rw-r--r--sysdeps/powerpc/q_qtoll.c64
-rw-r--r--sysdeps/powerpc/q_qtos.c84
-rw-r--r--sysdeps/powerpc/q_qtou.c64
-rw-r--r--sysdeps/powerpc/q_qtoull.c65
-rw-r--r--sysdeps/powerpc/q_stoq.c65
-rw-r--r--sysdeps/powerpc/q_ulltoq.c46
-rw-r--r--sysdeps/powerpc/q_utoq.c44
-rw-r--r--sysdeps/powerpc/quad_float.h44
19 files changed, 6 insertions, 1448 deletions
diff --git a/sysdeps/powerpc/Dist b/sysdeps/powerpc/Dist
index 9cd0a69..90d0c02 100644
--- a/sysdeps/powerpc/Dist
+++ b/sysdeps/powerpc/Dist
@@ -1,6 +1,5 @@
fenv_const.c
fenv_libc.h
ppc-mcount.S
-quad_float.h
fe_nomask.c
t_sqrt.c
diff --git a/sysdeps/powerpc/Makefile b/sysdeps/powerpc/Makefile
index 1813c78..a9922ff 100644
--- a/sysdeps/powerpc/Makefile
+++ b/sysdeps/powerpc/Makefile
@@ -1,15 +1,5 @@
ifeq ($(subdir),math)
libm-support += fenv_const fe_nomask t_sqrt
-
-# These routines have not been tested, so it's probable they don't work;
-# and they don't provide the complete list of FP routines. So there's
-# no point in compiling them.
-#sysdep_routines += q_feq q_fne q_utoq q_dtoq q_itoq q_stoq q_neg q_ulltoq \
-# q_lltoq q_qtou q_qtoi q_qtoull q_qtoll q_qtos
-
-tests += test-arith test-arithf
-LDLIBS-test-arith = libm
-LDLIBS-test-arithf = libm
endif
ifeq ($(subdir),gmon)
diff --git a/sysdeps/powerpc/bits/mathinline.h b/sysdeps/powerpc/bits/mathinline.h
index fff1d64..c689fd0 100644
--- a/sysdeps/powerpc/bits/mathinline.h
+++ b/sysdeps/powerpc/bits/mathinline.h
@@ -1,5 +1,5 @@
/* Inline math functions for powerpc.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -17,9 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#ifdef __GNUC__
+#if defined __GNUC__ && !defined _SOFT_FLOAT
-#if __USE_ISOC9X && !defined _SOFT_FLOAT
+#ifdef __USE_ISOC9X
# define __unordered_cmp(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
@@ -53,7 +53,7 @@ lrint (double __x)
double __d;
long int __ll[2];
} __u;
- asm ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
+ __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
}
@@ -65,7 +65,7 @@ lrintf (float __x)
double __d;
long int __ll[2];
} __u;
- asm ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
+ __asm__ ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
return __u.__ll[1];
}
@@ -85,4 +85,4 @@ fdimf (float __x, float __y)
#endif /* __USE_ISOC9X */
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-#endif /* __GNUC__ */
+#endif /* __GNUC__ && !_SOFT_FLOAT */
diff --git a/sysdeps/powerpc/q_addsub.c b/sysdeps/powerpc/q_addsub.c
deleted file mode 100644
index e4ef6d8..0000000
--- a/sysdeps/powerpc/q_addsub.c
+++ /dev/null
@@ -1,549 +0,0 @@
-/* Add or subtract two 128-bit floating point values. C prototype.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* Add 'a' to 'b' and put the result in 'result', but treat a[0]=axx,
- b[0]=bxx. bxx differs from b[0] only in the high bit, similarly axx. */
-/* Exceptions to raise:
- - Invalid (SNaN)
- - Invalid (Inf-Inf)
- - Overflow
- - Underflow
- - Inexact
- */
-
-/* Handle cases where exponent of a or b is maximum. */
-static void
-handle_max_exponent(unsigned result[4],
- const unsigned a[4], const unsigned b[4],
- const unsigned axx, /* Treat as a[0]. */
- const unsigned bxx, /* Treat as b[0]. */
- const unsigned ax, /* axx >> 16 & 0x7fff. */
- const unsigned bx) /* bxx >> 16 & 0x7fff. */
-{
- int ax_ismax, bx_ismax;
- unsigned a1,a2,a3, b1,b2,b3;
- int a_zeromant, b_zeromant;
-
- ax_ismax = ax == 0x7fff;
- bx_ismax = bx == 0x7fff;
-
- assert(ax_ismax || bx_ismax);
-
- a1 = a[1]; a2 = a[2]; a3 = a[3];
- b1 = b[1]; b2 = b[2]; b3 = b[3];
-
- a_zeromant = (axx & 0xffff | a1 | a2 | a3) == 0;
- b_zeromant = (bxx & 0xffff | b1 | b2 | b3) == 0;
-
- /* Deal with SNaNs. */
- if ( ax_ismax && !a_zeromant && (axx & 0x8000) == 0
- || bx_ismax && !b_zeromant && (bxx & 0x8000) == 0)
- {
- set_fpscr_bit(FPSCR_VXSNAN);
- axx |= 0x8000; /* Demote the SNaN to a QNaN (whichever of */
- bxx |= 0x8000; /* a or b it was). */
- }
- /* Deal with Inf-Inf. */
- else if (a_zeromant && b_zeromant && (axx ^ bxx) == 0x80000000)
- {
- set_fpscr_bit(FPSCR_VXISI);
- bxx |= 0x8000; /* Return an appropriate QNaN. */
- }
-
- /* Return the lexicographically larger of a or b, ignoring the sign
- bits. */
- if ((axx & 0x7fffffff) > (bxx & 0x7fffffff)) goto return_a;
- else if ((axx & 0x7fffffff) < (bxx & 0x7fffffff)) goto return_b;
- else if (a1 > b1) goto return_a;
- else if (a1 < b1) goto return_b;
- else if (a2 > b2) goto return_a;
- else if (a2 < b2) goto return_b;
- else if (a3 > b3) goto return_a; /* I've clearly been writing too */
- else if (a3 < b3) goto return_b; /* much Fortran... */
-
- /* If they are equal except for the sign bits, return 'b'. */
-
-return_b:
- result[0] = bxx; result[1] = b1; result[2] = b2; result[3] = b3;
- return;
-
-return_a:
- result[0] = axx; result[1] = a1; result[2] = a2; result[3] = a3;
- return;
-}
-
-/* Renormalise and output a FP number. */
-static void
-renormalise_value(unsigned result[4],
- const unsigned axx,
- unsigned ax,
- unsigned r0,
- unsigned r1,
- unsigned r2,
- unsigned r3)
-{
- int rshift;
- if (r0 != 0 || cntlzw(a1) < 16 || 32 > ax-1)
- {
- rshift = cntlzw(r0)-15 + (-(cntlzw(r0) >> 5) & cntlzw(a1));
- assert(rshift < 32);
- if (rshift > ax-1)
- {
- ax--;
- rshift = ax;
- }
-
- result[0] = (axx & 0x80000000
- | ax-rshift << 16
- | r0 << rshift & 0xffff
- | a1 >> 32-rshift & 0xffff);
- result[1] = a1 << rshift | a2 >> 32-rshift;
- result[2] = a2 << rshift | a3 >> 32-rshift;
- result[3] = a3 << rshift;
- return;
- }
- result[3] = 0;
- /* Special case for zero. */
- if (a1 == 0 && a2 == 0 && a3 == 0)
- {
- result[0] = axx & 0x80000000;
- result[1] = result[2] = 0;
- return;
- }
- while (a1 != 0 && cntlzw(a2) >= 16 && 64 <= ax-1)
- {
- ax -= 32;
- a1 = a2; a2 = a3; a3 = 0;
- }
- rshift = cntlzw(a1)-15 + (-(cntlzw(a1) >> 5) & cntlzw(a2));
- assert(rshift < 32);
- if (rshift > ax-1-32)
- {
- ax--;
- rshift = ax-32;
- }
-
- result[0] = (axx & 0x80000000
- | ax-rshift-32 << 16
- | a1 << rshift & 0xffff
- | a2 >> 32-rshift & 0xffff);
- result[1] = a2 << rshift | a3 >> 32-rshift;
- result[2] = a3 << rshift;
- return;
-}
-
-/* Handle the case where one or both numbers are denormalised or zero.
- This case almost never happens, so we don't slow the main code
- with it. */
-static void
-handle_min_exponent(unsigned result[4],
- const unsigned a[4], const unsigned b[4],
- const unsigned axx, /* Treat as a[0]. */
- const unsigned bxx, /* Treat as b[0]. */
- const unsigned ax, /* axx >> 16 & 0x7fff. */
- const unsigned bx) /* bxx >> 16 & 0x7fff. */
-{
- int ax_denorm, bx_denorm;
- unsigned a1,a2,a3, b1,b2,b3;
- int a_zeromant, b_zeromant;
-
- ax_denorm = ax == 0;
- bx_denorm = bx == 0;
-
- assert(ax_denorm || bx_denorm);
-
- a1 = a[1]; a2 = a[2]; a3 = a[3];
- b1 = b[1]; b2 = b[2]; b3 = b[3];
-
-
-}
-
-/* Add a+b+cin modulo 2^32, put result in 'r' and carry in 'cout'. */
-#define addc(r,cout,a,b,cin) \
- do { \
- unsigned long long addc_tmp = (a)+(b)+(cin);
- (cout) = addc_tmp >> 32;
- (r) = addc_tmp;
- }
-
-/* Calculate a+~b+cin modulo 2^32, put result in 'r' and carry in 'cout'. */
-#define subc(r,cout,a,b,cin) \
- do { \
- unsigned long long addc_tmp = (a)-(b)+(cin)-1;
- (cout) = addc_tmp >> 63;
- (r) = addc_tmp;
- }
-
-/* Handle the case where both exponents are the same. This requires quite
- a different algorithm than the general case. */
-static void
-handle_equal_exponents(unsigned result[4],
- const unsigned a[4], const unsigned b[4],
- const unsigned axx, /* Treat as a[0]. */
- const unsigned bxx, /* Treat as b[0]. */
- unsigned ax) /* [ab]xx >> 16 & 0x7fff. */
-{
- unsigned a1,a2,a3, b1,b2,b3;
- int roundmode;
- unsigned carry, r0;
-
- a1 = a[1]; a2 = a[2]; a3 = a[3];
- b1 = b[1]; b2 = b[2]; b3 = b[3];
-
- if ((int)(axx ^ bxx) >= 0)
- {
- int roundmode;
-
- /* Adding. */
- roundmode = fegetround();
-
- /* What about overflow? */
- if (ax == 0x7ffe)
- {
- /* Oh no! Too big! */
- /* Result:
- rounding result
- -------- ------
- nearest return Inf with sign of a,b
- zero return nearest possible non-Inf value with
- sign of a,b
- +Inf return +Inf if a,b>0, otherwise return
- value just before -Inf.
- -Inf return +Inf if a,b>0, otherwise return
- value just before -Inf.
- */
- set_fpscr_bit(FPSCR_OX);
- /* Overflow always produces inexact result. */
- set_fpscr_bit(FPSCR_XX);
-
- if ( roundmode == FE_TONEAREST
- || roundmode == FE_UPWARD && (int)axx >= 0
- || roundmode == FE_DOWNWARD && (int)axx < 0)
- {
- result[3] = result[2] = result[1] = 0;
- result[0] = axx & 0xffff0000 | 0x7fff0000;
- }
- else
- {
- result[3] = result[2] = result[1] = 0xffffffff;
- result[0] = axx & 0xfffe0000 | 0x7ffeffff;
- }
- return;
- }
-
- /* We need to worry about rounding/inexact here. Do it like this: */
- if (a3 + b3 & 1)
- {
- /* Need to round. Upwards? */
- set_fpscr_bit(FPSCR_XX);
- carry = ( roundmode == FE_NEAREST && (a3 + b3 & 2) != 0
- || roundmode == FE_UPWARD && (int)axx >= 0
- || roundmode == FE_DOWNWARD && (int)axx < 0);
- }
- else
- carry = 0; /* Result will be exact. */
-
- /* Perform the addition. */
- addc(a3,carry,a3,b3,carry);
- addc(a2,carry,a2,b2,carry);
- addc(a1,carry,a1,b1,carry);
- r0 = (axx & 0xffff) + (bxx & 0xffff) + carry;
-
- /* Shift right by 1. */
- result[3] = a3 >> 1 | a2 << 31;
- result[2] = a2 >> 1 | a1 << 31;
- result[1] = a1 >> 1 | r0 << 31;
- /* Exponent of result is exponent of inputs plus 1.
- Sign of result is common sign of inputs. */
- result[0] = r0 >> 1 & 0xffff | axx + 0x10000 & 0xffff0000;
- }
- else
- {
- /* Subtracting. */
-
- /* Perform the subtraction, a-b. */
- subc(a3,carry,a3,b3,0);
- subc(a2,carry,a2,b2,carry);
- subc(a1,carry,a1,b1,carry);
- subc(r0,carry,a0&0xffff,b0&0xffff,carry);
-
- /* Maybe we should have calculated b-a... */
- if (carry)
- {
- subc(a3,carry,0,a3,0);
- subc(a2,carry,0,a2,carry);
- subc(a1,carry,0,a1,carry);
- subc(r0,carry,0,r0,carry);
- axx ^= 0x80000000;
- }
-
- renormalise_value(result, axx, ax, r0, a1, a2, a3);
- }
-}
-
-
-static void
-add(unsigned result[4], const unsigned a[4], const unsigned b[4],
- unsigned axx, unsigned bxx)
-{
- int ax, bx, diff, carry;
- unsigned a0,a1,a2,a3, b0,b1,b2,b3,b4, sdiff;
-
- ax = axx >> 16 & 0x7fff;
- bx = bxx >> 16 & 0x7fff;
-
- /* Deal with NaNs and Inf. */
- if (ax == 0x7fff || bx == 0x7fff)
- {
- handle_max_exponent(result, a, b, axx, bxx, ax, bx);
- return;
- }
- /* Deal with denorms and zero. */
- if (ax == 0 || bx == 0)
- {
- handle_min_exponent(result, a, b, axx, bxx, ax, bx);
- return;
- }
- /* Finally, one special case, when both exponents are equal. */
- if (ax == bx)
- {
- handle_equal_exponents(result, a, b, axx, bxx, ax);
- return;
- }
-
- sdiff = axx ^ bxx;
- /* Swap a and b if b has a larger magnitude than a, so that a will have
- the larger magnitude. */
- if (ax < bx)
- {
- const unsigned *t;
- t = b; b = a; a = t;
- diff = bx - ax;
- ax = bx;
- axx = bxx;
- }
- else
- diff = ax - bx;
-
- a0 = a[0] & 0xffff | 0x10000; a1 = a[1]; a2 = a[2]; a3 = a[3];
- b0 = b[0] & 0xffff | 0x10000; b1 = b[1]; b2 = b[2]; b3 = b[3];
- if (diff < 32)
- {
- b4 = b3 << 32-diff;
- b3 = b3 >> diff | b2 << 32-biff;
- b2 = b2 >> diff | b1 << 32-diff;
- b1 = b1 >> diff | b0 << 32-diff;
- b0 = b0 >> diff;
- }
- else if (diff < 64)
- {
- diff -= 32;
- b4 = b3 & 1 | b3 >> (diff == 32) | b2 << 32-biff;
- b3 = b2 >> diff | b1 << 32-diff;
- b2 = b1 >> diff | b0 << 32-diff;
- b1 = b0 >> diff;
- b0 = 0;
- }
- else if (diff < 96)
- {
- b4 = b2 | b3 | b1 << 32-diff;
- b3 = b1 >> diff | b0 << 32-diff;
- b2 = b0 >> diff;
- b1 = b0 = 0;
- }
- else if (diff < 128)
- {
- b4 = b1 | b2 | b3 | b0 << 32-diff;
- b3 = b0 >> diff;
- b2 = b1 = b0 = 0;
- }
- else
- {
- b4 = b0|b1|b2|b3;
- b3 = b2 = b1 = b0 = 0;
- }
-
- /* Now, two cases: one for addition, one for subtraction. */
- if ((int)sdiff >= 0)
- {
- /* Addition. */
-
- /*
-
- /* Perform the addition. */
- addc(a3,carry,a3,b3,0);
- addc(a2,carry,a2,b2,carry);
- addc(a1,carry,a1,b1,carry);
- addc(a0,carry,a0,b0,carry);
-
-
-
- if (a0 & 0x20000)
- {
- /* Need to renormalise by shifting right. */
- /* Shift right by 1. */
- b4 = b4 | a3 << 31;
- a3 = a3 >> 1 | a2 << 31;
- a2 = a2 >> 1 | a1 << 31;
- result[1] = a1 >> 1 | r0 << 31;
- /* Exponent of result is exponent of inputs plus 1.
- Sign of result is common sign of inputs. */
- result[0] = r0 >> 1 & 0xffff | axx + 0x10000 & 0xffff0000;
- }
-
-
- }
- else
- {
- /* Subtraction. */
-
- }
-}
-
-/* Add the absolute values of two 128-bit floating point values,
- give the result the sign of one of them. The only exception this
- can raise is for SNaN. */
-static void
-aadd(unsigned result[4], const unsigned a[4], const unsigned b[4])
-{
- unsigned ax, bx, xd;
- const unsigned *sml;
- unsigned t0,t1,t2,t3,tx, s0,s1,s2,s3,s4, carry;
- int rmode, xdelta, shift;
-
- ax = a[0] >> 16 & 0x7fff;
- bx = b[0] >> 16 & 0x7fff;
-
- /* Deal with . */
- if (ax == 0x7fff)
- {
- t0 = a[0]; t1 = a[1]; t2 = a[2]; t3 = a[3];
- /* Check for SNaN. */
- if ((t0 & 0x8000) == 0
- && (t0 & 0x7fff | t1 | t2 | t3) != 0)
- set_fpscr_bit(FPSCR_VXSNAN);
- /* Return b. */
- result[0] = t0; result[1] = t1; result[2] = t2; result[3] = t3;
- return;
- }
- /* Deal with b==Inf or b==NaN. */
- if (bx == 0x7fff)
- {
- t0 = b[0]; t1 = b[1]; t2 = b[2]; t3 = b[3];
- /* Check for SNaN. */
- if ((t0 & 0x8000) == 0
- && (t0 & 0x7fff | t1 | t2 | t3) != 0)
- set_fpscr_bit(FPSCR_VXSNAN);
- /* Return b. */
- result[0] = t0; result[1] = t1; result[2] = t2; result[3] = t3;
- return;
- }
-
- /* Choose the larger of the two to be 't', and the smaller to be 's'. */
- if (ax > bx)
- {
- t0 = a[0] & 0xffff | (ax != 0) << 16;
- t1 = a[1]; t2 = a[2]; t3 = a[3]; tx = ax;
- s0 = b[0] & 0xffff | (bx != 0) << 16;
- s1 = b[1]; s2 = b[2]; s3 = b[3];
- xd = ax-bx;
- }
- else
- {
- t0 = b[0] & 0xffff | (bx != 0) << 16;
- t1 = b[1]; t2 = b[2]; t3 = b[3]; tx = bx;
- s0 = a[0] & 0xffff | (ax != 0) << 16;
- s1 = a[1]; s2 = a[2]; s3 = a[3];
- sml = a;
- xd = bx-ax;
- }
-
- /* Shift 's2' right by 'xd' bits. */
- switch (xd >> 5)
- {
- case 0:
- s4 = 0;
- break;
- case 1:
- s4 = s3; s3 = s2; s2 = s1; s1 = s0; s0 = 0;
- break;
- case 2:
- s4 = s2 | s3 != 0;
- s3 = s1; s2 = s0; s1 = s0 = 0;
- break;
- case 3:
- s4 = s1 | (s3|s2) != 0;
- s3 = s0; s2 = s1 = s0 = 0;
- break;
- default:
- s4 = s0 | (s3|s2|s1) != 0;
- s3 = s2 = s1 = s0 = 0;
- }
- xd = xd & 0x1f;
- if (xd != 0)
- {
- s4 = s4 >> xd | (s4 << 32-xd) != 0 | s3 << 32-xd;
- s3 = s3 >> xd | s2 << 32-xd;
- s2 = s2 >> xd | s1 << 32-xd;
- s1 = s1 >> xd | s0 << 32-xd;
- s0 = s0 >> xd;
- }
-
- /* Do the addition. */
-#define addc(r,cout,a,b,cin) \
- do { \
- unsigned long long addc_tmp = (a)+(b)+(cin);
- (cout) = addc_tmp >> 32;
- (r) = addc_tmp;
- }
- addc(t3,carry,t3,s3,0);
- addc(t2,carry,t2,s2,carry);
- addc(t1,carry,t1,s1,carry);
- t0 = t0 + s0 + carry;
-
- /* Renormalise. */
- xdelta = 15-cntlzw(t0);
- if (tx + xdelta <= 0x7fff)
- shift = xdelta;
- else
- {
- }
-}
-
-/* Add two 128-bit floating point values. */
-void
-__q_add(unsigned result[4], const unsigned a[4], const unsigned b[4])
-{
- if ((a[0] ^ b[0]) >= 0)
- aadd(result, a, b);
- else
- asubtract(result, a, b);
-}
-
-/* Subtract two 128-bit floating point values. */
-void
-__q_sub(unsigned result[4], const unsigned a[4], const unsigned b[4])
-{
- if ((a[0] ^ b[0]) < 0)
- aadd(result, a, b);
- else
- asubtract(result, a, b);
-}
diff --git a/sysdeps/powerpc/q_dtoq.c b/sysdeps/powerpc/q_dtoq.c
deleted file mode 100644
index 8cab9e4..0000000
--- a/sysdeps/powerpc/q_dtoq.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* 64-bit floating point to 128-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_dtoq(double a);
- Convert 'a' to long double. Don't raise exceptions.
- */
-
-void
-__q_dtoq(unsigned long long result[2], double a)
-{
- unsigned ux, rx;
- union {
- double d;
- unsigned long long u;
- } u;
-
- u.d = a;
- result[1] = u.u << 64-4;
- result[0] = u.u >> 4;
- /* correct exponent bias */
- rx = ((long long)u.u >> 52 & 0x87ff) + 16383-1023;
-
- ux = u.u >> 52 & 0x7ff;
- if (ux == 0)
- {
- if ((u.u & 0x7fffffffffffffffULL) == 0)
- {
- /* +0.0 or -0.0. */
- rx &= 0x8000;
- }
- else
- {
- /* Denormalised number. Renormalise. */
- unsigned long long um = u.u & 0x000fffffffffffffULL;
- int cs = cntlzd(um) - 12 + 1;
- rx -= cs;
- um <<= cs;
- result[0] = um >> 4;
- result[1] = um << 64-4;
- }
- }
- else if (ux == 0x7ff)
- {
- /* Inf or NaN. */
- rx |= 0x7fff;
- }
- *(unsigned short *)result = rx;
-}
diff --git a/sysdeps/powerpc/q_feq.c b/sysdeps/powerpc/q_feq.c
deleted file mode 100644
index 3f5512a..0000000
--- a/sysdeps/powerpc/q_feq.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 128-bit floating point unordered equality.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <fenv_libc.h>
-
-/* int _q_feq(const long double *a, const long double *b);
- Returns nonzero if a==b, 0 otherwise.
-
- Special cases:
- NaNs are never equal to anything;
- -0 == +0;
- If either argument is a SNaN, we set FPSCR_VXSNAN to cause an
- 'invalid operation' exception.
- */
-
-int
-__q_feq(const unsigned a[4], const unsigned b[4])
-{
- unsigned a0, b0;
-
- a0 = a[0]; b0 = b[0];
-
- if ((a0 >> 16 & 0x7fff) != 0x7fff &&
- (b0 >> 16 & 0x7fff) != 0x7fff)
- {
- unsigned a3,b3,a2,b2,a1,b1;
- unsigned z, result;
-
- a3 = a[3]; b3 = b[3]; a2 = a[2];
- b2 = b[2]; a1 = a[1]; b1 = b[1];
- result = ~(a3 ^ b3);
- result &= ~(a2 ^ b2);
- result &= ~(a1 ^ b1);
- z = a3 | a2;
- z |= a1;
- z = (z >> 1 | z | a0) & 0x7fffffff;
- /* 'z' is 0 iff a==0.0, otherwise between 1 and 0x7fffffff */
- return (result & ~(a0^b0 & ~(-z & 0x80000000)))+1;
- }
- else
- {
- /* Deal with SNaNs */
- if (((a0|b0) & 0x8000) == 0)
- {
- set_fpscr_bit(FPSCR_VXSNAN);
- }
- return 0;
- }
-}
diff --git a/sysdeps/powerpc/q_fne.c b/sysdeps/powerpc/q_fne.c
deleted file mode 100644
index 8f6429c..0000000
--- a/sysdeps/powerpc/q_fne.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 128-bit floating point unordered not-equality.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <fenv_libc.h>
-
-/* int _q_fne(const long double *a, const long double *b);
- Returns 0 if a==b
-
- Special cases:
- NaNs return 1 always;
- -0 == +0;
- If either argument is a SNaN, we set FPSCR_VXSNAN to cause an
- 'invalid operation' exception.
- */
-
-int
-__q_fne(const unsigned a[4], const unsigned b[4])
-{
- unsigned a0, b0;
-
- a0 = a[0]; b0 = b[0];
-
- if ((a0 >> 16 & 0x7fff) != 0x7fff &&
- (b0 >> 16 & 0x7fff) != 0x7fff)
- {
- unsigned a3,b3,a2,b2,a1,b1;
- unsigned z, result;
-
- a3 = a[3]; b3 = b[3]; a2 = a[2];
- result = a3 ^ b3;
- b2 = b[2];
- if (result != 0)
- return result;
- a1 = a[1]; b1 = b[1];
- result = a2 ^ b2;
- result |= a1 ^ b1;
- z = a3 | a2;
- if (result != 0)
- return result;
- z |= a1;
- z = (z >> 1 | z | a0) & 0x7fffffff;
- /* 'z' is 0 iff a==0.0, otherwise between 1 and 0x7fffffff */
- return (a0^b0) & ~(-z & 0x80000000);
- }
- else
- {
- /* Deal with SNaNs */
- if (((a0|b0) & 0x8000) == 0)
- {
- set_fpscr_bit(FPSCR_VXSNAN);
- }
- return 1;
- }
-}
diff --git a/sysdeps/powerpc/q_itoq.c b/sysdeps/powerpc/q_itoq.c
deleted file mode 100644
index aa73739..0000000
--- a/sysdeps/powerpc/q_itoq.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 32-bit fixed point signed integer to 128-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_itoq(int a);
- Convert 'a' to long double.
- */
-
-void
-__q_itoq(unsigned int result[4], int a)
-{
- unsigned rx;
- int cs, css;
-
- /* Note that if a==-2^31, then ua will be 2^31. */
- unsigned int ua = abs(a);
-
- /* Normalize. */
- cs = cntlzw(ua);
- ua <<= cs+1;
-
- /* Calculate the exponent, in 4 easy instructions. */
- css = 31-cs;
- rx = 16383+css << 16 & ~css;
-
- /* Copy the sign bit from 'a'. */
- asm ("rlwimi %0,%1,0,0,0": "=r"(rx) : "r"(a), "0"(rx));
-
- /* Put it all together. */
- result[2] = result[3] = 0;
- asm ("rlwimi %0,%1,16,16,31": "=r"(result[0]) : "r"(ua), "0"(rx));
- result[1] = ua << 16;
-}
diff --git a/sysdeps/powerpc/q_lltoq.c b/sysdeps/powerpc/q_lltoq.c
deleted file mode 100644
index 6222eff..0000000
--- a/sysdeps/powerpc/q_lltoq.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 64-bit fixed point signed integer to 128-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_ulltoq(long long a);
- Convert 'a' to long double.
- */
-
-void
-__q_lltoq(unsigned int result[4], long long a)
-{
- unsigned rx;
- int cs, css;
-
- /* Calculate absolute value of 'a'. */
- unsigned long long ua = (a ^ a >> 63) - (a >> 63);
-
- /* Normalize. */
- cs = cntlzd(a);
- ua <<= cs+1;
-
- /* Calculate the exponent, in 4 easy instructions. */
- css = 63-cs;
- rx = 16383+css << 16 & ~css;
-
- /* Copy the sign bit from 'a'. */
- asm ("rlwimi %0,%1,0,0,0": "=r"(rx) : "r"(a >> 32), "0"(rx));
-
- /* Put it all together. */
- result[3] = 0;
- asm ("rlwimi %0,%1,16,16,31": "=r"(result[0]) : "r"(ua >> 32), "0"(rx));
- ua <<= 16;
- result[2] = ua;
- result[1] = ua >> 32;
-}
diff --git a/sysdeps/powerpc/q_neg.c b/sysdeps/powerpc/q_neg.c
deleted file mode 100644
index 8e11afd..0000000
--- a/sysdeps/powerpc/q_neg.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Negate a 128-bit floating point value.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_neg(const long double *a);
- Negate 'a'. Don't raise exceptions.
- */
-
-void
-__q_neg(unsigned int result[4], unsigned int a[4])
-{
- unsigned int t1,t2;
- t1 = a[0];
- t2 = a[1];
- result[0] = t1 ^ 0x80000000;
- t1 = a[2];
- result[1] = t2;
- t2 = a[3];
- result[2] = t1;
- result[3] = t2;
-}
diff --git a/sysdeps/powerpc/q_qtoi.c b/sysdeps/powerpc/q_qtoi.c
deleted file mode 100644
index a2b1b3f..0000000
--- a/sysdeps/powerpc/q_qtoi.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 128-bit floating point to 32-bit fixed point signed integer.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* int _q_qtoi(const long double *a);
- Convert 'a' to signed int by truncation.
-
- Special cases:
- NaN: raise VXCVI, return 0x80000000
- SNaN: raise VXSNAN, VXCVI, and return 0x80000000
- >= 2^32: raise VXCVI, return 0x7fffffff
- <= -2^32: raise VXCVI, return 0x80000000
- */
-
-int
-__q_qtoi(const unsigned long long a[2])
-{
- int ax, sgn;
- unsigned long long a0;
-
- a0 = a[0];
- /* 'sgn' is -1 if 'a' is negative, 0 if positive. */
- sgn = (long long)a0 >> 63;
- ax = (a0 >> 48 & 0x7fff) - 16383;
- /* Deal with non-special cases. */
- if (ax <= 30)
- /* If we had a '>>' operator that behaved properly with respect to
- large shifts, we wouldn't need the '& -(ax >> 31)' term, which
- clears 'result' if ax is negative. The '^ sgn) - sgn' part is
- equivalent in this case to multiplication by 'sgn', but usually
- faster. */
- return (((unsigned)(a0 >> 17 | 0x80000000) >> 31-ax & -(ax >> 31))
- ^ sgn) - sgn;
-
- /* Check for SNaN, if so raise VXSNAN. */
- if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
- && (a[1] | a0 & 0x00007fffffffffffULL) != 0)
- set_fpscr_bit(FPSCR_VXSNAN);
-
- /* Treat all NaNs as large negative numbers. */
- sgn |= -cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
-
- /* All the specials raise VXCVI. */
- set_fpscr_bit(FPSCR_VXCVI);
-
- /* Return 0x7fffffff (if a < 0) or 0x80000000 (otherwise). */
- return sgn ^ 0x7fffffff;
-}
diff --git a/sysdeps/powerpc/q_qtoll.c b/sysdeps/powerpc/q_qtoll.c
deleted file mode 100644
index 77a54f8..0000000
--- a/sysdeps/powerpc/q_qtoll.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 128-bit floating point to 64-bit fixed point signed integer.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long long _q_qtoll(const long double *a);
- Convert 'a' to signed long long by truncation.
-
- Special cases:
- NaN: raise VXCVI, return 0x8000000000000000
- SNaN: raise VXSNAN, VXCVI, and return 0x8000000000000000
- >= 2^32: raise VXCVI, return 0x7fffffffffffffff
- <= -2^32: raise VXCVI, return 0x8000000000000000
- */
-
-long long
-__q_qtoll(const unsigned long long a[2])
-{
- int ax, sgn;
- unsigned long long a0, a1;
-
- a0 = a[0]; a1 = a[1];
- /* 'sgn' is -1 if 'a' is negative, 0 if positive. */
- sgn = (long long)a0 >> 63;
- ax = (a0 >> 48 & 0x7fff) - 16383;
- /* Deal with non-special cases. */
- if (ax <= 62)
- /* If we had a '>>' operator that behaved properly with respect to
- large shifts, we wouldn't need the '& -(ax >> 31)' term, which
- clears 'result' if ax is negative. The '^ sgn) - sgn' part is
- equivalent in this case to multiplication by 'sgn', but faster. */
- return (((a0 << 15 | a1 >> 64-15 | 0x8000000000000000ULL) >> 63-ax
- & -(unsigned long long)(ax >> 31))
- ^ (long long)sgn) - sgn;
-
- /* Check for SNaN, if so raise VXSNAN. */
- if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
- && (a1 | a0 & 0x00007fffffffffffULL) != 0)
- set_fpscr_bit(FPSCR_VXSNAN);
-
- /* Treat all NaNs as large negative numbers. */
- sgn |= -cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
-
- /* All the specials raise VXCVI. */
- set_fpscr_bit(FPSCR_VXCVI);
-
- return (long long)sgn ^ 0x7fffffffffffffffLL;
-}
diff --git a/sysdeps/powerpc/q_qtos.c b/sysdeps/powerpc/q_qtos.c
deleted file mode 100644
index cd2715f..0000000
--- a/sysdeps/powerpc/q_qtos.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 128-bit floating point to 32-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* float _q_qtos(const long double *a);
- Convert 'a' to float. Round as per current rounding flags.
-
- Input Rounding Output
- +/-0 * +/-0
- +/-Inf * +/-Inf
- +/-NaN * +/-NaN (with mantissa truncated)
- +/-SNaN * +/-NaN (with mantissa truncated, MSB of mantissa <- 1)
- && raise VXSNAN
- [Note: just truncating the mantissa may not give you
- a SNaN!]
- |a|>=2^128 Nearest +/-Inf && raise overflow && raise inexact
- |a|>=2^128 Truncate +/-(2^128-2^104) && raise overflow && raise inexact
- a>=2^128 +Inf +Inf && raise overflow && raise inexact
- a<=-2^128 +Inf -(2^128-2^104) && raise overflow && raise inexact
- a>=2^128 -Inf +(2^128-2^104) && raise overflow && raise inexact
- a<=-2^128 -Inf -Inf && raise overflow && raise inexact
-
- We also need to raise 'inexact' if the result will be inexact, which
- depends on the current rounding mode.
-
- To avoid having to deal with all that, we convert to a 'double'
- that will round correctly (but is not itself rounded correctly),
- and convert that to a float. This makes this procedure much
- simpler and much faster. */
-
-float
-__q_qtos(const unsigned long long a[2])
-{
- unsigned long long a0,d;
- union {
- double d;
- unsigned long long ull;
- } u;
-
- a0 = a[0];
-
- /* Truncate the mantissa to 48 bits. */
- d = a0 << 4;
- /* Set the low bit in the mantissa if any of the bits we are dropping
- were 1. This ensures correct rounding, and also distinguishes
- 0 and Inf from denormalised numbers and SNaN (respectively). */
- d |= a[1] != 0;
- /* Copy the sign bit. */
- d = d & 0x7fffffffffffffffULL | a0 & 0x8000000000000000ULL;
-
- /* Now, we need to fix the exponent. If the exponent of a was in
- the range +127 to -152, or was +16384 or -16383, it is already
- correct in 'd'. Otherwise, we need to ensure that the new
- exponent is in the range +1023 to +128, or -153 to -1022, with
- the same sign as the exponent of 'a'. We can do this by setting
- bits 1-3 (the second through fourth-most significant bit) of 'd'
- to 101 if bit 1 of 'a' is 1, or 010 if bit 1 of 'a' is 0. */
- if ((a0 >> 56 & 0x7f) - 0x3f > 1)
- {
- unsigned t = (a0 >> 32+2 & 2 << 31-1-2)*3 + (2 << 31-2);
- d = (d & 0x8fffffffffffffffULL
- | (unsigned long long)t<<32 & 0x7000000000000000ULL);
- }
-
- u.ull = d;
- return (float)u.d;
-}
diff --git a/sysdeps/powerpc/q_qtou.c b/sysdeps/powerpc/q_qtou.c
deleted file mode 100644
index a5583cc..0000000
--- a/sysdeps/powerpc/q_qtou.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 128-bit floating point to 32-bit fixed point unsigned integer.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* unsigned int _q_qtou(const long double *a);
- Convert 'a' to unsigned int by truncation.
-
- Special cases:
- -0: return 0
- NaN: raise VXCVI, return 0
- SNaN: raise VXSNAN, VXCVI, and return 0
- Negative numbers (other than -0, but including -Inf): raise VXCVI, return 0
- >= 2^32: raise VXCVI, return 0xffffffff
- */
-
-unsigned int
-__q_qtou(const unsigned long long a[2])
-{
- int ax;
- unsigned result;
- unsigned long long a0;
-
- /* Deal with non-special cases. */
- a0 = a[0];
- ax = (a0 >> 48) - 16383;
- if (ax <= 31)
- /* If we had a '>>' operator that behaved properly with respect to
- large shifts, we wouldn't need the '& -(ax >> 31)' term, which
- clears 'result' if ax is negative. */
- return (unsigned)(a0 >> 17 | 0x80000000) >> 31-ax & -(ax >> 31);
-
- /* 'result' is 1 if a is negative, 0 otherwise. */
- result = a0 >> 63;
- /* Check for -0, otherwise raise VXCVI. */
- if (a0 != 0x8000000000000000ULL || a[1] != 0)
- {
- /* Check for SNaN, if so raise VXSNAN. */
- if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
- && (a[1] | a0 & 0x00007fffffffffffULL) != 0)
- set_fpscr_bit(FPSCR_VXSNAN);
- /* Treat all NaNs as large negative numbers. */
- result |= cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
-
- set_fpscr_bit(FPSCR_VXCVI);
- }
- return result-1;
-}
diff --git a/sysdeps/powerpc/q_qtoull.c b/sysdeps/powerpc/q_qtoull.c
deleted file mode 100644
index e0b84d3..0000000
--- a/sysdeps/powerpc/q_qtoull.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 128-bit floating point to 64-bit fixed point unsigned integer.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* unsigned long long _q_qtoull(const long double *a);
- Convert 'a' to unsigned long long by truncation.
-
- Special cases:
- -0: return 0
- NaN: raise VXCVI, return 0
- SNaN: raise VXSNAN, VXCVI, and return 0
- Negative numbers (other than -0, but including -Inf): raise VXCVI, return 0
- >= 2^32: raise VXCVI, return 0xffffffffffffffff
- */
-
-unsigned long long
-__q_qtoull(const unsigned long long a[2])
-{
- int ax;
- unsigned result;
- unsigned long long a0, a1;
-
- /* Deal with non-special cases. */
- a0 = a[0]; a1 = a[1];
- ax = (a0 >> 48) - 16383;
- if (ax <= 63)
- /* If we had a '>>' operator that behaved properly with respect to
- large shifts, we wouldn't need the '& -(ax >> 31)' term, which
- clears 'result' if ax is negative. */
- return ((a0 << 15 | a1 >> 64-15 | 0x8000000000000000ULL) >> 63-ax
- & -(unsigned long long)(ax >> 31));
-
- /* 'result' is 1 if a is negative, 0 otherwise. */
- result = a0 >> 63;
- /* Check for -0, otherwise raise VXCVI. */
- if (a0 != 0x8000000000000000ULL || a[1] != 0)
- {
- /* Check for SNaN, if so raise VXSNAN. */
- if ((a0 >> 32 & 0x7fff8000) == 0x7fff0000
- && (a1 | a0 & 0x00007fffffffffffULL) != 0)
- set_fpscr_bit(FPSCR_VXSNAN);
- /* Treat all NaNs as large negative numbers. */
- result |= cntlzw(~(a0 >> 32) & 0x7fff0000) >> 5;
-
- set_fpscr_bit(FPSCR_VXCVI);
- }
- return result-1LL;
-}
diff --git a/sysdeps/powerpc/q_stoq.c b/sysdeps/powerpc/q_stoq.c
deleted file mode 100644
index 766997b..0000000
--- a/sysdeps/powerpc/q_stoq.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 32-bit floating point to 128-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_stoq(float a);
- Convert 'a' to long double. Don't raise exceptions.
- */
-
-void
-__q_stoq(unsigned long long result[2], float a)
-{
- unsigned ux, rx;
- union {
- float d;
- unsigned u;
- } u;
-
- u.d = a;
- result[1] = 0;
- result[0] = u.u << 32-7;
- /* correct exponent bias */
- rx = ((int)u.u >> 23 & 0x80ff) + 16383-127;
-
- ux = u.u >> 23 & 0xff;
- if (ux == 0)
- {
- if ((u.u & 0x7fffffff) == 0)
- {
- /* +0.0 or -0.0. */
- rx &= 0x8000;
- }
- else
- {
- /* Denormalised number. Renormalise. */
- unsigned um = u.u & 0x007fffff;
- int cs = cntlzw(um) - 9 + 1;
- rx -= cs;
- um <<= cs;
- result[0] = um << 32-7;
- }
- }
- else if (ux == 0xff)
- {
- /* Inf or NaN. */
- rx |= 0x7fff;
- }
- *(unsigned short *)result = rx;
-}
diff --git a/sysdeps/powerpc/q_ulltoq.c b/sysdeps/powerpc/q_ulltoq.c
deleted file mode 100644
index caae124..0000000
--- a/sysdeps/powerpc/q_ulltoq.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 64-bit fixed point unsigned integer to 128-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_ulltoq(unsigned long long a);
- Convert 'a' to long double.
- */
-
-void
-__q_ulltoq(unsigned int result[4], unsigned long long a)
-{
- unsigned rx;
- int cs, css;
-
- /* Normalize. */
- cs = cntlzd(a);
- a <<= cs+1;
-
- /* Calculate the exponent, in 4 easy instructions. */
- css = 63-cs;
- rx = 16383+css << 16 & ~css;
-
- /* Put it all together. */
- result[3] = 0;
- result[0] = rx & 0xffff0000 | a >> 48 & 0x0000ffff;
- a <<= 16;
- result[2] = a;
- result[1] = a >> 32;
-}
diff --git a/sysdeps/powerpc/q_utoq.c b/sysdeps/powerpc/q_utoq.c
deleted file mode 100644
index 84ce215..0000000
--- a/sysdeps/powerpc/q_utoq.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 32-bit fixed point unsigned integer to 128-bit floating point.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#include <quad_float.h>
-
-/* long double _q_utoq(unsigned int a);
- Convert 'a' to long double.
- */
-
-void
-__q_utoq(unsigned int result[4], unsigned int a)
-{
- unsigned rx;
- int cs, css;
-
- /* Normalize. */
- cs = cntlzw(a);
- a <<= cs+1;
-
- /* Calculate the exponent, in 4 easy instructions. */
- css = 31-cs;
- rx = 16383+css << 16 & ~css;
-
- /* Put it all together. */
- result[2] = result[3] = 0;
- asm ("rlwimi %0,%1,16,16,31": "=r"(result[0]) : "r"(a), "0"(rx));
- result[1] = a << 16;
-}
diff --git a/sysdeps/powerpc/quad_float.h b/sysdeps/powerpc/quad_float.h
deleted file mode 100644
index 787e8d9..0000000
--- a/sysdeps/powerpc/quad_float.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Internal libc stuff for 128-bit IEEE FP emulation routines.
- Copyright (C) 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef _QUAD_FLOAT_H
-#define _QUAD_FLOAT_H 1
-
-#include <fenv_libc.h>
-
-/* Returns the number of leading zero bits in 'x' (between 0 and 32
- inclusive). 'x' is treated as being 32 bits long. */
-#define cntlzw(x) \
- ({ unsigned p = (x); \
- unsigned r; \
- asm ("cntlzw %0,%1" : "=r"(r) : "r"(p)); \
- r; })
-
-/* Returns the number of leading zero bits in 'x' (between 0 and 64
- inclusive). 'x' is treated as being 64 bits long. */
-#define cntlzd(x) \
- ({ unsigned long long q = (x); \
- unsigned int c1, c2; \
- c1 = cntlzw(q >> 32); \
- c2 = cntlzw(q); \
- c1 + (-(c1 >> 5) & c2); })
-
-#define shift_and_or
-
-#endif /* quad_float.h */