Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/reassoc-46.h

raw
1 #define M 1024
2 unsigned int arr1[M];
3 unsigned int arr2[M];
4 volatile unsigned int sink;
5
6 unsigned int
7 test (void)
8 {
9 unsigned int sum = 0;
10 for (int i = 0; i < M; i++)
11 {
12 #ifdef MODIFY
13 /* Modify the loop accumulator using a chain of operations - this should
14 not affect its rank biasing. */
15 sum |= 1;
16 sum ^= 2;
17 #endif
18 #ifdef STORE
19 /* Save the loop accumulator into a global variable - this should not
20 affect its rank biasing. */
21 sink = sum;
22 #endif
23 #ifdef USE
24 /* Add a tricky use of the loop accumulator - this should prevent its
25 rank biasing. */
26 i = (i + sum) % M;
27 #endif
28 /* Use addends with different ranks. */
29 sum += arr1[i];
30 sum += arr2[((i ^ 1) + 1) % M];
31 }
32 return sum;
33 }