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/40900] New: redundant sign extend of short function returned value


Compile the following code with options -Os -mthumb -march=armv5te

extern short shortv2();
short shortv1()
{
  return shortv2();
}

Gcc generates

        push    {r3, lr}
        bl      shortv2
        lsl     r0, r0, #16    // A
        asr     r0, r0, #16    // B
        pop     {r3, pc}

The returned value in register r0 is already a sign extended short value, but
instructions A and B sign extend it again. So these two instructions are
redundant.


-- 
           Summary: redundant sign extend of short function returned value
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carrot at google dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-eabi


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


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