Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/20050316-3.c

raw
1 /* { dg-options "-Wno-psabi" } */
2 extern void abort (void);
3
4 typedef int V2SI __attribute__ ((vector_size (8)));
5 typedef unsigned int V2USI __attribute__ ((vector_size (8)));
6 typedef short V2HI __attribute__ ((vector_size (4)));
7 typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
8
9 V2USI
10 test1 (V2SI x)
11 {
12 return (V2USI) (V2SI) (long long) x;
13 }
14
15 long long
16 test2 (V2SI x)
17 {
18 return (long long) (V2USI) (V2SI) (long long) x;
19 }
20
21 int
22 main (void)
23 {
24 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
25 return 0;
26
27 union { V2SI x; int y[2]; V2USI z; long long l; } u;
28 V2SI a = { -3, -3 };
29 u.z = test1 (a);
30 if (u.y[0] != -3 || u.y[1] != -3)
31 abort ();
32
33 u.l = test2 (a);
34 if (u.y[0] != -3 || u.y[1] != -3)
35 abort ();
36 return 0;
37 }