1#include <stdio.h> 2 3int main(void) 4{ 5 int a, b, c; 6 int result; 7 8 b = 0x01; 9 c = 0xffffffff; 10 result = 1; 11 __asm 12 ("l.addc %0, %1, %2\n\t" 13 : "=r"(a) 14 : "r"(b), "r"(c) 15 ); 16 if (a != result) { 17 printf("first addc error\n"); 18 return -1; 19 } 20 21 b = 0x01; 22 c = 0xffffffff; 23 result = 0x80000001; 24 __asm 25 ("l.addc %0, %1, %2\n\t" 26 "l.movhi %2, 0x7fff\n\t" 27 "l.ori %2, %2, 0xffff\n\t" 28 "l.addc %0, %1, %2\n\t" 29 : "=r"(a) 30 : "r"(b), "r"(c) 31 ); 32 if (a != result) { 33 printf("addc error\n"); 34 return -1; 35 } 36 37 return 0; 38} 39