gcc/
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20050316-2.c
blobc6487774d375769788d20baa7755d74ad4cf0d0c
1 extern void abort (void);
3 typedef int V2SI __attribute__ ((vector_size (8)));
4 typedef unsigned int V2USI __attribute__ ((vector_size (8)));
5 typedef float V2SF __attribute__ ((vector_size (8)));
6 typedef short V2HI __attribute__ ((vector_size (4)));
7 typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
9 long long
10 test1 (V2SF x)
12 return (long long) (V2SI) x;
15 long long
16 test2 (V2SF x)
18 return (long long) x;
21 long long
22 test3 (V2SI x)
24 return (long long) (V2SF) x;
27 int
28 main (void)
30 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
31 return 0;
33 V2SF x = { 2.0, 2.0 };
34 union { long long l; float f[2]; int i[2]; } u;
35 u.l = test1 (x);
36 if (u.f[0] != 2.0 || u.f[1] != 2.0)
37 abort ();
39 V2SF y = { 6.0, 6.0 };
40 u.l = test2 (y);
41 if (u.f[0] != 6.0 || u.f[1] != 6.0)
42 abort ();
44 V2SI z = { 4, 4 };
45 u.l = test3 (z);
46 if (u.i[0] != 4 || u.i[1] != 4)
47 abort ();
48 return 0;