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
*/
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
/* Examine |br| < |bi|, and branch. */
t1 = gimplify_build1 (gsi, ABS_EXPR, inner_type, br);
t2 = gimplify_build1 (gsi, ABS_EXPR, inner_type, bi);
- compare = fold_build2 (LT_EXPR, boolean_type_node, t1, t2);
+ compare = fold_build2_loc (gimple_location (gsi_stmt (*gsi)),
+ LT_EXPR, boolean_type_node, t1, t2);
STRIP_NOPS (compare);
bb_cond = bb_true = bb_false = bb_join = NULL;
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);
- cond = fold_build2 (EQ_EXPR, boolean_type_node, tmp, boolean_true_node);
+ cond = fold_build2_loc (gimple_location (stmt),
+ EQ_EXPR, boolean_type_node, tmp, boolean_true_node);
stmt = gimple_build_cond_from_tree (cond, NULL_TREE, NULL_TREE);
gsi_insert_before (gsi, stmt, GSI_SAME_STMT);