1 #include <stdio.h> 2 int main(void) 3 { 4 int a, b; 5 int result; 6 7 a = 0; 8 result = 1; 9 __asm 10 ("1:\n\t" 11 "l.addi %0, %0, 1\n\t" 12 "l.sfgesi %0, 0x3\n\t" 13 "l.bf 1b\n\t" 14 "l.nop\n\t" 15 : "+r"(a) 16 ); 17 if (a != result) { 18 printf("sfgesi error\n"); 19 return -1; 20 } 21 22 a = 0xff; 23 b = 1; 24 result = 2; 25 __asm 26 ("1:\n\t" 27 "l.sub %0, %0, %1\n\t" 28 "l.sfgesi %0, 0x3\n\t" 29 "l.bf 1b\n\t" 30 "l.nop\n\t" 31 : "+r"(a) 32 : "r"(b) 33 ); 34 if (a != result) { 35 printf("sfgesi error\n"); 36 return -1; 37 } 38 39 return 0; 40 } 41