1#include "io.h" 2 3int main(void) 4{ 5 long long rt, rs; 6 long long achi, acli; 7 long long acho, aclo; 8 long long resh, resl; 9 achi = 0x1; 10 acli = 0x2; 11 12 rs = 0x0000000200000002; 13 rt = 0x0000000200000002; 14 resh = 0x1; 15 resl = 0xa; 16 __asm 17 ("mthi %2, $ac1 \t\n" 18 "mtlo %3, $ac1 \t\n" 19 "dmaddu $ac1, %4, %5\t\n" 20 "mfhi %0, $ac1 \t\n" 21 "mflo %1, $ac1 \t\n" 22 : "=r"(acho), "=r"(aclo) 23 : "r"(achi), "r"(acli), "r"(rs), "r"(rt) 24 ); 25 if ((acho != resh) || (aclo != resl)) { 26 printf("1 dmaddu error\n"); 27 28 return -1; 29 } 30 31 achi = 0x1; 32 acli = 0x1; 33 34 rs = 0xaaaabbbbccccdddd; 35 rt = 0xaaaabbbbccccdddd; 36 37 resh = 0x0000000000000002; 38 resl = 0xffffffffca860b63; 39 40 __asm 41 ("mthi %2, $ac1 \t\n" 42 "mtlo %3, $ac1 \t\n" 43 "dmaddu $ac1, %4, %5\t\n" 44 "mfhi %0, $ac1 \t\n" 45 "mflo %1, $ac1 \t\n" 46 : "=r"(acho), "=r"(aclo) 47 : "r"(achi), "r"(acli), "r"(rs), "r"(rt) 48 ); 49 if ((acho != resh) || (aclo != resl)) { 50 printf("2 dmaddu error\n"); 51 52 return -1; 53 } 54 55 return 0; 56} 57