This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/59533] [SH] Missed cmp/pz opportunity
- From: "olegendo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 25 Jan 2015 17:40:43 +0000
- Subject: [Bug target/59533] [SH] Missed cmp/pz opportunity
- Auto-submitted: auto-generated
- References: <bug-59533-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59533
--- Comment #7 from Oleg Endo <olegendo at gcc dot gnu.org> ---
If a shll is followed by a cbranch:
unsigned int
test_09_0 (int x, unsigned int y, unsigned int z)
{
return ~(x >> 31) ? y : z;
}
shll r4
bf .L4
mov r6,r5
.L4:
rts
mov r5,r0
it's better to use cmp/pz and invert the branch condition.
Combine is looking for the following pattern:
Failed to match this instruction:
(set (pc)
(if_then_else (ge (reg:SI 4 r4 [ x ])
(const_int 0 [0]))
(label_ref:SI 17)
(pc)))
One option could be adding a pattern like:
(define_insn_and_split "*cbranch"
[(set (pc)
(if_then_else (match_operand 0 "treg_set_expr")
(label_ref (match_operand 1))
(pc)))
(clobber (reg:SI T_REG))]