test_dsp_r1_modsub.c (512B)
1#include<stdio.h> 2#include<assert.h> 3 4int main() 5{ 6 int rd, rs, rt; 7 int result; 8 9 rs = 0xFFFFFFFF; 10 rt = 0x000000FF; 11 result = 0xFFFFFF00; 12 __asm 13 ("modsub %0, %1, %2\n\t" 14 : "=r"(rd) 15 : "r"(rs), "r"(rt) 16 ); 17 assert(result == rd); 18 19 rs = 0x00000000; 20 rt = 0x00CD1FFF; 21 result = 0x0000CD1F; 22 __asm 23 ("modsub %0, %1, %2\n\t" 24 : "=r"(rd) 25 : "r"(rs), "r"(rt) 26 ); 27 assert(result == rd); 28 29 return 0; 30}