This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How to determine access alignment in RTL ?
- From: Geert Bosch <bosch at gnat dot com>
- To: Jim Wilson <wilson at specifixinc dot com>
- Cc: gcc at gcc dot gnu dot org, Yossi Markovich <YOSSIM at il dot ibm dot com>
- Date: Tue, 23 Dec 2003 09:14:10 -0500
- Subject: Re: How to determine access alignment in RTL ?
- References: <OFF34991A6.C8D8DF8F-ONC2256E05.0031DEF7-C2256E05.00321D10@il.ibm.com>
Jim Wilson wrote:
Attribute align does not work that way for arrays. ints have size 32
bits, and thus a random array element has only 32-bit alignment. Even
if we align the base address of A to 128 bits, A[1] is that address
plus
32-bits, and thus can only have 32-bit alignment. If you want each
array element to have 128-bit alignment, then the array elements must
each be 128-bits in size.
Still, it does make sense to align an array of 32-bit elements to
128 bits. This way you know you can easier use vector instructions
for operations on whole arrays (such as those defined by Ada).
Even for machines without vector instructions, it is good to know
an array of char is word aligned for operations such as copying.
-Geert