[Bug rtl-optimization/46888] New: missed optimization of zero_extract with constant inputs
ams at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 10 16:59:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46888
Summary: missed optimization of zero_extract with constant
inputs
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ams@gcc.gnu.org
The compiler fails to do constant folding for bit fields, at least on ARM
targets, and instead builds the constant at run time.
Test case:
struct bits
{
unsigned a:5;
unsigned b:5;
unsigned c:5;
unsigned d:5;
};
struct bits
f (unsigned int a)
{
struct bits bits = {0,0,0,0};
bits.a = 1;
bits.b = 2;
bits.c = 3;
bits.d = a;
return bits;
}
Output, compiled for ARM with "-O2 -mcpu=cortex-a8 -mthumb":
movs r2, #1
movs r3, #0
bfi r3, r2, #0, #5
movs r2, #2
bfi r3, r2, #5, #5
movs r2, #3
bfi r3, r2, #10, #5
bfi r3, r0, #15, #5
mov r0, r3
bx lr
More information about the Gcc-bugs
mailing list