This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: handle user-defined alignment on SPU
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: trevor_smigiel at playstation dot sony dot com
- Cc: bje at au1 dot ibm dot com (Ben Elliston), gcc-patches at gcc dot gnu dot org, Ulrich dot Weigand at de dot ibm dot com (Ulrich Weigand)
- Date: Tue, 12 Dec 2006 13:37:24 +0100 (CET)
- Subject: Re: PATCH: handle user-defined alignment on SPU
Trevor Smigiel wrote:
> The following test case will fail, with or without this patch.
>
> extern void exit (int);
> extern void abort (void);
> int a = 1;
> int b __attribute__ ((__aligned__(4))) = 2;
> int main()
> {
> a = 3;
> if (b != 2)
> abort ();
> exit (0);
> }
>
> Can you adjust your patch to make it work? Perhaps special
> data sections for data with less than 16-byte alignment.
>
> The SPU backend assumes all objects are aligned to 16 bytes, which means
> that they are also all padded to 16 bytes. It does this so it can use
> single instruction loads and stores to access scalar objects.
Right. The patch does fix the problem it was originally implemented
to solve, because the aligned variables in crtstuff.c are in sections
of their own anyway (.ctors / .dtors).
However, to make it more generally useful, I agree that variables
defined with non-standard alignment (but without any specical section
assignment) should by default be moved to another section. What about
.data.unaligned and .bss.unaligned?
Do you think this should be explicitly specified in the ABI, or would
this simply be an extension? The ABI currently does not allow for
global data variables with less than 16 bytes alignment at all.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com