1#include<stdio.h> 2#include<assert.h> 3 4int main() 5{ 6 int rt, rs, ach, acl, dsp, pos, efi; 7 int result; 8 9 ach = 0x05; 10 acl = 0xB4CB; 11 dsp = 0x07; 12 rs = 0x03; 13 result = 0x000C; 14 15 __asm 16 ("wrdsp %1, 0x01\n\t" 17 "mthi %2, $ac1\n\t" 18 "mtlo %3, $ac1\n\t" 19 "extpdpv %0, $ac1, %4\n\t" 20 "rddsp %1\n\t" 21 : "=r"(rt), "+r"(dsp) 22 : "r"(ach), "r"(acl), "r"(rs) 23 ); 24 pos = dsp & 0x3F; 25 efi = (dsp >> 14) & 0x01; 26 assert(pos == 3); 27 assert(efi == 0); 28 assert(result == rt); 29 30 ach = 0x05; 31 acl = 0xB4CB; 32 dsp = 0x01; 33 34 __asm 35 ("wrdsp %1, 0x01\n\t" 36 "mthi %2, $ac1\n\t" 37 "mtlo %3, $ac1\n\t" 38 "extpdpv %0, $ac1, %4\n\t" 39 "rddsp %1\n\t" 40 : "=r"(rt), "+r"(dsp) 41 : "r"(ach), "r"(acl), "r"(rs) 42 ); 43 efi = (dsp >> 14) & 0x01; 44 assert(efi == 1); 45 46 return 0; 47} 48