+ t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, ratio);
+ tr = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, ai);
+
+ t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, ratio);
+ ti = gimplify_build2 (bsi, MINUS_EXPR, inner_type, t1, ar);
+
+ tr = gimplify_build2 (bsi, code, inner_type, tr, div);
+ ti = gimplify_build2 (bsi, code, inner_type, ti, div);
+
+ if (bb_true)
+ {
+ t1 = build (MODIFY_EXPR, inner_type, rr, tr);
+ bsi_insert_before (bsi, t1, BSI_SAME_STMT);
+ t1 = build (MODIFY_EXPR, inner_type, ri, ti);
+ bsi_insert_before (bsi, t1, BSI_SAME_STMT);
+ bsi_remove (bsi);
+ }
+ }
+
+ /* In the FALSE branch, we compute
+ ratio = d/c;
+ divisor = (d * ratio) + c;
+ tr = (b * ratio) + a;
+ ti = b - (a * ratio);
+ tr = tr / div;
+ ti = ti / div; */
+ if (bb_false || integer_zerop (cond))
+ {
+ if (bb_false)
+ {
+ *bsi = bsi_last (bb_false);
+ bsi_insert_after (bsi, build_empty_stmt (), BSI_NEW_STMT);
+ }
+
+ ratio = gimplify_build2 (bsi, code, inner_type, bi, br);
+
+ t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, bi, ratio);
+ div = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, br);
+
+ t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, ratio);
+ tr = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, ar);
+
+ t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ar, ratio);
+ ti = gimplify_build2 (bsi, MINUS_EXPR, inner_type, ai, t1);
+
+ tr = gimplify_build2 (bsi, code, inner_type, tr, div);
+ ti = gimplify_build2 (bsi, code, inner_type, ti, div);
+
+ if (bb_false)
+ {
+ t1 = build (MODIFY_EXPR, inner_type, rr, tr);
+ bsi_insert_before (bsi, t1, BSI_SAME_STMT);
+ t1 = build (MODIFY_EXPR, inner_type, ri, ti);
+ bsi_insert_before (bsi, t1, BSI_SAME_STMT);
+ bsi_remove (bsi);
+ }
+ }
+
+ if (bb_join)
+ *bsi = bsi_start (bb_join);
+ else
+ rr = tr, ri = ti;