Merge tag 'qemu-macppc-20230206' of https://github.com/mcayland/qemu into staging
[qemu.git] / tests / tcg / mips / user / ase / dsp / test_dsp_r2_mul_ph.c
blobc7e9d60d12e25c7053b7e4bd4d84a1e69539bde2
1 #include<stdio.h>
2 #include<assert.h>
4 int main()
6 int rd, rs, rt, dsp;
7 int result, resultdsp;
9 rs = 0x03FB1234;
10 rt = 0x0BCC4321;
11 result = 0xF504F4B4;
12 resultdsp = 1;
14 __asm
15 ("mul.ph %0, %2, %3\n\t"
16 "rddsp %1\n\t"
17 : "=r"(rd), "=r"(dsp)
18 : "r"(rs), "r"(rt)
20 dsp = (dsp >> 21) & 0x01;
21 assert(rd == result);
22 assert(dsp == resultdsp);
24 dsp = 0;
25 __asm
26 ("wrdsp %0\n\t"
28 : "r"(dsp)
31 rs = 0x00210010;
32 rt = 0x00110005;
33 result = 0x2310050;
34 resultdsp = 0;
36 __asm
37 ("mul.ph %0, %2, %3\n\t"
38 "rddsp %1\n\t"
39 : "=r"(rd), "=r"(dsp)
40 : "r"(rs), "r"(rt)
42 dsp = (dsp >> 21) & 0x01;
43 assert(rd == result);
44 assert(dsp == resultdsp);
46 return 0;