Add qemu 2.4.0
[kvmfornfv.git] / qemu / tests / tcg / mips / mips64-dsp / dpsq_sa_l_pw.c
1 #include "io.h"
2
3 int main(void)
4 {
5     long long rs, rt, dsp;
6     long long achi, acli;
7     long long resh, resl, resdsp;
8
9     rs = 0x89789BC0123AD;
10     rt = 0x5467591643721;
11
12     achi = 0x98765437;
13     acli = 0x65489709;
14
15     resh = 0xffffffffffffffff;
16     resl = 0x00;
17
18     resdsp = 0x01;
19
20     __asm
21         ("mthi  %0, $ac1\n\t"
22          "mtlo  %1, $ac1\n\t"
23          "dpsq_sa.l.pw $ac1, %3, %4\n\t"
24          "mfhi  %0, $ac1\n\t"
25          "mflo  %1, $ac1\n\t"
26          "rddsp %2\n\t"
27          : "+r"(achi), "+r"(acli), "=r"(dsp)
28          : "r"(rs), "r"(rt)
29         );
30
31     dsp = (dsp >> 17) & 0x01;
32     if ((dsp != resdsp) || (achi != resh) || (acli != resl)) {
33         printf("1 dpsq_sa.l.pw wrong\n");
34
35         return -1;
36     }
37
38     /* clear dspcontrol reg for next test use. */
39     dsp = 0;
40     __asm
41         ("wrdsp %0"
42          :
43          : "r"(dsp)
44         );
45
46     rs = 0x8B78980000000;
47     rt = 0x5867580000000;
48
49     achi = 0x98765437;
50     acli = 0x65489709;
51
52     resh = 0xffffffff98765436;
53     resl = 0x11d367d0;
54
55     resdsp = 0x01;
56
57     __asm
58         ("mthi  %0, $ac1\n\t"
59          "mtlo  %1, $ac1\n\t"
60          "dpsq_sa.l.pw $ac1, %3, %4\n\t"
61          "mfhi  %0, $ac1\n\t"
62          "mflo  %1, $ac1\n\t"
63          "rddsp %2\n\t"
64          : "+r"(achi), "+r"(acli), "=r"(dsp)
65          : "r"(rs), "r"(rt)
66         );
67
68     dsp = (dsp >> 17) & 0x01;
69     if ((dsp != resdsp) || (achi != resh) || (acli != resl)) {
70         printf("2 dpsq_sa.l.pw wrong\n");
71
72         return -1;
73     }
74
75     return 0;
76 }