Merge tag 'pull-loongarch-20241016' of https://gitlab.com/gaosong/qemu into staging
[qemu/armbru.git] / tests / tcg / openrisc / test_addc.c
bloba8f756a69b2e0ba0f033bb886651cc2946284177
1 #include <stdio.h>
3 int main(void)
5 int a, b, c;
6 int result;
8 b = 0x01;
9 c = 0xffffffff;
10 result = 0;
11 __asm
12 ("l.add r1, r1, r0\n\t" /* clear carry */
13 "l.addc %0, %1, %2\n\t"
14 : "=r"(a)
15 : "r"(b), "r"(c)
17 if (a != result) {
18 printf("first addc error\n");
19 return -1;
22 b = 0x01;
23 c = 0xffffffff;
24 result = 0x80000001;
25 __asm
26 ("l.add r1, r1, r0\n\t" /* clear carry */
27 "l.addc %0, %1, %2\n\t"
28 "l.movhi %2, 0x7fff\n\t"
29 "l.ori %2, %2, 0xffff\n\t"
30 "l.addc %0, %1, %2\n\t"
31 : "=r"(a)
32 : "r"(b), "r"(c)
34 if (a != result) {
35 printf("addc error\n");
36 return -1;
39 return 0;