PPC: Fix rldcl
[qemu/agraf.git] / tests / tcg / mips / mips64-dsp / extr_s_h.c
blobde10cb57a5e48bfa8aa88aba1e7338a772734449
1 #include "io.h"
3 int main(void)
5 long long rt, ach, acl, dsp;
6 long long result;
8 ach = 0x05;
9 acl = 0xB4CB;
10 result = 0x00007FFF;
11 __asm
12 ("mthi %2, $ac1\n\t"
13 "mtlo %3, $ac1\n\t"
14 "extr_s.h %0, $ac1, 0x03\n\t"
15 "rddsp %1\n\t"
16 : "=r"(rt), "=r"(dsp)
17 : "r"(ach), "r"(acl)
19 dsp = (dsp >> 23) & 0x01;
20 if ((dsp != 1) || (result != rt)) {
21 printf("extr_s.h wrong\n");
23 return -1;
26 ach = 0xffffffff;
27 acl = 0x12344321;
28 result = 0xffffffffFFFF8000;
29 __asm
30 ("mthi %2, $ac1\n\t"
31 "mtlo %3, $ac1\n\t"
32 "extr_s.h %0, $ac1, 0x08\n\t"
33 "rddsp %1\n\t"
34 : "=r"(rt), "=r"(dsp)
35 : "r"(ach), "r"(acl)
37 dsp = (dsp >> 23) & 0x01;
38 if ((dsp != 1) || (result != rt)) {
39 printf("extr_s.h wrong\n");
41 return -1;
44 /* Clear dsp */
45 dsp = 0;
46 __asm
47 ("wrdsp %0\n\t"
49 : "r"(dsp)
52 ach = 0x00;
53 acl = 0x4321;
54 result = 0x432;
55 __asm
56 ("mthi %2, $ac1\n\t"
57 "mtlo %3, $ac1\n\t"
58 "extr_s.h %0, $ac1, 0x04\n\t"
59 "rddsp %1\n\t"
60 : "=r"(rt), "=r"(dsp)
61 : "r"(ach), "r"(acl)
63 dsp = (dsp >> 23) & 0x01;
64 if ((dsp != 0) || (result != rt)) {
65 printf("extr_s.h wrong\n");
67 return -1;
70 return 0;