]> Git Repo - qemu.git/blame - tests/tcg/mips/mips32-dsp/shll_qb.c
target-mips: fix calculation of overflow for SHLL.PH and SHLL.QB
[qemu.git] / tests / tcg / mips / mips32-dsp / shll_qb.c
CommitLineData
d70080c4
JL
1#include<stdio.h>
2#include<assert.h>
3
4int main()
5{
6 int rd, rt, dsp;
7 int result, resultdsp;
8
9 rt = 0x87654321;
10 result = 0x87654321;
11 resultdsp = 0x00;
12
13 __asm
29851ee7
PJ
14 ("wrdsp $0\n\t"
15 "shll.qb %0, %2, 0x00\n\t"
d70080c4
JL
16 "rddsp %1\n\t"
17 : "=r"(rd), "=r"(dsp)
18 : "r"(rt)
19 );
20 dsp = (dsp >> 22) & 0x01;
29851ee7 21 assert(dsp == resultdsp);
d70080c4
JL
22 assert(rd == result);
23
24 rt = 0x87654321;
25 result = 0x38281808;
26 resultdsp = 0x01;
27
28 __asm
29851ee7
PJ
29 ("wrdsp $0\n\t"
30 "shll.qb %0, %2, 0x03\n\t"
d70080c4
JL
31 "rddsp %1\n\t"
32 : "=r"(rd), "=r"(dsp)
33 : "r"(rt)
34 );
35 dsp = (dsp >> 22) & 0x01;
29851ee7
PJ
36 assert(dsp == resultdsp);
37 assert(rd == result);
38
39 rt = 0x00000001;
40 result = 0x00000080;
41 resultdsp = 0x00;
42
43 __asm
44 ("wrdsp $0\n\t"
45 "shll.qb %0, %2, 0x07\n\t"
46 "rddsp %1\n\t"
47 : "=r"(rd), "=r"(dsp)
48 : "r"(rt)
49 );
50 dsp = (dsp >> 22) & 0x01;
51 assert(dsp == resultdsp);
d70080c4
JL
52 assert(rd == result);
53
54 return 0;
55}
This page took 0.115068 seconds and 4 git commands to generate.