Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20160719' into...
[qemu/kevin.git] / tests / tcg / openrisc / test_and_or.c
blob810d868c7b079273ea4e9dcd8be3d67dd7115cfd
1 #include <stdio.h>
3 int main(void)
5 int a, b, c;
6 int result;
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)
16 if (a != result) {
17 printf("and error\n");
18 return -1;
21 result = 0x2;
22 __asm
23 ("l.andi %0, %1, 0x3\n\t"
24 : "=r"(a)
25 : "r"(b)
27 if (a != result) {
28 printf("andi error %x\n", a);
29 return -1;
32 result = 0x3;
33 __asm
34 ("l.or %0, %1, %2\n\t"
35 : "=r"(a)
36 : "r"(b), "r"(c)
38 if (a != result) {
39 printf("or error\n");
40 return -1;
43 result = 0x3;
44 __asm
45 ("l.xor %0, %1, %2\n\t"
46 : "=r"(a)
47 : "r"(b), "r"(c)
49 if (a != result) {
50 printf("xor error\n");
51 return -1;
54 __asm
55 ("l.xori %0, %1, 0x1\n\t"
56 : "=r"(a)
57 : "r"(b)
59 if (a != result) {
60 printf("xori error\n");
61 return -1;
64 return 0;