test_lf_div.c (569B)
1#include <stdio.h> 2 3int main(void) 4{ 5 float a, b, c; 6 float result; 7 8 b = 1.5; 9 c = 0.5; 10 result = 3.0; 11 __asm 12 ("lf.div.s %0, %1, %2\n\t" 13 : "=r"(a) 14 : "r"(b), "r"(c) 15 ); 16 if (a != result) { 17 printf("lf.div.s error\n"); 18 return -1; 19 } 20 21/* double a, b, c, res; 22 23 b = 0x80000000; 24 c = 0x40; 25 result = 0x2000000; 26 __asm 27 ("lf.div.d %0, %1, %2\n\t" 28 : "=r"(a) 29 : "r"(b), "r"(c) 30 ); 31 if (a != result) { 32 printf("lf.div.d error\n"); 33 return -1; 34 }*/ 35 36 return 0; 37}