From patchwork Tue Nov 26 21:42:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1201221 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-514644-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="IBJWRAZr"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47My7X1rfTz9sRf for ; Wed, 27 Nov 2019 08:43:04 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; q= dns; s=default; b=G2PmL6m7IP1p0b4ManiHLWSA/dPlY2u9QVC9jOC7zUIq+P gWKzd1k7mQRWCTd5cJIU46N2H68jBpEzNOgXAw0aJ8HOmziw+51q0jp9htKu6E2C pH3qtsTupshQamrGhtxlB+Uv/mjAr1nF1sNHovyNTWvcOmCA93C2PJEKN4CC4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:cc:message-id:date:mime-version:content-type; s= default; bh=FjbENJUpDmM7Xgm3YCBs16utPNs=; b=IBJWRAZr4QU5cxN1aQsY V+WLPYFm3xUmN+KiSwhVj7oJ/rf/St17GIUBq3kuB1j30AE+Dcb6mPZxYSfPok+P 9GeVnthB2vxRDqlrHhiX88F3jDaQyi1t+HH3wqOAqRr7BCeJ5xIyXNsq5Rw1NJ4v KMsWmuuCUrEo1mN0BNyrnXU= Received: (qmail 32111 invoked by alias); 26 Nov 2019 21:42:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 32101 invoked by uid 89); 26 Nov 2019 21:42:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, SPF_PASS autolearn=ham version=3.3.1 spammy=Proceed, sticky, (unknown), touched X-HELO: esa4.mentor.iphmx.com Received: from esa4.mentor.iphmx.com (HELO esa4.mentor.iphmx.com) (68.232.137.252) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 21:42:53 +0000 IronPort-SDR: H8rSWgV3Sx4ItUADqenrkuv9gr/tf9WL3VkC27AwLh1NyRkdXULNUZSNN9ppRd59CD8jLdeSFK HuH9RWIVmJNlCZ082IJpMEfQKLEPuo3W2SOX0lCvuotg7zGS2ITlBeNMpxh1R7IEjq46lxrHJ4 SI+hwyjB//ezWpALcv0QJGRh2ovgBCKYNflvH9towT1sOT1JxPDu0QHjyT4ifkVsz4Hp4UzFto cRACx4Kdkj+Ic1Af+sYvBRmK1d6BUspRfwboWSq0OEVd5kRwQieICelNAU+Xze+sQO25ipZGne dfA= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 26 Nov 2019 13:42:51 -0800 IronPort-SDR: Zc1uwO7zqswJ8pzcf6qEBQWZEpZCvusVcqLGJUR5EuddFYr8quRLSVd2ZZhFQZqCbZQDjTB2cR cNtHdV9zOafADF/p7urL9TDlxn9P+XXNs+H6qBrUlD8j5seMC37nHYU0sFBdiAZyRY5WbxZ5cN SexktvTW47w2HivoXtKSzy52ayOAPjlAT0uet/DjyBCbXyTa/gsfRpDnMw2A7w7j6wIANFOBTl deYj6PKDzCes3lJYoqdEKcUr8Pe1w0+pPFDfolrW1GaXuwrHfZji1TLiiFCSGwaCUIbkZGwz8N /Zs= To: gcc-patches From: Tobias Burnus Subject: [Patch] PR 92463 - Cleanups due to minimum MPFR version bump to 3.1.0 CC: Janne Blomqvist Message-ID: <2a338982-99cb-cc33-ab2b-f11a095296d1@codesourcery.com> Date: Tue, 26 Nov 2019 22:42:37 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 X-IsSubscribed: yes Recently, Janne bumped the minimal MPFR version from 2.4 to 3.1. As a follow-up cleanup, the mp_ data types can now be changed to mpfr_ and GMP_RNDx rounding to MPFR_RNDx (with an additional MPFR_RNDA). This patch changes the types in the middle end and a left over from previous patch round in Fortran. However, I have not touched the MPFR users in GO. See https://www.mpfr.org/mpfr-3.0.0/#changes for the 2.4 to 3.0 changes. ("mp_rnd_t may be removed in the future"). Bootstrapped and regtested on x86-64-gnu-linux. OK for the trunk? Tobias PR middle-end/92463 * configure.ac: Use MPFR_RNDN instead of GMP's MP_RNDN. * configure: Regenerate gcc/ 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. fortran/ PR middle-end/92463 * arith.c (gfc_check_real_range): Replace mp_exp_t by mpfr_exp_t. diff --git a/configure b/configure index 00f7487e2e9..f6027397ced 100755 --- a/configure +++ b/configure @@ -5865,9 +5865,9 @@ main () 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); diff --git a/configure.ac b/configure.ac index 29e25f13278..50e2fa135b1 100644 --- a/configure.ac +++ b/configure.ac @@ -1641,9 +1641,9 @@ if test -d ${srcdir}/gcc && test "x$have_gmp" = xno; then 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); diff --git a/gcc/builtins.c b/gcc/builtins.c index 8296d846171..36319a97b52 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -11045,7 +11045,7 @@ do_mpfr_ckconv (mpfr_srcptr m, tree type, int inexact) { 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 @@ -11085,8 +11085,8 @@ do_mpc_ckconv (mpc_srcptr m, tree type, int inexact, int force_convert) { 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 @@ -11138,14 +11138,14 @@ do_mpfr_remquo (tree arg0, tree arg1, tree arg_quo) { 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 @@ -11218,13 +11218,13 @@ do_mpfr_lgamma_r (tree arg, tree arg_sg, tree type) { 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); @@ -11287,7 +11287,8 @@ do_mpc_arg2 (tree arg0, tree arg1, tree type, int do_nonfinite, 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; diff --git a/gcc/fold-const-call.c b/gcc/fold-const-call.c index 3a14d2a41c1..c4f52fb3c15 100644 --- a/gcc/fold-const-call.c +++ b/gcc/fold-const-call.c @@ -99,7 +99,7 @@ do_mpfr_ckconv (real_value *result, mpfr_srcptr m, bool inexact, 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 @@ -130,11 +130,11 @@ do_mpfr_arg1 (real_value *result, 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); @@ -160,11 +160,11 @@ do_mpfr_sincos (real_value *result_sin, real_value *result_cos, 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) @@ -193,12 +193,12 @@ do_mpfr_arg2 (real_value *result, 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); @@ -216,7 +216,7 @@ do_mpfr_arg2 (real_value *result, 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) { @@ -224,11 +224,11 @@ do_mpfr_arg2 (real_value *result, 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); @@ -260,13 +260,13 @@ do_mpfr_arg3 (real_value *result, 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); @@ -296,8 +296,8 @@ do_mpc_ckconv (real_value *result_real, real_value *result_imag, 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 @@ -341,8 +341,8 @@ do_mpc_arg1 (real_value *result_real, real_value *result_imag, 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); @@ -378,10 +378,10 @@ do_mpc_arg2 (real_value *result_real, real_value *result_imag, 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); diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index cf480779709..7f048da9583 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -385,8 +385,8 @@ gfc_check_real_range (mpfr_t p, int kind) /* 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); diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 804a0867587..2bbb2b37ac3 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -1606,7 +1606,7 @@ format_floating_max (tree type, char spec, HOST_WIDE_INT prec) 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 @@ -1953,7 +1953,7 @@ format_floating (const directive &dir, tree arg, const vr_values *) 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 diff --git a/gcc/real.c b/gcc/real.c index 90067f0087b..134240a6be9 100644 --- a/gcc/real.c +++ b/gcc/real.c @@ -2104,7 +2104,7 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) /* 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)); @@ -2120,7 +2120,7 @@ real_from_string (REAL_VALUE_TYPE *r, const char *str) } 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 @@ -2431,9 +2431,9 @@ dconst_e_ptr (void) { 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); } @@ -2474,8 +2474,8 @@ dconst_sqrt2_ptr (void) { 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; @@ -5410,13 +5410,13 @@ build_sinatan_real (REAL_VALUE_TYPE * r, tree type) 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); } diff --git a/gcc/realmpfr.c b/gcc/realmpfr.c index 39f9fa1333b..a760ae124c3 100644 --- a/gcc/realmpfr.c +++ b/gcc/realmpfr.c @@ -28,7 +28,7 @@ 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]; @@ -59,11 +59,11 @@ mpfr_from_real (mpfr_ptr m, const REAL_VALUE_TYPE *r, mp_rnd_t rndmode) 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)) @@ -105,7 +105,8 @@ real_from_mpfr (REAL_VALUE_TYPE *r, mpfr_srcptr m, const real_format *format, 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); diff --git a/gcc/realmpfr.h b/gcc/realmpfr.h index bfea86d2bd9..ebb44fd859d 100644 --- a/gcc/realmpfr.h +++ b/gcc/realmpfr.h @@ -27,15 +27,9 @@ /* 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 */ diff --git a/gcc/ubsan.c b/gcc/ubsan.c index d2696302bd0..f12674b5649 100644 --- a/gcc/ubsan.c +++ b/gcc/ubsan.c @@ -1860,7 +1860,7 @@ ubsan_instrument_float_cast (location_t loc, tree type, tree expr) 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); @@ -1873,8 +1873,8 @@ ubsan_instrument_float_cast (location_t loc, tree type, tree expr) /* 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);