Some more boolopt tests.
[libfirm] / ir / be / test / fehler71.c
1 /*$ -fno-if-conv -fno-inline $*/
2
3 #include <stdio.h>
4 #include <stdlib.h>
5
6 int a = 42;
7
8 int changea(void) {
9         a = 13;
10         return 1;
11 }
12
13 int f2(void) {
14         int t = a;
15         int t2 = changea();
16         changea();
17         changea();
18         int t3 = t + t2;
19         changea();
20         return t3;
21 }
22
23 int f(int f) {
24         int t = a;
25         changea();
26
27         /* must not use source address mode (loading from a) for t+1 */
28         if(f > 10000) {
29                 return t + 1;
30         }
31         return f + 2;
32 }
33
34 int main(void) {
35         srand(0);
36         printf("Res: %d (should be 43)\n", f(1000000));
37         a = 42;
38         printf("Res2: %d (should be 43)\n", f2());
39         return 0;
40 }