expr.c (expand_expr_real_2): Re-cost if previous costs are the same.
authorTamar Christina <tamar.christina@arm.com>
Tue, 2 May 2017 15:20:47 +0000 (15:20 +0000)
committerTamar Christina <tnfchris@gcc.gnu.org>
Tue, 2 May 2017 15:20:47 +0000 (15:20 +0000)
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

gcc/ChangeLog
gcc/expr.c

index 00f21e71c5d1a2e9a1e036976e8ebf57de40dd36..b177645b802407f4e5a59b74a40ec5cefadb322d 100644 (file)
@@ -1,3 +1,7 @@
+2017-04-26  Tamar Christina  <tamar.christina@arm.com>
+
+       * expr.c (expand_expr_real_2): Re-cost if previous costs are the same.
+
 2017-04-27  Tamar Christina  <tamar.christina@arm.com>
 
        * simplify-rtx.c (simplify_binary_operation_1): Add LSHIFTRT case.
index c5c50e015ad18db9e64e50471f44f71313a04a1e..4749cc508b88600d880ce9ed130a1e58cf60e97b 100644 (file)
@@ -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);