1#include "io.h"
2
3int main(void)
4{
5 long long rt, ach, acl, dsp;
6 long long result;
7
8 ach = 0x05;
9 acl = 0xB4CB;
10 result = 0xFFFFFFFFA0001699;
11 __asm
12 ("mthi %2, $ac1\n\t"
13 "mtlo %3, $ac1\n\t"
14 "extr_r.w %0, $ac1, 0x03\n\t"
15 "rddsp %1\n\t"
16 : "=r"(rt), "=r"(dsp)
17 : "r"(ach), "r"(acl)
18 );
19 dsp = (dsp >> 23) & 0x01;
20 if ((dsp != 1) || (result != rt)) {
21 printf("1 extr_r.w wrong\n");
22
23 return -1;
24 }
25
26
27 dsp = 0;
28 __asm
29 ("wrdsp %0\n\t"
30 :
31 : "r"(dsp)
32 );
33
34 ach = 0x01;
35 acl = 0xB4CB;
36 result = 0x10000B4D;
37 __asm
38 ("mthi %2, $ac1\n\t"
39 "mtlo %3, $ac1\n\t"
40 "extr_r.w %0, $ac1, 0x04\n\t"
41 "rddsp %1\n\t"
42 : "=r"(rt), "=r"(dsp)
43 : "r"(ach), "r"(acl)
44 );
45 dsp = (dsp >> 23) & 0x01;
46 if ((dsp != 0) || (result != rt)) {
47 printf("2 extr_r.w wrong\n");
48
49 return -1;
50 }
51
52 return 0;
53}
54