PR target/84524
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr84524.c
blob8ca07153fb449649ce518a2a9451ed3628d4b09c
1 /* PR target/84524 */
3 __attribute__((noipa)) void
4 foo (unsigned short *x)
6 unsigned short i, v;
7 unsigned char j;
8 for (i = 0; i < 256; i++)
10 v = i << 8;
11 for (j = 0; j < 8; j++)
12 if (v & 0x8000)
13 v = (v << 1) ^ 0x1021;
14 else
15 v = v << 1;
16 x[i] = v;
20 int
21 main ()
23 unsigned short a[256];
25 foo (a);
26 for (int i = 0; i < 256; i++)
28 unsigned short v = i << 8;
29 for (int j = 0; j < 8; j++)
31 asm volatile ("" : "+r" (v));
32 if (v & 0x8000)
33 v = (v << 1) ^ 0x1021;
34 else
35 v = v << 1;
37 if (a[i] != v)
38 __builtin_abort ();
40 return 0;