tap: factor out common tap initialization
[qemu/ar7.git] / tests / tcg / openrisc / test_lx.c
blob792e3d5c7fcbd051502aa0f6a4212e2fee17eeb5
1 #include <stdio.h>
3 int main(void)
5 int a;
6 int p[50];
7 int result;
9 result = 0x23;
10 __asm
11 ("l.ori r8, r0, 0x123\n\t"
12 "l.sb 0x4 + %1, r8\n\t"
13 "\n\t"
14 "l.lbz %0, 0x4 + %1\n\t"
15 : "=r"(a), "+m"(*p)
17 if (a != result) {
18 printf("lbz error, %x\n", a);
19 return -1;
22 result = 0x23;
23 __asm
24 ("l.lbs %0, 0x4 + %1\n\t"
25 : "=r"(a)
26 : "m"(*p)
28 if (a != result) {
29 printf("lbs error\n");
30 return -1;
33 result = 0x1111;
34 __asm
35 ("l.ori r8, r0, 0x1111\n\t"
36 "l.sh 0x20 + %1, r8\n\t"
37 "\n\t"
38 "l.lhs %0, 0x20 + %1\n\t"
39 : "=r"(a), "=m"(*p)
41 if (a != result) {
42 printf("lhs error, %x\n", a);
43 return -1;
46 result = 0x1111;
47 __asm
48 ("l.lhz %0, 0x20 + %1\n\t"
49 : "=r"(a)
50 : "m"(*p)
52 if (a != result) {
53 printf("lhz error\n");
54 return -1;
57 result = 0x1111233;
58 __asm
59 ("l.ori r8, r0, 0x1233\n\t"
60 "l.movhi r1, 0x111\n\t"
61 "l.or r8, r8, r1\n\t"
62 "l.sw 0x123 + %1, r8\n\t"
63 "\n\t"
64 "l.lws %0, 0x123 + %1\n\t"
65 : "=r"(a), "+m"(*p)
67 if (a != result) {
68 printf("lws error, %x\n", a);
69 return -1;
72 result = 0x1111233;
73 __asm
74 ("l.lwz %0, 0x123 + %1\n\t"
75 : "=r"(a)
76 : "m"(*p)
78 if (a != result) {
79 printf("lwz error\n");
80 return -1;
83 return 0;