summaryrefslogtreecommitdiff
path: root/gcc/tree-complex.c
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-24 20:44:55 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-24 20:44:55 +0000
commit03a7d9e96c2162143894318f0a6a9f48a8adda71 (patch)
tree942e85ee11d063e393b8d23171086e6c6108a90e /gcc/tree-complex.c
parentf8e7cebd1294cf9a424e36027401c4f394a44ccc (diff)
downloadgcc-03a7d9e96c2162143894318f0a6a9f48a8adda71.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152145 138bc75d-0d04-0410-961f-82ee72b054a4
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 f6918056a68..199f1dcf54c 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