aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-complex.c
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2009-09-24 20:44:55 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2009-09-24 20:44:55 +0000
commite3d5405d071e33540d70c62c6e24a2dfa7cc7d9d (patch)
tree942e85ee11d063e393b8d23171086e6c6108a90e /gcc/tree-complex.c
parent18b802688624127aa26b3d75dd0ce41e06cbeee9 (diff)
downloadgcc-e3d5405d071e33540d70c62c6e24a2dfa7cc7d9d.zip
gcc-e3d5405d071e33540d70c62c6e24a2dfa7cc7d9d.tar.gz
gcc-e3d5405d071e33540d70c62c6e24a2dfa7cc7d9d.tar.bz2
re PR middle-end/41435 (GCC doesn't fold complex int division)
PR middle-end/41435 * fold-const.c (const_binop): Handle complex int division. * tree-complex.c (expand_complex_div_straight, expand_complex_div_wide): Update comments. testsuite: * gcc.dg/torture/builtin-math-7.c: Test complex int division at compile-time. From-SVN: r152145
Diffstat (limited to 'gcc/tree-complex.c')
-rw-r--r--gcc/tree-complex.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index f691805..199f1dcf 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -1065,7 +1065,9 @@ expand_complex_multiplication (gimple_stmt_iterator *gsi, tree inner_type,
update_complex_assignment (gsi, rr, ri);
}
-/* Expand complex division to scalars, straightforward algorithm.
+/* Keep this algorithm in sync with fold-const.c:const_binop().
+
+ Expand complex division to scalars, straightforward algorithm.
a / b = ((ar*br + ai*bi)/t) + i((ai*br - ar*bi)/t)
t = br*br + bi*bi
*/
@@ -1094,7 +1096,9 @@ expand_complex_div_straight (gimple_stmt_iterator *gsi, tree inner_type,
update_complex_assignment (gsi, rr, ri);
}
-/* Expand complex division to scalars, modified algorithm to minimize
+/* Keep this algorithm in sync with fold-const.c:const_binop().
+
+ Expand complex division to scalars, modified algorithm to minimize
overflow with wide input ranges. */
static void