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:07:53 +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 #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
The issues mentioned above have been fixed by the treg_set_expr patch
(r220081).
There is one more thing, though:
int test2 (int x)
{
return x < 0;
}
It's effectively a lshiftrt 31 and compiles to:
shll r4
rts
movt r0
On SH2A the same can be done as:
cmp/pz r4
rts
movrt r0
which avoids mutating the input operand of the comparison. On non-SH2A this
would end up as:
cmp/pz r4
mov #-1,r0
rts
negc r0,r0
which could be better than shll-movt in cases where the input operand is not
dead after the insn and even better if the -1 constant can be shared.