PPC: Fix rldcl
[qemu/agraf.git] / tests / tcg / mips / mips32-dspr2 / dpsqx_s_w_ph.c
blob14cdd7c0f50a8363f28369f66ff50479466f5f7c
1 #include<stdio.h>
2 #include<assert.h>
4 int main()
6 int rs, rt, dsp;
7 int ach = 5, acl = 5;
8 int resulth, resultl, resultdsp;
10 rs = 0xBC0123AD;
11 rt = 0x01643721;
12 resulth = 0x04;
13 resultl = 0xAEA3E09B;
14 resultdsp = 0x00;
15 __asm
16 ("mthi %0, $ac1\n\t"
17 "mtlo %1, $ac1\n\t"
18 "dpsqx_s.w.ph $ac1, %3, %4\n\t"
19 "mfhi %0, $ac1\n\t"
20 "mflo %1, $ac1\n\t"
21 "rddsp %2\n\t"
22 : "+r"(ach), "+r"(acl), "=r"(dsp)
23 : "r"(rs), "r"(rt)
25 dsp = (dsp >> 17) & 0x01;
26 assert(dsp == resultdsp);
27 assert(ach == resulth);
28 assert(acl == resultl);
30 ach = 0x99f13005;
31 acl = 0x51730062;
32 rs = 0x80008000;
33 rt = 0x80008000;
35 resulth = 0x99f13004;
36 resultl = 0x51730064;
37 resultdsp = 0x01;
38 __asm
39 ("mthi %0, $ac1\n\t"
40 "mtlo %1, $ac1\n\t"
41 "dpsqx_s.w.ph $ac1, %3, %4\n\t"
42 "mfhi %0, $ac1\n\t"
43 "mflo %1, $ac1\n\t"
44 "rddsp %2\n\t"
45 : "+r"(ach), "+r"(acl), "=r"(dsp)
46 : "r"(rs), "r"(rt)
48 dsp = (dsp >> 17) & 0x01;
49 assert(dsp == resultdsp);
50 assert(ach == resulth);
51 assert(acl == resultl);
53 return 0;