aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2009-08-14 16:44:36 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2009-08-14 16:44:36 +0000
commit2f440f6abab72e52aed64f86cd1af2ac8d4ece32 (patch)
treed56a6176a6e43d637f2ab3512ce5fd889d048d90 /gcc/fold-const.c
parentfe83055dfa93a7a68ba98042f2ffcb7d6b140154 (diff)
downloadgcc-2f440f6abab72e52aed64f86cd1af2ac8d4ece32.zip
gcc-2f440f6abab72e52aed64f86cd1af2ac8d4ece32.tar.gz
gcc-2f440f6abab72e52aed64f86cd1af2ac8d4ece32.tar.bz2
re PR middle-end/30789 (complex folding inexact)
PR middle-end/30789 * builtins.c (do_mpc_arg2): Make extern, define for any MPC version. Move declaration... * real.h (do_mpc_arg2): ... here. * fold-const.c (const_binop): Use MPC for complex MULT_EXPR and RDIV_EXPR. testsuite: * gcc.dg/torture/builtin-math-7.c: New. From-SVN: r150760
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 803c7a5..342e376 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1972,6 +1972,11 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
break;
case MULT_EXPR:
+#ifdef HAVE_mpc
+ if (COMPLEX_FLOAT_TYPE_P (type))
+ return do_mpc_arg2 (arg1, arg2, type, mpc_mul);
+#endif
+
real = const_binop (MINUS_EXPR,
const_binop (MULT_EXPR, r1, r2, notrunc),
const_binop (MULT_EXPR, i1, i2, notrunc),
@@ -1983,6 +1988,11 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
break;
case RDIV_EXPR:
+#ifdef HAVE_mpc
+ if (COMPLEX_FLOAT_TYPE_P (type))
+ return do_mpc_arg2 (arg1, arg2, type, mpc_div);
+#endif
+
{
tree magsquared
= const_binop (PLUS_EXPR,