Small ChangeLog tweak.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr16104-1.c
blobad5eda65fca96490f938f45f2e8ba843c7e7b620
1 /* PR rtl-optimization/16104 */
2 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
3 /* { dg-options "-msse2" } */
4 /* { dg-require-effective-target sse2_runtime } */
6 extern void abort (void);
8 typedef int V2SI __attribute__ ((vector_size (8)));
9 typedef unsigned int V2USI __attribute__ ((vector_size (8)));
10 typedef short V2HI __attribute__ ((vector_size (4)));
11 typedef unsigned int V2UHI __attribute__ ((vector_size (4)));
13 int
14 test1 (void)
16 return (long long) (V2SI) 0LL;
19 int
20 test2 (V2SI x)
22 return (long long) x;
25 V2SI
26 test3 (void)
28 return (V2SI) (long long) (int) (V2HI) 0;
31 V2SI
32 test4 (V2HI x)
34 return (V2SI) (long long) (int) x;
37 V2SI
38 test5 (V2USI x)
40 return (V2SI) x;
43 void
44 __attribute__ ((noinline))
45 do_test (void)
47 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
48 return;
50 if (test1 () != 0)
51 abort ();
53 V2SI x = { 2, 2 };
54 if (test2 (x) != 2)
55 abort ();
57 union { V2SI x; int y[2]; V2USI z; long long l; } u;
58 u.x = test3 ();
59 if (u.y[0] != 0 || u.y[1] != 0)
60 abort ();
62 V2HI y = { 4, 4 };
63 union { V2SI x; long long y; } v;
64 v.x = test4 (y);
65 if (v.y != 0x40004)
66 abort ();
68 V2USI z = { 6, 6 };
69 u.x = test5 (z);
70 if (u.y[0] != 6 || u.y[1] != 6)
71 abort ();
74 int
75 main (void)
77 do_test ();
78 return 0;