On Power : GCC2 optimises better than GCC4??
Mark Colby
markc at liferacing.com
Wed Dec 23 15:13:57 UTC 2009
Sounds a dumb question I know. However the following code snippet
results in many more machine instructions under 4.4.1 than under 2.9.5:
typedef unsigned int U32;
typedef union
{
U32 R;
struct
{
U32 BF1:2;
U32 :8;
U32 BF2:2;
U32 BF3:2;
U32 :18;
} B;
} TEST_t;
U32 testFunc(void)
{
TEST_t t;
t.R=0;
t.B.BF1=2;
t.B.BF2=3;
t.B.BF3=1;
return t.R;
}
Output under 4.4.1 (powerpc-eabi-gcc-4-4-1 -O3 -S gcc-test.cpp -o
gcc-test-441.s):
li 0,2
li 3,0
rlwimi 3,0,30,0,1
li 0,3
rlwimi 3,0,20,10,11
li 0,1
rlwimi 3,0,18,12,13
blr
Output under 2.9.5 (powerpc-eabi-gcc-2-9-5 -O3 -S gcc-test.cpp -o
gcc-test-295.s):
lis 3,0x8034
blr
What am I missing? Many thanks if you can shed any light on this.
Mark
*****************************************************************
This email has been checked by the altohiway Mailcontroller Service
*****************************************************************
More information about the power-gnu-discuss
mailing list