https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53987

--- Comment #12 from Oleg Endo <olegendo at gcc dot gnu.org> ---
The following case:

int
fun_01 (char* x, char* y, int z)
{
  return ((x[1] & x[2] & x[3]) == 0) + z;
}

results in:
        add     #1,r4
        mov.b   @r4+,r2
        mov     #0,r0
        mov.b   @r4+,r1
        and     r2,r1
        mov.b   @r4+,r2
        extu.b  r1,r1     <<< unnecessary
        tst     r2,r1
        rts     
        addc    r6,r0

The tstsi_t splitter has some code to eliminate some sign/zero extensions but
it doesn't see through the and/or/xor insns.  Maybe it's better to a separate
pass that optimizes sign/zero extensions instead of adding more clutter to the
splitters.

Reply via email to