diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2010-11-16 21:23:19 +0000 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-11-16 22:23:19 +0100 |
commit | 1ec601bf9fb0fbc39b3a6cb90450500f857adae8 (patch) | |
tree | e26ad385cfada5f1f2c55f92057a0259de8b98d2 /gcc/fortran | |
parent | 07078664fd6fdcb046cee4adf01ee697e56fcbd3 (diff) | |
download | gcc-1ec601bf9fb0fbc39b3a6cb90450500f857adae8.zip gcc-1ec601bf9fb0fbc39b3a6cb90450500f857adae8.tar.gz gcc-1ec601bf9fb0fbc39b3a6cb90450500f857adae8.tar.bz2 |
re PR fortran/32049 (Support on x86_64 also kind=16)
/
2010-11-13 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
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 <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
Initial implementation and checkin.
gcc/fortran/
2010-11-13 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
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 <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
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 <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
PR fortran/32049
* configure.ac:
* configure: Regenerate.
libgfortran/
2010-11-13 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Tobias Burnus <burnus@net-b.de>
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.
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
From-SVN: r166825
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/fortran/gfortranspec.c | 38 | ||||
-rw-r--r-- | gcc/fortran/trans-io.c | 49 | ||||
-rw-r--r-- | gcc/fortran/trans-types.c | 8 |
4 files changed, 101 insertions, 6 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a7c4439..61a0df6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,15 @@ +2010-11-16 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + Tobias Burnus <burnus@net-b.de> + + 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. + 2010-11-15 Tobias Burnus <burnus@net.b.de> PR fortran/46484 diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c index 44d80232..24c9093 100644 --- a/gcc/fortran/gfortranspec.c +++ b/gcc/fortran/gfortranspec.c @@ -63,6 +63,9 @@ along with GCC; see the file COPYING3. If not see #define FORTRAN_LIBRARY "gfortran" #endif +/* Name of the spec file. */ +#define SPEC_FILE "libgfortran.spec" + /* The original argument list and related info is copied here. */ static unsigned int g77_xargc; static const struct cl_decoded_option *g77_x_decoded_options; @@ -72,6 +75,27 @@ static void append_arg (const struct cl_decoded_option *); static unsigned int g77_newargc; static struct cl_decoded_option *g77_new_decoded_options; + +/* Return full path name of spec file if it is in DIR, or NULL if + not. */ +static char * +find_spec_file (const char *dir) +{ + const char dirsep_string[] = { DIR_SEPARATOR, '\0' }; + char *spec; + struct stat sb; + + spec = XNEWVEC (char, strlen (dir) + sizeof (SPEC_FILE) + 4); + strcpy (spec, dir); + strcat (spec, dirsep_string); + strcat (spec, SPEC_FILE); + if (!stat (spec, &sb)) + return spec; + free (spec); + return NULL; +} + + /* Return whether strings S1 and S2 are both NULL or both the same string. */ @@ -199,6 +223,9 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, /* Whether we should link a static libgfortran. */ int static_lib = 0; + /* The path to the spec file. */ + char *spec_file = NULL; + /* Whether we need to link statically. */ int static_linking = 0; @@ -283,6 +310,12 @@ For more information about these matters, see the file named COPYING\n\n")); cool facility for handling --help and --verbose --help. */ return; + case OPT_L: + if (!spec_file) + spec_file = find_spec_file (decoded_options[i].arg); + break; + + default: break; } @@ -413,6 +446,11 @@ For more information about these matters, see the file named COPYING\n\n")); #endif + /* Read the specs file corresponding to libgfortran. + If we didn't find the spec file on the -L path, then we hope it + is somewhere in the standard install areas. */ + append_option (OPT_specs_, spec_file == NULL ? SPEC_FILE : spec_file, 1); + if (verbose && g77_new_decoded_options != g77_x_decoded_options) { fprintf (stderr, _("Driving:")); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 2ac3e5c..04ad870 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -126,6 +126,10 @@ enum iocall IOCALL_X_REAL_WRITE, IOCALL_X_COMPLEX, IOCALL_X_COMPLEX_WRITE, + IOCALL_X_REAL128, + IOCALL_X_REAL128_WRITE, + IOCALL_X_COMPLEX128, + IOCALL_X_COMPLEX128_WRITE, IOCALL_X_ARRAY, IOCALL_X_ARRAY_WRITE, IOCALL_OPEN, @@ -365,6 +369,23 @@ gfc_build_io_library_fndecls (void) get_identifier (PREFIX("transfer_complex_write")), ".wR", void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node); + /* Version for __float128. */ + iocall[IOCALL_X_REAL128] = gfc_build_library_function_decl_with_spec ( + get_identifier (PREFIX("transfer_real128")), ".wW", + void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node); + + iocall[IOCALL_X_REAL128_WRITE] = gfc_build_library_function_decl_with_spec ( + get_identifier (PREFIX("transfer_real128_write")), ".wR", + void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node); + + iocall[IOCALL_X_COMPLEX128] = gfc_build_library_function_decl_with_spec ( + get_identifier (PREFIX("transfer_complex128")), ".wW", + void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node); + + iocall[IOCALL_X_COMPLEX128_WRITE] = gfc_build_library_function_decl_with_spec ( + get_identifier (PREFIX("transfer_complex128_write")), ".wR", + void_type_node, 3, dt_parm_type, pvoid_type_node, gfc_int4_type_node); + iocall[IOCALL_X_ARRAY] = gfc_build_library_function_decl_with_spec ( get_identifier (PREFIX("transfer_array")), ".ww", void_type_node, 4, dt_parm_type, pvoid_type_node, @@ -2057,18 +2078,38 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr, gfc_code * code) case BT_REAL: arg2 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) - function = iocall[IOCALL_X_REAL]; + { + if (gfc_real16_is_float128 && ts->kind == 16) + function = iocall[IOCALL_X_REAL128]; + else + function = iocall[IOCALL_X_REAL]; + } else - function = iocall[IOCALL_X_REAL_WRITE]; + { + if (gfc_real16_is_float128 && ts->kind == 16) + function = iocall[IOCALL_X_REAL128_WRITE]; + else + function = iocall[IOCALL_X_REAL_WRITE]; + } break; case BT_COMPLEX: arg2 = build_int_cst (NULL_TREE, kind); if (last_dt == READ) - function = iocall[IOCALL_X_COMPLEX]; + { + if (gfc_real16_is_float128 && ts->kind == 16) + function = iocall[IOCALL_X_COMPLEX128]; + else + function = iocall[IOCALL_X_COMPLEX]; + } else - function = iocall[IOCALL_X_COMPLEX_WRITE]; + { + if (gfc_real16_is_float128 && ts->kind == 16) + function = iocall[IOCALL_X_COMPLEX128_WRITE]; + else + function = iocall[IOCALL_X_COMPLEX_WRITE]; + } break; diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index a597cd7..0571bd1 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -418,8 +418,12 @@ gfc_init_kinds (void) useless. TODO: TFmode support should be enabled once libgfortran support is done. */ if (mode != TYPE_MODE (float_type_node) - && (mode != TYPE_MODE (double_type_node)) - && (mode != TYPE_MODE (long_double_type_node))) + && (mode != TYPE_MODE (double_type_node)) + && (mode != TYPE_MODE (long_double_type_node)) +#ifdef LIBGCC2_HAS_TF_MODE + && (mode != TFmode) +#endif + ) continue; /* Let the kind equal the precision divided by 8, rounding up. Again, |