1#include"io.h" 2 3int main(void) 4{ 5 long long rs, rt, dsp; 6 long long ach = 5, acl = 5; 7 long long resulth, resultl, resultdsp; 8 9 rs = 0xBC0123AD; 10 rt = 0x01643721; 11 resulth = 0x04; 12 resultl = 0xFFFFFFFFAEA3E09B; 13 resultdsp = 0x00; 14 __asm 15 ("mthi %0, $ac1\n\t" 16 "mtlo %1, $ac1\n\t" 17 "dpsqx_s.w.ph $ac1, %3, %4\n\t" 18 "mfhi %0, $ac1\n\t" 19 "mflo %1, $ac1\n\t" 20 "rddsp %2\n\t" 21 : "+r"(ach), "+r"(acl), "=r"(dsp) 22 : "r"(rs), "r"(rt) 23 ); 24 dsp = (dsp >> 17) & 0x01; 25 if (dsp != resultdsp || ach != resulth || acl != resultl) { 26 printf("dpsqx_s.w.ph error\n"); 27 return -1; 28 } 29 30 ach = 0x99f13005; 31 acl = 0x51730062; 32 rs = 0x80008000; 33 rt = 0x80008000; 34 35 resulth = 0xffffffff99f13004; 36 resultl = 0x51730064; 37 resultdsp = 0x01; 38 __asm 39 ("mthi %0, $ac1\n\t" 40 "mtlo %1, $ac1\n\t" 41 "dpsqx_s.w.ph $ac1, %3, %4\n\t" 42 "mfhi %0, $ac1\n\t" 43 "mflo %1, $ac1\n\t" 44 "rddsp %2\n\t" 45 : "+r"(ach), "+r"(acl), "=r"(dsp) 46 : "r"(rs), "r"(rt) 47 ); 48 dsp = (dsp >> 17) & 0x01; 49 if (dsp != resultdsp || ach != resulth || acl != resultl) { 50 printf("dpsqx_s.w.ph error\n"); 51 return -1; 52 } 53 54 return 0; 55} 56