[power-gnu-discuss] -te500v2 and packed attribute

S. Couture & K. Musgrove muscou at sympatico.ca
Thu May 8 00:45:28 UTC 2008


Mark Mitchell wrote:
> S. Couture & K. Musgrove wrote:
>> This seem to be a bug, the code generated is byte access only.
>
>> # cat test.c
>> struct a_packed{
>>    int data;
>> } __attribute__((packed));
>> struct a_unpacked{
>>    int data;
>> };
>> void test_packed(int in)
>> {     struct a_packed * ptr;
>>    ptr->data = in;
>> }
>> void test_unpacked(int in)
>> {     struct a_unpacked * ptr;
>>    ptr->data = in;
>> }
>
> The compiler cannot assume anything about alignment of a packed 
> structure and therefore cannot assume that "ptr->data" as at a 
> byte-aligned address.
>
Thanks altough the same compiler using -te600 generates dword access for 
both packed and unpacked and I am not aware of any limitation in the 
e500 architecture wrt to unaligned access.  This has serious performance 
implications for e500 users.



More information about the power-gnu-discuss mailing list