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