Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Subject: Re: [power-gnu-discuss] -te500v2 and packed attribute
  • From: "S. Couture & K. Musgrove" <muscou@xxxxxxxxxxxx>
  • Date: Wed, 07 May 2008 20:45:28 -0400

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.