Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / mips / user / ase / dsp / test_dsp_r1_extpv.c
blob401b94afadfc7a239b659d76e5a442f3973a47fa
1 #include<stdio.h>
2 #include<assert.h>
4 int main()
6 int rt, ac, ach, acl, dsp;
7 int result;
9 ach = 0x05;
10 acl = 0xB4CB;
11 dsp = 0x07;
12 ac = 0x03;
13 result = 0x000C;
15 __asm
16 ("wrdsp %1, 0x01\n\t"
17 "mthi %2, $ac1\n\t"
18 "mtlo %3, $ac1\n\t"
19 "extpv %0, $ac1, %4\n\t"
20 "rddsp %1\n\t"
21 : "=r"(rt), "+r"(dsp)
22 : "r"(ach), "r"(acl), "r"(ac)
24 dsp = (dsp >> 14) & 0x01;
25 assert(dsp == 0);
26 assert(result == rt);
28 ach = 0x05;
29 acl = 0xB4CB;
30 dsp = 0x01;
32 __asm
33 ("wrdsp %1, 0x01\n\t"
34 "mthi %2, $ac1\n\t"
35 "mtlo %3, $ac1\n\t"
36 "extpv %0, $ac1, %4\n\t"
37 "rddsp %1\n\t"
38 : "=r"(rt), "+r"(dsp)
39 : "r"(ach), "r"(acl), "r"(ac)
41 dsp = (dsp >> 14) & 0x01;
42 assert(dsp == 1);
44 return 0;