diff options
| author | Geoff Keating <geoffk@cygnus.com> | 2000-03-04 03:36:14 +0000 |
|---|---|---|
| committer | Geoff Keating <geoffk@cygnus.com> | 2000-03-04 03:36:14 +0000 |
| commit | 8ed1e7d5894000c155acbd06ffd2ba07ea9f718b (patch) | |
| tree | b9555e693953f12cd6a0a4f533922db17513d8b0 /soft-fp | |
| parent | 706546ff10e0979cf49d002c03334810663b655f (diff) | |
| download | glibc-8ed1e7d5894000c155acbd06ffd2ba07ea9f718b.tar.xz glibc-8ed1e7d5894000c155acbd06ffd2ba07ea9f718b.zip | |
In libc/:
* configure.in: Compute sizeof-long-double.
* configure: Regenerated.
* config.make.in: Make sizeof-long-double available to sub-makes.
In libc/soft-fp/:
* soft-fp.h (_FP_ROUND_ZERO): Cast 0 to void before using it
as a statement.
* sysdeps/powerpc/Makefile (routines): New file.
* sysdeps/powerpc/q_*: New files.
2000-03-03 Geoff Keating <geoffk@cygnus.com>
* configure.in: Compute sizeof-long-double.
* configure: Regenerated.
* config.make.in: Make sizeof-long-double available to sub-makes.
Diffstat (limited to 'soft-fp')
31 files changed, 1155 insertions, 2 deletions
diff --git a/soft-fp/ChangeLog b/soft-fp/ChangeLog index f4e8bea5ee..737d5070ec 100644 --- a/soft-fp/ChangeLog +++ b/soft-fp/ChangeLog @@ -1,3 +1,11 @@ +2000-03-03 Geoff Keating <geoffk@cygnus.com> + + * soft-fp.h (_FP_ROUND_ZERO): Cast 0 to void before using it + as a statement. + + * sysdeps/powerpc/Makefile (routines): New file. + * sysdeps/powerpc/q_*: New files. + 1999-10-29 Jakub Jelinek <jakub@redhat.com> * Makefile: New file. diff --git a/soft-fp/soft-fp.h b/soft-fp/soft-fp.h index 26798ecf25..6af8eaaf19 100644 --- a/soft-fp/soft-fp.h +++ b/soft-fp/soft-fp.h @@ -1,5 +1,5 @@ /* Software floating-point emulation. - Copyright (C) 1997,1998,1999 Free Software Foundation, Inc. + Copyright (C) 1997,1998,1999, 2000 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), @@ -107,7 +107,7 @@ do { \ _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \ } while (0) -#define _FP_ROUND_ZERO(wc, X) 0 +#define _FP_ROUND_ZERO(wc, X) (void)0 #define _FP_ROUND_PINF(wc, X) \ do { \ diff --git a/soft-fp/sysdeps/powerpc/Makefile b/soft-fp/sysdeps/powerpc/Makefile new file mode 100644 index 0000000000..bc9e6ff61a --- /dev/null +++ b/soft-fp/sysdeps/powerpc/Makefile @@ -0,0 +1,35 @@ +# Software floating-point emulation. +# Makefile for PowerPC SVR4 ABI mandated long double utility +# functions (_q_*). +# Copyright (C) 1999, 2000 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# Contributed by Jakub Jelinek (jj@ultra.linux.cz). +# +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with the GNU C Library; see the file COPYING.LIB. If +# not, write to the Free Software Foundation, Inc., +# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +ifeq ($(subdir),soft-fp) +ifeq ($(sizeof-long-double),16) +powerpc-quad-routines := q_add q_cmp q_cmpe q_div q_dtoq q_feq q_fge \ + q_fgt q_fle q_flt q_fne q_itoq q_mul q_neg q_qtod q_qtoi \ + q_qtos q_qtou q_qtoull q_qtoll q_sqrt q_stoq q_sub q_utoq \ + q_ulltoq q_lltoq q_util +routines += $(powerpc-quad-routines) +endif +endif + +ifeq ($(subdir),math) +CPPFLAGS += -I../soft-fp/ +endif diff --git a/soft-fp/sysdeps/powerpc/Versions b/soft-fp/sysdeps/powerpc/Versions new file mode 100644 index 0000000000..242aaf99cd --- /dev/null +++ b/soft-fp/sysdeps/powerpc/Versions @@ -0,0 +1,8 @@ +libc { + GLIBC_2.2 { + _q_add; _q_cmp; _q_cmpe; _q_div; _q_dtoq; _q_feq; _q_fge; _q_fgt; + _q_fle; _q_flt; _q_fne; _q_itoq; _q_mul; _q_neg; _q_qtod; _q_qtoi; + _q_qtos; _q_qtou; _q_sqrt; _q_stoq; _q_sub; + _q_utoq; + _q_lltoq; _q_qtoll; _q_qtoull; _q_ulltoq; +} diff --git a/soft-fp/sysdeps/powerpc/q_add.c b/soft-fp/sysdeps/powerpc/q_add.c new file mode 100644 index 0000000000..11779d5fbd --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_add.c @@ -0,0 +1,39 @@ +/* Software floating-point emulation. + Return a + b + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "quad.h" + +long double _q_add(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + long double c; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); + FP_UNPACK_Q(B, b); + FP_ADD_Q(C, A, B); + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/soft-fp/sysdeps/powerpc/q_cmp.c b/soft-fp/sysdeps/powerpc/q_cmp.c new file mode 100644 index 0000000000..d68b9cbaf0 --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_cmp.c @@ -0,0 +1,41 @@ +/* Software floating-point emulation. + Compare a and b, return float condition code. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "quad.h" + +int _q_cmp(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_UNPACK_RAW_Q(A, a); + FP_UNPACK_RAW_Q(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == -1) r = 2; + if (r == 3 && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) + FP_SET_EXCEPTION(FP_EX_INVALID); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/soft-fp/sysdeps/powerpc/q_cmpe.c b/soft-fp/sysdeps/powerpc/q_cmpe.c new file mode 100644 index 0000000000..9894eff4d4 --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_cmpe.c @@ -0,0 +1,42 @@ +/* Software floating-point emulation. + Compare a and b, return float condition code. + Signal exception (unless masked) if unordered. + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "quad.h" + +int _q_cmpe(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_UNPACK_RAW_Q(A, a); + FP_UNPACK_RAW_Q(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == -1) r = 2; + if (r == 3) + FP_SET_EXCEPTION(FP_EX_INVALID); + FP_HANDLE_EXCEPTIONS; + + return r; +} diff --git a/soft-fp/sysdeps/powerpc/q_div.c b/soft-fp/sysdeps/powerpc/q_div.c new file mode 100644 index 0000000000..9904fbc22d --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_div.c @@ -0,0 +1,39 @@ +/* Software floating-point emulation. + Return a / b + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "quad.h" + +long double _q_div(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C); + long double c; + + FP_INIT_ROUNDMODE; + FP_UNPACK_Q(A, a); + FP_UNPACK_Q(B, b); + FP_DIV_Q(C, A, B); + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/soft-fp/sysdeps/powerpc/q_dtoq.c b/soft-fp/sysdeps/powerpc/q_dtoq.c new file mode 100644 index 0000000000..bc588ad634 --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_dtoq.c @@ -0,0 +1,44 @@ +/* Software floating-point emulation. + Return (long double)(a) + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "double.h" +#include "quad.h" + +long double _q_dtoq(const double a) +{ + FP_DECL_EX; + FP_DECL_D(A); + FP_DECL_Q(C); + long double c; + + FP_INIT_ROUNDMODE; + FP_UNPACK_D(A, a); +#if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q + FP_CONV(Q,D,4,2,C,A); +#else + FP_CONV(Q,D,2,1,C,A); +#endif + FP_PACK_Q(c, C); + FP_HANDLE_EXCEPTIONS; + return c; +} diff --git a/soft-fp/sysdeps/powerpc/q_feq.c b/soft-fp/sysdeps/powerpc/q_feq.c new file mode 100644 index 0000000000..4611c82d20 --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_feq.c @@ -0,0 +1,40 @@ +/* Software floating-point emulation. + Return 1 if a == b + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "quad.h" + +int _q_feq(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_UNPACK_RAW_Q(A, a); + FP_UNPACK_RAW_Q(B, b); + FP_CMP_EQ_Q(r, A, B); + if (r && (FP_ISSIGNAN_Q(A) || FP_ISSIGNAN_Q(B))) + FP_SET_EXCEPTION(FP_EX_INVALID); + FP_HANDLE_EXCEPTIONS; + + return !r; +} diff --git a/soft-fp/sysdeps/powerpc/q_fge.c b/soft-fp/sysdeps/powerpc/q_fge.c new file mode 100644 index 0000000000..d7230a3b3c --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_fge.c @@ -0,0 +1,40 @@ +/* Software floating-point emulation. + Return 1 if a >= b + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, write to the Free Software Foundation, Inc., + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#include "soft-fp.h" +#include "quad.h" + +int _q_fge(const long double a, const long double b) +{ + FP_DECL_EX; + FP_DECL_Q(A); FP_DECL_Q(B); + int r; + + FP_UNPACK_RAW_Q(A, a); + FP_UNPACK_RAW_Q(B, b); + FP_CMP_Q(r, B, A, 3); + if (r == 3) + FP_SET_EXCEPTION(FP_EX_INVALID); + FP_HANDLE_EXCEPTIONS; + + return (r <= 0); +} diff --git a/soft-fp/sysdeps/powerpc/q_fgt.c b/soft-fp/sysdeps/powerpc/q_fgt.c new file mode 100644 index 0000000000..ad1fe16c48 --- /dev/null +++ b/soft-fp/sysdeps/powerpc/q_fgt.c @@ -0,0 +1,40 @@ +/* Software floating-point emulation. + Return 1 if a > b + Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Richard Henderson (rth@cygnus.com) and + Jakub Jelinek (jj@ultra.linux.cz). + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty |
