aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/optabs.c11
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 602c7b8..0757c89 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2016-07-21 James Greenhalgh <james.greenhalgh@arm.com>
+ * optabs.c (emit_condiitonal_move): Short circuit for identical
+ sources.
+
+2016-07-21 James Greenhalgh <james.greenhalgh@arm.com>
+
* ifcvt.c (noce_if_info): New fields: speed_p, original_cost,
max_seq_cost. Removed fields: then_cost, else_cost, branch_cost.
(noce_conversion_profitable_p): New.
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 51e10e2..87b4f97 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4214,6 +4214,17 @@ emit_conditional_move (rtx target, enum rtx_code code, rtx op0, rtx op1,
enum insn_code icode;
enum rtx_code reversed;
+ /* If the two source operands are identical, that's just a move. */
+
+ if (rtx_equal_p (op2, op3))
+ {
+ if (!target)
+ target = gen_reg_rtx (mode);
+
+ emit_move_insn (target, op3);
+ return target;
+ }
+
/* If one operand is constant, make it the second one. Only do this
if the other operand is not constant as well. */