aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2017-05-02 15:20:47 +0000
committerTamar Christina <tnfchris@gcc.gnu.org>2017-05-02 15:20:47 +0000
commit22677ff0c4bd069d574a57c9a45efdcc89578560 (patch)
tree5c7b10e0e3db06e515bea76842fbfdb296a53b1d /gcc/expr.c
parentcc5b8f3d568e95ce74e03d8d87ada71117a6c106 (diff)
downloadgcc-22677ff0c4bd069d574a57c9a45efdcc89578560.zip
gcc-22677ff0c4bd069d574a57c9a45efdcc89578560.tar.gz
gcc-22677ff0c4bd069d574a57c9a45efdcc89578560.tar.bz2
expr.c (expand_expr_real_2): Re-cost if previous costs are the same.
2017-04-26 Tamar Christina <tamar.christina@arm.com> * expr.c (expand_expr_real_2): Re-cost if previous costs are the same. From-SVN: r247505
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 c5c50e0..4749cc5 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);