Short example of graph, which needs RN reduction.
[libfirm] / ir / be / test / BinaryOpTest.c
1 /*
2  * File name:   test/BinaryOpTest.c
3  * Purpose:     test binary operators
4  * Author:      Boris Boesler
5  * Modified by: Michael Beck
6  * Created:     X.Y.2003
7  * CVS-ID:      $Id$
8  * Copyright:   (c) 2003 Universitaet Karlsruhe
9  * Licence:
10  */
11
12 #include <stdio.h>
13
14 typedef int boolean;
15 #define true    1
16 #define false   0
17
18 static int id(int i) {
19   return(i);
20 }
21
22 static boolean bid(boolean i) {
23   return(i);
24 }
25
26 static void nop(int i) {
27   printf("  %d\n", i);
28 }
29
30 static void test_and_and(int i, int j) {
31   if((i + 5 == 1) && (j + 4 == 3))
32     nop(1);
33   else
34     nop(2);
35 }
36
37 static void test_or_or(int i, int j) {
38   if((i + 5 == 1) || (i + 4 == 3))
39     nop(1);
40   else
41     nop(2);
42 }
43
44 int main(int argc, char *argv[]) {
45   int i, j;
46   int res;
47   boolean b;
48
49   printf("BinaryOpTest.c\n");
50
51   b = bid(true);
52   if(!b)
53     i = id(1);
54   else
55     i = id(3);
56   j = id(2);
57
58   nop(i << j);
59   nop(i >> j);
60   nop(i & j);
61   nop(i | j);
62   nop(i ^ j);
63   nop(~i);
64
65   nop(i % j);
66   nop(i / j);
67
68   test_and_and(i,j);
69   test_or_or(i,j);
70
71   return 0;
72 }