This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Altivec + 16 byte alignment
- From: Daniel Egger <degger at fhm dot edu>
- To: Gianni Tedesco <gianni at scaramanga dot co dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: 12 Feb 2003 01:54:50 +0100
- Subject: Re: Altivec + 16 byte alignment
- Organization:
- References: <1044958034.1117.67.camel@lemsip>
On Tue, 2003-02-11 at 11:07, Gianni Tedesco wrote:
> gcc version 2.95.4 20010319 (prerelease/franzo/20011204)
Please do yourself a favour and ditch that Motorola crap. Gcc supports
AltiVec natively since 3.1 and does a much better job at things similar
to your problem.
Your problem is fixed by supplying the -mabi=altivec switch to gcc 3.1
or later as demonstrated by the following dump program:
struct vector {
float x,y,z,w;
}__attribute__((aligned(16)));
int main (void)
{
short a = 0;
struct vector b = {1, 2, 3};
int c = 4;
struct vector d = {4, 5, 6};
printf ("address: %p\n", &a);
printf ("address: %p\n", &b);
printf ("address: %p\n", &c);
printf ("address: %p\n", &d);
}
egger@sonja:~$ gcc -o test test.c
egger@sonja:~$ ./test
address: 0x7ffff9a8
address: 0x7ffff9b0
address: 0x7ffff9c0
address: 0x7ffff9c8
egger@sonja:~$ gcc -mabi=altivec -o test test.c
egger@sonja:~$ ./test
address: 0x7ffff9a8
address: 0x7ffff9b0
address: 0x7ffff9c0
address: 0x7ffff9d0
> PS. Is there any documentation about the vector support directly in C? I
> hear gcc3 has that feature.
Check back with altivec.h in gcc 3.1 or later. The C implementation is
horrible though compared to the C++ one realized with overloading.
--
Servus,
Daniel