From a9591af9e9ff0ecd0ae09214bd6e19157bff61d8 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 5 Sep 2000 09:07:19 +0000 Subject: Moved from soft-fp/sysdeps/sparc/sparc64/s_scalbnl.c --- soft-fp/sysdeps/alpha/sfp-machine.h | 35 ----- soft-fp/sysdeps/i386/sfp-machine.h | 87 ----------- soft-fp/sysdeps/mips/mips64/sfp-machine.h | 47 ------ soft-fp/sysdeps/mips/sfp-machine.h | 47 ------ soft-fp/sysdeps/powerpc/sfp-machine.h | 48 ------ soft-fp/sysdeps/sparc/sparc32/q_qtod.c | 45 ------ soft-fp/sysdeps/sparc/sparc32/q_qtoi.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_qtos.c | 45 ------ soft-fp/sysdeps/sparc/sparc32/q_qtoui.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_qtoux.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_qtox.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_sqrt.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_stoq.c | 43 ------ soft-fp/sysdeps/sparc/sparc32/q_sub.c | 39 ----- soft-fp/sysdeps/sparc/sparc32/q_uitoq.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_util.c | 57 ------- soft-fp/sysdeps/sparc/sparc32/q_uxtoq.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/q_xtoq.c | 38 ----- soft-fp/sysdeps/sparc/sparc32/sfp-machine.h | 221 ---------------------------- soft-fp/sysdeps/sparc/sparc64/qp_add.c | 45 ------ soft-fp/sysdeps/sparc/sparc64/qp_cmp.c | 51 ------- soft-fp/sysdeps/sparc/sparc64/qp_cmpe.c | 52 ------- soft-fp/sysdeps/sparc/sparc64/qp_div.c | 45 ------ soft-fp/sysdeps/sparc/sparc64/qp_dtoq.c | 46 ------ soft-fp/sysdeps/sparc/sparc64/qp_feq.c | 51 ------- soft-fp/sysdeps/sparc/sparc64/qp_fge.c | 51 ------- soft-fp/sysdeps/sparc/sparc64/qp_fgt.c | 51 ------- soft-fp/sysdeps/sparc/sparc64/qp_fle.c | 51 ------- soft-fp/sysdeps/sparc/sparc64/qp_flt.c | 51 ------- soft-fp/sysdeps/sparc/sparc64/qp_fne.c | 52 ------- soft-fp/sysdeps/sparc/sparc64/qp_itoq.c | 35 ----- soft-fp/sysdeps/sparc/sparc64/qp_mul.c | 50 ------- soft-fp/sysdeps/sparc/sparc64/qp_qtod.c | 49 ------ soft-fp/sysdeps/sparc/sparc64/qp_qtoi.c | 47 ------ soft-fp/sysdeps/sparc/sparc64/qp_qtos.c | 50 ------- soft-fp/sysdeps/sparc/sparc64/qp_qtoui.c | 47 ------ soft-fp/sysdeps/sparc/sparc64/qp_qtoux.c | 47 ------ soft-fp/sysdeps/sparc/sparc64/qp_qtox.c | 47 ------ soft-fp/sysdeps/sparc/sparc64/qp_sqrt.c | 42 ------ soft-fp/sysdeps/sparc/sparc64/qp_stoq.c | 46 ------ soft-fp/sysdeps/sparc/sparc64/qp_sub.c | 45 ------ soft-fp/sysdeps/sparc/sparc64/qp_uitoq.c | 35 ----- soft-fp/sysdeps/sparc/sparc64/qp_util.c | 57 ------- soft-fp/sysdeps/sparc/sparc64/qp_uxtoq.c | 35 ----- soft-fp/sysdeps/sparc/sparc64/qp_xtoq.c | 35 ----- soft-fp/sysdeps/sparc/sparc64/s_frexpl.c | 52 ------- soft-fp/sysdeps/sparc/sparc64/s_ilogbl.c | 82 ----------- soft-fp/sysdeps/sparc/sparc64/s_scalblnl.c | 55 ------- soft-fp/sysdeps/sparc/sparc64/s_scalbnl.c | 55 ------- soft-fp/sysdeps/sparc/sparc64/sfp-machine.h | 143 ------------------ sysdeps/alpha/soft-fp/sfp-machine.h | 35 +++++ sysdeps/i386/soft-fp/sfp-machine.h | 87 +++++++++++ sysdeps/mips/mips64/soft-fp/sfp-machine.h | 47 ++++++ sysdeps/mips/soft-fp/sfp-machine.h | 47 ++++++ sysdeps/powerpc/soft-fp/sfp-machine.h | 48 ++++++ sysdeps/sparc/sparc32/soft-fp/q_qtod.c | 45 ++++++ sysdeps/sparc/sparc32/soft-fp/q_qtoi.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_qtos.c | 45 ++++++ sysdeps/sparc/sparc32/soft-fp/q_qtoui.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_qtoux.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_qtox.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_sqrt.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_stoq.c | 43 ++++++ sysdeps/sparc/sparc32/soft-fp/q_sub.c | 39 +++++ sysdeps/sparc/sparc32/soft-fp/q_uitoq.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_util.c | 57 +++++++ sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/q_xtoq.c | 38 +++++ sysdeps/sparc/sparc32/soft-fp/sfp-machine.h | 221 ++++++++++++++++++++++++++++ sysdeps/sparc/sparc64/soft-fp/Versions | 7 + sysdeps/sparc/sparc64/soft-fp/qp_add.c | 45 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_cmp.c | 51 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c | 52 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_div.c | 45 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c | 46 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_feq.c | 51 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_fge.c | 51 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_fgt.c | 51 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_fle.c | 51 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_flt.c | 51 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_fne.c | 52 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_itoq.c | 35 +++++ sysdeps/sparc/sparc64/soft-fp/qp_mul.c | 50 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_qtod.c | 49 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c | 47 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_qtos.c | 50 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c | 47 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c | 47 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_qtox.c | 47 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c | 42 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_stoq.c | 46 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_sub.c | 45 ++++++ sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c | 35 +++++ sysdeps/sparc/sparc64/soft-fp/qp_util.c | 57 +++++++ sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c | 35 +++++ sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c | 35 +++++ sysdeps/sparc/sparc64/soft-fp/s_frexpl.c | 52 +++++++ sysdeps/sparc/sparc64/soft-fp/s_ilogbl.c | 82 +++++++++++ sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c | 55 +++++++ sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c | 55 +++++++ sysdeps/sparc/sparc64/soft-fp/sfp-machine.h | 143 ++++++++++++++++++ 101 files changed, 2625 insertions(+), 2618 deletions(-) delete mode 100644 soft-fp/sysdeps/alpha/sfp-machine.h delete mode 100644 soft-fp/sysdeps/i386/sfp-machine.h delete mode 100644 soft-fp/sysdeps/mips/mips64/sfp-machine.h delete mode 100644 soft-fp/sysdeps/mips/sfp-machine.h delete mode 100644 soft-fp/sysdeps/powerpc/sfp-machine.h delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_qtod.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_qtoi.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_qtos.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_qtoui.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_qtoux.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_qtox.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_sqrt.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_stoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_sub.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_uitoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_util.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_uxtoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/q_xtoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc32/sfp-machine.h delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_add.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_cmp.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_cmpe.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_div.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_dtoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_feq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_fge.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_fgt.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_fle.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_flt.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_fne.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_itoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_mul.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_qtod.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_qtoi.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_qtos.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_qtoui.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_qtoux.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_qtox.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_sqrt.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_stoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_sub.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_uitoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_util.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_uxtoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/qp_xtoq.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/s_frexpl.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/s_ilogbl.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/s_scalblnl.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/s_scalbnl.c delete mode 100644 soft-fp/sysdeps/sparc/sparc64/sfp-machine.h create mode 100644 sysdeps/alpha/soft-fp/sfp-machine.h create mode 100644 sysdeps/i386/soft-fp/sfp-machine.h create mode 100644 sysdeps/mips/mips64/soft-fp/sfp-machine.h create mode 100644 sysdeps/mips/soft-fp/sfp-machine.h create mode 100644 sysdeps/powerpc/soft-fp/sfp-machine.h create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_qtod.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_qtoi.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_qtos.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_qtoui.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_qtoux.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_qtox.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_sqrt.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_stoq.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_sub.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_uitoq.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_util.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/q_xtoq.c create mode 100644 sysdeps/sparc/sparc32/soft-fp/sfp-machine.h create mode 100644 sysdeps/sparc/sparc64/soft-fp/Versions create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_add.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_cmp.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_div.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_feq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fge.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fgt.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fle.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_flt.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fne.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_itoq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_mul.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtod.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtos.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtox.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_stoq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_sub.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_util.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/s_frexpl.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/s_ilogbl.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c create mode 100644 sysdeps/sparc/sparc64/soft-fp/sfp-machine.h diff --git a/soft-fp/sysdeps/alpha/sfp-machine.h b/soft-fp/sysdeps/alpha/sfp-machine.h deleted file mode 100644 index 73b934ddce..0000000000 --- a/soft-fp/sysdeps/alpha/sfp-machine.h +++ /dev/null @@ -1,35 +0,0 @@ -#define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define _alpha_mul_64_128(rhi, rlo, x, y) \ - __asm__("umulh %2,%3,%0; mulq %2,%3,%1" \ - : "=&r"(rhi), "=r"(rlo) : "r"(x), "r"(y)) - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,_alpha_mul_64_128) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,_alpha_mul_64_128) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S _FP_QNANBIT_S -#define _FP_NANFRAC_D _FP_QNANBIT_D -#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0 -/* FIXME: This is just a wild guess */ -#define _FP_NANSIGN_S 1 -#define _FP_NANSIGN_D 1 -#define _FP_NANSIGN_Q 1 - -#define _FP_KEEPNANFRACP 1 -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - R##_s = Y##_s; \ - _FP_FRAC_COPY_##wc(R,Y); \ - R##_c = FP_CLS_NAN; \ - } while (0) diff --git a/soft-fp/sysdeps/i386/sfp-machine.h b/soft-fp/sysdeps/i386/sfp-machine.h deleted file mode 100644 index 047452b905..0000000000 --- a/soft-fp/sysdeps/i386/sfp-machine.h +++ /dev/null @@ -1,87 +0,0 @@ -#define _FP_W_TYPE_SIZE 32 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \ - __asm__("addl %5,%1; adcl %3,%0" \ - : "=r"(rh), "=r"(rl) \ - : "%0"(xh), "g"(yh), "%1"(xl), "g"(yl) \ - : "cc") - -#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ - do { \ - __asm__ volatile("addl %5,%1; adcl %3,%0" \ - : "=r"(r1), "=r"(r0) \ - : "%0"(x1), "g"(y1), "%1"(x0), "g"(y0) \ - : "cc"); \ - __asm__ volatile("adcl %5,%1; adcl %3,%0" \ - : "=r"(r3), "=r"(r2) \ - : "%0"(x3), "g"(y3), "%1"(x2), "g"(y2) \ - : "cc"); \ - } while (0) - -#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \ - __asm__("subl %5,%1; sbbl %4,%0" \ - : "=r"(rh), "=r"(rl) \ - : "0"(xh), "1"(xl), "g"(yh), "g"(yl) \ - : "cc") - -#define __FP_CLZ(r, x) \ - do { \ - __asm__("bsrl %1,%0" : "=r"(r) : "g"(x) : "cc"); \ - r ^= 31; \ - } while (0) - -#define _i386_mul_32_64(rh, rl, x, y) \ - __asm__("mull %2" : "=d"(rh), "=a"(rl) : "%g"(x), "1"(y) : "cc") - -#define _i386_div_64_32(q, r, nh, nl, d) \ - __asm__ ("divl %4" : "=a"(q), "=d"(r) : "0"(nl), "1"(nh), "g"(d) : "cc") - - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,_i386_mul_32_64) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,_i386_mul_32_64) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) - -#define _FP_NANFRAC_S _FP_QNANBIT_S -#define _FP_NANFRAC_D _FP_QNANBIT_D, 0 -#define _FP_NANSIGN_S 1 -#define _FP_NANSIGN_D 1 - -#define _FP_KEEPNANFRACP 1 -/* Here is something Intel misdesigned: the specs don't define - the case where we have two NaNs with same mantissas, but - different sign. Different operations pick up different NaNs. - */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if (_FP_FRAC_GT_##wc(X, Y) \ - || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - else \ - { \ - R##_s = Y##_s; \ - _FP_FRAC_COPY_##wc(R,Y); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -#define FP_EX_INVALID (1 << 0) -#define FP_EX_DENORM (1 << 1) -#define FP_EX_DIVZERO (1 << 2) -#define FP_EX_OVERFLOW (1 << 3) -#define FP_EX_UNDERFLOW (1 << 4) -#define FP_EX_INEXACT (1 << 5) - -#define FP_RND_NEAREST 0 -#define FP_RND_ZERO 3 -#define FP_RND_PINF 2 -#define FP_RND_MINF 1 diff --git a/soft-fp/sysdeps/mips/mips64/sfp-machine.h b/soft-fp/sysdeps/mips/mips64/sfp-machine.h deleted file mode 100644 index 730deae872..0000000000 --- a/soft-fp/sysdeps/mips/mips64/sfp-machine.h +++ /dev/null @@ -1,47 +0,0 @@ -#define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 -/* From my experiments it seems X is chosen unless one of the - NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(X) | \ - _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \ - { \ - R##_s = _FP_NANSIGN_##fs; \ - _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \ - } \ - else \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -#define FP_EX_INVALID (1 << 4) -#define FP_EX_DIVZERO (1 << 3) -#define FP_EX_OVERFLOW (1 << 2) -#define FP_EX_UNDERFLOW (1 << 1) -#define FP_EX_INEXACT (1 << 0) diff --git a/soft-fp/sysdeps/mips/sfp-machine.h b/soft-fp/sysdeps/mips/sfp-machine.h deleted file mode 100644 index 3b2a40f0e2..0000000000 --- a/soft-fp/sysdeps/mips/sfp-machine.h +++ /dev/null @@ -1,47 +0,0 @@ -#define _FP_W_TYPE_SIZE 32 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 -/* From my experiments it seems X is chosen unless one of the - NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(X) | \ - _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \ - { \ - R##_s = _FP_NANSIGN_##fs; \ - _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \ - } \ - else \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -#define FP_EX_INVALID (1 << 4) -#define FP_EX_DIVZERO (1 << 3) -#define FP_EX_OVERFLOW (1 << 2) -#define FP_EX_UNDERFLOW (1 << 1) -#define FP_EX_INEXACT (1 << 0) diff --git a/soft-fp/sysdeps/powerpc/sfp-machine.h b/soft-fp/sysdeps/powerpc/sfp-machine.h deleted file mode 100644 index 6d68f01ca3..0000000000 --- a/soft-fp/sysdeps/powerpc/sfp-machine.h +++ /dev/null @@ -1,48 +0,0 @@ -#define _FP_W_TYPE_SIZE 32 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 - -/* Someone please check this. */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ - && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ - { \ - R##_s = Y##_s; \ - _FP_FRAC_COPY_##wc(R,Y); \ - } \ - else \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -/* Exception flags. */ -#define FP_EX_INVALID (1 << 4) -#define FP_EX_OVERFLOW (1 << 3) -#define FP_EX_UNDERFLOW (1 << 2) -#define FP_EX_DIVZERO (1 << 1) -#define FP_EX_INEXACT (1 << 0) diff --git a/soft-fp/sysdeps/sparc/sparc32/q_qtod.c b/soft-fp/sysdeps/sparc/sparc32/q_qtod.c deleted file mode 100644 index 92874502ea..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_qtod.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - Return (double)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "double.h" -#include "quad.h" - -double _Q_qtod(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - FP_DECL_D(R); - double r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(D,Q,2,4,R,A); -#else - FP_CONV(D,Q,1,2,R,A); -#endif - FP_PACK_D(r, R); - FP_HANDLE_EXCEPTIONS; - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_qtoi.c b/soft-fp/sysdeps/sparc/sparc32/q_qtoi.c deleted file mode 100644 index b472364cdb..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_qtoi.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return (int)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -int _Q_qtoi(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - int r; - - FP_UNPACK_Q(A, a); - FP_TO_INT_Q(r, A, 32, 1); - FP_HANDLE_EXCEPTIONS; - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_qtos.c b/soft-fp/sysdeps/sparc/sparc32/q_qtos.c deleted file mode 100644 index b0945cb318..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_qtos.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - Return (float)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "single.h" -#include "quad.h" - -float _Q_qtos(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - FP_DECL_S(R); - float r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(S,Q,1,4,R,A); -#else - FP_CONV(S,Q,1,2,R,A); -#endif - FP_PACK_S(r, R); - FP_HANDLE_EXCEPTIONS; - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_qtoui.c b/soft-fp/sysdeps/sparc/sparc32/q_qtoui.c deleted file mode 100644 index c2de37f15e..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_qtoui.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return (unsigned int)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -unsigned int _Q_qtoui(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - unsigned int r; - - FP_UNPACK_Q(A, a); - FP_TO_INT_Q(r, A, 32, -1); - FP_HANDLE_EXCEPTIONS; - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_qtoux.c b/soft-fp/sysdeps/sparc/sparc32/q_qtoux.c deleted file mode 100644 index ff1e1a9edb..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_qtoux.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return (unsigned long)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -unsigned long long _Q_qtoux(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - unsigned long long r; - - FP_UNPACK_Q(A, a); - FP_TO_INT_Q(r, A, 64, -1); - FP_HANDLE_EXCEPTIONS; - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_qtox.c b/soft-fp/sysdeps/sparc/sparc32/q_qtox.c deleted file mode 100644 index ba591606dc..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_qtox.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return (long)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -long long _Q_qtox(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - long long r; - - FP_UNPACK_Q(A, a); - FP_TO_INT_Q(r, A, 64, 1); - FP_HANDLE_EXCEPTIONS; - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_sqrt.c b/soft-fp/sysdeps/sparc/sparc32/q_sqrt.c deleted file mode 100644 index 2f759284a0..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_sqrt.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return sqrtl(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -long double _Q_sqrt(const long double a) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(C); - long double c; - - FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); - FP_SQRT_Q(C, A); - FP_PACK_Q(c, C); - FP_HANDLE_EXCEPTIONS; - return c; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_stoq.c b/soft-fp/sysdeps/sparc/sparc32/q_stoq.c deleted file mode 100644 index ad5153da3c..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_stoq.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Software floating-point emulation. - c = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "single.h" -#include "quad.h" - -long double _Q_stoq(const float a) -{ - FP_DECL_EX; - FP_DECL_S(A); - FP_DECL_Q(C); - long double c; - - FP_UNPACK_S(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(Q,S,4,1,C,A); -#else - FP_CONV(Q,S,2,1,C,A); -#endif - FP_PACK_Q(c, C); - FP_HANDLE_EXCEPTIONS; - return c; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_sub.c b/soft-fp/sysdeps/sparc/sparc32/q_sub.c deleted file mode 100644 index 2cfd49d26a..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_sub.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Software floating-point emulation. - c = a - b - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -long double _Q_sub(const long double a, const long double b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - long double c; - - FP_INIT_ROUNDMODE; - FP_UNPACK_Q(A, a); - FP_UNPACK_Q(B, b); - FP_SUB_Q(C, A, B); - FP_PACK_Q(c, C); - FP_HANDLE_EXCEPTIONS; - return c; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_uitoq.c b/soft-fp/sysdeps/sparc/sparc32/q_uitoq.c deleted file mode 100644 index 8a3c664f1d..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_uitoq.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - c = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -long double _Q_uitoq(const unsigned int a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - long double c; - unsigned int b = a; - - FP_FROM_INT_Q(C, b, 32, int); - FP_PACK_Q(c, C); - FP_CLEAR_EXCEPTIONS; - FP_HANDLE_EXCEPTIONS; - return c; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_util.c b/soft-fp/sysdeps/sparc/sparc32/q_util.c deleted file mode 100644 index df4d16c019..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_util.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Software floating-point emulation. - Helper routine for _Q_* routines. - Simulate exceptions using double arithmetics. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" - -unsigned long long ___Q_numbers [] = { -0x0000000000000000ULL, /* Zero */ -0x0010100000000000ULL, /* Very tiny number */ -0x0010000000000000ULL, /* Minimum normalized number */ -0x7fef000000000000ULL, /* A huge double number */ -}; - -double ___Q_simulate_exceptions(int exceptions) -{ - double d, *p = (double *)___Q_numbers; - if (exceptions & FP_EX_INVALID) - d = p[0]/p[0]; - if (exceptions & FP_EX_OVERFLOW) - { - d = p[3] + p[3]; - exceptions &= ~FP_EX_INEXACT; - } - if (exceptions & FP_EX_UNDERFLOW) - { - if (exceptions & FP_EX_INEXACT) - { - d = p[2] * p[2]; - exceptions &= ~FP_EX_INEXACT; - } - else - d = p[1] - p[2]; - } - if (exceptions & FP_EX_DIVZERO) - d = 1.0/p[0]; - if (exceptions & FP_EX_INEXACT) - d = p[3] - p[2]; - return d; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_uxtoq.c b/soft-fp/sysdeps/sparc/sparc32/q_uxtoq.c deleted file mode 100644 index ee68ca2563..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_uxtoq.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -long double _Q_uxtoq(const unsigned long long a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - long double c; - unsigned long long b = a; - - FP_FROM_INT_Q(C, b, 64, long long); - FP_PACK_Q(c, C); - FP_CLEAR_EXCEPTIONS; - FP_HANDLE_EXCEPTIONS; - return c; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/q_xtoq.c b/soft-fp/sysdeps/sparc/sparc32/q_xtoq.c deleted file mode 100644 index 3dd70b9329..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/q_xtoq.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Software floating-point emulation. - Return (long double)a - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -long double _Q_xtoq(const long long a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - long double c; - long long b = a; - - FP_FROM_INT_Q(C, b, 64, long long); - FP_PACK_Q(c, C); - FP_CLEAR_EXCEPTIONS; - FP_HANDLE_EXCEPTIONS; - return c; -} diff --git a/soft-fp/sysdeps/sparc/sparc32/sfp-machine.h b/soft-fp/sysdeps/sparc/sparc32/sfp-machine.h deleted file mode 100644 index d3713b96d7..0000000000 --- a/soft-fp/sysdeps/sparc/sparc32/sfp-machine.h +++ /dev/null @@ -1,221 +0,0 @@ -/* Machine-dependent software floating-point definitions. - Sparc userland (_Q_*) version. - Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz) and - David S. Miller (davem@redhat.com). - - 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 - -#define _FP_W_TYPE_SIZE 32 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 - -/* If one NaN is signaling and the other is not, - * we choose that one, otherwise we choose X. - */ -/* For _Qp_* and _Q_*, this should prefer X, for - * CPU instruction emulation this should prefer Y. - * (see SPAMv9 B.2.2 section). - */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ - && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ - { \ - R##_s = Y##_s; \ - _FP_FRAC_COPY_##wc(R,Y); \ - } \ - else \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -/* Some assembly to speed things up. */ -#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ - __asm__ ("addcc %r7,%8,%2 - addxcc %r5,%6,%1 - addx %r3,%4,%0" \ - : "=r" ((USItype)(r2)), \ - "=&r" ((USItype)(r1)), \ - "=&r" ((USItype)(r0)) \ - : "%rJ" ((USItype)(x2)), \ - "rI" ((USItype)(y2)), \ - "%rJ" ((USItype)(x1)), \ - "rI" ((USItype)(y1)), \ - "%rJ" ((USItype)(x0)), \ - "rI" ((USItype)(y0)) \ - : "cc") - -#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ - __asm__ ("subcc %r7,%8,%2 - subxcc %r5,%6,%1 - subx %r3,%4,%0" \ - : "=r" ((USItype)(r2)), \ - "=&r" ((USItype)(r1)), \ - "=&r" ((USItype)(r0)) \ - : "%rJ" ((USItype)(x2)), \ - "rI" ((USItype)(y2)), \ - "%rJ" ((USItype)(x1)), \ - "rI" ((USItype)(y1)), \ - "%rJ" ((USItype)(x0)), \ - "rI" ((USItype)(y0)) \ - : "cc") - -#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ - do { \ - /* We need to fool gcc, as we need to pass more than 10 \ - input/outputs. */ \ - register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ - __asm__ __volatile__ (" - addcc %r8,%9,%1 - addxcc %r6,%7,%0 - addxcc %r4,%5,%%g2 - addx %r2,%3,%%g1" \ - : "=&r" ((USItype)(r1)), \ - "=&r" ((USItype)(r0)) \ - : "%rJ" ((USItype)(x3)), \ - "rI" ((USItype)(y3)), \ - "%rJ" ((USItype)(x2)), \ - "rI" ((USItype)(y2)), \ - "%rJ" ((USItype)(x1)), \ - "rI" ((USItype)(y1)), \ - "%rJ" ((USItype)(x0)), \ - "rI" ((USItype)(y0)) \ - : "cc", "g1", "g2"); \ - __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ - r3 = _t1; r2 = _t2; \ - } while (0) - -#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ - do { \ - /* We need to fool gcc, as we need to pass more than 10 \ - input/outputs. */ \ - register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ - __asm__ __volatile__ (" - subcc %r8,%9,%1 - subxcc %r6,%7,%0 - subxcc %r4,%5,%%g2 - subx %r2,%3,%%g1" \ - : "=&r" ((USItype)(r1)), \ - "=&r" ((USItype)(r0)) \ - : "%rJ" ((USItype)(x3)), \ - "rI" ((USItype)(y3)), \ - "%rJ" ((USItype)(x2)), \ - "rI" ((USItype)(y2)), \ - "%rJ" ((USItype)(x1)), \ - "rI" ((USItype)(y1)), \ - "%rJ" ((USItype)(x0)), \ - "rI" ((USItype)(y0)) \ - : "cc", "g1", "g2"); \ - __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ - r3 = _t1; r2 = _t2; \ - } while (0) - -#define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) __FP_FRAC_SUB_3(x2,x1,x0,x2,x1,x0,y2,y1,y0) - -#define __FP_FRAC_DEC_4(x3,x2,x1,x0,y3,y2,y1,y0) __FP_FRAC_SUB_4(x3,x2,x1,x0,x3,x2,x1,x0,y3,y2,y1,y0) - -#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \ - __asm__ ("addcc %3,%4,%3 - addxcc %2,%%g0,%2 - addxcc %1,%%g0,%1 - addx %0,%%g0,%0" \ - : "=&r" ((USItype)(x3)), \ - "=&r" ((USItype)(x2)), \ - "=&r" ((USItype)(x1)), \ - "=&r" ((USItype)(x0)) \ - : "rI" ((USItype)(i)), \ - "0" ((USItype)(x3)), \ - "1" ((USItype)(x2)), \ - "2" ((USItype)(x1)), \ - "3" ((USItype)(x0)) \ - : "cc") - -/* Obtain the current rounding mode. */ -#ifndef FP_ROUNDMODE -#define FP_ROUNDMODE ((_fcw >> 30) & 0x3) -#endif - -/* Exception flags. */ -#define FP_EX_INVALID (1 << 4) -#define FP_EX_OVERFLOW (1 << 3) -#define FP_EX_UNDERFLOW (1 << 2) -#define FP_EX_DIVZERO (1 << 1) -#define FP_EX_INEXACT (1 << 0) - -#define _FP_DECL_EX fpu_control_t _fcw - -#define FP_INIT_ROUNDMODE \ -do { \ - _FPU_GETCW(_fcw); \ -} while (0) - -/* Simulate exceptions using double arithmetics. */ -extern double ___Q_simulate_exceptions(int exc); - -#define FP_HANDLE_EXCEPTIONS \ -do { \ - if (!_fex) \ - { \ - /* This is the common case, so we do it inline. \ - * We need to clear cexc bits if any. \ - */ \ - extern unsigned long long ___Q_numbers[]; \ - __asm__ __volatile__(" - ldd [%0], %%f30 - faddd %%f30, %%f30, %%f30 - " : : "r" (___Q_numbers) : "f30"); \ - } \ - else \ - { \ - __asm__ __volatile__(" - mov %0, %%o0 - mov %%o7, %%g1 - call ___Q_simulate_exceptions - mov %%g1, %%o7 - " : : "r" (_fex) : \ - "g1", "g2", "g3", "g4", "g5", "o0", \ - "o1", "o2", "o3", "o4", "o5", "cc"); \ - } \ -} while (0) diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_add.c b/soft-fp/sysdeps/sparc/sparc64/qp_add.c deleted file mode 100644 index b77f4d49c6..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_add.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) + (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_add(long double *c, const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_UNPACK_QP(B, b); - FP_ADD_Q(C, A, B); - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - ldd [%2], %%f56 - ldd [%2+8], %%f58 - faddq %%f52, %%f56, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_cmp.c b/soft-fp/sysdeps/sparc/sparc64/qp_cmp.c deleted file mode 100644 index 739fb5e910..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_cmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Software floating-point emulation. - Compare (*a) and (*b), return float condition code. - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_cmp(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_Q(r, B, A, 3); - if (r == -1) r = 2; - if (r == 3 && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) - FP_SET_EXCEPTION(FP_EX_INVALID); - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 3)); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_cmpe.c b/soft-fp/sysdeps/sparc/sparc64/qp_cmpe.c deleted file mode 100644 index d881f904df..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_cmpe.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Software floating-point emulation. - Compare (*a) and (*b), return float condition code. - Signal exception (unless masked) if unordered. - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_cmpe(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_Q(r, B, A, 3); - if (r == -1) r = 2; - if (r == 3) - FP_SET_EXCEPTION(FP_EX_INVALID); - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpeq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 3)); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_div.c b/soft-fp/sysdeps/sparc/sparc64/qp_div.c deleted file mode 100644 index c79ac1b392..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_div.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) / (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_div(long double *c, const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_UNPACK_QP(B, b); - FP_DIV_Q(C, A, B); - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - ldd [%2], %%f56 - ldd [%2+8], %%f58 - fdivq %%f52, %%f56, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_dtoq.c b/soft-fp/sysdeps/sparc/sparc64/qp_dtoq.c deleted file mode 100644 index 079b6d08d5..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_dtoq.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "double.h" -#include "quad.h" - -void _Qp_dtoq(long double *c, const double a) -{ - FP_DECL_EX; - FP_DECL_D(A); - FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_D(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(Q,D,4,2,C,A); -#else - FP_CONV(Q,D,2,1,C,A); -#endif - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( - "fdtoq %1, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "e" (a) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_feq.c b/soft-fp/sysdeps/sparc/sparc64/qp_feq.c deleted file mode 100644 index 1d32ec6fe7..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_feq.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) == (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_feq(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_EQ_Q(r, A, B); - if (r && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) - FP_SET_EXCEPTION(FP_EX_INVALID); - - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 3)); - - return !r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_fge.c b/soft-fp/sysdeps/sparc/sparc64/qp_fge.c deleted file mode 100644 index 6d73745cdb..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_fge.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) >= (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_fge(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_Q(r, B, A, 3); - if (r == 3) - FP_SET_EXCEPTION(FP_EX_INVALID); - - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpeq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 1)); - - return (r <= 0); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_fgt.c b/soft-fp/sysdeps/sparc/sparc64/qp_fgt.c deleted file mode 100644 index e389fd9d41..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_fgt.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) > (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_fgt(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_Q(r, B, A, 3); - if (r == 3) - FP_SET_EXCEPTION(FP_EX_INVALID); - - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpeq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 3) - 3); - - return (r == -1); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_fle.c b/soft-fp/sysdeps/sparc/sparc64/qp_fle.c deleted file mode 100644 index 2afe2af86f..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_fle.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) <= (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_fle(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_Q(r, B, A, -2); - if (r == -2) - FP_SET_EXCEPTION(FP_EX_INVALID); - - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpeq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 2) ? -1 : 0); - - return (r >= 0); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_flt.c b/soft-fp/sysdeps/sparc/sparc64/qp_flt.c deleted file mode 100644 index 42c8659301..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_flt.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) < (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_flt(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_Q(r, B, A, 3); - if (r == 3) - FP_SET_EXCEPTION(FP_EX_INVALID); - - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpeq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 3)); - - return (r == 1); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_fne.c b/soft-fp/sysdeps/sparc/sparc64/qp_fne.c deleted file mode 100644 index bcc1ec2ee7..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_fne.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) != (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -int _Qp_fne(const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_UNPACK_RAW_QP(B, b); - FP_CMP_EQ_Q(r, A, B); - if (r && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) - FP_SET_EXCEPTION(FP_EX_INVALID); - - QP_HANDLE_EXCEPTIONS( - __asm ( - "ldd [%0], %%f52 - ldd [%0+8], %%f54 - ldd [%1], %%f56 - ldd [%1+8], %%f58 - fcmpq %%fcc3, %%f52, %%f56 - " : : "r" (a), "r" (b) : QP_CLOBBER_CC); - _FPU_GETCW(_fcw); - r = ((_fcw >> 36) & 3) != 0); - - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_itoq.c b/soft-fp/sysdeps/sparc/sparc64/qp_itoq.c deleted file mode 100644 index b1b80ac8a0..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_itoq.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_itoq(long double *c, const int a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - int b = a; - - FP_FROM_INT_Q(C, b, 32, int); - FP_PACK_QP(c, C); - QP_NO_EXCEPTIONS; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_mul.c b/soft-fp/sysdeps/sparc/sparc64/qp_mul.c deleted file mode 100644 index 9dbc06b989..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_mul.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) * (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -/* As QP_HANDLE_EXCEPTIONS reloads FPU control word anyway, - avoid doing it twice. */ -#define _FP_MUL_MEAT_RESET_FE do {} while (0) -#include "soft-fp.h" -#include "quad.h" - -void _Qp_mul(long double *c, const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_UNPACK_QP(B, b); - FP_MUL_Q(C, A, B); - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS( - _FPU_SETCW(_fcw); - __asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - ldd [%2], %%f56 - ldd [%2+8], %%f58 - fmulq %%f52, %%f56, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_qtod.c b/soft-fp/sysdeps/sparc/sparc64/qp_qtod.c deleted file mode 100644 index 50c44026e1..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_qtod.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Software floating-point emulation. - Return (double)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "double.h" -#include "quad.h" - -double _Qp_qtod(const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - FP_DECL_D(R); - double r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(D,Q,2,4,R,A); -#else - FP_CONV(D,Q,1,2,R,A); -#endif - FP_PACK_D(r, R); - QP_HANDLE_EXCEPTIONS(__asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fqtod %%f52, %0 - " : "=&e" (r) : "r" (a) : QP_CLOBBER)); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_qtoi.c b/soft-fp/sysdeps/sparc/sparc64/qp_qtoi.c deleted file mode 100644 index 770c887653..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_qtoi.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Software floating-point emulation. - Return (int)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -int _Qp_qtoi(const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_TO_INT_Q(r, A, 32, 1); - QP_HANDLE_EXCEPTIONS( - int rx; - __asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fqtoi %%f52, %%f60 - st %%f60, [%0] - " : : "r" (&rx), "r" (a) : QP_CLOBBER); - r = rx); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_qtos.c b/soft-fp/sysdeps/sparc/sparc64/qp_qtos.c deleted file mode 100644 index 630300ea44..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_qtos.c +++ /dev/null @@ -1,50 +0,0 @@ -/* Software floating-point emulation. - Return (float)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "single.h" -#include "quad.h" - -float _Qp_qtos(const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - FP_DECL_S(R); - float r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(S,Q,1,4,R,A); -#else - FP_CONV(S,Q,1,2,R,A); -#endif - FP_PACK_S(r, R); - - QP_HANDLE_EXCEPTIONS(__asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fqtos %%f52, %0 - " : "=&f" (r) : "r" (a) : QP_CLOBBER)); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_qtoui.c b/soft-fp/sysdeps/sparc/sparc64/qp_qtoui.c deleted file mode 100644 index 011cf73114..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_qtoui.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Software floating-point emulation. - Return (unsigned int)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -unsigned int _Qp_qtoui(const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - unsigned int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_TO_INT_Q(r, A, 32, -1); - QP_HANDLE_EXCEPTIONS( - int rx; - __asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fqtoi %%f52, %%f60 - st %%f60, [%0] - " : : "r" (&rx), "r" (a) : QP_CLOBBER); - r = rx); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_qtoux.c b/soft-fp/sysdeps/sparc/sparc64/qp_qtoux.c deleted file mode 100644 index f2a393a8e7..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_qtoux.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Software floating-point emulation. - Return (unsigned long)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -unsigned long _Qp_qtoux(const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - unsigned long r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_TO_INT_Q(r, A, 64, -1); - QP_HANDLE_EXCEPTIONS( - unsigned long rx; - __asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fqtoi %%f52, %%f60 - std %%f60, [%0] - " : : "r" (&rx), "r" (a) : QP_CLOBBER); - r = rx); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_qtox.c b/soft-fp/sysdeps/sparc/sparc64/qp_qtox.c deleted file mode 100644 index a54c5c5833..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_qtox.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Software floating-point emulation. - Return (long)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -#define FP_ROUNDMODE FP_RND_ZERO -#include "soft-fp.h" -#include "quad.h" - -long _Qp_qtox(const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); - long r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_TO_INT_Q(r, A, 64, 1); - QP_HANDLE_EXCEPTIONS( - long rx; - __asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fqtoi %%f52, %%f60 - std %%f60, [%0] - " : : "r" (&rx), "r" (a) : QP_CLOBBER); - r = rx); - - return r; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_sqrt.c b/soft-fp/sysdeps/sparc/sparc64/qp_sqrt.c deleted file mode 100644 index 00e3980286..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_sqrt.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Software floating-point emulation. - (*c) = sqrtl(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_sqrt(long double *c, const long double *a) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_SQRT_Q(C, A); - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - fsqrtq %%f52, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "r" (a) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_stoq.c b/soft-fp/sysdeps/sparc/sparc64/qp_stoq.c deleted file mode 100644 index ab0f49a0ca..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_stoq.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "single.h" -#include "quad.h" - -void _Qp_stoq(long double *c, const float a) -{ - FP_DECL_EX; - FP_DECL_S(A); - FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_S(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_CONV(Q,S,4,1,C,A); -#else - FP_CONV(Q,S,2,1,C,A); -#endif - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( - "fstoq %1, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "f" (a) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_sub.c b/soft-fp/sysdeps/sparc/sparc64/qp_sub.c deleted file mode 100644 index 9532f7b817..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_sub.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) - (*b) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_sub(long double *c, const long double *a, const long double *b) -{ - FP_DECL_EX; - FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); - - FP_INIT_ROUNDMODE; - FP_UNPACK_QP(A, a); - FP_UNPACK_QP(B, b); - FP_SUB_Q(C, A, B); - FP_PACK_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( - "ldd [%1], %%f52 - ldd [%1+8], %%f54 - ldd [%2], %%f56 - ldd [%2+8], %%f58 - fsubq %%f52, %%f56, %%f60 - std %%f60, [%0] - std %%f62, [%0+8] - " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_uitoq.c b/soft-fp/sysdeps/sparc/sparc64/qp_uitoq.c deleted file mode 100644 index e35f0c688e..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_uitoq.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_uitoq(long double *c, const unsigned int a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - unsigned int b = a; - - FP_FROM_INT_Q(C, b, 32, int); - FP_PACK_QP(c, C); - QP_NO_EXCEPTIONS; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_util.c b/soft-fp/sysdeps/sparc/sparc64/qp_util.c deleted file mode 100644 index 3009b2212a..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_util.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Software floating-point emulation. - Helper routine for _Qp_* routines. - Simulate exceptions using double arithmetics. - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" - -static unsigned long numbers [] = { -0x7fef000000000000UL, /* A huge double number */ -0x0010100000000000UL, /* Very tiny number */ -0x0010000000000000UL, /* Minimum normalized number */ -0x0000000000000000UL, /* Zero */ -}; - -double __Qp_handle_exceptions(int exceptions) -{ - double d, *p = (double *)numbers; - if (exceptions & FP_EX_INVALID) - d = p[3]/p[3]; - if (exceptions & FP_EX_OVERFLOW) - { - d = p[0] + p[0]; - exceptions &= ~FP_EX_INEXACT; - } - if (exceptions & FP_EX_UNDERFLOW) - { - if (exceptions & FP_EX_INEXACT) - { - d = p[2] * p[2]; - exceptions &= ~FP_EX_INEXACT; - } - else - d = p[1] - p[2]; - } - if (exceptions & FP_EX_DIVZERO) - d = 1.0/p[3]; - if (exceptions & FP_EX_INEXACT) - d = p[0] - p[2]; - return d; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_uxtoq.c b/soft-fp/sysdeps/sparc/sparc64/qp_uxtoq.c deleted file mode 100644 index d7442cfa71..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_uxtoq.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_uxtoq(long double *c, const unsigned long a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - unsigned long b = a; - - FP_FROM_INT_Q(C, b, 64, long); - FP_PACK_QP(c, C); - QP_NO_EXCEPTIONS; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/qp_xtoq.c b/soft-fp/sysdeps/sparc/sparc64/qp_xtoq.c deleted file mode 100644 index 06cfa9adc7..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/qp_xtoq.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(*a) - Copyright (C) 1997,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com) and - Jakub Jelinek (jj@ultra.linux.cz). - - 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 "soft-fp.h" -#include "quad.h" - -void _Qp_xtoq(long double *c, const long a) -{ - FP_DECL_EX; - FP_DECL_Q(C); - long b = a; - - FP_FROM_INT_Q(C, b, 64, long); - FP_PACK_QP(c, C); - QP_NO_EXCEPTIONS; -} diff --git a/soft-fp/sysdeps/sparc/sparc64/s_frexpl.c b/soft-fp/sysdeps/sparc/sparc64/s_frexpl.c deleted file mode 100644 index a307a7e113..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/s_frexpl.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Software floating-point emulation. - frexpl(x, exp) - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -/* - * for non-zero x - * x = frexpl(arg,&exp); - * return a long double fp quantity x such that 0.5 <= |x| <1.0 - * and the corresponding binary exponent "exp". That is - * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg - * with *exp=0. - */ - -#include "soft-fp.h" -#include "quad.h" - -long double __frexpl(long double arg, int *exp) -{ - FP_DECL_EX; - FP_DECL_Q(A); - long double r; - - *exp = 0; - FP_UNPACK_Q(A, arg); - if (A_c != FP_CLS_NORMAL) - return arg; - *exp = A_e + 1; - A_e = -1; - FP_PACK_Q(r, A); - - return r; -} - -weak_alias (__frexpl, frexpl) diff --git a/soft-fp/sysdeps/sparc/sparc64/s_ilogbl.c b/soft-fp/sysdeps/sparc/sparc64/s_ilogbl.c deleted file mode 100644 index d3b1a51dbf..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/s_ilogbl.c +++ /dev/null @@ -1,82 +0,0 @@ -/* Software floating-point emulation. - ilogbl(x, exp) - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -/* ilogbl(long double x) - * return the binary exponent of non-zero x - * ilogbl(0) = 0x80000001 - * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised) - */ - -#include "soft-fp.h" -#include "quad.h" -#include - -int __ilogbl(long double x) -{ - FP_DECL_EX; - FP_DECL_Q(X); - -/* - FP_UNPACK_Q(X, x); - switch (X_c) - { - case FP_CLS_ZERO: - return FP_ILOGB0; - case FP_CLS_NAN: - case FP_CLS_INF: - return FP_ILOGBNAN; - default: - return X_e; - } - */ - FP_UNPACK_RAW_Q(X, x); - switch (X_e) - { - default: - return X_e - _FP_EXPBIAS_Q; - case 0: -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - if (_FP_FRAC_ZEROP_4(X)) - return FP_ILOGB0; - else - { - _FP_I_TYPE shift; - _FP_FRAC_CLZ_4(shift, X); - shift -= _FP_FRACXBITS_Q; - return X_e - _FP_EXPBIAS_Q - 1 + shift; - } -#else - if (_FP_FRAC_ZEROP_2(X)) - return FP_ILOGB0; - else - { - _FP_I_TYPE shift; - _FP_FRAC_CLZ_2(shift, X); - shift -= _FP_FRACXBITS_Q; - return X_e - _FP_EXPBIAS_Q - 1 + shift; - } -#endif - case _FP_EXPBIAS_Q: - return FP_ILOGBNAN; - } -} - -weak_alias (__ilogbl, ilogbl) diff --git a/soft-fp/sysdeps/sparc/sparc64/s_scalblnl.c b/soft-fp/sysdeps/sparc/sparc64/s_scalblnl.c deleted file mode 100644 index 5568cfdab2..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/s_scalblnl.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Software floating-point emulation. - scalblnl(x, exp) - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -/* - * scalblnl (long double x, long int n) - * scalblnl(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "soft-fp.h" -#include "quad.h" - -long double __scalblnl(long double arg, int exp) -{ - FP_DECL_EX; - FP_DECL_Q(A); - long double r; - - FP_UNPACK_Q(A, arg); - switch (A_c) - { - case FP_CLS_ZERO: - return arg; - case FP_CLS_NAN: - case FP_CLS_INF: - FP_HANDLE_EXCEPTIONS; - return arg; - } - A_e += exp; - FP_PACK_Q(r, A); - FP_HANDLE_EXCEPTIONS; - - return r; -} - -weak_alias (__scalblnl, scalblnl) diff --git a/soft-fp/sysdeps/sparc/sparc64/s_scalbnl.c b/soft-fp/sysdeps/sparc/sparc64/s_scalbnl.c deleted file mode 100644 index fb913fdd6b..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/s_scalbnl.c +++ /dev/null @@ -1,55 +0,0 @@ -/* Software floating-point emulation. - scalbnl(x, exp) - Copyright (C) 1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek (jj@ultra.linux.cz). - - 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. */ - -/* - * scalbnl (long double x, int n) - * scalbnl(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include "soft-fp.h" -#include "quad.h" - -long double __scalbnl(long double arg, int exp) -{ - FP_DECL_EX; - FP_DECL_Q(A); - long double r; - - FP_UNPACK_Q(A, arg); - switch (A_c) - { - case FP_CLS_ZERO: - return arg; - case FP_CLS_NAN: - case FP_CLS_INF: - FP_HANDLE_EXCEPTIONS; - return arg; - } - A_e += exp; - FP_PACK_Q(r, A); - FP_HANDLE_EXCEPTIONS; - - return r; -} - -weak_alias (__scalbnl, scalbnl) diff --git a/soft-fp/sysdeps/sparc/sparc64/sfp-machine.h b/soft-fp/sysdeps/sparc/sparc64/sfp-machine.h deleted file mode 100644 index 4703dd070e..0000000000 --- a/soft-fp/sysdeps/sparc/sparc64/sfp-machine.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Machine-dependent software floating-point definitions. - Sparc64 userland (_Q_* and _Qp_*) version. - Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Richard Henderson (rth@cygnus.com), - Jakub Jelinek (jj@ultra.linux.cz) and - David S. Miller (davem@redhat.com). - - 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 -#include - -#define _FP_W_TYPE_SIZE 64 -#define _FP_W_TYPE unsigned long -#define _FP_WS_TYPE signed long -#define _FP_I_TYPE long - -/* Helper macros for _FP_MUL_MEAT_2_120_240_double. */ -#define _FP_MUL_MEAT_SET_FE_TZ \ -do { \ - static fpu_control_t _fetz = _FPU_RC_DOWN; \ - _FPU_SETCW(_fetz); \ -} while (0) -#ifndef _FP_MUL_MEAT_RESET_FE -#define _FP_MUL_MEAT_RESET_FE _FPU_SETCW(_fcw) -#endif - -#define _FP_MUL_MEAT_S(R,X,Y) \ - _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) -#define _FP_MUL_MEAT_D(R,X,Y) \ - _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) -#define _FP_MUL_MEAT_Q(R,X,Y) \ - _FP_MUL_MEAT_2_120_240_double(_FP_WFRACBITS_Q,R,X,Y, \ - _FP_MUL_MEAT_SET_FE_TZ, \ - _FP_MUL_MEAT_RESET_FE) - -#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) -#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) -#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) - -#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) -#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) -#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 -#define _FP_NANSIGN_S 0 -#define _FP_NANSIGN_D 0 -#define _FP_NANSIGN_Q 0 - -#define _FP_KEEPNANFRACP 1 - -/* If one NaN is signaling and the other is not, - * we choose that one, otherwise we choose Y. - */ -#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ - do { \ - if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ - && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ - { \ - R##_s = X##_s; \ - _FP_FRAC_COPY_##wc(R,X); \ - } \ - else \ - { \ - R##_s = Y##_s; \ - _FP_FRAC_COPY_##wc(R,Y); \ - } \ - R##_c = FP_CLS_NAN; \ - } while (0) - -/* Obtain the current rounding mode. */ -#ifndef FP_ROUNDMODE -#define FP_ROUNDMODE ((_fcw >> 30) & 0x3) -#endif - -/* Exception flags. */ -#define FP_EX_INVALID (1 << 4) -#define FP_EX_OVERFLOW (1 << 3) -#define FP_EX_UNDERFLOW (1 << 2) -#define FP_EX_DIVZERO (1 << 1) -#define FP_EX_INEXACT (1 << 0) - -#define _FP_DECL_EX fpu_control_t _fcw - -#define FP_INIT_ROUNDMODE \ -do { \ - _FPU_GETCW(_fcw); \ -} while (0) - -#define FP_INHIBIT_RESULTS ((_fcw >> 23) & _fex) - -/* Simulate exceptions using double arithmetics. */ -extern double __Qp_handle_exceptions(int exc); - -#define FP_HANDLE_EXCEPTIONS \ -do { \ - if (!_fex) \ - { \ - /* This is the common case, so we do it inline. \ - * We need to clear cexc bits if any. \ - */ \ - __asm__ __volatile__(" - fzero %%f62 - faddd %%f62, %%f62, %%f62 - " : : : "f62"); \ - } \ - else \ - { \ - __Qp_handle_exceptions (_fex); \ - } \ -} while (0) - -#define QP_HANDLE_EXCEPTIONS(_a) \ -do { \ - if ((_fcw >> 23) & _fex) \ - { \ - _a; \ - } \ - else \ - { \ - _fcw = (_fcw & ~0x1fL) | (_fex << 5) | _fex; \ - _FPU_SETCW(_fcw); \ - } \ -} while (0) - -#define QP_NO_EXCEPTIONS \ - __asm ("fzero %%f62 - faddd %%f62, %%f62, %%f62" : : : "f62") - -#define QP_CLOBBER "memory", "f52", "f54", "f56", "f58", "f60", "f62" -#define QP_CLOBBER_CC QP_CLOBBER , "cc" diff --git a/sysdeps/alpha/soft-fp/sfp-machine.h b/sysdeps/alpha/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..73b934ddce --- /dev/null +++ b/sysdeps/alpha/soft-fp/sfp-machine.h @@ -0,0 +1,35 @@ +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _alpha_mul_64_128(rhi, rlo, x, y) \ + __asm__("umulh %2,%3,%0; mulq %2,%3,%1" \ + : "=&r"(rhi), "=r"(rlo) : "r"(x), "r"(y)) + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,_alpha_mul_64_128) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,_alpha_mul_64_128) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S _FP_QNANBIT_S +#define _FP_NANFRAC_D _FP_QNANBIT_D +#define _FP_NANFRAC_Q _FP_QNANBIT_Q, 0 +/* FIXME: This is just a wild guess */ +#define _FP_NANSIGN_S 1 +#define _FP_NANSIGN_D 1 +#define _FP_NANSIGN_Q 1 + +#define _FP_KEEPNANFRACP 1 +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + R##_c = FP_CLS_NAN; \ + } while (0) diff --git a/sysdeps/i386/soft-fp/sfp-machine.h b/sysdeps/i386/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..047452b905 --- /dev/null +++ b/sysdeps/i386/soft-fp/sfp-machine.h @@ -0,0 +1,87 @@ +#define _FP_W_TYPE_SIZE 32 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define __FP_FRAC_ADD_2(rh, rl, xh, xl, yh, yl) \ + __asm__("addl %5,%1; adcl %3,%0" \ + : "=r"(rh), "=r"(rl) \ + : "%0"(xh), "g"(yh), "%1"(xl), "g"(yl) \ + : "cc") + +#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + do { \ + __asm__ volatile("addl %5,%1; adcl %3,%0" \ + : "=r"(r1), "=r"(r0) \ + : "%0"(x1), "g"(y1), "%1"(x0), "g"(y0) \ + : "cc"); \ + __asm__ volatile("adcl %5,%1; adcl %3,%0" \ + : "=r"(r3), "=r"(r2) \ + : "%0"(x3), "g"(y3), "%1"(x2), "g"(y2) \ + : "cc"); \ + } while (0) + +#define __FP_FRAC_SUB_2(rh, rl, xh, xl, yh, yl) \ + __asm__("subl %5,%1; sbbl %4,%0" \ + : "=r"(rh), "=r"(rl) \ + : "0"(xh), "1"(xl), "g"(yh), "g"(yl) \ + : "cc") + +#define __FP_CLZ(r, x) \ + do { \ + __asm__("bsrl %1,%0" : "=r"(r) : "g"(x) : "cc"); \ + r ^= 31; \ + } while (0) + +#define _i386_mul_32_64(rh, rl, x, y) \ + __asm__("mull %2" : "=d"(rh), "=a"(rl) : "%g"(x), "1"(y) : "cc") + +#define _i386_div_64_32(q, r, nh, nl, d) \ + __asm__ ("divl %4" : "=a"(q), "=d"(r) : "0"(nl), "1"(nh), "g"(d) : "cc") + + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,_i386_mul_32_64) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,_i386_mul_32_64) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) + +#define _FP_NANFRAC_S _FP_QNANBIT_S +#define _FP_NANFRAC_D _FP_QNANBIT_D, 0 +#define _FP_NANSIGN_S 1 +#define _FP_NANSIGN_D 1 + +#define _FP_KEEPNANFRACP 1 +/* Here is something Intel misdesigned: the specs don't define + the case where we have two NaNs with same mantissas, but + different sign. Different operations pick up different NaNs. + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if (_FP_FRAC_GT_##wc(X, Y) \ + || (_FP_FRAC_EQ_##wc(X,Y) && (OP == '+' || OP == '*'))) \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + else \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +#define FP_EX_INVALID (1 << 0) +#define FP_EX_DENORM (1 << 1) +#define FP_EX_DIVZERO (1 << 2) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 4) +#define FP_EX_INEXACT (1 << 5) + +#define FP_RND_NEAREST 0 +#define FP_RND_ZERO 3 +#define FP_RND_PINF 2 +#define FP_RND_MINF 1 diff --git a/sysdeps/mips/mips64/soft-fp/sfp-machine.h b/sysdeps/mips/mips64/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..730deae872 --- /dev/null +++ b/sysdeps/mips/mips64/soft-fp/sfp-machine.h @@ -0,0 +1,47 @@ +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_2_wide_3mul(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 +/* From my experiments it seems X is chosen unless one of the + NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(X) | \ + _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \ + { \ + R##_s = _FP_NANSIGN_##fs; \ + _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \ + } \ + else \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +#define FP_EX_INVALID (1 << 4) +#define FP_EX_DIVZERO (1 << 3) +#define FP_EX_OVERFLOW (1 << 2) +#define FP_EX_UNDERFLOW (1 << 1) +#define FP_EX_INEXACT (1 << 0) diff --git a/sysdeps/mips/soft-fp/sfp-machine.h b/sysdeps/mips/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..3b2a40f0e2 --- /dev/null +++ b/sysdeps/mips/soft-fp/sfp-machine.h @@ -0,0 +1,47 @@ +#define _FP_W_TYPE_SIZE 32 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(S,R,X,Y) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 +/* From my experiments it seems X is chosen unless one of the + NaNs is sNaN, in which case the result is NANSIGN/NANFRAC. */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(X) | \ + _FP_FRAC_HIGH_RAW_##fs(Y)) & _FP_QNANBIT_##fs) \ + { \ + R##_s = _FP_NANSIGN_##fs; \ + _FP_FRAC_SET_##wc(R,_FP_NANFRAC_##fs); \ + } \ + else \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +#define FP_EX_INVALID (1 << 4) +#define FP_EX_DIVZERO (1 << 3) +#define FP_EX_OVERFLOW (1 << 2) +#define FP_EX_UNDERFLOW (1 << 1) +#define FP_EX_INEXACT (1 << 0) diff --git a/sysdeps/powerpc/soft-fp/sfp-machine.h b/sysdeps/powerpc/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..6d68f01ca3 --- /dev/null +++ b/sysdeps/powerpc/soft-fp/sfp-machine.h @@ -0,0 +1,48 @@ +#define _FP_W_TYPE_SIZE 32 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 + +/* Someone please check this. */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ + && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + else \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +/* Exception flags. */ +#define FP_EX_INVALID (1 << 4) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 2) +#define FP_EX_DIVZERO (1 << 1) +#define FP_EX_INEXACT (1 << 0) diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtod.c b/sysdeps/sparc/sparc32/soft-fp/q_qtod.c new file mode 100644 index 0000000000..92874502ea --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_qtod.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Return (double)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "double.h" +#include "quad.h" + +double _Q_qtod(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + FP_DECL_D(R); + double r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(D,Q,2,4,R,A); +#else + FP_CONV(D,Q,1,2,R,A); +#endif + FP_PACK_D(r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c new file mode 100644 index 0000000000..b472364cdb --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoi.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return (int)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +int _Q_qtoi(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + int r; + + FP_UNPACK_Q(A, a); + FP_TO_INT_Q(r, A, 32, 1); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtos.c b/sysdeps/sparc/sparc32/soft-fp/q_qtos.c new file mode 100644 index 0000000000..b0945cb318 --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_qtos.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + Return (float)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "single.h" +#include "quad.h" + +float _Q_qtos(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + FP_DECL_S(R); + float r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(S,Q,1,4,R,A); +#else + FP_CONV(S,Q,1,2,R,A); +#endif + FP_PACK_S(r, R); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c new file mode 100644 index 0000000000..c2de37f15e --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoui.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return (unsigned int)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +unsigned int _Q_qtoui(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + unsigned int r; + + FP_UNPACK_Q(A, a); + FP_TO_INT_Q(r, A, 32, -1); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c b/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c new file mode 100644 index 0000000000..ff1e1a9edb --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_qtoux.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return (unsigned long)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +unsigned long long _Q_qtoux(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + unsigned long long r; + + FP_UNPACK_Q(A, a); + FP_TO_INT_Q(r, A, 64, -1); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_qtox.c b/sysdeps/sparc/sparc32/soft-fp/q_qtox.c new file mode 100644 index 0000000000..ba591606dc --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_qtox.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return (long)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +long long _Q_qtox(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + long long r; + + FP_UNPACK_Q(A, a); + FP_TO_INT_Q(r, A, 64, 1); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c new file mode 100644 index 0000000000..2f759284a0 --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_sqrt.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return sqrtl(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +long double _Q_sqrt(const long double a) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(C); + long double c; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); + FP_SQRT_Q(C, A); + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_stoq.c b/sysdeps/sparc/sparc32/soft-fp/q_stoq.c new file mode 100644 index 0000000000..ad5153da3c --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_stoq.c @@ -0,0 +1,43 @@ +/* Software floating-point emulation. + c = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "single.h" +#include "quad.h" + +long double _Q_stoq(const float a) +{ + FP_DECL_EX; + FP_DECL_S(A); + FP_DECL_Q(C); + long double c; + + FP_UNPACK_S(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(Q,S,4,1,C,A); +#else + FP_CONV(Q,S,2,1,C,A); +#endif + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_sub.c b/sysdeps/sparc/sparc32/soft-fp/q_sub.c new file mode 100644 index 0000000000..2cfd49d26a --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_sub.c @@ -0,0 +1,39 @@ +/* Software floating-point emulation. + c = a - b + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +long double _Q_sub(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + long double c; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); + FP_UNPACK_Q(B, b); + FP_SUB_Q(C, A, B); + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c b/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c new file mode 100644 index 0000000000..8a3c664f1d --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_uitoq.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + c = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +long double _Q_uitoq(const unsigned int a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + long double c; + unsigned int b = a; + + FP_FROM_INT_Q(C, b, 32, int); + FP_PACK_Q(c, C); + FP_CLEAR_EXCEPTIONS; + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_util.c b/sysdeps/sparc/sparc32/soft-fp/q_util.c new file mode 100644 index 0000000000..df4d16c019 --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_util.c @@ -0,0 +1,57 @@ +/* Software floating-point emulation. + Helper routine for _Q_* routines. + Simulate exceptions using double arithmetics. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" + +unsigned long long ___Q_numbers [] = { +0x0000000000000000ULL, /* Zero */ +0x0010100000000000ULL, /* Very tiny number */ +0x0010000000000000ULL, /* Minimum normalized number */ +0x7fef000000000000ULL, /* A huge double number */ +}; + +double ___Q_simulate_exceptions(int exceptions) +{ + double d, *p = (double *)___Q_numbers; + if (exceptions & FP_EX_INVALID) + d = p[0]/p[0]; + if (exceptions & FP_EX_OVERFLOW) + { + d = p[3] + p[3]; + exceptions &= ~FP_EX_INEXACT; + } + if (exceptions & FP_EX_UNDERFLOW) + { + if (exceptions & FP_EX_INEXACT) + { + d = p[2] * p[2]; + exceptions &= ~FP_EX_INEXACT; + } + else + d = p[1] - p[2]; + } + if (exceptions & FP_EX_DIVZERO) + d = 1.0/p[0]; + if (exceptions & FP_EX_INEXACT) + d = p[3] - p[2]; + return d; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c new file mode 100644 index 0000000000..ee68ca2563 --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_uxtoq.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +long double _Q_uxtoq(const unsigned long long a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + long double c; + unsigned long long b = a; + + FP_FROM_INT_Q(C, b, 64, long long); + FP_PACK_Q(c, C); + FP_CLEAR_EXCEPTIONS; + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c b/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c new file mode 100644 index 0000000000..3dd70b9329 --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/q_xtoq.c @@ -0,0 +1,38 @@ +/* Software floating-point emulation. + Return (long double)a + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +long double _Q_xtoq(const long long a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + long double c; + long long b = a; + + FP_FROM_INT_Q(C, b, 64, long long); + FP_PACK_Q(c, C); + FP_CLEAR_EXCEPTIONS; + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..d3713b96d7 --- /dev/null +++ b/sysdeps/sparc/sparc32/soft-fp/sfp-machine.h @@ -0,0 +1,221 @@ +/* Machine-dependent software floating-point definitions. + Sparc userland (_Q_*) version. + Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com), + Jakub Jelinek (jj@ultra.linux.cz) and + David S. Miller (davem@redhat.com). + + 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 + +#define _FP_W_TYPE_SIZE 32 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_S,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_4_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_udiv(S,R,X,Y) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_2_udiv(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_4_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1), -1 +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1, -1, -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 + +/* If one NaN is signaling and the other is not, + * we choose that one, otherwise we choose X. + */ +/* For _Qp_* and _Q_*, this should prefer X, for + * CPU instruction emulation this should prefer Y. + * (see SPAMv9 B.2.2 section). + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs) \ + && !(_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs)) \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + else \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +/* Some assembly to speed things up. */ +#define __FP_FRAC_ADD_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ + __asm__ ("addcc %r7,%8,%2 + addxcc %r5,%6,%1 + addx %r3,%4,%0" \ + : "=r" ((USItype)(r2)), \ + "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc") + +#define __FP_FRAC_SUB_3(r2,r1,r0,x2,x1,x0,y2,y1,y0) \ + __asm__ ("subcc %r7,%8,%2 + subxcc %r5,%6,%1 + subx %r3,%4,%0" \ + : "=r" ((USItype)(r2)), \ + "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc") + +#define __FP_FRAC_ADD_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + do { \ + /* We need to fool gcc, as we need to pass more than 10 \ + input/outputs. */ \ + register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ + __asm__ __volatile__ (" + addcc %r8,%9,%1 + addxcc %r6,%7,%0 + addxcc %r4,%5,%%g2 + addx %r2,%3,%%g1" \ + : "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x3)), \ + "rI" ((USItype)(y3)), \ + "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc", "g1", "g2"); \ + __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ + r3 = _t1; r2 = _t2; \ + } while (0) + +#define __FP_FRAC_SUB_4(r3,r2,r1,r0,x3,x2,x1,x0,y3,y2,y1,y0) \ + do { \ + /* We need to fool gcc, as we need to pass more than 10 \ + input/outputs. */ \ + register USItype _t1 __asm__ ("g1"), _t2 __asm__ ("g2"); \ + __asm__ __volatile__ (" + subcc %r8,%9,%1 + subxcc %r6,%7,%0 + subxcc %r4,%5,%%g2 + subx %r2,%3,%%g1" \ + : "=&r" ((USItype)(r1)), \ + "=&r" ((USItype)(r0)) \ + : "%rJ" ((USItype)(x3)), \ + "rI" ((USItype)(y3)), \ + "%rJ" ((USItype)(x2)), \ + "rI" ((USItype)(y2)), \ + "%rJ" ((USItype)(x1)), \ + "rI" ((USItype)(y1)), \ + "%rJ" ((USItype)(x0)), \ + "rI" ((USItype)(y0)) \ + : "cc", "g1", "g2"); \ + __asm__ __volatile__ ("" : "=r" (_t1), "=r" (_t2)); \ + r3 = _t1; r2 = _t2; \ + } while (0) + +#define __FP_FRAC_DEC_3(x2,x1,x0,y2,y1,y0) __FP_FRAC_SUB_3(x2,x1,x0,x2,x1,x0,y2,y1,y0) + +#define __FP_FRAC_DEC_4(x3,x2,x1,x0,y3,y2,y1,y0) __FP_FRAC_SUB_4(x3,x2,x1,x0,x3,x2,x1,x0,y3,y2,y1,y0) + +#define __FP_FRAC_ADDI_4(x3,x2,x1,x0,i) \ + __asm__ ("addcc %3,%4,%3 + addxcc %2,%%g0,%2 + addxcc %1,%%g0,%1 + addx %0,%%g0,%0" \ + : "=&r" ((USItype)(x3)), \ + "=&r" ((USItype)(x2)), \ + "=&r" ((USItype)(x1)), \ + "=&r" ((USItype)(x0)) \ + : "rI" ((USItype)(i)), \ + "0" ((USItype)(x3)), \ + "1" ((USItype)(x2)), \ + "2" ((USItype)(x1)), \ + "3" ((USItype)(x0)) \ + : "cc") + +/* Obtain the current rounding mode. */ +#ifndef FP_ROUNDMODE +#define FP_ROUNDMODE ((_fcw >> 30) & 0x3) +#endif + +/* Exception flags. */ +#define FP_EX_INVALID (1 << 4) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 2) +#define FP_EX_DIVZERO (1 << 1) +#define FP_EX_INEXACT (1 << 0) + +#define _FP_DECL_EX fpu_control_t _fcw + +#define FP_INIT_ROUNDMODE \ +do { \ + _FPU_GETCW(_fcw); \ +} while (0) + +/* Simulate exceptions using double arithmetics. */ +extern double ___Q_simulate_exceptions(int exc); + +#define FP_HANDLE_EXCEPTIONS \ +do { \ + if (!_fex) \ + { \ + /* This is the common case, so we do it inline. \ + * We need to clear cexc bits if any. \ + */ \ + extern unsigned long long ___Q_numbers[]; \ + __asm__ __volatile__(" + ldd [%0], %%f30 + faddd %%f30, %%f30, %%f30 + " : : "r" (___Q_numbers) : "f30"); \ + } \ + else \ + { \ + __asm__ __volatile__(" + mov %0, %%o0 + mov %%o7, %%g1 + call ___Q_simulate_exceptions + mov %%g1, %%o7 + " : : "r" (_fex) : \ + "g1", "g2", "g3", "g4", "g5", "o0", \ + "o1", "o2", "o3", "o4", "o5", "cc"); \ + } \ +} while (0) diff --git a/sysdeps/sparc/sparc64/soft-fp/Versions b/sysdeps/sparc/sparc64/soft-fp/Versions new file mode 100644 index 0000000000..599708ae80 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/Versions @@ -0,0 +1,7 @@ +libc { + GLIBC_2.1.1 { + _Qp_add; _Qp_cmp; _Qp_cmpe; _Qp_div; _Qp_dtoq; _Qp_feq; _Qp_fge; _Qp_fgt; + _Qp_fle; _Qp_flt; _Qp_fne; _Qp_itoq; _Qp_mul; _Qp_neg; _Qp_qtod; _Qp_qtoi; + _Qp_qtos; _Qp_qtoui; _Qp_qtoux; _Qp_qtox; _Qp_sqrt; _Qp_stoq; _Qp_sub; + _Qp_uitoq; _Qp_uxtoq; _Qp_xtoq; __Qp_handle_exceptions; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_add.c b/sysdeps/sparc/sparc64/soft-fp/qp_add.c new file mode 100644 index 0000000000..b77f4d49c6 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_add.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + (*c) = (*a) + (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_add(long double *c, const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_UNPACK_QP(B, b); + FP_ADD_Q(C, A, B); + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + ldd [%2], %%f56 + ldd [%2+8], %%f58 + faddq %%f52, %%f56, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_cmp.c b/sysdeps/sparc/sparc64/soft-fp/qp_cmp.c new file mode 100644 index 0000000000..739fb5e910 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_cmp.c @@ -0,0 +1,51 @@ +/* Software floating-point emulation. + Compare (*a) and (*b), return float condition code. + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_cmp(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == -1) r = 2; + if (r == 3 && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) + FP_SET_EXCEPTION(FP_EX_INVALID); + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c b/sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c new file mode 100644 index 0000000000..d881f904df --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c @@ -0,0 +1,52 @@ +/* Software floating-point emulation. + Compare (*a) and (*b), return float condition code. + Signal exception (unless masked) if unordered. + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_cmpe(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == -1) r = 2; + if (r == 3) + FP_SET_EXCEPTION(FP_EX_INVALID); + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpeq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_div.c b/sysdeps/sparc/sparc64/soft-fp/qp_div.c new file mode 100644 index 0000000000..c79ac1b392 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_div.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + (*c) = (*a) / (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_div(long double *c, const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_UNPACK_QP(B, b); + FP_DIV_Q(C, A, B); + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + ldd [%2], %%f56 + ldd [%2+8], %%f58 + fdivq %%f52, %%f56, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c new file mode 100644 index 0000000000..079b6d08d5 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c @@ -0,0 +1,46 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "double.h" +#include "quad.h" + +void _Qp_dtoq(long double *c, const double a) +{ + FP_DECL_EX; + FP_DECL_D(A); + FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_D(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(Q,D,4,2,C,A); +#else + FP_CONV(Q,D,2,1,C,A); +#endif + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( + "fdtoq %1, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "e" (a) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_feq.c b/sysdeps/sparc/sparc64/soft-fp/qp_feq.c new file mode 100644 index 0000000000..1d32ec6fe7 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_feq.c @@ -0,0 +1,51 @@ +/* Software floating-point emulation. + Return 1 if (*a) == (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_feq(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_EQ_Q(r, A, B); + if (r && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) + FP_SET_EXCEPTION(FP_EX_INVALID); + + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return !r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_fge.c b/sysdeps/sparc/sparc64/soft-fp/qp_fge.c new file mode 100644 index 0000000000..6d73745cdb --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_fge.c @@ -0,0 +1,51 @@ +/* Software floating-point emulation. + Return 1 if (*a) >= (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_fge(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == 3) + FP_SET_EXCEPTION(FP_EX_INVALID); + + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpeq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 1)); + + return (r <= 0); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_fgt.c b/sysdeps/sparc/sparc64/soft-fp/qp_fgt.c new file mode 100644 index 0000000000..e389fd9d41 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_fgt.c @@ -0,0 +1,51 @@ +/* Software floating-point emulation. + Return 1 if (*a) > (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_fgt(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == 3) + FP_SET_EXCEPTION(FP_EX_INVALID); + + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpeq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3) - 3); + + return (r == -1); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_fle.c b/sysdeps/sparc/sparc64/soft-fp/qp_fle.c new file mode 100644 index 0000000000..2afe2af86f --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_fle.c @@ -0,0 +1,51 @@ +/* Software floating-point emulation. + Return 1 if (*a) <= (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_fle(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_Q(r, B, A, -2); + if (r == -2) + FP_SET_EXCEPTION(FP_EX_INVALID); + + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpeq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 2) ? -1 : 0); + + return (r >= 0); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_flt.c b/sysdeps/sparc/sparc64/soft-fp/qp_flt.c new file mode 100644 index 0000000000..42c8659301 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_flt.c @@ -0,0 +1,51 @@ +/* Software floating-point emulation. + Return 1 if (*a) < (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_flt(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == 3) + FP_SET_EXCEPTION(FP_EX_INVALID); + + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpeq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return (r == 1); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_fne.c b/sysdeps/sparc/sparc64/soft-fp/qp_fne.c new file mode 100644 index 0000000000..bcc1ec2ee7 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_fne.c @@ -0,0 +1,52 @@ +/* Software floating-point emulation. + Return 1 if (*a) != (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +int _Qp_fne(const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_UNPACK_RAW_QP(B, b); + FP_CMP_EQ_Q(r, A, B); + if (r && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) + FP_SET_EXCEPTION(FP_EX_INVALID); + + QP_HANDLE_EXCEPTIONS( + __asm ( + "ldd [%0], %%f52 + ldd [%0+8], %%f54 + ldd [%1], %%f56 + ldd [%1+8], %%f58 + fcmpq %%fcc3, %%f52, %%f56 + " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3) != 0); + + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c new file mode 100644 index 0000000000..b1b80ac8a0 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c @@ -0,0 +1,35 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_itoq(long double *c, const int a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + int b = a; + + FP_FROM_INT_Q(C, b, 32, int); + FP_PACK_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_mul.c b/sysdeps/sparc/sparc64/soft-fp/qp_mul.c new file mode 100644 index 0000000000..9dbc06b989 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_mul.c @@ -0,0 +1,50 @@ +/* Software floating-point emulation. + (*c) = (*a) * (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +/* As QP_HANDLE_EXCEPTIONS reloads FPU control word anyway, + avoid doing it twice. */ +#define _FP_MUL_MEAT_RESET_FE do {} while (0) +#include "soft-fp.h" +#include "quad.h" + +void _Qp_mul(long double *c, const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_UNPACK_QP(B, b); + FP_MUL_Q(C, A, B); + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS( + _FPU_SETCW(_fcw); + __asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + ldd [%2], %%f56 + ldd [%2+8], %%f58 + fmulq %%f52, %%f56, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c new file mode 100644 index 0000000000..50c44026e1 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c @@ -0,0 +1,49 @@ +/* Software floating-point emulation. + Return (double)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "double.h" +#include "quad.h" + +double _Qp_qtod(const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + FP_DECL_D(R); + double r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(D,Q,2,4,R,A); +#else + FP_CONV(D,Q,1,2,R,A); +#endif + FP_PACK_D(r, R); + QP_HANDLE_EXCEPTIONS(__asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fqtod %%f52, %0 + " : "=&e" (r) : "r" (a) : QP_CLOBBER)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c new file mode 100644 index 0000000000..770c887653 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c @@ -0,0 +1,47 @@ +/* Software floating-point emulation. + Return (int)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +int _Qp_qtoi(const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_TO_INT_Q(r, A, 32, 1); + QP_HANDLE_EXCEPTIONS( + int rx; + __asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fqtoi %%f52, %%f60 + st %%f60, [%0] + " : : "r" (&rx), "r" (a) : QP_CLOBBER); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c new file mode 100644 index 0000000000..630300ea44 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c @@ -0,0 +1,50 @@ +/* Software floating-point emulation. + Return (float)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "single.h" +#include "quad.h" + +float _Qp_qtos(const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + FP_DECL_S(R); + float r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(S,Q,1,4,R,A); +#else + FP_CONV(S,Q,1,2,R,A); +#endif + FP_PACK_S(r, R); + + QP_HANDLE_EXCEPTIONS(__asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fqtos %%f52, %0 + " : "=&f" (r) : "r" (a) : QP_CLOBBER)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c new file mode 100644 index 0000000000..011cf73114 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c @@ -0,0 +1,47 @@ +/* Software floating-point emulation. + Return (unsigned int)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +unsigned int _Qp_qtoui(const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + unsigned int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_TO_INT_Q(r, A, 32, -1); + QP_HANDLE_EXCEPTIONS( + int rx; + __asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fqtoi %%f52, %%f60 + st %%f60, [%0] + " : : "r" (&rx), "r" (a) : QP_CLOBBER); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c new file mode 100644 index 0000000000..f2a393a8e7 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c @@ -0,0 +1,47 @@ +/* Software floating-point emulation. + Return (unsigned long)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +unsigned long _Qp_qtoux(const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + unsigned long r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_TO_INT_Q(r, A, 64, -1); + QP_HANDLE_EXCEPTIONS( + unsigned long rx; + __asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fqtoi %%f52, %%f60 + std %%f60, [%0] + " : : "r" (&rx), "r" (a) : QP_CLOBBER); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c new file mode 100644 index 0000000000..a54c5c5833 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c @@ -0,0 +1,47 @@ +/* Software floating-point emulation. + Return (long)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +#define FP_ROUNDMODE FP_RND_ZERO +#include "soft-fp.h" +#include "quad.h" + +long _Qp_qtox(const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); + long r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_TO_INT_Q(r, A, 64, 1); + QP_HANDLE_EXCEPTIONS( + long rx; + __asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fqtoi %%f52, %%f60 + std %%f60, [%0] + " : : "r" (&rx), "r" (a) : QP_CLOBBER); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c b/sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c new file mode 100644 index 0000000000..00e3980286 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c @@ -0,0 +1,42 @@ +/* Software floating-point emulation. + (*c) = sqrtl(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_sqrt(long double *c, const long double *a) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_SQRT_Q(C, A); + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + fsqrtq %%f52, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "r" (a) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c new file mode 100644 index 0000000000..ab0f49a0ca --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c @@ -0,0 +1,46 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "single.h" +#include "quad.h" + +void _Qp_stoq(long double *c, const float a) +{ + FP_DECL_EX; + FP_DECL_S(A); + FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_S(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(Q,S,4,1,C,A); +#else + FP_CONV(Q,S,2,1,C,A); +#endif + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( + "fstoq %1, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "f" (a) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_sub.c b/sysdeps/sparc/sparc64/soft-fp/qp_sub.c new file mode 100644 index 0000000000..9532f7b817 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_sub.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + (*c) = (*a) - (*b) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_sub(long double *c, const long double *a, const long double *b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + + FP_INIT_ROUNDMODE; + FP_UNPACK_QP(A, a); + FP_UNPACK_QP(B, b); + FP_SUB_Q(C, A, B); + FP_PACK_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( + "ldd [%1], %%f52 + ldd [%1+8], %%f54 + ldd [%2], %%f56 + ldd [%2+8], %%f58 + fsubq %%f52, %%f56, %%f60 + std %%f60, [%0] + std %%f62, [%0+8] + " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c new file mode 100644 index 0000000000..e35f0c688e --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c @@ -0,0 +1,35 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_uitoq(long double *c, const unsigned int a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + unsigned int b = a; + + FP_FROM_INT_Q(C, b, 32, int); + FP_PACK_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_util.c b/sysdeps/sparc/sparc64/soft-fp/qp_util.c new file mode 100644 index 0000000000..3009b2212a --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_util.c @@ -0,0 +1,57 @@ +/* Software floating-point emulation. + Helper routine for _Qp_* routines. + Simulate exceptions using double arithmetics. + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" + +static unsigned long numbers [] = { +0x7fef000000000000UL, /* A huge double number */ +0x0010100000000000UL, /* Very tiny number */ +0x0010000000000000UL, /* Minimum normalized number */ +0x0000000000000000UL, /* Zero */ +}; + +double __Qp_handle_exceptions(int exceptions) +{ + double d, *p = (double *)numbers; + if (exceptions & FP_EX_INVALID) + d = p[3]/p[3]; + if (exceptions & FP_EX_OVERFLOW) + { + d = p[0] + p[0]; + exceptions &= ~FP_EX_INEXACT; + } + if (exceptions & FP_EX_UNDERFLOW) + { + if (exceptions & FP_EX_INEXACT) + { + d = p[2] * p[2]; + exceptions &= ~FP_EX_INEXACT; + } + else + d = p[1] - p[2]; + } + if (exceptions & FP_EX_DIVZERO) + d = 1.0/p[3]; + if (exceptions & FP_EX_INEXACT) + d = p[0] - p[2]; + return d; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c new file mode 100644 index 0000000000..d7442cfa71 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c @@ -0,0 +1,35 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_uxtoq(long double *c, const unsigned long a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + unsigned long b = a; + + FP_FROM_INT_Q(C, b, 64, long); + FP_PACK_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c new file mode 100644 index 0000000000..06cfa9adc7 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c @@ -0,0 +1,35 @@ +/* Software floating-point emulation. + (*c) = (long double)(*a) + Copyright (C) 1997,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + 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 "soft-fp.h" +#include "quad.h" + +void _Qp_xtoq(long double *c, const long a) +{ + FP_DECL_EX; + FP_DECL_Q(C); + long b = a; + + FP_FROM_INT_Q(C, b, 64, long); + FP_PACK_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/soft-fp/s_frexpl.c b/sysdeps/sparc/sparc64/soft-fp/s_frexpl.c new file mode 100644 index 0000000000..a307a7e113 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/s_frexpl.c @@ -0,0 +1,52 @@ +/* Software floating-point emulation. + frexpl(x, exp) + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +/* + * for non-zero x + * x = frexpl(arg,&exp); + * return a long double fp quantity x such that 0.5 <= |x| <1.0 + * and the corresponding binary exponent "exp". That is + * arg = x*2^exp. + * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg + * with *exp=0. + */ + +#include "soft-fp.h" +#include "quad.h" + +long double __frexpl(long double arg, int *exp) +{ + FP_DECL_EX; + FP_DECL_Q(A); + long double r; + + *exp = 0; + FP_UNPACK_Q(A, arg); + if (A_c != FP_CLS_NORMAL) + return arg; + *exp = A_e + 1; + A_e = -1; + FP_PACK_Q(r, A); + + return r; +} + +weak_alias (__frexpl, frexpl) diff --git a/sysdeps/sparc/sparc64/soft-fp/s_ilogbl.c b/sysdeps/sparc/sparc64/soft-fp/s_ilogbl.c new file mode 100644 index 0000000000..d3b1a51dbf --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/s_ilogbl.c @@ -0,0 +1,82 @@ +/* Software floating-point emulation. + ilogbl(x, exp) + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +/* ilogbl(long double x) + * return the binary exponent of non-zero x + * ilogbl(0) = 0x80000001 + * ilogbl(inf/NaN) = 0x7fffffff (no signal is raised) + */ + +#include "soft-fp.h" +#include "quad.h" +#include + +int __ilogbl(long double x) +{ + FP_DECL_EX; + FP_DECL_Q(X); + +/* + FP_UNPACK_Q(X, x); + switch (X_c) + { + case FP_CLS_ZERO: + return FP_ILOGB0; + case FP_CLS_NAN: + case FP_CLS_INF: + return FP_ILOGBNAN; + default: + return X_e; + } + */ + FP_UNPACK_RAW_Q(X, x); + switch (X_e) + { + default: + return X_e - _FP_EXPBIAS_Q; + case 0: +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + if (_FP_FRAC_ZEROP_4(X)) + return FP_ILOGB0; + else + { + _FP_I_TYPE shift; + _FP_FRAC_CLZ_4(shift, X); + shift -= _FP_FRACXBITS_Q; + return X_e - _FP_EXPBIAS_Q - 1 + shift; + } +#else + if (_FP_FRAC_ZEROP_2(X)) + return FP_ILOGB0; + else + { + _FP_I_TYPE shift; + _FP_FRAC_CLZ_2(shift, X); + shift -= _FP_FRACXBITS_Q; + return X_e - _FP_EXPBIAS_Q - 1 + shift; + } +#endif + case _FP_EXPBIAS_Q: + return FP_ILOGBNAN; + } +} + +weak_alias (__ilogbl, ilogbl) diff --git a/sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c b/sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c new file mode 100644 index 0000000000..5568cfdab2 --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/s_scalblnl.c @@ -0,0 +1,55 @@ +/* Software floating-point emulation. + scalblnl(x, exp) + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +/* + * scalblnl (long double x, long int n) + * scalblnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "soft-fp.h" +#include "quad.h" + +long double __scalblnl(long double arg, int exp) +{ + FP_DECL_EX; + FP_DECL_Q(A); + long double r; + + FP_UNPACK_Q(A, arg); + switch (A_c) + { + case FP_CLS_ZERO: + return arg; + case FP_CLS_NAN: + case FP_CLS_INF: + FP_HANDLE_EXCEPTIONS; + return arg; + } + A_e += exp; + FP_PACK_Q(r, A); + FP_HANDLE_EXCEPTIONS; + + return r; +} + +weak_alias (__scalblnl, scalblnl) diff --git a/sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c b/sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c new file mode 100644 index 0000000000..fb913fdd6b --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/s_scalbnl.c @@ -0,0 +1,55 @@ +/* Software floating-point emulation. + scalbnl(x, exp) + Copyright (C) 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Jakub Jelinek (jj@ultra.linux.cz). + + 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. */ + +/* + * scalbnl (long double x, int n) + * scalbnl(x,n) returns x* 2**n computed by exponent + * manipulation rather than by actually performing an + * exponentiation or a multiplication. + */ + +#include "soft-fp.h" +#include "quad.h" + +long double __scalbnl(long double arg, int exp) +{ + FP_DECL_EX; + FP_DECL_Q(A); + long double r; + + FP_UNPACK_Q(A, arg); + switch (A_c) + { + case FP_CLS_ZERO: + return arg; + case FP_CLS_NAN: + case FP_CLS_INF: + FP_HANDLE_EXCEPTIONS; + return arg; + } + A_e += exp; + FP_PACK_Q(r, A); + FP_HANDLE_EXCEPTIONS; + + return r; +} + +weak_alias (__scalbnl, scalbnl) diff --git a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h new file mode 100644 index 0000000000..4703dd070e --- /dev/null +++ b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h @@ -0,0 +1,143 @@ +/* Machine-dependent software floating-point definitions. + Sparc64 userland (_Q_* and _Qp_*) version. + Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com), + Jakub Jelinek (jj@ultra.linux.cz) and + David S. Miller (davem@redhat.com). + + 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 +#include + +#define _FP_W_TYPE_SIZE 64 +#define _FP_W_TYPE unsigned long +#define _FP_WS_TYPE signed long +#define _FP_I_TYPE long + +/* Helper macros for _FP_MUL_MEAT_2_120_240_double. */ +#define _FP_MUL_MEAT_SET_FE_TZ \ +do { \ + static fpu_control_t _fetz = _FPU_RC_DOWN; \ + _FPU_SETCW(_fetz); \ +} while (0) +#ifndef _FP_MUL_MEAT_RESET_FE +#define _FP_MUL_MEAT_RESET_FE _FPU_SETCW(_fcw) +#endif + +#define _FP_MUL_MEAT_S(R,X,Y) \ + _FP_MUL_MEAT_1_imm(_FP_WFRACBITS_S,R,X,Y) +#define _FP_MUL_MEAT_D(R,X,Y) \ + _FP_MUL_MEAT_1_wide(_FP_WFRACBITS_D,R,X,Y,umul_ppmm) +#define _FP_MUL_MEAT_Q(R,X,Y) \ + _FP_MUL_MEAT_2_120_240_double(_FP_WFRACBITS_Q,R,X,Y, \ + _FP_MUL_MEAT_SET_FE_TZ, \ + _FP_MUL_MEAT_RESET_FE) + +#define _FP_DIV_MEAT_S(R,X,Y) _FP_DIV_MEAT_1_imm(S,R,X,Y,_FP_DIV_HELP_imm) +#define _FP_DIV_MEAT_D(R,X,Y) _FP_DIV_MEAT_1_udiv_norm(D,R,X,Y) +#define _FP_DIV_MEAT_Q(R,X,Y) _FP_DIV_MEAT_2_udiv(Q,R,X,Y) + +#define _FP_NANFRAC_S ((_FP_QNANBIT_S << 1) - 1) +#define _FP_NANFRAC_D ((_FP_QNANBIT_D << 1) - 1) +#define _FP_NANFRAC_Q ((_FP_QNANBIT_Q << 1) - 1), -1 +#define _FP_NANSIGN_S 0 +#define _FP_NANSIGN_D 0 +#define _FP_NANSIGN_Q 0 + +#define _FP_KEEPNANFRACP 1 + +/* If one NaN is signaling and the other is not, + * we choose that one, otherwise we choose Y. + */ +#define _FP_CHOOSENAN(fs, wc, R, X, Y, OP) \ + do { \ + if ((_FP_FRAC_HIGH_RAW_##fs(Y) & _FP_QNANBIT_##fs) \ + && !(_FP_FRAC_HIGH_RAW_##fs(X) & _FP_QNANBIT_##fs)) \ + { \ + R##_s = X##_s; \ + _FP_FRAC_COPY_##wc(R,X); \ + } \ + else \ + { \ + R##_s = Y##_s; \ + _FP_FRAC_COPY_##wc(R,Y); \ + } \ + R##_c = FP_CLS_NAN; \ + } while (0) + +/* Obtain the current rounding mode. */ +#ifndef FP_ROUNDMODE +#define FP_ROUNDMODE ((_fcw >> 30) & 0x3) +#endif + +/* Exception flags. */ +#define FP_EX_INVALID (1 << 4) +#define FP_EX_OVERFLOW (1 << 3) +#define FP_EX_UNDERFLOW (1 << 2) +#define FP_EX_DIVZERO (1 << 1) +#define FP_EX_INEXACT (1 << 0) + +#define _FP_DECL_EX fpu_control_t _fcw + +#define FP_INIT_ROUNDMODE \ +do { \ + _FPU_GETCW(_fcw); \ +} while (0) + +#define FP_INHIBIT_RESULTS ((_fcw >> 23) & _fex) + +/* Simulate exceptions using double arithmetics. */ +extern double __Qp_handle_exceptions(int exc); + +#define FP_HANDLE_EXCEPTIONS \ +do { \ + if (!_fex) \ + { \ + /* This is the common case, so we do it inline. \ + * We need to clear cexc bits if any. \ + */ \ + __asm__ __volatile__(" + fzero %%f62 + faddd %%f62, %%f62, %%f62 + " : : : "f62"); \ + } \ + else \ + { \ + __Qp_handle_exceptions (_fex); \ + } \ +} while (0) + +#define QP_HANDLE_EXCEPTIONS(_a) \ +do { \ + if ((_fcw >> 23) & _fex) \ + { \ + _a; \ + } \ + else \ + { \ + _fcw = (_fcw & ~0x1fL) | (_fex << 5) | _fex; \ + _FPU_SETCW(_fcw); \ + } \ +} while (0) + +#define QP_NO_EXCEPTIONS \ + __asm ("fzero %%f62 + faddd %%f62, %%f62, %%f62" : : : "f62") + +#define QP_CLOBBER "memory", "f52", "f54", "f56", "f58", "f60", "f62" +#define QP_CLOBBER_CC QP_CLOBBER , "cc" -- cgit v1.2.3