diff options
author | Steven G. Kargl <kargls@comcast.net> | 2004-08-06 20:36:05 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-08-06 20:36:05 +0000 |
commit | f8e566e5253e4b0fe2dcd477fbc35ca5576cc7bc (patch) | |
tree | 53477a0ca399a88c97246cb2b86b7147d2cdaece /gcc/fortran/trans-intrinsic.c | |
parent | 1b4ed0bcf4f8a2d46d628dd7ad57ac9ec30a2a46 (diff) | |
download | gcc-f8e566e5253e4b0fe2dcd477fbc35ca5576cc7bc.zip gcc-f8e566e5253e4b0fe2dcd477fbc35ca5576cc7bc.tar.gz gcc-f8e566e5253e4b0fe2dcd477fbc35ca5576cc7bc.tar.bz2 |
arith.c: Add #define for model numbers.
2004-08-06 Steven G. Kargl <kargls@comcast.net>
* arith.c: Add #define for model numbers. Remove global GMP variables.
(natural_logarithm,common_logarithm,exponential,sine,
cosine,arctangent,hypercos,hypersine ): Remove.
(gfc_mpfr_to_mpz,gfc_set_model_kind,gfc_set_model): New functions.
(arctangent2,gfc_arith_init_1,gfc_arith_done_1
gfc_check_real_range, gfc_constant_result, gfc_range_check,
gfc_arith_uminus,gfc_arith_plus, gfc_arith_minus, gfc_arith_times,
gfc_arith_divide,complex_reciprocal,complex_pow_ui,
gfc_arith_power,gfc_compare_expr,compare_complex,gfc_convert_real,
gfc_convert_complex,gfc_int2real,gfc_int2complex,
gfc_real2int,gfc_real2real,gfc_real2complex,
gfc_complex2int,gfc_complex2real,gfc_complex2complex): Convert GMP
to MPFR, use new functions.
* arith.h: Remove extern global variables.
(natural_logarithm,common_logarithm,exponential, sine, cosine,
arctangent,hypercos,hypersine): Remove prototypes.
(arctangent2): Update prototype from GMP to MPFR.
(gfc_mpfr_to_mpz, gfc_set_model_kind,gfc_set_model): Add prototypes.
* dump-parse-tree.c (gfc_show_expr): Convert GMP to MPFR.
* expr.c (free_expr0,gfc_copy_expr): Convert GMP to MPFR.
* gfortran.h (GFC_REAL_BITS): Remove.
(arith): Add ARITH_NAN.
Include mpfr.h. Define GFC_RND_MODE.
Rename GCC_GFORTRAN_H GFC_GFC_H.
(gfc_expr): Convert GMP to MPFR.
* module.c: Add arith.h, correct type in comment.
(mio_gmp_real): Convert GMP to MPFR.
(mio_expr): Use gfc_set_model_kind().
* primary.c: Update copyright date with 2004.
(match_real_constant,match_const_complex_part): Convert GMP to MPFR.
* simplify.c: Remove global GMP variables
(gfc_simplify_abs,gfc_simplify_acos,gfc_simplify_aimag,
gfc_simplify_aint,gfc_simplify_dint,gfc_simplify_anint,
gfc_simplify_dnint,gfc_simplify_asin,gfc_simplify_atan,
gfc_simplify_atan2,gfc_simplify_ceiling,simplify_cmplx,
gfc_simplify_conjg,gfc_simplify_cos,gfc_simplify_cosh,
gfc_simplify_dim,gfc_simplify_dprod,gfc_simplify_epsilon,
gfc_simplify_exp,gfc_simplify_exponent,gfc_simplify_floor,
gfc_simplify_fraction,gfc_simplify_huge,gfc_simplify_int,
gfc_simplify_ifix,gfc_simplify_idint,gfc_simplify_log,
gfc_simplify_log10,simplify_min_max,gfc_simplify_mod,
gfc_simplify_modulo,gfc_simplify_nearest,simplify_nint,
gfc_simplify_rrspacing,gfc_simplify_scale,
gfc_simplify_set_exponent,gfc_simplify_sign,gfc_simplify_sin,
gfc_simplify_sinh,gfc_simplify_spacing,gfc_simplify_sqrt,
gfc_simplify_tan,gfc_simplify_tanh,gfc_simplify_tiny,
gfc_simplify_init_1,gfc_simplify_done_1): Convert GMP to MPFR.
Use new functions.
* trans-const.c (gfc_conv_mpfr_to_tree): Rename from
gfc_conv_mpf_to_tree. Convert it to use MPFR
(gfc_conv_constant_to_tree): Use it.
* trans-const.h: Update prototype for gfc_conv_mpfr_to_tree().
* trans-intrinsic.c: Add arith.h, remove gmp.h
(gfc_conv_intrinsic_aint,gfc_conv_intrinsic_mod): Convert GMP to MPFR.
From-SVN: r85652
Diffstat (limited to 'gcc/fortran/trans-intrinsic.c')
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 71923fa..f83e1e1 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -33,9 +33,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "real.h" #include "tree-gimple.h" #include "flags.h" -#include <gmp.h> #include <assert.h> #include "gfortran.h" +#include "arith.h" #include "intrinsic.h" #include "trans.h" #include "trans-const.h" @@ -308,7 +308,7 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op) tree arg; tree tmp; tree cond; - mpf_t huge; + mpfr_t huge; int n; int kind; @@ -363,14 +363,15 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op) arg = gfc_evaluate_now (arg, &se->pre); /* Test if the value is too large to handle sensibly. */ - mpf_init (huge); + gfc_set_model_kind (kind); + mpfr_init (huge); n = gfc_validate_kind (BT_INTEGER, kind); - mpf_set_z (huge, gfc_integer_kinds[n].huge); - tmp = gfc_conv_mpf_to_tree (huge, kind); + mpfr_set_z (huge, gfc_integer_kinds[n].huge, GFC_RND_MODE); + tmp = gfc_conv_mpfr_to_tree (huge, kind); cond = build (LT_EXPR, boolean_type_node, arg, tmp); - mpf_neg (huge, huge); - tmp = gfc_conv_mpf_to_tree (huge, kind); + mpfr_neg (huge, huge, GFC_RND_MODE); + tmp = gfc_conv_mpfr_to_tree (huge, kind); tmp = build (GT_EXPR, boolean_type_node, arg, tmp); cond = build (TRUTH_AND_EXPR, boolean_type_node, cond, tmp); itype = gfc_get_int_type (kind); @@ -378,6 +379,7 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op) tmp = build_fix_expr (&se->pre, arg, itype, op); tmp = convert (type, tmp); se->expr = build (COND_EXPR, type, cond, tmp, arg); + mpfr_clear (huge); } @@ -777,7 +779,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) tree zero; tree test; tree test2; - mpf_t huge; + mpfr_t huge; int n; arg = gfc_conv_intrinsic_function_args (se, expr); @@ -799,14 +801,15 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) tmp = build (RDIV_EXPR, type, arg, arg2); /* Test if the value is too large to handle sensibly. */ - mpf_init (huge); + gfc_set_model_kind (expr->ts.kind); + mpfr_init (huge); n = gfc_validate_kind (BT_INTEGER, expr->ts.kind); - mpf_set_z (huge, gfc_integer_kinds[n].huge); - test = gfc_conv_mpf_to_tree (huge, expr->ts.kind); + mpfr_set_z (huge, gfc_integer_kinds[n].huge, GFC_RND_MODE); + test = gfc_conv_mpfr_to_tree (huge, expr->ts.kind); test2 = build (LT_EXPR, boolean_type_node, tmp, test); - mpf_neg (huge, huge); - test = gfc_conv_mpf_to_tree (huge, expr->ts.kind); + mpfr_neg (huge, huge, GFC_RND_MODE); + test = gfc_conv_mpfr_to_tree (huge, expr->ts.kind); test = build (GT_EXPR, boolean_type_node, tmp, test); test2 = build (TRUTH_AND_EXPR, boolean_type_node, test, test2); @@ -816,6 +819,7 @@ gfc_conv_intrinsic_mod (gfc_se * se, gfc_expr * expr, int modulo) tmp = build (COND_EXPR, type, test2, tmp, arg); tmp = build (MULT_EXPR, type, tmp, arg2); se->expr = build (MINUS_EXPR, type, arg, tmp); + mpfr_clear (huge); break; default: @@ -1423,7 +1427,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) switch (arrayexpr->ts.type) { case BT_REAL: - tmp = gfc_conv_mpf_to_tree (gfc_real_kinds[n].huge, arrayexpr->ts.kind); + tmp = gfc_conv_mpfr_to_tree (gfc_real_kinds[n].huge, arrayexpr->ts.kind); break; case BT_INTEGER: @@ -1564,7 +1568,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op) switch (expr->ts.type) { case BT_REAL: - tmp = gfc_conv_mpf_to_tree (gfc_real_kinds[n].huge, expr->ts.kind); + tmp = gfc_conv_mpfr_to_tree (gfc_real_kinds[n].huge, expr->ts.kind); break; case BT_INTEGER: |