This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/40900] New: redundant sign extend of short function returned value
- From: "carrot at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jul 2009 08:56:19 -0000
- Subject: [Bug target/40900] New: redundant sign extend of short function returned value
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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