[NDS32] Add intrinsic functions for TLB operation and data prefech.
[official-gcc.git] / gcc / testsuite / gcc.dg / pr57233.c
blob484844e491d5e5052336e672c659df3ca116d295
1 /* PR tree-optimization/57233 */
2 /* { dg-do run { target { ilp32 || lp64 } } } */
3 /* { dg-options "-O2" } */
4 /* { dg-additional-options "-fno-common" { target hppa*-*-hpux* } } */
6 typedef unsigned V4 __attribute__((vector_size(4 * sizeof (int))));
7 typedef unsigned V8 __attribute__((vector_size(8 * sizeof (int))));
8 typedef unsigned V16 __attribute__((vector_size(16 * sizeof (int))));
9 V4 a, b, g;
10 V8 c, d, h;
11 V16 e, f, j;
13 __attribute__((noinline)) void
14 f1 (void)
16 a = (a << 2) | (a >> 30);
19 __attribute__((noinline)) void
20 f2 (void)
22 a = (a << 30) | (a >> 2);
25 __attribute__((noinline)) void
26 f3 (void)
28 a = (a << b) | (a >> (32 - b));
31 __attribute__((noinline, noclone)) void
32 f4 (int x)
34 a = (a << x) | (a >> (32 - x));
37 __attribute__((noinline)) void
38 f5 (void)
40 c = (c << 2) | (c >> 30);
43 __attribute__((noinline)) void
44 f6 (void)
46 c = (c << 30) | (c >> 2);
49 __attribute__((noinline)) void
50 f7 (void)
52 c = (c << d) | (c >> (32 - d));
55 __attribute__((noinline, noclone)) void
56 f8 (int x)
58 c = (c << x) | (c >> (32 - x));
61 __attribute__((noinline)) void
62 f9 (void)
64 e = (e << 2) | (e >> 30);
67 __attribute__((noinline)) void
68 f10 (void)
70 e = (e << 30) | (e >> 2);
73 __attribute__((noinline)) void
74 f11 (void)
76 e = (e << f) | (e >> (32 - f));
79 __attribute__((noinline, noclone)) void
80 f12 (int x)
82 e = (e << x) | (e >> (32 - x));
85 unsigned
86 r (void)
88 static unsigned x = 0xdeadbeefU;
89 static unsigned y = 0x12347654U;
90 static unsigned z = 0x1a2b3c4dU;
91 static unsigned w = 0x87654321U;
92 unsigned t = x ^ (x << 11);
93 x = y;
94 y = z;
95 z = w;
96 w = w ^ (w >> 19) ^ t ^ (t >> 8);
97 return w;
100 void
101 init (unsigned int *p, int count, int mod)
103 int i;
104 for (i = 0; i < count; i++)
106 unsigned int v = r ();
107 if (mod)
108 v = (v % 31) + 1;
109 p[i] = v;
113 void
114 check (unsigned int *p, unsigned int *q, int count, unsigned int *s, int ss)
116 int i;
117 for (i = 0; i < count; i++)
119 if (s)
120 ss = s[i];
121 if (p[i] != ((q[i] << ss) | (q[i] >> (32 - ss))))
122 __builtin_abort ();
127 main ()
129 init ((unsigned int *) &a, 4, 0);
130 init ((unsigned int *) &b, 4, 1);
131 init ((unsigned int *) &c, 8, 0);
132 init ((unsigned int *) &d, 8, 1);
133 init ((unsigned int *) &e, 16, 0);
134 init ((unsigned int *) &f, 16, 1);
135 g = a;
136 h = c;
137 j = e;
138 f1 ();
139 f5 ();
140 f9 ();
141 check ((unsigned int *) &a, (unsigned int *) &g, 4, 0, 2);
142 check ((unsigned int *) &c, (unsigned int *) &h, 8, 0, 2);
143 check ((unsigned int *) &e, (unsigned int *) &j, 16, 0, 2);
144 g = a;
145 h = c;
146 j = e;
147 f2 ();
148 f6 ();
149 f10 ();
150 check ((unsigned int *) &a, (unsigned int *) &g, 4, 0, 30);
151 check ((unsigned int *) &c, (unsigned int *) &h, 8, 0, 30);
152 check ((unsigned int *) &e, (unsigned int *) &j, 16, 0, 30);
153 g = a;
154 h = c;
155 j = e;
156 f3 ();
157 f7 ();
158 f11 ();
159 check ((unsigned int *) &a, (unsigned int *) &g, 4, (unsigned int *) &b, 0);
160 check ((unsigned int *) &c, (unsigned int *) &h, 8, (unsigned int *) &d, 0);
161 check ((unsigned int *) &e, (unsigned int *) &j, 16, (unsigned int *) &f, 0);
162 g = a;
163 h = c;
164 j = e;
165 f4 (5);
166 f8 (5);
167 f12 (5);
168 check ((unsigned int *) &a, (unsigned int *) &g, 4, 0, 5);
169 check ((unsigned int *) &c, (unsigned int *) &h, 8, 0, 5);
170 check ((unsigned int *) &e, (unsigned int *) &j, 16, 0, 5);
171 return 0;