aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2014-10-24 05:01:50 +0000
committerIan Lance Taylor <iant@google.com>2014-10-24 05:01:50 +0000
commit1545791cc60a391236ae8d619bce1705c559285f (patch)
treec692cb03790db22948d2d1d2c21226b54e7c9a25 /gcc/go/go-gcc.cc
parent439de2e2a44abfec8155ec3548acdb8ddabd85c2 (diff)
compiler: Use MPC library for complex numbers.
* go-gcc.cc (Gcc_backend::complex_constant_expression): Take one mpc_t parameter instead of two mpfr_t parameters. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@216611 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 6bac84f2565..caf66db72f6 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -247,7 +247,7 @@ class Gcc_backend : public Backend
float_constant_expression(Btype* btype, mpfr_t val);
Bexpression*
- complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag);
+ complex_constant_expression(Btype* btype, mpc_t val);
Bexpression*
string_constant_expression(const std::string& val);
@@ -1241,7 +1241,7 @@ Gcc_backend::float_constant_expression(Btype* btype, mpfr_t val)
// Return a typed real and imaginary value as a constant complex number.
Bexpression*
-Gcc_backend::complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag)
+Gcc_backend::complex_constant_expression(Btype* btype, mpc_t val)
{
tree t = btype->get_tree();
tree ret;
@@ -1249,12 +1249,12 @@ Gcc_backend::complex_constant_expression(Btype* btype, mpfr_t real, mpfr_t imag)
return this->error_expression();
REAL_VALUE_TYPE r1;
- real_from_mpfr(&r1, real, TREE_TYPE(t), GMP_RNDN);
+ real_from_mpfr(&r1, mpc_realref(val), TREE_TYPE(t), GMP_RNDN);
REAL_VALUE_TYPE r2;
real_convert(&r2, TYPE_MODE(TREE_TYPE(t)), &r1);
REAL_VALUE_TYPE r3;
- real_from_mpfr(&r3, imag, TREE_TYPE(t), GMP_RNDN);
+ real_from_mpfr(&r3, mpc_imagref(val), TREE_TYPE(t), GMP_RNDN);
REAL_VALUE_TYPE r4;
real_convert(&r4, TYPE_MODE(TREE_TYPE(t)), &r3);