From: Tamar Christina Date: Tue, 2 May 2017 15:20:47 +0000 (+0000) Subject: expr.c (expand_expr_real_2): Re-cost if previous costs are the same. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=22677ff0c4bd069d574a57c9a45efdcc89578560;p=gcc.git expr.c (expand_expr_real_2): Re-cost if previous costs are the same. 2017-04-26 Tamar Christina * expr.c (expand_expr_real_2): Re-cost if previous costs are the same. From-SVN: r247505 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 00f21e71c5d..b177645b802 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-04-26 Tamar Christina + + * expr.c (expand_expr_real_2): Re-cost if previous costs are the same. + 2017-04-27 Tamar Christina * simplify-rtx.c (simplify_binary_operation_1): Add LSHIFTRT case. diff --git a/gcc/expr.c b/gcc/expr.c index c5c50e015ad..4749cc508b8 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8838,6 +8838,15 @@ expand_expr_real_2 (sepops ops, rtx target, machine_mode tmode, end_sequence (); unsigned uns_cost = seq_cost (uns_insns, speed_p); unsigned sgn_cost = seq_cost (sgn_insns, speed_p); + + /* If costs are the same then use as tie breaker the other + other factor. */ + if (uns_cost == sgn_cost) + { + uns_cost = seq_cost (uns_insns, !speed_p); + sgn_cost = seq_cost (sgn_insns, !speed_p); + } + if (uns_cost < sgn_cost || (uns_cost == sgn_cost && unsignedp)) { emit_insn (uns_insns);