test_lf_sub.c (532B)
1#include <stdio.h> 2 3int main(void) 4{ 5 float a, b, c; 6 float result; 7 8 b = 10.5; 9 c = 1.5; 10 result = 9.0; 11 __asm 12 ("lf.sub.s %0, %1, %2\n\t" 13 : "=r"(a) 14 : "r"(b), "r"(c) 15 ); 16 if (a != result) { 17 printf("lf.sub.s error\n"); 18 return -1; 19 } 20 21/* b = 0x999; 22 c = 0x654; 23 result = 0x345; 24 __asm 25 ("lf.sub.d %0, %1, %2\n\t" 26 : "=r"(a) 27 : "r"(b), "r"(c) 28 ); 29 if (a != result) { 30 printf("lf.sub.d error\n"); 31 return -1; 32 }*/ 33 34 return 0; 35}