1#include "io.h" 2 3int main(void) 4{ 5 long long rs, dsp; 6 long long achi, acli; 7 8 long long rsdsp; 9 long long acho, aclo; 10 11 long long res; 12 long long reshi, reslo; 13 14 15 rs = 0xaaaabbbbccccdddd; 16 achi = 0x87654321; 17 acli = 0x12345678; 18 dsp = 0x22; 19 20 res = 0x62; 21 reshi = 0x12345678; 22 reslo = 0xffffffffccccdddd; 23 24 __asm 25 ("mthi %3, $ac1\n\t" 26 "mtlo %4, $ac1\n\t" 27 "wrdsp %5\n\t" 28 "dmthlip %6, $ac1\n\t" 29 "rddsp %0\n\t" 30 "mfhi %1, $ac1\n\t" 31 "mflo %2, $ac1\n\t" 32 : "=r"(rsdsp), "=r"(acho), "=r"(aclo) 33 : "r"(achi), "r"(acli), "r"(dsp), "r"(rs) 34 ); 35 if ((rsdsp != res) || (acho != reshi) || (aclo != reslo)) { 36 printf("dmthlip error\n"); 37 return -1; 38 } 39 40 return 0; 41} 42