1#include "io.h" 2 3int main(void) 4{ 5 long long rt, ac, ach, acl, dsp; 6 long long result; 7 8 ach = 0x05; 9 acl = 0xB4CB; 10 dsp = 0x07; 11 ac = 0x03; 12 result = 0x000C; 13 14 __asm 15 ("wrdsp %1, 0x01\n\t" 16 "mthi %2, $ac1\n\t" 17 "mtlo %3, $ac1\n\t" 18 "extpv %0, $ac1, %4\n\t" 19 "rddsp %1\n\t" 20 : "=r"(rt), "+r"(dsp) 21 : "r"(ach), "r"(acl), "r"(ac) 22 ); 23 dsp = (dsp >> 14) & 0x01; 24 if ((dsp != 0) || (result != rt)) { 25 printf("extpv wrong\n"); 26 27 return -1; 28 } 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 "extpv %0, $ac1, %4\n\t" 39 "rddsp %1\n\t" 40 : "=r"(rt), "+r"(dsp) 41 : "r"(ach), "r"(acl), "r"(ac) 42 ); 43 dsp = (dsp >> 14) & 0x01; 44 if (dsp != 1) { 45 printf("extpv wrong\n"); 46 47 return -1; 48 } 49 50 return 0; 51} 52