AVR: target/84211 - Add a post reload register optimization pass.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr48702.c
blob1ec371da8e485685631133cbe294ca5c964c72ee
1 /* { dg-do run } */
3 extern void abort (void);
5 #define LEN 4
7 static inline void unpack(int array[LEN])
9 int ii, val;
10 val = 1;
11 for (ii = 0; ii < LEN; ii++) {
12 array[ii] = val % 2;
13 val = val / 2;
17 static inline int pack(int array[LEN])
19 int ans, ii;
20 ans = 0;
21 for (ii = LEN-1; ii >= 0; ii--) {
22 ans = 2 * ans + array[ii];
24 return ans;
27 int __attribute__((noinline))
28 foo()
30 int temp, ans;
31 int array[LEN];
32 unpack(array);
33 temp = array[0];
34 array[0] = array[2];
35 array[2] = temp;
36 ans = pack(array);
37 return ans;
40 int main(void)
42 int val;
43 val = foo();
44 if (val != 4)
45 abort ();
46 return 0;