This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/59533] [SH] Missed cmp/pz opportunity


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]