repo.or.cz
/
qemu
/
ar7.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge remote-tracking branch 'remotes/ehabkost/tags/machine-next-pull-request' into...
[qemu/ar7.git]
/
tests
/
tcg
/
openrisc
/
test_div.c
blob
9b65f6e673ce14f301a214df194ae2d128421951
1
#include <stdio.h>
2
3
int
main
(
void
)
4
{
5
int
a
,
b
,
c
;
6
int
result
;
7
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
)
15
);
16
if
(
a
!=
result
) {
17
printf
(
"div error
\n
"
);
18
return
-
1
;
19
}
20
21
result
=
0x4
;
22
__asm
23
(
"l.div %0, %1, %0
\n\t
"
24
:
"+r"
(
a
)
25
:
"r"
(
b
)
26
);
27
if
(
a
!=
result
) {
28
printf
(
"div error
\n
"
);
29
return
-
1
;
30
}
31
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
)
39
);
40
if
(
a
!=
result
) {
41
printf
(
"div error
\n
"
);
42
return
-
1
;
43
}
44
45
b
=
0x80000000
;
46
c
=
0xffffffff
;
47
__asm
48
(
"l.div %0, %1, %2
\n\t
"
49
:
"=r"
(
a
)
50
:
"r"
(
b
),
"r"
(
c
)
51
);
52
53
return
0
;
54
}