Debian Codegraph @

gcc/testsuite/gcc.dg/torture/pr16104-1.c

raw
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 } */
5
6 extern void abort (void);
7
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)));
12
13 int
14 test1 (void)
15 {
16 return (long long) (V2SI) 0LL;
17 }
18
19 int
20 test2 (V2SI x)
21 {
22 return (long long) x;
23 }
24
25 V2SI
26 test3 (void)
27 {
28 return (V2SI) (long long) (int) (V2HI) 0;
29 }
30
31 V2SI
32 test4 (V2HI x)
33 {
34 return (V2SI) (long long) (int) x;
35 }
36
37 V2SI
38 test5 (V2USI x)
39 {
40 return (V2SI) x;
41 }
42
43 void
44 __attribute__ ((noinline))
45 do_test (void)
46 {
47 if (sizeof (short) != 2 || sizeof (int) != 4 || sizeof (long long) != 8)
48 return;
49
50 if (test1 () != 0)
51 abort ();
52
53 V2SI x = { 2, 2 };
54 if (test2 (x) != 2)
55 abort ();
56
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 ();
61
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 ();
67
68 V2USI z = { 6, 6 };
69 u.x = test5 (z);
70 if (u.y[0] != 6 || u.y[1] != 6)
71 abort ();
72 }
73
74 int
75 main (void)
76 {
77 do_test ();
78 return 0;
79 }