test_addic.c (612B)
1#include <stdio.h> 2 3int main(void) 4{ 5 int a, b, c; 6 int result; 7 8 a = 1; 9 result = 0x0; 10 __asm 11 ("l.add r1, r1, r0\n\t" /* clear carry */ 12 "l.addic %0, %0, 0xffff\n\t" 13 : "+r"(a) 14 ); 15 if (a != result) { 16 printf("first addic error\n"); 17 return -1; 18 } 19 20 a = -1; 21 result = 0x201; 22 __asm 23 ("l.add r1, r1, r0\n\t" /* clear carry */ 24 "l.addic %0, %0, 0x1\n\t" 25 "l.ori %0, r0, 0x100\n\t" 26 "l.addic %0, %0, 0x100\n\t" 27 : "+r"(a) 28 ); 29 if (a != result) { 30 printf("second addic error\n"); 31 return -1; 32 } 33 34 return 0; 35}