1#include "io.h" 2 3int main(void) 4{ 5 long long rd, rs, rt; 6 long long dspi, dspo; 7 long long result; 8 9 rs = 0x10FF01FF; 10 rt = 0x10010001; 11 dspi = 0x00002000; 12 result = 0x21000201; 13 __asm 14 ("wrdsp %3\n" 15 "addwc %0, %1, %2\n\t" 16 : "=r"(rd) 17 : "r"(rs), "r"(rt), "r"(dspi) 18 ); 19 if (rd != result) { 20 printf("1 addwc wrong\n"); 21 22 return -1; 23 } 24 25 rs = 0xFFFF1111; 26 rt = 0x00020001; 27 dspi = 0x00; 28 result = 0x00011112; 29 __asm 30 ("wrdsp %3\n" 31 "addwc %0, %1, %2\n\t" 32 : "=r"(rd) 33 : "r"(rs), "r"(rt), "r"(dspi) 34 ); 35 if (rd != result) { 36 printf("2 addwc wrong\n"); 37 38 return -1; 39 } 40 41 rs = 0x8FFF1111; 42 rt = 0x80020001; 43 dspi = 0x00; 44 result = 0x10011112; 45 __asm 46 ("wrdsp %4\n" 47 "addwc %0, %2, %3\n\t" 48 "rddsp %1\n\t" 49 : "=r"(rd), "=r"(dspo) 50 : "r"(rs), "r"(rt), "r"(dspi) 51 ); 52 if ((rd != result) || (((dspo >> 20) & 0x01) != 1)) { 53 printf("3 addwc wrong\n"); 54 55 return -1; 56 } 57 58 return 0; 59} 60