diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-14 16:44:36 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-14 16:44:36 +0000 |
commit | 63e8969836b3c9a5e0c843659bfcae2969218999 (patch) | |
tree | d56a6176a6e43d637f2ab3512ce5fd889d048d90 /gcc/fold-const.c | |
parent | c937fbeaac7bffbf2f303022c416c8e0b63697fa (diff) | |
download | gcc-63e8969836b3c9a5e0c843659bfcae2969218999.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150760 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 803c7a549af..342e3760bdf 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, |