From b5453d9f7a95545f3941ad439b4fb9af3585ab83 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 25 May 2018 20:00:51 +0000 Subject: Remove sysdeps/sparc/sparc64/soft-fp directory. As per , there should not be separate sysdeps//soft-fp directories when those are used by all configurations that use sysdeps/, and, more generally, should not be sysdeps/foo/Implies files pointing to a subdirectory foo/bar. This patch eliminates the sysdeps/sparc/sparc64/soft-fp directory accordingly, merging its contents into sysdeps/sparc/sparc64. This completes removing the unnecessary /soft-fp sysdeps directories. sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c is removed rather than moved. It was not in fact used previously - the ldbl-128 version of e_ilogbl.c was used instead - and moving it into sysdeps/sparc/sparc64 results in it being used, but causing a build failure because of FP_DECL_EX declaring an unused variable (as I noted in that file doesn't appear to use FP_DECL_EX). Given that the file was previously unused and so presumably not tested recently, removing it is the safe way to avoid this patch changing what actually gets built into glibc (if this file should turn out more efficient than the ldbl-128 e_ilogbl.c, it can always be added back in future with the build failure fixed). Tested with build-many-glibcs.py that installed stripped shared libraries for sparc configurations are unchanged by this patch. * sysdeps/sparc/sparc64/Implies: Remove sparc/sparc64/soft-fp. * sysdeps/sparc/sparc64/Makefile [$(subdir) = soft-fp] (sparc64-quad-routines): New variable. Moved from .... [$(subdir) = soft-fp] (sysdep_routines): Add $(sparc64-quad-routines). Moved from .... [$(subdir) = math] (CPPFLAGS): Add -I../soft-fp/. Moved from .... * sysdeps/sparc/sparc64/soft-fp/Makefile: ... here. Remove file. * sysdeps/sparc/sparc64/Versions (libc): Add GLIBC_2.2 symbols moved from .... * sysdeps/sparc/sparc64/soft-fp/Versions: ... here. Remove file. * sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c: Remove file. * sysdeps/sparc/sparc64/soft-fp/qp_add.c: Move to .... * sysdeps/sparc/sparc64/qp_add.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_cmp.c: Move to .... * sysdeps/sparc/sparc64/qp_cmp.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c: Move to .... * sysdeps/sparc/sparc64/qp_cmpe.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_div.c: Move to .... * sysdeps/sparc/sparc64/qp_div.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c: Move to .... * sysdeps/sparc/sparc64/qp_dtoq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_feq.c: Move to .... * sysdeps/sparc/sparc64/qp_feq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_fge.c: Move to .... * sysdeps/sparc/sparc64/qp_fge.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_fgt.c: Move to .... * sysdeps/sparc/sparc64/qp_fgt.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_fle.c: Move to .... * sysdeps/sparc/sparc64/qp_fle.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_flt.c: Move to .... * sysdeps/sparc/sparc64/qp_flt.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_fne.c: Move to .... * sysdeps/sparc/sparc64/qp_fne.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_itoq.c: Move to .... * sysdeps/sparc/sparc64/qp_itoq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_mul.c: Move to .... * sysdeps/sparc/sparc64/qp_mul.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_neg.S: Move to .... * sysdeps/sparc/sparc64/qp_neg.S: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_qtod.c: Move to .... * sysdeps/sparc/sparc64/qp_qtod.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c: Move to .... * sysdeps/sparc/sparc64/qp_qtoi.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_qtos.c: Move to .... * sysdeps/sparc/sparc64/qp_qtos.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c: Move to .... * sysdeps/sparc/sparc64/qp_qtoui.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c: Move to .... * sysdeps/sparc/sparc64/qp_qtoux.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_qtox.c: Move to .... * sysdeps/sparc/sparc64/qp_qtox.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c: Move to .... * sysdeps/sparc/sparc64/qp_sqrt.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_stoq.c: Move to .... * sysdeps/sparc/sparc64/qp_stoq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_sub.c: Move to .... * sysdeps/sparc/sparc64/qp_sub.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c: Move to .... * sysdeps/sparc/sparc64/qp_uitoq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_util.c: Move to .... * sysdeps/sparc/sparc64/qp_util.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c: Move to .... * sysdeps/sparc/sparc64/qp_uxtoq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c: Move to .... * sysdeps/sparc/sparc64/qp_xtoq.c: ... here. * sysdeps/sparc/sparc64/soft-fp/sfp-machine.h: Move to .... * sysdeps/sparc/sparc64/sfp-machine.h: ... here. --- sysdeps/sparc/sparc64/Implies | 1 - sysdeps/sparc/sparc64/Makefile | 32 ++++++ sysdeps/sparc/sparc64/Versions | 6 ++ sysdeps/sparc/sparc64/qp_add.c | 44 +++++++++ sysdeps/sparc/sparc64/qp_cmp.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_cmpe.c | 49 ++++++++++ sysdeps/sparc/sparc64/qp_div.c | 44 +++++++++ sysdeps/sparc/sparc64/qp_dtoq.c | 45 +++++++++ sysdeps/sparc/sparc64/qp_feq.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_fge.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_fgt.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_fle.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_flt.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_fne.c | 49 ++++++++++ sysdeps/sparc/sparc64/qp_itoq.c | 34 +++++++ sysdeps/sparc/sparc64/qp_mul.c | 49 ++++++++++ sysdeps/sparc/sparc64/qp_neg.S | 30 ++++++ sysdeps/sparc/sparc64/qp_qtod.c | 48 +++++++++ sysdeps/sparc/sparc64/qp_qtoi.c | 46 +++++++++ sysdeps/sparc/sparc64/qp_qtos.c | 49 ++++++++++ sysdeps/sparc/sparc64/qp_qtoui.c | 46 +++++++++ sysdeps/sparc/sparc64/qp_qtoux.c | 46 +++++++++ sysdeps/sparc/sparc64/qp_qtox.c | 46 +++++++++ sysdeps/sparc/sparc64/qp_sqrt.c | 41 ++++++++ sysdeps/sparc/sparc64/qp_stoq.c | 45 +++++++++ sysdeps/sparc/sparc64/qp_sub.c | 44 +++++++++ sysdeps/sparc/sparc64/qp_uitoq.c | 34 +++++++ sysdeps/sparc/sparc64/qp_util.c | 60 ++++++++++++ sysdeps/sparc/sparc64/qp_uxtoq.c | 34 +++++++ sysdeps/sparc/sparc64/qp_xtoq.c | 34 +++++++ sysdeps/sparc/sparc64/sfp-machine.h | 147 ++++++++++++++++++++++++++++ sysdeps/sparc/sparc64/soft-fp/Makefile | 33 ------- sysdeps/sparc/sparc64/soft-fp/Versions | 8 -- sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c | 79 --------------- sysdeps/sparc/sparc64/soft-fp/qp_add.c | 44 --------- sysdeps/sparc/sparc64/soft-fp/qp_cmp.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c | 49 ---------- sysdeps/sparc/sparc64/soft-fp/qp_div.c | 44 --------- sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c | 45 --------- sysdeps/sparc/sparc64/soft-fp/qp_feq.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_fge.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_fgt.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_fle.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_flt.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_fne.c | 49 ---------- sysdeps/sparc/sparc64/soft-fp/qp_itoq.c | 34 ------- sysdeps/sparc/sparc64/soft-fp/qp_mul.c | 49 ---------- sysdeps/sparc/sparc64/soft-fp/qp_neg.S | 30 ------ sysdeps/sparc/sparc64/soft-fp/qp_qtod.c | 48 --------- sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c | 46 --------- sysdeps/sparc/sparc64/soft-fp/qp_qtos.c | 49 ---------- sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c | 46 --------- sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c | 46 --------- sysdeps/sparc/sparc64/soft-fp/qp_qtox.c | 46 --------- sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c | 41 -------- sysdeps/sparc/sparc64/soft-fp/qp_stoq.c | 45 --------- sysdeps/sparc/sparc64/soft-fp/qp_sub.c | 44 --------- sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c | 34 ------- sysdeps/sparc/sparc64/soft-fp/qp_util.c | 60 ------------ sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c | 34 ------- sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c | 34 ------- sysdeps/sparc/sparc64/soft-fp/sfp-machine.h | 147 ---------------------------- 62 files changed, 1390 insertions(+), 1473 deletions(-) create mode 100644 sysdeps/sparc/sparc64/qp_add.c create mode 100644 sysdeps/sparc/sparc64/qp_cmp.c create mode 100644 sysdeps/sparc/sparc64/qp_cmpe.c create mode 100644 sysdeps/sparc/sparc64/qp_div.c create mode 100644 sysdeps/sparc/sparc64/qp_dtoq.c create mode 100644 sysdeps/sparc/sparc64/qp_feq.c create mode 100644 sysdeps/sparc/sparc64/qp_fge.c create mode 100644 sysdeps/sparc/sparc64/qp_fgt.c create mode 100644 sysdeps/sparc/sparc64/qp_fle.c create mode 100644 sysdeps/sparc/sparc64/qp_flt.c create mode 100644 sysdeps/sparc/sparc64/qp_fne.c create mode 100644 sysdeps/sparc/sparc64/qp_itoq.c create mode 100644 sysdeps/sparc/sparc64/qp_mul.c create mode 100644 sysdeps/sparc/sparc64/qp_neg.S create mode 100644 sysdeps/sparc/sparc64/qp_qtod.c create mode 100644 sysdeps/sparc/sparc64/qp_qtoi.c create mode 100644 sysdeps/sparc/sparc64/qp_qtos.c create mode 100644 sysdeps/sparc/sparc64/qp_qtoui.c create mode 100644 sysdeps/sparc/sparc64/qp_qtoux.c create mode 100644 sysdeps/sparc/sparc64/qp_qtox.c create mode 100644 sysdeps/sparc/sparc64/qp_sqrt.c create mode 100644 sysdeps/sparc/sparc64/qp_stoq.c create mode 100644 sysdeps/sparc/sparc64/qp_sub.c create mode 100644 sysdeps/sparc/sparc64/qp_uitoq.c create mode 100644 sysdeps/sparc/sparc64/qp_util.c create mode 100644 sysdeps/sparc/sparc64/qp_uxtoq.c create mode 100644 sysdeps/sparc/sparc64/qp_xtoq.c create mode 100644 sysdeps/sparc/sparc64/sfp-machine.h delete mode 100644 sysdeps/sparc/sparc64/soft-fp/Makefile delete mode 100644 sysdeps/sparc/sparc64/soft-fp/Versions delete mode 100644 sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_add.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_cmp.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_div.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_feq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fge.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fgt.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fle.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_flt.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_fne.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_itoq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_mul.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_neg.S delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtod.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtos.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_qtox.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_stoq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_sub.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_util.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c delete mode 100644 sysdeps/sparc/sparc64/soft-fp/sfp-machine.h (limited to 'sysdeps/sparc/sparc64') diff --git a/sysdeps/sparc/sparc64/Implies b/sysdeps/sparc/sparc64/Implies index 7abc50efcc..fe5eccd855 100644 --- a/sysdeps/sparc/sparc64/Implies +++ b/sysdeps/sparc/sparc64/Implies @@ -4,4 +4,3 @@ ieee754/ldbl-128 ieee754/dbl-64/wordsize-64 ieee754/dbl-64 ieee754/flt-32 -sparc/sparc64/soft-fp diff --git a/sysdeps/sparc/sparc64/Makefile b/sysdeps/sparc/sparc64/Makefile index 0963a559a7..16b760539e 100644 --- a/sysdeps/sparc/sparc64/Makefile +++ b/sysdeps/sparc/sparc64/Makefile @@ -1,3 +1,23 @@ +# Makefile for SPARC 64-bit. +# Copyright (C) 1997-2018 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 Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + sysdep-CFLAGS += -Wa,-Av9a -mvis ifeq ($(subdir),string) @@ -17,3 +37,15 @@ endif ifeq ($(subdir),nptl) libpthread-routines += cpu_relax endif + +ifeq ($(subdir),soft-fp) +sparc64-quad-routines := 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_util +sysdep_routines += $(sparc64-quad-routines) +endif + +ifeq ($(subdir),math) +CPPFLAGS += -I../soft-fp/ +endif diff --git a/sysdeps/sparc/sparc64/Versions b/sysdeps/sparc/sparc64/Versions index 4cef7bcc71..b2661ede85 100644 --- a/sysdeps/sparc/sparc64/Versions +++ b/sysdeps/sparc/sparc64/Versions @@ -4,6 +4,12 @@ libc { __align_cpy_1; __align_cpy_2; __align_cpy_4; __align_cpy_8; __align_cpy_16; } + GLIBC_2.2 { + _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; + } } libm { GLIBC_2.1 { diff --git a/sysdeps/sparc/sparc64/qp_add.c b/sysdeps/sparc/sparc64/qp_add.c new file mode 100644 index 0000000000..aa9262f40e --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_add.c @@ -0,0 +1,44 @@ +/* Software floating-point emulation. + (*c) = (*a) + (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_SEMIRAW_QP(A, a); + FP_UNPACK_SEMIRAW_QP(B, b); + FP_ADD_Q(C, A, B); + FP_PACK_SEMIRAW_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" ldd [%2], %%f56\n" +" ldd [%2+8], %%f58\n" +" faddq %%f52, %%f56, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_cmp.c b/sysdeps/sparc/sparc64/qp_cmp.c new file mode 100644 index 0000000000..0f97e94cf1 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_cmp.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Compare (*a) and (*b), return float condition code. + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 1); + if (r == -1) r = 2; + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_cmpe.c b/sysdeps/sparc/sparc64/qp_cmpe.c new file mode 100644 index 0000000000..8ff9d400d6 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_cmpe.c @@ -0,0 +1,49 @@ +/* Software floating-point emulation. + Compare (*a) and (*b), return float condition code. + Signal exception (unless masked) if unordered. + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 2); + if (r == -1) r = 2; + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpeq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_div.c b/sysdeps/sparc/sparc64/qp_div.c new file mode 100644 index 0000000000..11a5571368 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_div.c @@ -0,0 +1,44 @@ +/* Software floating-point emulation. + (*c) = (*a) / (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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\n" +" ldd [%1+8], %%f54\n" +" ldd [%2], %%f56\n" +" ldd [%2+8], %%f58\n" +" fdivq %%f52, %%f56, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_dtoq.c b/sysdeps/sparc/sparc64/qp_dtoq.c new file mode 100644 index 0000000000..a53040559d --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_dtoq.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_RAW_D(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_EXTEND(Q,D,4,2,C,A); +#else + FP_EXTEND(Q,D,2,1,C,A); +#endif + FP_PACK_RAW_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( +" fdtoq %1, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "e" (a) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_feq.c b/sysdeps/sparc/sparc64/qp_feq.c new file mode 100644 index 0000000000..19d44a3612 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_feq.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Return 1 if (*a) == (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 1); + + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return !r; +} diff --git a/sysdeps/sparc/sparc64/qp_fge.c b/sysdeps/sparc/sparc64/qp_fge.c new file mode 100644 index 0000000000..1c652f7a3a --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_fge.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Return 1 if (*a) >= (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 2); + + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpeq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 1)); + + return (r <= 0); +} diff --git a/sysdeps/sparc/sparc64/qp_fgt.c b/sysdeps/sparc/sparc64/qp_fgt.c new file mode 100644 index 0000000000..203ad06525 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_fgt.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Return 1 if (*a) > (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 2); + + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpeq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3) - 3); + + return (r == -1); +} diff --git a/sysdeps/sparc/sparc64/qp_fle.c b/sysdeps/sparc/sparc64/qp_fle.c new file mode 100644 index 0000000000..e6b188038d --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_fle.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Return 1 if (*a) <= (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 2); + + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpeq %%fcc3, %%f52, %%f56\n" +" " : : "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/qp_flt.c b/sysdeps/sparc/sparc64/qp_flt.c new file mode 100644 index 0000000000..64cd908f5c --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_flt.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Return 1 if (*a) < (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 2); + + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpeq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3)); + + return (r == 1); +} diff --git a/sysdeps/sparc/sparc64/qp_fne.c b/sysdeps/sparc/sparc64/qp_fne.c new file mode 100644 index 0000000000..2b859d8bb2 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_fne.c @@ -0,0 +1,49 @@ +/* Software floating-point emulation. + Return 1 if (*a) != (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, 1); + + QP_HANDLE_EXCEPTIONS( + __asm ( +" ldd [%0], %%f52\n" +" ldd [%0+8], %%f54\n" +" ldd [%1], %%f56\n" +" ldd [%1+8], %%f58\n" +" fcmpq %%fcc3, %%f52, %%f56\n" +" " : : "r" (a), "r" (b) : QP_CLOBBER_CC); + _FPU_GETCW(_fcw); + r = ((_fcw >> 36) & 3) != 0); + + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_itoq.c b/sysdeps/sparc/sparc64/qp_itoq.c new file mode 100644 index 0000000000..626eef7602 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_itoq.c @@ -0,0 +1,34 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, unsigned int); + FP_PACK_RAW_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/qp_mul.c b/sysdeps/sparc/sparc64/qp_mul.c new file mode 100644 index 0000000000..20583ea026 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_mul.c @@ -0,0 +1,49 @@ +/* Software floating-point emulation. + (*c) = (*a) * (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* 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\n" +" ldd [%1+8], %%f54\n" +" ldd [%2], %%f56\n" +" ldd [%2+8], %%f58\n" +" fmulq %%f52, %%f56, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_neg.S b/sysdeps/sparc/sparc64/qp_neg.S new file mode 100644 index 0000000000..7671a0ef49 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_neg.S @@ -0,0 +1,30 @@ +/* Quad floating-point emulation. + (*c) = !(*a) + Copyright (C) 1999-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +ENTRY(_Qp_neg) + ldd [%o1], %f60 + ldd [%o1 + 8], %f62 + fnegd %f60, %f60 + std %f60, [%o0] + jmpl %o7 + 8, %g0 + std %f62, [%o0 + 8] +END(_Qp_neg) diff --git a/sysdeps/sparc/sparc64/qp_qtod.c b/sysdeps/sparc/sparc64/qp_qtod.c new file mode 100644 index 0000000000..c0f0e5370e --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_qtod.c @@ -0,0 +1,48 @@ +/* Software floating-point emulation. + Return (double)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_SEMIRAW_QP(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_TRUNC(D,Q,2,4,R,A); +#else + FP_TRUNC(D,Q,1,2,R,A); +#endif + FP_PACK_SEMIRAW_D(r, R); + QP_HANDLE_EXCEPTIONS(__asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" fqtod %%f52, %0\n" +" " : "=&e" (r) : "r" (a) : QP_CLOBBER)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_qtoi.c b/sysdeps/sparc/sparc64/qp_qtoi.c new file mode 100644 index 0000000000..ca511e9fe5 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_qtoi.c @@ -0,0 +1,46 @@ +/* Software floating-point emulation. + Return (int)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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); + unsigned int r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_TO_INT_Q(r, A, 32, 1); + QP_HANDLE_EXCEPTIONS( + int rx; + __asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" fqtoi %%f52, %%f31\n" +" st %%f31, [%0]\n" +" " : : "r" (&rx), "r" (a) : QP_CLOBBER, "f31"); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_qtos.c b/sysdeps/sparc/sparc64/qp_qtos.c new file mode 100644 index 0000000000..f78e15aca3 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_qtos.c @@ -0,0 +1,49 @@ +/* Software floating-point emulation. + Return (float)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_SEMIRAW_QP(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_TRUNC(S,Q,1,4,R,A); +#else + FP_TRUNC(S,Q,1,2,R,A); +#endif + FP_PACK_SEMIRAW_S(r, R); + + QP_HANDLE_EXCEPTIONS(__asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" fqtos %%f52, %0\n" +" " : "=&f" (r) : "r" (a) : QP_CLOBBER)); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_qtoui.c b/sysdeps/sparc/sparc64/qp_qtoui.c new file mode 100644 index 0000000000..3822dbd469 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_qtoui.c @@ -0,0 +1,46 @@ +/* Software floating-point emulation. + Return (unsigned int)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_RAW_QP(A, a); + FP_TO_INT_Q(r, A, 32, -1); + QP_HANDLE_EXCEPTIONS( + int rx; + __asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" fqtoi %%f52, %%f31\n" +" st %%f31, [%0]\n" +" " : : "r" (&rx), "r" (a) : QP_CLOBBER, "f31"); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_qtoux.c b/sysdeps/sparc/sparc64/qp_qtoux.c new file mode 100644 index 0000000000..d51192a17c --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_qtoux.c @@ -0,0 +1,46 @@ +/* Software floating-point emulation. + Return (unsigned long)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_RAW_QP(A, a); + FP_TO_INT_Q(r, A, 64, -1); + QP_HANDLE_EXCEPTIONS( + unsigned long rx; + __asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" fqtox %%f52, %%f60\n" +" std %%f60, [%0]\n" +" " : : "r" (&rx), "r" (a) : QP_CLOBBER); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_qtox.c b/sysdeps/sparc/sparc64/qp_qtox.c new file mode 100644 index 0000000000..50f1057a9b --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_qtox.c @@ -0,0 +1,46 @@ +/* Software floating-point emulation. + Return (long)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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); + unsigned long r; + + FP_INIT_ROUNDMODE; + FP_UNPACK_RAW_QP(A, a); + FP_TO_INT_Q(r, A, 64, 1); + QP_HANDLE_EXCEPTIONS( + long rx; + __asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" fqtox %%f52, %%f60\n" +" std %%f60, [%0]\n" +" " : : "r" (&rx), "r" (a) : QP_CLOBBER); + r = rx); + + return r; +} diff --git a/sysdeps/sparc/sparc64/qp_sqrt.c b/sysdeps/sparc/sparc64/qp_sqrt.c new file mode 100644 index 0000000000..1b986392cb --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_sqrt.c @@ -0,0 +1,41 @@ +/* Software floating-point emulation. + (*c) = sqrtl(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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\n" +" ldd [%1+8], %%f54\n" +" fsqrtq %%f52, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "r" (a) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_stoq.c b/sysdeps/sparc/sparc64/qp_stoq.c new file mode 100644 index 0000000000..88e5620b63 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_stoq.c @@ -0,0 +1,45 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_RAW_S(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_EXTEND(Q,S,4,1,C,A); +#else + FP_EXTEND(Q,S,2,1,C,A); +#endif + FP_PACK_RAW_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( +" fstoq %1, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "f" (a) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_sub.c b/sysdeps/sparc/sparc64/qp_sub.c new file mode 100644 index 0000000000..e400c63d33 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_sub.c @@ -0,0 +1,44 @@ +/* Software floating-point emulation. + (*c) = (*a) - (*b) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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_SEMIRAW_QP(A, a); + FP_UNPACK_SEMIRAW_QP(B, b); + FP_SUB_Q(C, A, B); + FP_PACK_SEMIRAW_QP(c, C); + QP_HANDLE_EXCEPTIONS(__asm ( +" ldd [%1], %%f52\n" +" ldd [%1+8], %%f54\n" +" ldd [%2], %%f56\n" +" ldd [%2+8], %%f58\n" +" fsubq %%f52, %%f56, %%f60\n" +" std %%f60, [%0]\n" +" std %%f62, [%0+8]\n" +" " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); +} diff --git a/sysdeps/sparc/sparc64/qp_uitoq.c b/sysdeps/sparc/sparc64/qp_uitoq.c new file mode 100644 index 0000000000..0d43555c82 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_uitoq.c @@ -0,0 +1,34 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, unsigned int); + FP_PACK_RAW_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/qp_util.c b/sysdeps/sparc/sparc64/qp_util.c new file mode 100644 index 0000000000..fc9edf2153 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_util.c @@ -0,0 +1,60 @@ +/* Software floating-point emulation. + Helper routine for _Qp_* routines. + Simulate exceptions using double arithmetics. + Copyright (C) 1999-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include "soft-fp.h" + +void __Qp_handle_exceptions(int exceptions) +{ + if (exceptions & FP_EX_INVALID) + { + float f = 0.0; + __asm__ __volatile__ ("fdivs %0, %0, %0" : "+f" (f)); + } + if (exceptions & FP_EX_DIVZERO) + { + float f = 1.0, g = 0.0; + __asm__ __volatile__ ("fdivs %0, %1, %0" + : "+f" (f) + : "f" (g)); + } + if (exceptions & FP_EX_OVERFLOW) + { + float f = FLT_MAX; + __asm__ __volatile__("fmuls %0, %0, %0" : "+f" (f)); + exceptions &= ~FP_EX_INEXACT; + } + if (exceptions & FP_EX_UNDERFLOW) + { + float f = FLT_MIN; + __asm__ __volatile__("fmuls %0, %0, %0" : "+f" (f)); + exceptions &= ~FP_EX_INEXACT; + } + if (exceptions & FP_EX_INEXACT) + { + double d = 1.0, e = M_PI; + __asm__ __volatile__ ("fdivd %0, %1, %0" + : "+f" (d) + : "f" (e)); + } +} diff --git a/sysdeps/sparc/sparc64/qp_uxtoq.c b/sysdeps/sparc/sparc64/qp_uxtoq.c new file mode 100644 index 0000000000..ed2a8985d6 --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_uxtoq.c @@ -0,0 +1,34 @@ +/* Software floating-point emulation. + (*c) = (long double)(a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, unsigned long); + FP_PACK_RAW_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/qp_xtoq.c b/sysdeps/sparc/sparc64/qp_xtoq.c new file mode 100644 index 0000000000..fe3e8e764d --- /dev/null +++ b/sysdeps/sparc/sparc64/qp_xtoq.c @@ -0,0 +1,34 @@ +/* Software floating-point emulation. + (*c) = (long double)(*a) + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#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, unsigned long); + FP_PACK_RAW_QP(c, C); + QP_NO_EXCEPTIONS; +} diff --git a/sysdeps/sparc/sparc64/sfp-machine.h b/sysdeps/sparc/sparc64/sfp-machine.h new file mode 100644 index 0000000000..333f1988f3 --- /dev/null +++ b/sysdeps/sparc/sparc64/sfp-machine.h @@ -0,0 +1,147 @@ +/* Machine-dependent software floating-point definitions. + Sparc64 userland (_Q_* and _Qp_*) version. + Copyright (C) 1997-2018 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 Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#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 +#define _FP_QNANNEGATEDP 0 + +/* 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_TININESS_AFTER_ROUNDING 0 + +#define _FP_DECL_EX \ + fpu_control_t _fcw __attribute__ ((unused)) = (FP_RND_NEAREST << 30) + +#define FP_INIT_ROUNDMODE \ +do { \ + _FPU_GETCW(_fcw); \ +} while (0) + +#define FP_TRAPPING_EXCEPTIONS ((_fcw >> 23) & 0x1f) +#define FP_INHIBIT_RESULTS ((_fcw >> 23) & _fex) + +/* Simulate exceptions using double arithmetics. */ +extern void __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\n\t" \ + "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\n\t" \ + "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/sparc/sparc64/soft-fp/Makefile b/sysdeps/sparc/sparc64/soft-fp/Makefile deleted file mode 100644 index e785b8ccbd..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Software floating-point emulation. -# Makefile for SPARC v9 ABI mandated long double utility -# functions (_Qp_*). -# Copyright (C) 1999-2018 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 Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 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 -# Lesser General Public License for more details. - -# You should have received a copy of the GNU Lesser General Public -# License along with the GNU C Library; if not, see -# . - -ifeq ($(subdir),soft-fp) -sparc64-quad-routines := 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_util -sysdep_routines += $(sparc64-quad-routines) -endif - -ifeq ($(subdir),math) -CPPFLAGS += -I../soft-fp/ -endif diff --git a/sysdeps/sparc/sparc64/soft-fp/Versions b/sysdeps/sparc/sparc64/soft-fp/Versions deleted file mode 100644 index 9e89c3c3ef..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/Versions +++ /dev/null @@ -1,8 +0,0 @@ -libc { - GLIBC_2.2 { - _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; - } -} diff --git a/sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c b/sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c deleted file mode 100644 index 5e78940760..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/e_ilogbl.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Software floating-point emulation. - ilogbl(x, exp) - Copyright (C) 1999-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* 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 __ieee754_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; - } -} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_add.c b/sysdeps/sparc/sparc64/soft-fp/qp_add.c deleted file mode 100644 index aa9262f40e..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_add.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) + (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_SEMIRAW_QP(A, a); - FP_UNPACK_SEMIRAW_QP(B, b); - FP_ADD_Q(C, A, B); - FP_PACK_SEMIRAW_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" ldd [%2], %%f56\n" -" ldd [%2+8], %%f58\n" -" faddq %%f52, %%f56, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "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 deleted file mode 100644 index 0f97e94cf1..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_cmp.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Compare (*a) and (*b), return float condition code. - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 1); - if (r == -1) r = 2; - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 8ff9d400d6..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_cmpe.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Software floating-point emulation. - Compare (*a) and (*b), return float condition code. - Signal exception (unless masked) if unordered. - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 2); - if (r == -1) r = 2; - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpeq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 11a5571368..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_div.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) / (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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\n" -" ldd [%1+8], %%f54\n" -" ldd [%2], %%f56\n" -" ldd [%2+8], %%f58\n" -" fdivq %%f52, %%f56, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "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 deleted file mode 100644 index a53040559d..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_dtoq.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_RAW_D(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_EXTEND(Q,D,4,2,C,A); -#else - FP_EXTEND(Q,D,2,1,C,A); -#endif - FP_PACK_RAW_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( -" fdtoq %1, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "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 deleted file mode 100644 index 19d44a3612..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_feq.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) == (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 1); - - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 1c652f7a3a..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_fge.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) >= (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 2); - - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpeq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 203ad06525..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_fgt.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) > (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 2); - - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpeq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index e6b188038d..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_fle.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) <= (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 2); - - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpeq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 64cd908f5c..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_flt.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) < (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 2); - - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpeq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 2b859d8bb2..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_fne.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Software floating-point emulation. - Return 1 if (*a) != (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, 1); - - QP_HANDLE_EXCEPTIONS( - __asm ( -" ldd [%0], %%f52\n" -" ldd [%0+8], %%f54\n" -" ldd [%1], %%f56\n" -" ldd [%1+8], %%f58\n" -" fcmpq %%fcc3, %%f52, %%f56\n" -" " : : "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 deleted file mode 100644 index 626eef7602..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_itoq.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, unsigned int); - FP_PACK_RAW_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 deleted file mode 100644 index 20583ea026..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_mul.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) * (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* 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\n" -" ldd [%1+8], %%f54\n" -" ldd [%2], %%f56\n" -" ldd [%2+8], %%f58\n" -" fmulq %%f52, %%f56, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "r" (c), "r" (a), "r" (b) : QP_CLOBBER)); -} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_neg.S b/sysdeps/sparc/sparc64/soft-fp/qp_neg.S deleted file mode 100644 index 7671a0ef49..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_neg.S +++ /dev/null @@ -1,30 +0,0 @@ -/* Quad floating-point emulation. - (*c) = !(*a) - Copyright (C) 1999-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include - -ENTRY(_Qp_neg) - ldd [%o1], %f60 - ldd [%o1 + 8], %f62 - fnegd %f60, %f60 - std %f60, [%o0] - jmpl %o7 + 8, %g0 - std %f62, [%o0 + 8] -END(_Qp_neg) diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c deleted file mode 100644 index c0f0e5370e..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_qtod.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Software floating-point emulation. - Return (double)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_SEMIRAW_QP(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_TRUNC(D,Q,2,4,R,A); -#else - FP_TRUNC(D,Q,1,2,R,A); -#endif - FP_PACK_SEMIRAW_D(r, R); - QP_HANDLE_EXCEPTIONS(__asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" fqtod %%f52, %0\n" -" " : "=&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 deleted file mode 100644 index ca511e9fe5..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_qtoi.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Software floating-point emulation. - Return (int)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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); - unsigned int r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_TO_INT_Q(r, A, 32, 1); - QP_HANDLE_EXCEPTIONS( - int rx; - __asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" fqtoi %%f52, %%f31\n" -" st %%f31, [%0]\n" -" " : : "r" (&rx), "r" (a) : QP_CLOBBER, "f31"); - r = rx); - - return r; -} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c deleted file mode 100644 index f78e15aca3..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_qtos.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Software floating-point emulation. - Return (float)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_SEMIRAW_QP(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_TRUNC(S,Q,1,4,R,A); -#else - FP_TRUNC(S,Q,1,2,R,A); -#endif - FP_PACK_SEMIRAW_S(r, R); - - QP_HANDLE_EXCEPTIONS(__asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" fqtos %%f52, %0\n" -" " : "=&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 deleted file mode 100644 index 3822dbd469..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_qtoui.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Software floating-point emulation. - Return (unsigned int)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_RAW_QP(A, a); - FP_TO_INT_Q(r, A, 32, -1); - QP_HANDLE_EXCEPTIONS( - int rx; - __asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" fqtoi %%f52, %%f31\n" -" st %%f31, [%0]\n" -" " : : "r" (&rx), "r" (a) : QP_CLOBBER, "f31"); - r = rx); - - return r; -} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c b/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c deleted file mode 100644 index d51192a17c..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_qtoux.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Software floating-point emulation. - Return (unsigned long)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_RAW_QP(A, a); - FP_TO_INT_Q(r, A, 64, -1); - QP_HANDLE_EXCEPTIONS( - unsigned long rx; - __asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" fqtox %%f52, %%f60\n" -" std %%f60, [%0]\n" -" " : : "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 deleted file mode 100644 index 50f1057a9b..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_qtox.c +++ /dev/null @@ -1,46 +0,0 @@ -/* Software floating-point emulation. - Return (long)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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); - unsigned long r; - - FP_INIT_ROUNDMODE; - FP_UNPACK_RAW_QP(A, a); - FP_TO_INT_Q(r, A, 64, 1); - QP_HANDLE_EXCEPTIONS( - long rx; - __asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" fqtox %%f52, %%f60\n" -" std %%f60, [%0]\n" -" " : : "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 deleted file mode 100644 index 1b986392cb..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_sqrt.c +++ /dev/null @@ -1,41 +0,0 @@ -/* Software floating-point emulation. - (*c) = sqrtl(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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\n" -" ldd [%1+8], %%f54\n" -" fsqrtq %%f52, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "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 deleted file mode 100644 index 88e5620b63..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_stoq.c +++ /dev/null @@ -1,45 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_RAW_S(A, a); -#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q - FP_EXTEND(Q,S,4,1,C,A); -#else - FP_EXTEND(Q,S,2,1,C,A); -#endif - FP_PACK_RAW_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( -" fstoq %1, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "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 deleted file mode 100644 index e400c63d33..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_sub.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Software floating-point emulation. - (*c) = (*a) - (*b) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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_SEMIRAW_QP(A, a); - FP_UNPACK_SEMIRAW_QP(B, b); - FP_SUB_Q(C, A, B); - FP_PACK_SEMIRAW_QP(c, C); - QP_HANDLE_EXCEPTIONS(__asm ( -" ldd [%1], %%f52\n" -" ldd [%1+8], %%f54\n" -" ldd [%2], %%f56\n" -" ldd [%2+8], %%f58\n" -" fsubq %%f52, %%f56, %%f60\n" -" std %%f60, [%0]\n" -" std %%f62, [%0+8]\n" -" " : : "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 deleted file mode 100644 index 0d43555c82..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_uitoq.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, unsigned int); - FP_PACK_RAW_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 deleted file mode 100644 index fc9edf2153..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_util.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Software floating-point emulation. - Helper routine for _Qp_* routines. - Simulate exceptions using double arithmetics. - Copyright (C) 1999-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include "soft-fp.h" - -void __Qp_handle_exceptions(int exceptions) -{ - if (exceptions & FP_EX_INVALID) - { - float f = 0.0; - __asm__ __volatile__ ("fdivs %0, %0, %0" : "+f" (f)); - } - if (exceptions & FP_EX_DIVZERO) - { - float f = 1.0, g = 0.0; - __asm__ __volatile__ ("fdivs %0, %1, %0" - : "+f" (f) - : "f" (g)); - } - if (exceptions & FP_EX_OVERFLOW) - { - float f = FLT_MAX; - __asm__ __volatile__("fmuls %0, %0, %0" : "+f" (f)); - exceptions &= ~FP_EX_INEXACT; - } - if (exceptions & FP_EX_UNDERFLOW) - { - float f = FLT_MIN; - __asm__ __volatile__("fmuls %0, %0, %0" : "+f" (f)); - exceptions &= ~FP_EX_INEXACT; - } - if (exceptions & FP_EX_INEXACT) - { - double d = 1.0, e = M_PI; - __asm__ __volatile__ ("fdivd %0, %1, %0" - : "+f" (d) - : "f" (e)); - } -} diff --git a/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c b/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c deleted file mode 100644 index ed2a8985d6..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_uxtoq.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, unsigned long); - FP_PACK_RAW_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 deleted file mode 100644 index fe3e8e764d..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/qp_xtoq.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Software floating-point emulation. - (*c) = (long double)(*a) - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#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, unsigned long); - FP_PACK_RAW_QP(c, C); - QP_NO_EXCEPTIONS; -} diff --git a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h b/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h deleted file mode 100644 index 333f1988f3..0000000000 --- a/sysdeps/sparc/sparc64/soft-fp/sfp-machine.h +++ /dev/null @@ -1,147 +0,0 @@ -/* Machine-dependent software floating-point definitions. - Sparc64 userland (_Q_* and _Qp_*) version. - Copyright (C) 1997-2018 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 Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#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 -#define _FP_QNANNEGATEDP 0 - -/* 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_TININESS_AFTER_ROUNDING 0 - -#define _FP_DECL_EX \ - fpu_control_t _fcw __attribute__ ((unused)) = (FP_RND_NEAREST << 30) - -#define FP_INIT_ROUNDMODE \ -do { \ - _FPU_GETCW(_fcw); \ -} while (0) - -#define FP_TRAPPING_EXCEPTIONS ((_fcw >> 23) & 0x1f) -#define FP_INHIBIT_RESULTS ((_fcw >> 23) & _fex) - -/* Simulate exceptions using double arithmetics. */ -extern void __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\n\t" \ - "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\n\t" \ - "faddd %%f62, %%f62, %%f62" : : : "f62") - -#define QP_CLOBBER "memory", "f52", "f54", "f56", "f58", "f60", "f62" -#define QP_CLOBBER_CC QP_CLOBBER , "cc" -- cgit 1.4.1