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