1 /* PR rtl-optimization/16104 */
2 /* { dg-require-effective-target int32plus } */
3 /* { dg-options "-Wno-psabi" } */
4 
5 extern void abort (void);
6 
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)));
11 
12 int
test1(void)13 test1 (void)
14 {
15   return (long long) (V2SI) 0LL;
16 }
17 
18 int
test2(V2SI x)19 test2 (V2SI x)
20 {
21   return (long long) x;
22 }
23 
24 V2SI
test3(void)25 test3 (void)
26 {
27   return (V2SI) (long long) (int) (V2HI) 0;
28 }
29 
30 V2SI
test4(V2HI x)31 test4 (V2HI x)
32 {
33   return (V2SI) (long long) (int) x;
34 }
35 
36 V2SI
test5(V2USI x)37 test5 (V2USI x)
38 {
39   return (V2SI) x;
40 }
41 
42 int
main(void)43 main (void)
44 {
45   if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
46     return 0;
47 
48   if (test1 () != 0)
49     abort ();
50 
51   V2SI x = { 2, 2 };
52   if (test2 (x) != 2)
53     abort ();
54 
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 ();
59 
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 ();
65 
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;
71 }
72