Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / tests / tcg / openrisc / test_div.c
blob9b65f6e673ce14f301a214df194ae2d128421951
1 #include <stdio.h>
3 int main(void)
5 int a, b, c;
6 int result;
8 b = 0x120;
9 c = 0x4;
10 result = 0x48;
11 __asm
12 ("l.div %0, %1, %2\n\t"
13 : "=r"(a)
14 : "r"(b), "r"(c)
16 if (a != result) {
17 printf("div error\n");
18 return -1;
21 result = 0x4;
22 __asm
23 ("l.div %0, %1, %0\n\t"
24 : "+r"(a)
25 : "r"(b)
27 if (a != result) {
28 printf("div error\n");
29 return -1;
32 b = 0xffffffff;
33 c = 0x80000000;
34 result = 0;
35 __asm
36 ("l.div %0, %1, %2\n\t"
37 : "=r"(a)
38 : "r"(b), "r"(c)
40 if (a != result) {
41 printf("div error\n");
42 return -1;
45 b = 0x80000000;
46 c = 0xffffffff;
47 __asm
48 ("l.div %0, %1, %2\n\t"
49 : "=r"(a)
50 : "r"(b), "r"(c)
53 return 0;