+2019-11-27 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/92463
+ * configure.ac: Use MPFR_RNDN instead of GMP's MP_RNDN.
+ * configure: Regenerate
+
2019-11-20 Janne Blomqvist <jb@gcc.gnu.org>
* configure.ac: Use https for gcc.gnu.org.
2019-11-11 Janne Blomqvist <jb@gcc.gnu.org>
- PR fortran/91828
- * configure.ac: Bump minimum MPFR to 3.1.0, recommended to 3.1.6+.
- * configure: Regenerated.
+ PR fortran/91828
+ * configure.ac: Bump minimum MPFR to 3.1.0, recommended to 3.1.6+.
+ * configure: Regenerated.
2019-10-21 Jason Merrill <jason@redhat.com>
int t;
mpfr_init (n);
mpfr_init (x);
- mpfr_atan2 (n, n, x, GMP_RNDN);
- mpfr_erfc (n, x, GMP_RNDN);
- mpfr_subnormalize (x, t, GMP_RNDN);
+ mpfr_atan2 (n, n, x, MPFR_RNDN);
+ mpfr_erfc (n, x, MPFR_RNDN);
+ mpfr_subnormalize (x, t, MPFR_RNDN);
mpfr_clear(n);
mpfr_clear(x);
mpc_init2 (c, 53);
int t;
mpfr_init (n);
mpfr_init (x);
- mpfr_atan2 (n, n, x, GMP_RNDN);
- mpfr_erfc (n, x, GMP_RNDN);
- mpfr_subnormalize (x, t, GMP_RNDN);
+ mpfr_atan2 (n, n, x, MPFR_RNDN);
+ mpfr_erfc (n, x, MPFR_RNDN);
+ mpfr_subnormalize (x, t, MPFR_RNDN);
mpfr_clear(n);
mpfr_clear(x);
mpc_init2 (c, 53);
+2019-11-27 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/92463
+ * builtins.c (do_mpfr_ckconv, do_mpc_ckconv, do_mpfr_remquo,
+ do_mpfr_lgamma_r, do_mpc_arg2): Use MPFR_RNDx instead of GMP_RNDx,
+ mpfr_rnd_t instead of mp_rnd_t.
+ * fold-const-call.c (do_mpfr_ckconv, do_mpfr_arg1, do_mpfr_sincos,
+ do_mpfr_arg2, do_mpfr_arg3, do_mpc_arg1, do_mpc_arg2): Likewise.
+ * gimple-ssa-sprintf.c (format_floating_max, format_floating):
+ Use mpfr_exp_t instead of mp_exp_t.
+ * real.c (real_from_string, dconst_e_ptr, dconst_sqrt2_ptr): Use
+ MPFR_RNDx instead of GMP_RNDx.
+ * realmpfr.c (real_from_mpfr, mpfr_from_real): Use mpfr_rnd_t and
+ mpfr_exp_t instead mp_rnd_t and mp_exp_t, respectively.
+ * realmpfr.h (real_from_mpfr, mpfr_from_real): Use mpfr_rnd_t instead
+ of mp_rnd_t and remove MPFR_RNDx poisoning.
+ * ubsan.c (ubsan_instrument_float_cast): MPFR_RNDx instead of GMP_RNDx.
+
2019-11-27 Kewen Lin <linkw@gcc.gnu.org>
PR tree-optimization/91790
{
REAL_VALUE_TYPE rr;
- real_from_mpfr (&rr, m, type, GMP_RNDN);
+ real_from_mpfr (&rr, m, type, MPFR_RNDN);
/* Proceed iff GCC's REAL_VALUE_TYPE can hold the MPFR value,
check for overflow/underflow. If the REAL_VALUE_TYPE is zero
but the mpft_t is not, then we underflowed in the
{
REAL_VALUE_TYPE re, im;
- real_from_mpfr (&re, mpc_realref (m), TREE_TYPE (type), GMP_RNDN);
- real_from_mpfr (&im, mpc_imagref (m), TREE_TYPE (type), GMP_RNDN);
+ real_from_mpfr (&re, mpc_realref (m), TREE_TYPE (type), MPFR_RNDN);
+ real_from_mpfr (&im, mpc_imagref (m), TREE_TYPE (type), MPFR_RNDN);
/* Proceed iff GCC's REAL_VALUE_TYPE can hold the MPFR values,
check for overflow/underflow. If the REAL_VALUE_TYPE is zero
but the mpft_t is not, then we underflowed in the
{
const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
const int prec = fmt->p;
- const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
+ const mpfr_rnd_t rnd = fmt->round_towards_zero? MPFR_RNDZ : MPFR_RNDN;
tree result_rem;
long integer_quo;
mpfr_t m0, m1;
mpfr_inits2 (prec, m0, m1, NULL);
- mpfr_from_real (m0, ra0, GMP_RNDN);
- mpfr_from_real (m1, ra1, GMP_RNDN);
+ mpfr_from_real (m0, ra0, MPFR_RNDN);
+ mpfr_from_real (m1, ra1, MPFR_RNDN);
mpfr_clear_flags ();
mpfr_remquo (m0, &integer_quo, m0, m1, rnd);
/* Remquo is independent of the rounding mode, so pass
{
const struct real_format *fmt = REAL_MODE_FORMAT (TYPE_MODE (type));
const int prec = fmt->p;
- const mp_rnd_t rnd = fmt->round_towards_zero? GMP_RNDZ : GMP_RNDN;
+ const mpfr_rnd_t rnd = fmt->round_towards_zero? MPFR_RNDZ : MPFR_RNDN;
int inexact, sg;
mpfr_t m;
tree result_lg;
mpfr_init2 (m, prec);
- mpfr_from_real (m, ra, GMP_RNDN);
+ mpfr_from_real (m, ra, MPFR_RNDN);
mpfr_clear_flags ();
inexact = mpfr_lgamma (m, &sg, m, rnd);
result_lg = do_mpfr_ckconv (m, type, inexact);
const struct real_format *const fmt =
REAL_MODE_FORMAT (TYPE_MODE (TREE_TYPE (type)));
const int prec = fmt->p;
- const mp_rnd_t rnd = fmt->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+ const mpfr_rnd_t rnd = fmt->round_towards_zero
+ ? MPFR_RNDZ : MPFR_RNDN;
const mpc_rnd_t crnd = fmt->round_towards_zero ? MPC_RNDZZ : MPC_RNDNN;
int inexact;
mpc_t m0, m1;
return false;
REAL_VALUE_TYPE tmp;
- real_from_mpfr (&tmp, m, format, GMP_RNDN);
+ real_from_mpfr (&tmp, m, format, MPFR_RNDN);
/* Proceed iff GCC's REAL_VALUE_TYPE can hold the MPFR values.
If the REAL_VALUE_TYPE is zero but the mpft_t is not, then we
return false;
int prec = format->p;
- mp_rnd_t rnd = format->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+ mpfr_rnd_t rnd = format->round_towards_zero ? MPFR_RNDZ : MPFR_RNDN;
mpfr_t m;
mpfr_init2 (m, prec);
- mpfr_from_real (m, arg, GMP_RNDN);
+ mpfr_from_real (m, arg, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = func (m, m, rnd);
bool ok = do_mpfr_ckconv (result, m, inexact, format);
return false;
int prec = format->p;
- mp_rnd_t rnd = format->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+ mpfr_rnd_t rnd = format->round_towards_zero ? MPFR_RNDZ : MPFR_RNDN;
mpfr_t m, ms, mc;
mpfr_inits2 (prec, m, ms, mc, NULL);
- mpfr_from_real (m, arg, GMP_RNDN);
+ mpfr_from_real (m, arg, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = mpfr_sin_cos (ms, mc, m, rnd);
bool ok = (do_mpfr_ckconv (result_sin, ms, inexact, format)
return false;
int prec = format->p;
- mp_rnd_t rnd = format->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+ mpfr_rnd_t rnd = format->round_towards_zero ? MPFR_RNDZ : MPFR_RNDN;
mpfr_t m0, m1;
mpfr_inits2 (prec, m0, m1, NULL);
- mpfr_from_real (m0, arg0, GMP_RNDN);
- mpfr_from_real (m1, arg1, GMP_RNDN);
+ mpfr_from_real (m0, arg0, MPFR_RNDN);
+ mpfr_from_real (m1, arg1, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = func (m0, m0, m1, rnd);
bool ok = do_mpfr_ckconv (result, m0, inexact, format);
static bool
do_mpfr_arg2 (real_value *result,
- int (*func) (mpfr_ptr, long, mpfr_srcptr, mp_rnd_t),
+ int (*func) (mpfr_ptr, long, mpfr_srcptr, mpfr_rnd_t),
const wide_int_ref &arg0, const real_value *arg1,
const real_format *format)
{
return false;
int prec = format->p;
- mp_rnd_t rnd = format->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+ mpfr_rnd_t rnd = format->round_towards_zero ? MPFR_RNDZ : MPFR_RNDN;
mpfr_t m;
mpfr_init2 (m, prec);
- mpfr_from_real (m, arg1, GMP_RNDN);
+ mpfr_from_real (m, arg1, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = func (m, arg0.to_shwi (), m, rnd);
bool ok = do_mpfr_ckconv (result, m, inexact, format);
return false;
int prec = format->p;
- mp_rnd_t rnd = format->round_towards_zero ? GMP_RNDZ : GMP_RNDN;
+ mpfr_rnd_t rnd = format->round_towards_zero ? MPFR_RNDZ : MPFR_RNDN;
mpfr_t m0, m1, m2;
mpfr_inits2 (prec, m0, m1, m2, NULL);
- mpfr_from_real (m0, arg0, GMP_RNDN);
- mpfr_from_real (m1, arg1, GMP_RNDN);
- mpfr_from_real (m2, arg2, GMP_RNDN);
+ mpfr_from_real (m0, arg0, MPFR_RNDN);
+ mpfr_from_real (m1, arg1, MPFR_RNDN);
+ mpfr_from_real (m2, arg2, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = func (m0, m0, m1, m2, rnd);
bool ok = do_mpfr_ckconv (result, m0, inexact, format);
return false;
REAL_VALUE_TYPE tmp_real, tmp_imag;
- real_from_mpfr (&tmp_real, mpc_realref (m), format, GMP_RNDN);
- real_from_mpfr (&tmp_imag, mpc_imagref (m), format, GMP_RNDN);
+ real_from_mpfr (&tmp_real, mpc_realref (m), format, MPFR_RNDN);
+ real_from_mpfr (&tmp_imag, mpc_imagref (m), format, MPFR_RNDN);
/* Proceed iff GCC's REAL_VALUE_TYPE can hold the MPFR values.
If the REAL_VALUE_TYPE is zero but the mpft_t is not, then we
mpc_t m;
mpc_init2 (m, prec);
- mpfr_from_real (mpc_realref (m), arg_real, GMP_RNDN);
- mpfr_from_real (mpc_imagref (m), arg_imag, GMP_RNDN);
+ mpfr_from_real (mpc_realref (m), arg_real, MPFR_RNDN);
+ mpfr_from_real (mpc_imagref (m), arg_imag, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = func (m, m, crnd);
bool ok = do_mpc_ckconv (result_real, result_imag, m, inexact, format);
mpc_init2 (m0, prec);
mpc_init2 (m1, prec);
- mpfr_from_real (mpc_realref (m0), arg0_real, GMP_RNDN);
- mpfr_from_real (mpc_imagref (m0), arg0_imag, GMP_RNDN);
- mpfr_from_real (mpc_realref (m1), arg1_real, GMP_RNDN);
- mpfr_from_real (mpc_imagref (m1), arg1_imag, GMP_RNDN);
+ mpfr_from_real (mpc_realref (m0), arg0_real, MPFR_RNDN);
+ mpfr_from_real (mpc_imagref (m0), arg0_imag, MPFR_RNDN);
+ mpfr_from_real (mpc_realref (m1), arg1_real, MPFR_RNDN);
+ mpfr_from_real (mpc_imagref (m1), arg1_imag, MPFR_RNDN);
mpfr_clear_flags ();
bool inexact = func (m0, m0, m1, crnd);
bool ok = do_mpc_ckconv (result_real, result_imag, m0, inexact, format);
+2019-11-27 Tobias Burnus <tobias@codesourcery.com>
+
+ PR middle-end/92463
+ * arith.c (gfc_check_real_range): Replace mp_exp_t by mpfr_exp_t.
+
2019-11-25 Harald Anlauf <anlauf@gmx.de>
PR fortran/92629
/* Set emin and emax for the current model number. */
en = gfc_real_kinds[i].min_exponent - gfc_real_kinds[i].digits + 1;
- mpfr_set_emin ((mp_exp_t) en);
- mpfr_set_emax ((mp_exp_t) gfc_real_kinds[i].max_exponent);
+ mpfr_set_emin ((mpfr_exp_t) en);
+ mpfr_set_emax ((mpfr_exp_t) gfc_real_kinds[i].max_exponent);
mpfr_check_range (q, 0, GFC_RND_MODE);
mpfr_subnormalize (q, 0, GFC_RND_MODE);
round-to-nearest mode. */
mpfr_t x;
mpfr_init2 (x, rfmt->p);
- mpfr_from_real (x, &rv, GMP_RNDN);
+ mpfr_from_real (x, &rv, MPFR_RNDN);
/* Return a value one greater to account for the leading minus sign. */
unsigned HOST_WIDE_INT r
rounding in either direction can result in longer output. */
mpfr_t mpfrval;
mpfr_init2 (mpfrval, rfmt->p);
- mpfr_from_real (mpfrval, rvp, i ? GMP_RNDU : GMP_RNDD);
+ mpfr_from_real (mpfrval, rvp, i ? MPFR_RNDU : MPFR_RNDD);
/* Use the MPFR rounding specifier to round down in the first
iteration and then up. In most but not all cases this will
/* Nonzero value, possibly overflowing or underflowing. */
mpfr_init2 (m, SIGNIFICAND_BITS);
- inexact = mpfr_strtofr (m, str, NULL, 10, GMP_RNDZ);
+ inexact = mpfr_strtofr (m, str, NULL, 10, MPFR_RNDZ);
/* The result should never be a NaN, and because the rounding is
toward zero should never be an infinity. */
gcc_assert (!mpfr_nan_p (m) && !mpfr_inf_p (m));
}
else
{
- real_from_mpfr (r, m, NULL_TREE, GMP_RNDZ);
+ real_from_mpfr (r, m, NULL_TREE, MPFR_RNDZ);
/* 1 to 3 bits may have been shifted off (with a sticky bit)
because the hex digits used in real_from_mpfr did not
start with a digit 8 to f, but the exponent bounds above
{
mpfr_t m;
mpfr_init2 (m, SIGNIFICAND_BITS);
- mpfr_set_ui (m, 1, GMP_RNDN);
- mpfr_exp (m, m, GMP_RNDN);
- real_from_mpfr (&value, m, NULL_TREE, GMP_RNDN);
+ mpfr_set_ui (m, 1, MPFR_RNDN);
+ mpfr_exp (m, m, MPFR_RNDN);
+ real_from_mpfr (&value, m, NULL_TREE, MPFR_RNDN);
mpfr_clear (m);
}
{
mpfr_t m;
mpfr_init2 (m, SIGNIFICAND_BITS);
- mpfr_sqrt_ui (m, 2, GMP_RNDN);
- real_from_mpfr (&value, m, NULL_TREE, GMP_RNDN);
+ mpfr_sqrt_ui (m, 2, MPFR_RNDN);
+ real_from_mpfr (&value, m, NULL_TREE, MPFR_RNDN);
mpfr_clear (m);
}
return &value;
mpfr_inits (mpfr_const1, mpfr_c, mpfr_maxval, NULL);
- mpfr_from_real (mpfr_const1, &dconst1, GMP_RNDN);
- mpfr_from_real (mpfr_maxval, &maxval, GMP_RNDN);
+ mpfr_from_real (mpfr_const1, &dconst1, MPFR_RNDN);
+ mpfr_from_real (mpfr_maxval, &maxval, MPFR_RNDN);
- mpfr_sub (mpfr_c, mpfr_maxval, mpfr_const1, GMP_RNDN);
- mpfr_sqrt (mpfr_c, mpfr_c, GMP_RNDZ);
+ mpfr_sub (mpfr_c, mpfr_maxval, mpfr_const1, MPFR_RNDN);
+ mpfr_sqrt (mpfr_c, mpfr_c, MPFR_RNDZ);
- real_from_mpfr (r, mpfr_c, fmt, GMP_RNDZ);
+ real_from_mpfr (r, mpfr_c, fmt, MPFR_RNDZ);
mpfr_clears (mpfr_const1, mpfr_c, mpfr_maxval, NULL);
}
for initializing and clearing the MPFR parameter. */
void
-mpfr_from_real (mpfr_ptr m, const REAL_VALUE_TYPE *r, mp_rnd_t rndmode)
+mpfr_from_real (mpfr_ptr m, const REAL_VALUE_TYPE *r, mpfr_rnd_t rndmode)
{
/* We use a string as an intermediate type. */
char buf[128];
void
real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m, const real_format *format,
- mp_rnd_t rndmode)
+ mpfr_rnd_t rndmode)
{
/* We use a string as an intermediate type. */
char buf[128], *rstr;
- mp_exp_t exp;
+ mpfr_exp_t exp;
/* Take care of Infinity and NaN. */
if (mpfr_inf_p (m))
mode RNDMODE. TYPE is only relevant if M is a NaN. */
void
-real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m, tree type, mp_rnd_t rndmode)
+real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m, tree type,
+ mpfr_rnd_t rndmode)
{
real_from_mpfr (r, m, type ? REAL_MODE_FORMAT (TYPE_MODE (type)) : NULL,
rndmode);
/* Convert between MPFR and REAL_VALUE_TYPE. The caller is
responsible for initializing and clearing the MPFR parameter. */
-extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, tree, mp_rnd_t);
+extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr, tree, mpfr_rnd_t);
extern void real_from_mpfr (REAL_VALUE_TYPE *, mpfr_srcptr,
- const real_format *, mp_rnd_t);
-extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *, mp_rnd_t);
-
-#if (GCC_VERSION >= 3000)
- /* For compatibility with mpfr 2.4 and earlier, we want to only use
- GMP_RND*. */
- #pragma GCC poison MPFR_RNDN MPFR_RNDZ MPFR_RNDU MPFR_RNDD
-#endif
+ const real_format *, mpfr_rnd_t);
+extern void mpfr_from_real (mpfr_ptr, const REAL_VALUE_TYPE *, mpfr_rnd_t);
#endif /* ! GCC_REALGMP_H */
representable decimal number greater or equal than
1 << (prec - !uns_p). */
mpfr_init2 (m, prec + 2);
- mpfr_set_ui_2exp (m, 1, prec - !uns_p, GMP_RNDN);
+ mpfr_set_ui_2exp (m, 1, prec - !uns_p, MPFR_RNDN);
mpfr_snprintf (buf, sizeof buf, "%.*RUe", p - 1, m);
decimal_real_from_string (&maxval, buf);
max = build_real (expr_type, maxval);
/* Use mpfr_snprintf rounding to compute the largest
representable decimal number less or equal than
(-1 << (prec - 1)) - 1. */
- mpfr_set_si_2exp (m, -1, prec - 1, GMP_RNDN);
- mpfr_sub_ui (m, m, 1, GMP_RNDN);
+ mpfr_set_si_2exp (m, -1, prec - 1, MPFR_RNDN);
+ mpfr_sub_ui (m, m, 1, MPFR_RNDN);
mpfr_snprintf (buf, sizeof buf, "%.*RDe", p - 1, m);
decimal_real_from_string (&minval, buf);
min = build_real (expr_type, minval);