From 87969c8c8b36df7b629b962028b668d7ede7321c Mon Sep 17 00:00:00 2001 From: burnus Date: Tue, 16 Nov 2010 21:23:19 +0000 Subject: / 2010-11-13 Francois-Xavier Coudert Tobias Burnus PR fortran/32049 * Makefile.def: Add libquadmath; build it with language=fortran. * configure.ac: Add libquadmath. * Makefile.tpl: Handle multiple libs in check-[+language+]. * Makefile.in: Regenerate. * configure: Regenerate. libquadmath/ 2010-11-13 Francois-Xavier Coudert Tobias Burnus PR fortran/32049 Initial implementation and checkin. gcc/fortran/ 2010-11-13 Francois-Xavier Coudert Tobias Burnus PR fortran/32049 * gfortranspec.c (find_spec_file): New function. (lang_specific_driver): Try to find .spec file and use it. * trans-io.c (iocall): Define * IOCALL_X_REAL128/COMPLEX128(,write). (gfc_build_io_library_fndecls): Build decl for __float128 I/O. (transfer_expr): Call __float128 I/O functions. * trans-types.c (gfc_init_kinds): Allow kind-16 belonging to __float128. gcc/testsuite/ 2010-11-13 Francois-Xavier Coudert Tobias Burnus PR fortran/32049 * gfortran.dg/quad_1.f90: New. * lib/gcc-defs.exp (gcc-set-multilib-library-path): Use also compiler arguments. * lib/gfortran.exp (gfortran_link_flags): Add libquadmath to library search path; call gcc-set-multilib-library-path with arguments such that libgfortran.spec is found. (gfortran_init): Add path for libgfortran.spec to GFORTRAN_UNDER_TEST. libgomp/ 2010-11-13 Francois-Xavier Coudert Tobias Burnus PR fortran/32049 * configure.ac: * configure: Regenerate. libgfortran/ 2010-11-13 Francois-Xavier Coudert Tobias Burnus PR fortran/32049 * Makefile.am: Add missing pow_r16_i4.c, add transfer128.c, link libquadmath, if used. * acinclude.m4 (LIBGFOR_CHECK_FLOAT128): Add. * configure.ac: Use it, touch spec file. * gfortran.map: Add pow_r16_i4 and transfer_(real,complex)128(,write) functions. * intrinsics/cshift0.c (cshift0): Handle __float128 type. * intrinsics/erfc_scaled_inc.c: Ditto. * intrinsics/pack_generic.c (pack): Ditto * intrinsics/spread_generic.c (spread): Ditto. * intrinsics/unpack_generic.c (unpack1): Ditto. * io/read.c (convert_real): Ditto. * io/transfer.c: Update comments. * io/transfer128.c: New file. * io/write_float.def (write_float): Handle __float128 type. * libgfortran.h: #include quadmath_weak.h, define __builtin_infq and nanq. * m4/mtype.m4: Handle __float128 type. * runtime/in_pack_generic.c (internal_pack): Ditto. * runtime/in_unpack_generic.c (internal_unpack): Ditto. * kinds-override.h: New file. * libgfortran.spec.in: Ditto. * generated/pow_r16_i4.c: Generated. * Makefile.in: Regenerate. * configure: Regenerate. * config.h: Regenerate. * bessel_r10.c: Regenerate. * bessel_r16.c: Regenerate. * bessel_r4.c: Regenerate. * bessel_r8.c: Regenerate. * exponent_r16.c: Regenerate. * fraction_r16.c: Regenerate. * nearest_r16.c: Regenerate. * norm2_r10.c: Regenerate. * norm2_r16.c: Regenerate. * norm2_r4.c: Regenerate. * norm2_r8.c: Regenerate. * rrspacing_r16.c: Regenerate. * set_exponent_r16.c: Regenerate. * spacing_r16.c: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166825 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/generated/bessel_r10.c | 1 + libgfortran/generated/bessel_r16.c | 9 +++- libgfortran/generated/bessel_r4.c | 1 + libgfortran/generated/bessel_r8.c | 1 + libgfortran/generated/exponent_r16.c | 2 +- libgfortran/generated/fraction_r16.c | 2 +- libgfortran/generated/nearest_r16.c | 2 +- libgfortran/generated/norm2_r10.c | 1 + libgfortran/generated/norm2_r16.c | 7 ++- libgfortran/generated/norm2_r4.c | 1 + libgfortran/generated/norm2_r8.c | 1 + libgfortran/generated/pow_r16_i4.c | 75 ++++++++++++++++++++++++++++++++ libgfortran/generated/rrspacing_r16.c | 4 +- libgfortran/generated/set_exponent_r16.c | 2 +- libgfortran/generated/spacing_r16.c | 4 +- 15 files changed, 102 insertions(+), 11 deletions(-) create mode 100644 libgfortran/generated/pow_r16_i4.c (limited to 'libgfortran/generated') diff --git a/libgfortran/generated/bessel_r10.c b/libgfortran/generated/bessel_r10.c index 93d08d6ce6d..87599fea6f1 100644 --- a/libgfortran/generated/bessel_r10.c +++ b/libgfortran/generated/bessel_r10.c @@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l +#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname) #if defined (HAVE_GFC_REAL_10) diff --git a/libgfortran/generated/bessel_r16.c b/libgfortran/generated/bessel_r16.c index da9ab9760c5..7097f6b0460 100644 --- a/libgfortran/generated/bessel_r16.c +++ b/libgfortran/generated/bessel_r16.c @@ -35,12 +35,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #else #define MATHFUNC(funcname) funcname ## l #endif +#if defined(GFC_REAL_16_IS_FLOAT128) +#define BUILTINMATHFUNC(funcname) funcname ## q +#else +#define BUILTINMATHFUNC(funcname) funcname ## l +#endif #if defined (HAVE_GFC_REAL_16) -#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_JNL)) +#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_JNL)) extern void bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x); export_proto(bessel_jn_r16); @@ -107,7 +112,7 @@ bessel_jn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x #endif -#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_YNL)) +#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_YNL)) extern void bessel_yn_r16 (gfc_array_r16 * const restrict ret, int n1, int n2, GFC_REAL_16 x); export_proto(bessel_yn_r16); diff --git a/libgfortran/generated/bessel_r4.c b/libgfortran/generated/bessel_r4.c index 3d6e3ca231a..75d2ff0a86b 100644 --- a/libgfortran/generated/bessel_r4.c +++ b/libgfortran/generated/bessel_r4.c @@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## f +#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname) #if defined (HAVE_GFC_REAL_4) diff --git a/libgfortran/generated/bessel_r8.c b/libgfortran/generated/bessel_r8.c index 7e3bcab4a1c..899237b1e4d 100644 --- a/libgfortran/generated/bessel_r8.c +++ b/libgfortran/generated/bessel_r8.c @@ -31,6 +31,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname +#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname) #if defined (HAVE_GFC_REAL_8) diff --git a/libgfortran/generated/exponent_r16.c b/libgfortran/generated/exponent_r16.c index 899a2aef359..24a115f2ad4 100644 --- a/libgfortran/generated/exponent_r16.c +++ b/libgfortran/generated/exponent_r16.c @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l #endif -#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL)) +#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL)) extern GFC_INTEGER_4 exponent_r16 (GFC_REAL_16 s); export_proto(exponent_r16); diff --git a/libgfortran/generated/fraction_r16.c b/libgfortran/generated/fraction_r16.c index 97e283dddc8..148148508ab 100644 --- a/libgfortran/generated/fraction_r16.c +++ b/libgfortran/generated/fraction_r16.c @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l #endif -#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL)) +#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL)) extern GFC_REAL_16 fraction_r16 (GFC_REAL_16 s); export_proto(fraction_r16); diff --git a/libgfortran/generated/nearest_r16.c b/libgfortran/generated/nearest_r16.c index 474cf3609ae..7a7f43069f7 100644 --- a/libgfortran/generated/nearest_r16.c +++ b/libgfortran/generated/nearest_r16.c @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l #endif -#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_COPYSIGNL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_NEXTAFTERL)) +#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_COPYSIGNL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_NEXTAFTERL)) extern GFC_REAL_16 nearest_r16 (GFC_REAL_16 s, GFC_REAL_16 dir); export_proto(nearest_r16); diff --git a/libgfortran/generated/norm2_r10.c b/libgfortran/generated/norm2_r10.c index 475a8cfa110..404cb1c169e 100644 --- a/libgfortran/generated/norm2_r10.c +++ b/libgfortran/generated/norm2_r10.c @@ -33,6 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10) && defined (HAVE_SQRTL) && defined (HAVE_FABSL) #define MATHFUNC(funcname) funcname ## l +#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname) extern void norm2_r10 (gfc_array_r10 * const restrict, diff --git a/libgfortran/generated/norm2_r16.c b/libgfortran/generated/norm2_r16.c index acd57790a3d..100f2e76df5 100644 --- a/libgfortran/generated/norm2_r16.c +++ b/libgfortran/generated/norm2_r16.c @@ -30,13 +30,18 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_SQRTL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FABSL)) +#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_SQRTL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FABSL)) #if defined(GFC_REAL_16_IS_FLOAT128) #define MATHFUNC(funcname) funcname ## q #else #define MATHFUNC(funcname) funcname ## l #endif +#if defined(GFC_REAL_16_IS_FLOAT128) +#define BUILTINMATHFUNC(funcname) funcname ## q +#else +#define BUILTINMATHFUNC(funcname) funcname ## l +#endif extern void norm2_r16 (gfc_array_r16 * const restrict, diff --git a/libgfortran/generated/norm2_r4.c b/libgfortran/generated/norm2_r4.c index 83e034fa613..a86f76e0ac2 100644 --- a/libgfortran/generated/norm2_r4.c +++ b/libgfortran/generated/norm2_r4.c @@ -33,6 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4) && defined (HAVE_SQRTF) && defined (HAVE_FABSF) #define MATHFUNC(funcname) funcname ## f +#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname) extern void norm2_r4 (gfc_array_r4 * const restrict, diff --git a/libgfortran/generated/norm2_r8.c b/libgfortran/generated/norm2_r8.c index 88599e83c7f..14487e8b221 100644 --- a/libgfortran/generated/norm2_r8.c +++ b/libgfortran/generated/norm2_r8.c @@ -33,6 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8) && defined (HAVE_SQRT) && defined (HAVE_FABS) #define MATHFUNC(funcname) funcname +#define BUILTINMATHFUNC(funcname) MATHFUNC(funcname) extern void norm2_r8 (gfc_array_r8 * const restrict, diff --git a/libgfortran/generated/pow_r16_i4.c b/libgfortran/generated/pow_r16_i4.c new file mode 100644 index 00000000000..bba2a844538 --- /dev/null +++ b/libgfortran/generated/pow_r16_i4.c @@ -0,0 +1,75 @@ +/* Support routines for the intrinsic power (**) operator. + Copyright 2004, 2007, 2009 Free Software Foundation, Inc. + Contributed by Paul Brook + +This file is part of the GNU Fortran 95 runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +Libgfortran 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 General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +. */ + +#include "libgfortran.h" + + +/* Use Binary Method to calculate the powi. This is not an optimal but + a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of + Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art + of Computer Programming", 3rd Edition, 1998. */ + +#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4) + +GFC_REAL_16 pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b); +export_proto(pow_r16_i4); + +GFC_REAL_16 +pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b) +{ + GFC_REAL_16 pow, x; + GFC_INTEGER_4 n; + GFC_UINTEGER_4 u; + + n = b; + x = a; + pow = 1; + if (n != 0) + { + if (n < 0) + { + + u = -n; + x = pow / x; + } + else + { + u = n; + } + for (;;) + { + if (u & 1) + pow *= x; + u >>= 1; + if (u) + x *= x; + else + break; + } + } + return pow; +} + +#endif diff --git a/libgfortran/generated/rrspacing_r16.c b/libgfortran/generated/rrspacing_r16.c index 3812435ba80..8c6aae17cd2 100644 --- a/libgfortran/generated/rrspacing_r16.c +++ b/libgfortran/generated/rrspacing_r16.c @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l #endif -#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FABSL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL)) +#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FABSL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL)) extern GFC_REAL_16 rrspacing_r16 (GFC_REAL_16 s, int p); export_proto(rrspacing_r16); @@ -47,7 +47,7 @@ rrspacing_r16 (GFC_REAL_16 s, int p) if (x == 0.) return 0.; MATHFUNC(frexp) (s, &e); -#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_LDEXPL)) +#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_LDEXPL)) return MATHFUNC(ldexp) (x, p - e); #else return MATHFUNC(scalbn) (x, p - e); diff --git a/libgfortran/generated/set_exponent_r16.c b/libgfortran/generated/set_exponent_r16.c index 8842dad8993..e1383444438 100644 --- a/libgfortran/generated/set_exponent_r16.c +++ b/libgfortran/generated/set_exponent_r16.c @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l #endif -#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_SCALBNL)) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL)) +#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_SCALBNL)) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL)) extern GFC_REAL_16 set_exponent_r16 (GFC_REAL_16 s, GFC_INTEGER_4 i); export_proto(set_exponent_r16); diff --git a/libgfortran/generated/spacing_r16.c b/libgfortran/generated/spacing_r16.c index c95c0bafde8..f26b9fc220c 100644 --- a/libgfortran/generated/spacing_r16.c +++ b/libgfortran/generated/spacing_r16.c @@ -33,7 +33,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define MATHFUNC(funcname) funcname ## l #endif -#if defined (HAVE_GFC_REAL_16) && (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_FREXPL)) +#if defined (HAVE_GFC_REAL_16) && (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_FREXPL)) extern GFC_REAL_16 spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny); export_proto(spacing_r16); @@ -47,7 +47,7 @@ spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny) MATHFUNC(frexp) (s, &e); e = e - p; e = e > emin ? e : emin; -#if (defined(GFC_WITH_QUAD_LIB) || defined(HAVE_LDEXPL)) +#if (defined(GFC_REAL_16_IS_FLOAT128) || defined(HAVE_LDEXPL)) return MATHFUNC(ldexp) (1., e); #else return MATHFUNC(scalbn) (1., e); -- cgit v1.2.1