aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-04-21 05:55:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-04-21 05:55:22 +0000
commit470f5b53a29f5310b0e3782a06f18430de836fd2 (patch)
tree25c3333ba5a3feecc16cc0dfc5053a022b9770db /gcc
parentfa9ef321070b9fbedf735ee8fdf864aa7c2b80f5 (diff)
downloadgcc-470f5b53a29f5310b0e3782a06f18430de836fd2.zip
gcc-470f5b53a29f5310b0e3782a06f18430de836fd2.tar.gz
gcc-470f5b53a29f5310b0e3782a06f18430de836fd2.tar.bz2
Use mpfr_prec_round, not real_convert, to constraint floats.
From-SVN: r172811
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/expressions.cc20
1 files changed, 3 insertions, 17 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 5f885ab..8a1fc34 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -1909,13 +1909,7 @@ Float_expression::constrain_float(mpfr_t val, Type* type)
{
Float_type* ftype = type->float_type();
if (ftype != NULL && !ftype->is_abstract())
- {
- tree type_tree = ftype->type_tree();
- REAL_VALUE_TYPE rvt;
- real_from_mpfr(&rvt, val, type_tree, GMP_RNDN);
- real_convert(&rvt, TYPE_MODE(type_tree), &rvt);
- mpfr_from_real(val, &rvt, GMP_RNDN);
- }
+ mpfr_prec_round(val, ftype->bits(), GMP_RNDN);
}
// Return a floating point constant value.
@@ -2158,16 +2152,8 @@ Complex_expression::constrain_complex(mpfr_t real, mpfr_t imag, Type* type)
Complex_type* ctype = type->complex_type();
if (ctype != NULL && !ctype->is_abstract())
{
- tree type_tree = ctype->type_tree();
-
- REAL_VALUE_TYPE rvt;
- real_from_mpfr(&rvt, real, TREE_TYPE(type_tree), GMP_RNDN);
- real_convert(&rvt, TYPE_MODE(TREE_TYPE(type_tree)), &rvt);
- mpfr_from_real(real, &rvt, GMP_RNDN);
-
- real_from_mpfr(&rvt, imag, TREE_TYPE(type_tree), GMP_RNDN);
- real_convert(&rvt, TYPE_MODE(TREE_TYPE(type_tree)), &rvt);
- mpfr_from_real(imag, &rvt, GMP_RNDN);
+ mpfr_prec_round(real, ctype->bits() / 2, GMP_RNDN);
+ mpfr_prec_round(imag, ctype->bits() / 2, GMP_RNDN);
}
}