1/* PR rtl-optimization/16104 */
2/* { dg-require-effective-target int32plus } */
3/* { dg-options "-Wno-psabi" } */
4
5extern void abort (void);
6
7typedef int V2SI __attribute__ ((vector_size (8)));
8typedef unsigned int V2USI __attribute__ ((vector_size (8)));
9typedef short V2HI __attribute__ ((vector_size (4)));
10typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
11
12int
13test1 (void)
14{
15  return (long long) (V2SI) 0LL;
16}
17
18int
19test2 (V2SI x)
20{
21  return (long long) x;
22}
23
24V2SI
25test3 (void)
26{
27  return (V2SI) (long long) (int) (V2HI) 0;
28}
29
30V2SI
31test4 (V2HI x)
32{
33  return (V2SI) (long long) (int) x;
34}
35
36V2SI
37test5 (V2USI x)
38{
39  return (V2SI) x;
40}
41
42int
43main (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