PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr37573.c
blob173a8d478881245e96086b7f3f1cd4e8b0afef66
1 /* PR tree-optimization/37573 */
2 /* { dg-require-effective-target int32plus } */
4 struct S
6 unsigned int *a;
7 unsigned int b;
8 unsigned int c[624];
9 };
11 static unsigned char __attribute__((noinline))
12 foo (struct S *s)
14 unsigned int r;
15 if (!--s->b)
17 unsigned int *c = s->c;
18 unsigned int i;
19 s->a = c;
20 for (i = 0; i < 227; i++)
21 c[i] = ((((c[i] ^ c[i + 1]) & 0x7ffffffe) ^ c[i]) >> 1)
22 ^ ((0 - (c[i + 1] & 1)) & 0x9908b0df) ^ c[i + 397];
24 r = *(s->a++);
25 r ^= (r >> 11);
26 r ^= ((r & 0xff3a58ad) << 7);
27 r ^= ((r & 0xffffdf8c) << 15);
28 r ^= (r >> 18);
29 return (unsigned char) (r >> 1);
32 static void __attribute__((noinline))
33 bar (unsigned char *p, unsigned int q, unsigned int r)
35 struct S s;
36 unsigned int i;
37 unsigned int *c = s.c;
38 *c = r;
39 for (i = 1; i < 624; i++)
40 c[i] = i + 0x6c078965 * ((c[i - 1] >> 30) ^ c[i - 1]);
41 s.b = 1;
42 while (q--)
43 *p++ ^= foo (&s);
46 static unsigned char p[23] = {
47 0xc0, 0x49, 0x17, 0x32, 0x62, 0x1e, 0x2e, 0xd5, 0x4c, 0x19, 0x28, 0x49,
48 0x91, 0xe4, 0x72, 0x83, 0x91, 0x3d, 0x93, 0x83, 0xb3, 0x61, 0x38
51 static unsigned char q[23] = {
52 0x3e, 0x41, 0x55, 0x54, 0x4f, 0x49, 0x54, 0x20, 0x55, 0x4e, 0x49, 0x43,
53 0x4f, 0x44, 0x45, 0x20, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x3c
56 int
57 main (void)
59 unsigned int s;
60 s = 23;
61 bar (p, s, s + 0xa25e);
62 if (__builtin_memcmp (p, q, s) != 0)
63 __builtin_abort ();
64 return 0;