Add qemu 2.4.0
[kvmfornfv.git] / qemu / tests / tcg / mips / mips64-dsp / dextp.c
1 #include "io.h"
2
3 int main(void)
4 {
5     long long rt, dsp;
6     long long achi, acli;
7     long long res, resdsp;
8     int rs;
9
10     rs = 0xabcd1234;
11
12     achi = 0x12345678;
13     acli = 0x87654321;
14     res = 0xff;
15     resdsp = 0x0;
16
17     __asm
18         ("mthi %2, $ac1\n\t"
19          "mtlo %3, $ac1\n\t"
20          "wrdsp %4\n\t"
21          "dextp %0, $ac1, 0x7\n\t"
22          "rddsp %1\n\t"
23          : "=r"(rt), "=r"(dsp)
24          : "r"(achi), "r"(acli), "r"(rs)
25         );
26     dsp = (dsp >> 14) & 0x1;
27     if ((dsp != resdsp) || (rt != res)) {
28         printf("dextp error\n");
29         return -1;
30     }
31
32     rs = 0xabcd1200;
33
34     achi = 0x12345678;
35     acli = 0x87654321;
36     resdsp = 0x1;
37
38     __asm
39         ("mthi %2, $ac1\n\t"
40          "mtlo %3, $ac1\n\t"
41          "wrdsp %4\n\t"
42          "dextp %0, $ac1, 0x7\n\t"
43          "rddsp %1\n\t"
44          : "=r"(rt), "=r"(dsp)
45          : "r"(achi), "r"(acli), "r"(rs)
46         );
47     dsp = (dsp >> 14) & 0x1;
48     if (dsp != resdsp) {
49         printf("dextp error\n");
50         return -1;
51     }
52
53     return 0;
54 }