Add qemu 2.4.0
[kvmfornfv.git] / qemu / tests / tcg / mips / mips64-dspr2 / dpaqx_s_w_ph.c
1 #include"io.h"
2
3 int main(void)
4 {
5     long long rs, rt, dsp;
6     long long ach = 5, acl = 5;
7     long long resulth, resultl, resultdsp;
8
9     rs     = 0x800000FF;
10     rt     = 0x00018000;
11     resulth = 0x05;
12     resultl = 0xFFFFFFFF80000202;
13     resultdsp = 0x01;
14     __asm
15         ("mthi  %0, $ac1\n\t"
16          "mtlo  %1, $ac1\n\t"
17          "dpaqx_s.w.ph $ac1, %3, %4\n\t"
18          "mfhi  %0, $ac1\n\t"
19          "mflo  %1, $ac1\n\t"
20          "rddsp %2\n\t"
21          : "+r"(ach), "+r"(acl), "=r"(dsp)
22          : "r"(rs), "r"(rt)
23         );
24     dsp = (dsp >> 17) & 0x01;
25     if (dsp != resultdsp) {
26         printf("dpaqx_s.w.ph error\n");
27         return -1;
28     }
29     if (ach != resulth) {
30         printf("dpaqx_s.w.ph error\n");
31         return -1;
32     }
33     if (acl != resultl) {
34         printf("dpaqx_s.w.ph error\n");
35         return -1;
36     }
37
38     ach    = 5;
39     acl    = 5;
40     rs     = 0x00FF00FF;
41     rt     = 0x00010002;
42     resulth = 0x05;
43     resultl = 0x05FF;
44     /***********************************************************
45      * Because of we set outflag at last time, although this
46      * time we set nothing, but it is stay the last time value.
47      **********************************************************/
48     resultdsp = 0x01;
49     __asm
50         ("mthi  %0, $ac1\n\t"
51          "mtlo  %1, $ac1\n\t"
52          "dpaqx_s.w.ph $ac1, %3, %4\n\t"
53          "mfhi  %0, $ac1\n\t"
54          "mflo  %1, $ac1\n\t"
55          "rddsp %2\n\t"
56          : "+r"(ach), "+r"(acl), "=r"(dsp)
57          : "r"(rs), "r"(rt)
58         );
59     dsp = (dsp >> 17) & 0x01;
60     if (dsp != resultdsp) {
61         printf("dpaqx_s.w.ph error\n");
62         return -1;
63     }
64     if (ach != resulth) {
65         printf("dpaqx_s.w.ph error\n");
66         return -1;
67     }
68     if (acl != resultl) {
69         printf("dpaqx_s.w.ph error\n");
70         return -1;
71     }
72
73     ach    = 5;
74     acl    = 5;
75     rs     = 0x800000FF;
76     rt     = 0x00028000;
77     resulth = 0x05;
78     resultl = 0xffffffff80000400;
79     resultdsp = 0x01;
80     __asm
81         ("mthi  %0, $ac1\n\t"
82          "mtlo  %1, $ac1\n\t"
83          "dpaqx_s.w.ph $ac1, %3, %4\n\t"
84          "mfhi  %0, $ac1\n\t"
85          "mflo  %1, $ac1\n\t"
86          "rddsp %2\n\t"
87          : "+r"(ach), "+r"(acl), "=r"(dsp)
88          : "r"(rs), "r"(rt)
89         );
90     dsp = (dsp >> 17) & 0x01;
91     if ((dsp != resultdsp) || (ach != resulth) || (acl != resultl)) {
92         printf("dpaqx_s.w.ph error\n");
93         return -1;
94     }
95
96     return 0;
97 }