diff options
author | jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-21 15:41:59 +0000 |
---|---|---|
committer | jgreenhalgh <jgreenhalgh@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-07-21 15:41:59 +0000 |
commit | 1575bb3ddb4ae6db206ce9b90051b8eb7785bf3c (patch) | |
tree | 7ac5f6a54c660c17fb69f44c672abf5ac9f9aa6c /gcc/optabs.c | |
parent | 3b0d72939125a8004eac769314db928b0ce7fa6a (diff) |
[Patch 3/2 ifcvt costs] Don't expand a conditional move between identical sources
gcc/
* optabs.c (emit_condiitonal_move): Short circuit for identical
sources.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@238595 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index 51e10e21769..87b4f978420 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. */ |