repo.or.cz
/
qemu
/
armbru.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git]
/
tests
/
tcg
/
openrisc
/
test_add.c
blob
3d23592e7606f84ad8d30121e43ed56189b48795
1
#include <stdio.h>
2
3
int
main
(
void
)
4
{
5
int
a
,
b
,
d
;
6
int
result
;
7
8
a
=
0x100
;
9
b
=
0x100
;
10
result
=
0x200
;
11
__asm
12
(
"l.add %0, %0, %1
\n\t
"
13
:
"+r"
(
a
)
14
:
"r"
(
b
)
15
);
16
if
(
a
!=
result
) {
17
printf
(
"add error
\n
"
);
18
return
-
1
;
19
}
20
21
a
=
0xffff
;
22
b
=
0x1
;
23
result
=
0x10000
;
24
__asm
25
(
"l.add %0, %0, %1
\n\t
"
26
:
"+r"
(
a
)
27
:
"r"
(
b
)
28
);
29
if
(
a
!=
result
) {
30
printf
(
"add error
\n
"
);
31
return
-
1
;
32
}
33
34
a
=
0x7fffffff
;
35
b
=
0x1
;
36
__asm
37
(
"l.add %0, %1, %2
\n\t
"
38
:
"=r"
(
d
)
39
:
"r"
(
b
),
"r"
(
a
)
40
);
41
42
return
0
;
43
}