PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20050316-1.c
blob0a285d73ec800b276b457edf3d4bbf3725866262
1 /* PR rtl-optimization/16104 */
2 /* { dg-require-effective-target int32plus } */
3 /* { dg-options "-Wno-psabi" } */
5 extern void abort (void);
7 typedef int V2SI __attribute__ ((vector_size (8)));
8 typedef unsigned int V2USI __attribute__ ((vector_size (8)));
9 typedef short V2HI __attribute__ ((vector_size (4)));
10 typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
12 int
13 test1 (void)
15 return (long long) (V2SI) 0LL;
18 int
19 test2 (V2SI x)
21 return (long long) x;
24 V2SI
25 test3 (void)
27 return (V2SI) (long long) (int) (V2HI) 0;
30 V2SI
31 test4 (V2HI x)
33 return (V2SI) (long long) (int) x;
36 V2SI
37 test5 (V2USI x)
39 return (V2SI) x;
42 int
43 main (void)
45 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
46 return 0;
48 if (test1 () != 0)
49 abort ();
51 V2SI x = { 2, 2 };
52 if (test2 (x) != 2)
53 abort ();
55 union { V2SI x; int y[2]; V2USI z; long long l; } u;
56 u.x = test3 ();
57 if (u.y[0] != 0 || u.y[1] != 0)
58 abort ();
60 V2HI y = { 4, 4 };
61 union { V2SI x; long long y; } v;
62 v.x = test4 (y);
63 if (v.y != 0x40004)
64 abort ();
66 V2USI z = { 6, 6 };
67 u.x = test5 (z);
68 if (u.y[0] != 6 || u.y[1] != 6)
69 abort ();
70 return 0;