aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2017-06-07 15:36:02 +0200
committerYvan Roux <yvan.roux@linaro.org>2017-06-13 08:02:55 +0000
commitcae2dc7f64aeeb7861ce2d6242475f288d88fb4b (patch)
treee5679fe9064635a5c6b9183876f8f5641206d98d /gcc/expr.c
parentd043ff2ac6f8c3ce0a0f0c652f0eedc767f04d7a (diff)
gcc/
Backport from trunk r247505. 2017-04-26 Tamar Christina <tamar.christina@arm.com> * expr.c (expand_expr_real_2): Re-cost if previous costs are the same. Change-Id: If81c130ecd1ba4978d44c4da6778cb6bfe756bbd
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c9
1 files changed, 9 insertions, 0 deletions
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);