aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/sparc/sparc32/q_util.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-05-25 16:51:15 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-05-25 16:51:15 +0000
commit2c753f3e8406495862d9db1347ea61271c18ace1 (patch)
tree29748352a3763b4aae896ee94ec83ba6e27f08c1 /sysdeps/sparc/sparc32/q_util.c
parentc1dc1e1b34873db79dfbfa8f2f0a2abbe28c0514 (diff)
downloadglibc-2c753f3e8406495862d9db1347ea61271c18ace1.tar
glibc-2c753f3e8406495862d9db1347ea61271c18ace1.tar.gz
glibc-2c753f3e8406495862d9db1347ea61271c18ace1.tar.bz2
glibc-2c753f3e8406495862d9db1347ea61271c18ace1.zip
Remove sysdeps/sparc/sparc32/soft-fp directory.
As per <https://sourceware.org/ml/libc-alpha/2014-10/msg00369.html>, there should not be separate sysdeps/<arch>/soft-fp directories when those are used by all configurations that use sysdeps/<arch>, and, more generally, should not be sysdeps/foo/Implies files pointing to a subdirectory foo/bar. This patch eliminates the sysdeps/sparc/sparc32/soft-fp directory accordingly, merging its contents into sysdeps/sparc/sparc32. Tested with build-many-glibcs.py that installed stripped shared libraries for sparc configurations are unchanged by this patch. * sysdeps/sparc/sparc32/Implies: Remove sparc/sparc32/soft-fp. * sysdeps/sparc/sparc32/Makefile [$(subdir) = soft-fp] (sparc32-quad-routines): New variable. Moved from .... [$(subdir) = soft-fp] (sysdep_routines): Add $(sparc32-quad-routines). Moved from .... * sysdeps/sparc/sparc32/soft-fp/Makefile: ... here. Remove file. * sysdeps/sparc/sparc32/Versions (libc): Add GLIBC_2.4 symbols moved from .... * sysdeps/sparc/sparc32/soft-fp/Versions: ... here. Remove file. * sysdeps/sparc/sparc32/soft-fp/q_add.c: Move to .... * sysdeps/sparc/sparc32/q_add.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_cmp.c: Move to .... * sysdeps/sparc/sparc32/q_cmp.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_cmpe.c: Move to .... * sysdeps/sparc/sparc32/q_cmpe.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_div.c: Move to .... * sysdeps/sparc/sparc32/q_div.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_dtoq.c: Move to .... * sysdeps/sparc/sparc32/q_dtoq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_feq.c: Move to .... * sysdeps/sparc/sparc32/q_feq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_fge.c: Move to .... * sysdeps/sparc/sparc32/q_fge.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_fgt.c: Move to .... * sysdeps/sparc/sparc32/q_fgt.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_fle.c: Move to .... * sysdeps/sparc/sparc32/q_fle.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_flt.c: Move to .... * sysdeps/sparc/sparc32/q_flt.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_fne.c: Move to .... * sysdeps/sparc/sparc32/q_fne.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_itoq.c: Move to .... * sysdeps/sparc/sparc32/q_itoq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_lltoq.c: Move to .... * sysdeps/sparc/sparc32/q_lltoq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_mul.c: Move to .... * sysdeps/sparc/sparc32/q_mul.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_neg.c: Move to .... * sysdeps/sparc/sparc32/q_neg.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_qtod.c: Move to .... * sysdeps/sparc/sparc32/q_qtod.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_qtoi.c: Move to .... * sysdeps/sparc/sparc32/q_qtoi.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_qtoll.c: Move to .... * sysdeps/sparc/sparc32/q_qtoll.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_qtos.c: Move to .... * sysdeps/sparc/sparc32/q_qtos.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_qtou.c: Move to .... * sysdeps/sparc/sparc32/q_qtou.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_qtoull.c: Move to .... * sysdeps/sparc/sparc32/q_qtoull.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_sqrt.c: Move to .... * sysdeps/sparc/sparc32/q_sqrt.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_stoq.c: Move to .... * sysdeps/sparc/sparc32/q_stoq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_sub.c: Move to .... * sysdeps/sparc/sparc32/q_sub.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_ulltoq.c: Move to .... * sysdeps/sparc/sparc32/q_ulltoq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_util.c: Move to .... * sysdeps/sparc/sparc32/q_util.c: ... here. * sysdeps/sparc/sparc32/soft-fp/q_utoq.c: Move to .... * sysdeps/sparc/sparc32/q_utoq.c: ... here. * sysdeps/sparc/sparc32/soft-fp/sfp-machine.h: Move to .... * sysdeps/sparc/sparc32/sfp-machine.h: ... here.
Diffstat (limited to 'sysdeps/sparc/sparc32/q_util.c')
-rw-r--r--sysdeps/sparc/sparc32/q_util.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/sysdeps/sparc/sparc32/q_util.c b/sysdeps/sparc/sparc32/q_util.c
new file mode 100644
index 0000000000..82b7a84c37
--- /dev/null
+++ b/sysdeps/sparc/sparc32/q_util.c
@@ -0,0 +1,62 @@
+/* Software floating-point emulation.
+ Helper routine for _Q_* 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <float.h>
+#include <math.h>
+#include <assert.h>
+#include "soft-fp.h"
+
+unsigned long long ___Q_zero = 0x0000000000000000ULL;
+
+void ___Q_simulate_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));
+ }
+}