1#include "io.h" 2 3int main(void) 4{ 5 long long rs, rt; 6 long long achi, acli; 7 long long acho, aclo; 8 long long dsp; 9 long long resh, resl; 10 long long resdsp; 11 12 rs = 0x0000000100000001; 13 rt = 0x0000000200000002; 14 achi = 0x1; 15 acli = 0x1; 16 resh = 0xffffffffffffffff; 17 resl = 0x0; 18 resdsp = 0x01; 19 20 __asm 21 ("mthi %3, $ac1\n\t" 22 "mtlo %4, $ac1\n\t" 23 "dpaq_sa.l.pw $ac1, %5, %6\n\t" 24 "mfhi %0, $ac1\n\t" 25 "mflo %1, $ac1\n\t" 26 "rddsp %2\n\t" 27 : "=r"(acho), "=r"(aclo), "=r"(dsp) 28 : "r"(achi), "r"(acli), "r"(rs), "r"(rt) 29 ); 30 31 if ((acho != resh) || (aclo != resl) || ((dsp >> (16 + 1)) != resdsp)) { 32 printf("1 dpaq_sa_l_pw error\n"); 33 34 return -1; 35 } 36 37 rs = 0xaaaabbbbccccdddd; 38 rt = 0x3333444455556666; 39 achi = 0x88888888; 40 acli = 0x66666666; 41 42 resh = 0xffffffff88888887; 43 resl = 0xffffffff9e2661da; 44 45 __asm 46 ("mthi %2, $ac1\n\t" 47 "mtlo %3, $ac1\n\t" 48 "dpaq_sa.l.pw $ac1, %4, %5\n\t" 49 "mfhi %0, $ac1\n\t" 50 "mflo %1, $ac1\n\t" 51 : "=r"(acho), "=r"(aclo) 52 : "r"(achi), "r"(acli), "r"(rs), "r"(rt) 53 ); 54 55 if ((acho != resh) || (aclo != resl)) { 56 printf("2 dpaq_sa_l_pw error\n"); 57 58 return -1; 59 } 60 61 rs = 0x8000000080000000; 62 rt = 0x8000000080000000; 63 achi = 0x88888888; 64 acli = 0x66666666; 65 66 resh = 0xffffffffffffffff; 67 resl = 0x00; 68 resdsp = 0x01; 69 70 __asm 71 ("mthi %3, $ac1\n\t" 72 "mtlo %4, $ac1\n\t" 73 "dpaq_sa.l.pw $ac1, %5, %6\n\t" 74 "mfhi %0, $ac1\n\t" 75 "mflo %1, $ac1\n\t" 76 "rddsp %2\n\t" 77 : "=r"(acho), "=r"(aclo), "=r"(dsp) 78 : "r"(achi), "r"(acli), "r"(rs), "r"(rt) 79 ); 80 81 if ((acho != resh) || (aclo != resl) || ((dsp >> (16 + 1)) != resdsp)) { 82 printf("2 dpaq_sa_l_pw error\n"); 83 84 return -1; 85 } 86 87 return 0; 88} 89