[Cbe-oss-dev] Does the gcc attribute ((aligned 128))); work?

Sylvain HENRY hsyl20 at gmail.com
Wed May 27 07:40:51 EST 2009


Hi,

Guilherme Cox a écrit :
> Hi,
>
> I don't know if this is the best place to talk about this kind of
> stuff, but I asked on the Forum and I didn't get any good answer. If
> here is not the place, let me know where I can send my email.
>
> In the programming tutorial, it says:
>
> "The MFC supports naturally aligned transfer sizes of 1, 2, 4, or 8
> bytes, and multiples of 16-bytes, with a maximum transfer size of 16
> KB. Peak performance can be achieved for transfers when both the EA
> and LSA are 128-byte aligned and the size of the transfer is a
> multiple of 128 bytes."
>
> When I define a variable:
>
> int a attribute ((aligned 128)));
>
> and check out the address &a, it's not 128bytes aligned..
>
> printf( "a is: %p", &a );
>
> the output was:
> a is: 0xfffff826010
>
> if a is 128 byte aligned this address is invalid.
>
> Am I doing something wrong?
>   
Are you using global variable or local variable (on the stack)? I had 
the same problem with local variables. Obviously the compiler has no way 
to know statically what will be the alignment of the stack pointer when 
the function will be called.

> I tested the same on SPE and got the same result (not the same address
> but an address not aligned ;))
>
> Thank's for any information, even if I am totally wrong in my concepts..
>
> Guilherme
>   
Cheers,

Sylvain



More information about the cbe-oss-dev mailing list