Add qemu 2.4.0
[kvmfornfv.git] / qemu / tests / tcg / openrisc / test_and_or.c
1 #include <stdio.h>
2
3 int main(void)
4 {
5     int a, b, c;
6     int result;
7
8     b = 0x2;
9     c = 0x1;
10     result = 0;
11     __asm
12     ("l.and  %0, %1, %2\n\t"
13      : "=r"(a)
14      : "r"(b), "r"(c)
15     );
16     if (a != result) {
17         printf("and error\n");
18         return -1;
19     }
20
21     result = 0x2;
22     __asm
23     ("l.andi  %0, %1, 0x3\n\t"
24      : "=r"(a)
25      : "r"(b)
26     );
27     if (a != result) {
28         printf("andi error %x\n", a);
29         return -1;
30     }
31
32     result = 0x3;
33     __asm
34     ("l.or   %0, %1, %2\n\t"
35      : "=r"(a)
36      : "r"(b), "r"(c)
37     );
38     if (a != result) {
39         printf("or error\n");
40         return -1;
41     }
42
43     result = 0x3;
44     __asm
45     ("l.xor  %0, %1, %2\n\t"
46      : "=r"(a)
47      : "r"(b), "r"(c)
48     );
49     if (a != result) {
50         printf("xor error\n");
51         return -1;
52     }
53
54     __asm
55     ("l.xori  %0, %1, 0x1\n\t"
56      : "=r"(a)
57      : "r"(b)
58     );
59     if (a != result) {
60         printf("xori error\n");
61         return -1;
62     }
63
64     return 0;
65 }