root / tests / tcg / mips / mips32-dsp / shilov.c @ 19e6c50d
History | View | Annotate | Download (879 Bytes)
1 |
#include<stdio.h> |
---|---|
2 |
#include<assert.h> |
3 |
|
4 |
int main()
|
5 |
{ |
6 |
int rs, ach, acl;
|
7 |
int resulth, resultl;
|
8 |
|
9 |
rs = 0x0F;
|
10 |
ach = 0xBBAACCFF;
|
11 |
acl = 0x1C3B001D;
|
12 |
|
13 |
resulth = 0x17755;
|
14 |
resultl = 0x99fe3876;
|
15 |
|
16 |
__asm |
17 |
("mthi %0, $ac1\n\t"
|
18 |
"mtlo %1, $ac1\n\t"
|
19 |
"shilov $ac1, %2\n\t"
|
20 |
"mfhi %0, $ac1\n\t"
|
21 |
"mflo %1, $ac1\n\t"
|
22 |
: "+r"(ach), "+r"(acl) |
23 |
: "r"(rs)
|
24 |
); |
25 |
assert(ach == resulth); |
26 |
assert(acl == resultl); |
27 |
|
28 |
|
29 |
rs = 0xffffffff;
|
30 |
ach = 0x1;
|
31 |
acl = 0x80000000;
|
32 |
|
33 |
resulth = 0x3;
|
34 |
resultl = 0x0;
|
35 |
|
36 |
__asm |
37 |
("mthi %0, $ac1\n\t"
|
38 |
"mtlo %1, $ac1\n\t"
|
39 |
"shilov $ac1, %2\n\t"
|
40 |
"mfhi %0, $ac1\n\t"
|
41 |
"mflo %1, $ac1\n\t"
|
42 |
: "+r"(ach), "+r"(acl) |
43 |
: "r"(rs)
|
44 |
); |
45 |
assert(ach == resulth); |
46 |
assert(acl == resultl); |
47 |
|
48 |
return 0; |
49 |
} |