renamed SubSP to SubSPandCopy, add some constants
[libfirm] / ir / be / test / confirm.c
1 #include <stdio.h>
2
3 int looptest(int x) {
4         while (x) {
5                 printf("%d\n", x);
6         }
7         if (x) {
8                 printf("%d\n", x);
9         }
10 }
11
12
13 int xtest(int x) {
14         if (x) {
15                 printf("%d\n", x);
16         }
17         if (x) {
18                 printf("%d\n", x);
19         }
20 }
21
22 int test(int a, int b) {
23         int x = a * b;
24         if (a == 0)
25                 return x;
26         else
27                 return x - 1;
28 }
29
30 static int abs(int x) {
31         if (x < 0)
32                 return -x;
33         return x;
34 }
35
36 int test2(int a, int b) {
37         if (a > 0) {
38                 return abs(a);
39         }
40         return b;
41 }
42
43 int test3(int a, int b) {
44         if (a != 0) {
45                 b = b / -a;
46         }
47         return b;
48 }
49
50 int main(void) {
51         looptest(0);
52         printf("xtest() = %d\n", xtest(1));
53         printf("test() = %d\n", test(0, 1));
54         printf("test2() = %d\n", test2(1, 3));
55         printf("test3() = %d\n", test3(-3, 3));
56         return 0;
57 }