A colleague at ARM found this a couple of days back.
With trunk as of a few days back configured for arm-none-eabi for cortex-a8
typedef unsigned short ushort;
typedef unsigned char uchar;
ushort foo(uchar data, uchar data1, uchar data2)
{
uchar x = (uchar)(data);
x ^= (x + 5);
x ^= (x << 2);
x ^= (x << 1);
return x;
}
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
add r3, r0, #5
eor r0, r3, r0
uxtb r0, r0 //redundant
eor r0, r0, r0, lsl #2
uxtb r0, r0 // redundant
eor r0, r0, r0, lsl #1
uxtb r0, r0
bx lr
--
Summary: Extra zero extensions produced for ARM.
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ramana at gcc dot gnu dot org
GCC build triplet: x86_64-linux
GCC host triplet: x86_64-linux
GCC target triplet: arm-eabi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40487