master
c
45 lines
799 Bytes
|
1
|
#include<stdio.h> |
|
2
|
#include<assert.h> |
|
3
|
|
|
4
|
int main() |
|
5
|
{ |
|
6
|
int ach, acl; |
|
7
|
int resulth, resultl; |
|
8
|
|
|
9
|
ach = 0xBBAACCFF; |
|
10
|
acl = 0x1C3B001D; |
|
11
|
|
|
12
|
resulth = 0x17755; |
|
13
|
resultl = 0x99fe3876; |
|
14
|
|
|
15
|
__asm |
|
16
|
("mthi %0, $ac1\n\t" |
|
17
|
"mtlo %1, $ac1\n\t" |
|
18
|
"shilo $ac1, 0x0F\n\t" |
|
19
|
"mfhi %0, $ac1\n\t" |
|
20
|
"mflo %1, $ac1\n\t" |
|
21
|
: "+r"(ach), "+r"(acl) |
|
22
|
); |
|
23
|
assert(ach == resulth); |
|
24
|
assert(acl == resultl); |
|
25
|
|
|
26
|
|
|
27
|
ach = 0x1; |
|
28
|
acl = 0x80000000; |
|
29
|
|
|
30
|
resulth = 0x3; |
|
31
|
resultl = 0x0; |
|
32
|
|
|
33
|
__asm |
|
34
|
("mthi %0, $ac1\n\t" |
|
35
|
"mtlo %1, $ac1\n\t" |
|
36
|
"shilo $ac1, -1\n\t" |
|
37
|
"mfhi %0, $ac1\n\t" |
|
38
|
"mflo %1, $ac1\n\t" |
|
39
|
: "+r"(ach), "+r"(acl) |
|
40
|
); |
|
41
|
assert(ach == resulth); |
|
42
|
assert(acl == resultl); |
|
43
|
|
|
44
|
return 0; |
|
45
|
} |