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
86 lines
3.2 KiB
C
86 lines
3.2 KiB
C
/* Compiler arithmetic header.
|
|
Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
|
|
Contributed by Steven Bosscher
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC 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 2, or (at your option) any later
|
|
version.
|
|
|
|
GCC 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.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
02111-1307, USA. */
|
|
|
|
#ifndef GFC_ARITH_H
|
|
#define GFC_ARITH_H
|
|
|
|
#include "gfortran.h"
|
|
|
|
/* MPFR does not have mpfr_atan2(), which needs to return the principle
|
|
value of atan2(). MPFR also does not have the conversion of a mpfr_t
|
|
to a mpz_t, so declare a function for this as well. */
|
|
|
|
void arctangent2 (mpfr_t, mpfr_t, mpfr_t);
|
|
void gfc_mpfr_to_mpz(mpz_t, mpfr_t);
|
|
void gfc_set_model_kind (int);
|
|
void gfc_set_model (mpfr_t);
|
|
|
|
/* Return a constant result of a given type and kind, with locus. */
|
|
gfc_expr *gfc_constant_result (bt, int, locus *);
|
|
|
|
/* Make sure a gfc_expr expression is within its allowed range. Checks
|
|
for overflow and underflow. */
|
|
arith gfc_range_check (gfc_expr *);
|
|
|
|
int gfc_compare_expr (gfc_expr *, gfc_expr *);
|
|
int gfc_compare_string (gfc_expr *, gfc_expr *, const int *);
|
|
|
|
/* Constant folding for gfc_expr trees. */
|
|
gfc_expr *gfc_uplus (gfc_expr * op);
|
|
gfc_expr *gfc_uminus (gfc_expr * op);
|
|
gfc_expr *gfc_add (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_subtract (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_multiply (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_divide (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_power (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_concat (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_and (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_or (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_not (gfc_expr *);
|
|
gfc_expr *gfc_eqv (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_neqv (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_eq (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_ne (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_gt (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_ge (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_lt (gfc_expr *, gfc_expr *);
|
|
gfc_expr *gfc_le (gfc_expr *, gfc_expr *);
|
|
|
|
/* Convert strings to literal constants. */
|
|
gfc_expr *gfc_convert_integer (const char *, int, int, locus *);
|
|
gfc_expr *gfc_convert_real (const char *, int, locus *);
|
|
gfc_expr *gfc_convert_complex (gfc_expr *, gfc_expr *, int);
|
|
|
|
/* Convert a constant of one kind to another kind. */
|
|
gfc_expr *gfc_int2int (gfc_expr *, int);
|
|
gfc_expr *gfc_int2real (gfc_expr *, int);
|
|
gfc_expr *gfc_int2complex (gfc_expr *, int);
|
|
gfc_expr *gfc_real2int (gfc_expr *, int);
|
|
gfc_expr *gfc_real2real (gfc_expr *, int);
|
|
gfc_expr *gfc_real2complex (gfc_expr *, int);
|
|
gfc_expr *gfc_complex2int (gfc_expr *, int);
|
|
gfc_expr *gfc_complex2real (gfc_expr *, int);
|
|
gfc_expr *gfc_complex2complex (gfc_expr *, int);
|
|
gfc_expr *gfc_log2log (gfc_expr *, int);
|
|
|
|
#endif /* GFC_ARITH_H */
|
|
|