1#include "io.h" 2 3int main(void) 4{ 5 long long rt, dsp; 6 long long achi, acli; 7 long long res, resdsp, resdsppos; 8 int rs; 9 int tmp1, tmp2; 10 11 rs = 0xabcd1234; 12 13 achi = 0x12345678; 14 acli = 0x87654321; 15 res = 0xff; 16 resdsp = 0x0; 17 resdsppos = 0x2c; 18 19 __asm 20 ("mthi %2, $ac1\n\t" 21 "mtlo %3, $ac1\n\t" 22 "wrdsp %4\n\t" 23 "dextpdp %0, $ac1, 0x7\n\t" 24 "rddsp %1\n\t" 25 : "=r"(rt), "=r"(dsp) 26 : "r"(achi), "r"(acli), "r"(rs) 27 ); 28 tmp1 = (dsp >> 14) & 0x1; 29 tmp2 = dsp & 0x3f; 30 31 if ((tmp1 != resdsp) || (rt != res) || (tmp2 != resdsppos)) { 32 printf("dextpdp error\n"); 33 return -1; 34 } 35 36 rs = 0xabcd1200; 37 38 achi = 0x12345678; 39 acli = 0x87654321; 40 resdsp = 0x1; 41 42 __asm 43 ("mthi %2, $ac1\n\t" 44 "mtlo %3, $ac1\n\t" 45 "wrdsp %4\n\t" 46 "dextpdp %0, $ac1, 0x7\n\t" 47 "rddsp %1\n\t" 48 : "=r"(rt), "=r"(dsp) 49 : "r"(achi), "r"(acli), "r"(rs) 50 ); 51 tmp1 = (dsp >> 14) & 0x1; 52 53 if (tmp1 != resdsp) { 54 printf("dextpdp error\n"); 55 return -1; 56 } 57 58 return 0; 59} 60