Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / mips / user / ase / dsp / test_dsp_r1_rddsp.c
blob2f30285033242aacbb43afc71a7575b2cfaaaa97
1 #include<stdio.h>
2 #include<assert.h>
4 int main()
6 int dsp_i, dsp_o;
7 int ccond_i, outflag_i, efi_i, c_i, scount_i, pos_i;
8 int ccond_o, outflag_o, efi_o, c_o, scount_o, pos_o;
10 ccond_i = 0x0000000C; /* 4 */
11 outflag_i = 0x0000001B; /* 3 */
12 efi_i = 0x00000001; /* 5 */
13 c_i = 0x00000001; /* 2 */
14 scount_i = 0x0000000F; /* 1 */
15 pos_i = 0x0000000C; /* 0 */
17 dsp_i = (ccond_i << 24) | \
18 (outflag_i << 16) | \
19 (efi_i << 14) | \
20 (c_i << 13) | \
21 (scount_i << 7) | \
22 pos_i;
24 __asm
25 ("wrdsp %1, 0x3F\n\t"
26 "rddsp %0, 0x3F\n\t"
27 : "=r"(dsp_o)
28 : "r"(dsp_i)
31 ccond_o = (dsp_o >> 24) & 0xFF;
32 outflag_o = (dsp_o >> 16) & 0xFF;
33 efi_o = (dsp_o >> 14) & 0x01;
34 c_o = (dsp_o >> 14) & 0x01;
35 scount_o = (dsp_o >> 7) & 0x3F;
36 pos_o = dsp_o & 0x1F;
38 assert(ccond_o == ccond_i);
39 assert(outflag_o == outflag_i);
40 assert(efi_o == efi_i);
41 assert(c_o == c_i);
42 assert(scount_o == scount_i);
43 assert(pos_o == pos_i);
45 return 0;