bug in the tarval modul ...
[libfirm] / ir / be / test / am_test.c
1 /*$ -fno-inline $*/
2
3 int val;
4
5 #define T(name,OP) \
6         int test_##name(void) { return val OP 7; }   \
7         int test2_##name(int v) { return val OP v; }  \
8         int testp_##name(void) { return 7 OP val; }  \
9         int testp2_##name(int v) { return v OP val; }
10
11 int test_cmp_testset(int v, int v2) { return (v & 14) > 0; }
12
13 T(add,+)
14 T(sub,-)
15 T(or,|)
16 T(and,&)
17 T(xor,^)
18 T(cmp,<)
19 T(shl,<<)
20 T(shr,>>)
21
22 #undef T
23
24 int main(void) {
25         int res1, res2, res3, res4;
26         val = 11;
27
28 #define T(name,OP)          \
29         res1 = test_##name();   \
30         res2 = test2_##name(20); \
31         res3 = testp_##name();   \
32         res4 = testp2_##name(20); \
33         printf("Test %s: %d (should be %d)\n", #name, res1, 11 OP 7);   \
34         printf("Test2 %s: %d (should be %d)\n", #name, res2, 11 OP 20); \
35         printf("Testp %s: %d (should be %d)\n", #name, res3, 7 OP 11);   \
36         printf("Testp2 %s: %d (should be %d)\n", #name, res4, 20 OP 11);
37
38         T(add,+)
39         T(sub,-)
40         T(or,|)
41         T(and,&)
42         T(xor,^)
43         T(cmp,<)
44         T(shl,<<)
45         T(shr,>>)
46 }