Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / mips / user / ase / dsp / test_dsp_r1_extpdp.c
blob79ee16e8b87c662a75703152211a68c96820047b
1 #include<stdio.h>
2 #include<assert.h>
4 int main()
6 int rt, ach, acl, dsp, pos, efi;
7 int result;
9 ach = 0x05;
10 acl = 0xB4CB;
11 dsp = 0x07;
12 result = 0x000C;
14 __asm
15 ("wrdsp %1, 0x01\n\t"
16 "mthi %2, $ac1\n\t"
17 "mtlo %3, $ac1\n\t"
18 "extpdp %0, $ac1, 0x03\n\t"
19 "rddsp %1\n\t"
20 : "=r"(rt), "+r"(dsp)
21 : "r"(ach), "r"(acl)
23 pos = dsp & 0x3F;
24 efi = (dsp >> 14) & 0x01;
25 assert(pos == 3);
26 assert(efi == 0);
27 assert(result == rt);
29 ach = 0x05;
30 acl = 0xB4CB;
31 dsp = 0x01;
33 __asm
34 ("wrdsp %1, 0x01\n\t"
35 "mthi %2, $ac1\n\t"
36 "mtlo %3, $ac1\n\t"
37 "extpdp %0, $ac1, 0x03\n\t"
38 "rddsp %1\n\t"
39 : "=r"(rt), "+r"(dsp)
40 : "r"(ach), "r"(acl)
42 efi = (dsp >> 14) & 0x01;
43 assert(efi == 1);
46 ach = 0;
47 acl = 0;
48 dsp = 0;
49 result = 0;
51 __asm
52 ("wrdsp %1\n\t"
53 "mthi %2, $ac1\n\t"
54 "mtlo %3, $ac1\n\t"
55 "extpdp %0, $ac1, 0x00\n\t"
56 "rddsp %1\n\t"
57 : "=r"(rt), "+r"(dsp)
58 : "r"(ach), "r"(acl)
60 assert(dsp == 0x3F);
61 assert(result == rt);
63 return 0;