http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53988

             Bug #: 53988
           Summary: [SH] tst Rm,Rn not used for QI/HImode
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: olege...@gcc.gnu.org
            Target: sh*-*-*


The following functions:

int test_00 (unsigned char* a, unsigned char* b, int c, int d)
{
  if (*a & *b)
    return c;
  return d;
}

int test_01 (char* a, char* b, int c, int d)
{
  if (*a & *b)
    return c;
  return d;
}

get compiled to:
        mov.b   @r4,r1  ! 10    *extendqisi2_compact_snd
        mov.b   @r5,r0  ! 11    *extendqisi2_compact_snd
        and     r1,r0   ! 12    *andsi_compact/4
        tst     #255,r0 ! 15    tstqi_t_zero
        bf      .L9     ! 16    branch_false
        mov     r7,r6   ! 7    movsi_ie/2
.L9:
        rts             ! 49    *return_i
        mov     r6,r0   ! 24    movsi_ie/2


which should actually result in:
        mov.b   @r4,r1
        mov.b   @r5,r2
        tst     r1,r2
        bf      .L9
        mov     r7,r6
.L9:
        rts
        mov     r6,r0

The same happens for QImode and HImode.

Reply via email to