• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdio.h>
2 
3 #define TESTINST1(instruction, RSval, RTval, RD, RS, RT) \
4 { \
5    unsigned int out; \
6    __asm__ volatile( \
7       "li   $" #RD ", 0\n\t"  \
8       "move $" #RS ", %1\n\t" \
9       "move $" #RT ", %2\n\t" \
10       instruction "\n\t" \
11       "move %0, $" #RD "\n\t" \
12       : "=&r" (out) \
13       : "r" (RSval), "r" (RTval) \
14       : #RD, #RS, #RT, "cc", "memory" \
15         ); \
16         printf("%s :: rd 0x%08x rs 0x%08x, rt 0x%08x\n", \
17         instruction, out, RSval, RTval); \
18 }
19 
20 #define TESTINST2(instruction, RSval, imm, RT, RS) \
21 { \
22    unsigned int out; \
23    __asm__ volatile( \
24       "move $" #RS ", %1\n\t" \
25       instruction "\n\t" \
26       "move %0, $" #RT "\n\t" \
27       : "=&r" (out) \
28       : "r" (RSval) \
29       : #RT, #RS, "cc", "memory" \
30         ); \
31         printf("%s :: rt 0x%08x rs 0x%08x, imm 0x%08x\n", \
32         instruction, out, RSval, imm); \
33 }
34 
35 #define TESTINST3(instruction, RSval, RD, RS) \
36 { \
37    unsigned int out; \
38    __asm__ volatile( \
39       "move $" #RS ", %1\n\t" \
40       instruction "\n\t" \
41       "move %0, $" #RD "\n\t" \
42       : "=&r" (out) \
43       : "r" (RSval) \
44       : #RD, #RS, "cc", "memory" \
45         ); \
46         printf("%s :: rd 0x%08x rs 0x%08x\n", \
47         instruction, out, RSval); \
48 }
49 
50 #define TESTINST3a(instruction, RSval, RTval, RS, RT) \
51 { \
52    unsigned int HI; \
53    unsigned int LO; \
54    __asm__ volatile( \
55       "li $" #RS ", 0x0\n\t" \
56       "mthi $" #RS"\n\t" \
57       "mtlo $" #RS"\n\t" \
58       "move $" #RS ", %2\n\t" \
59       "move $" #RT ", %3\n\t" \
60       instruction "\n\t" \
61       "mfhi %0 \n\t" \
62       "mflo %1 \n\t" \
63       : "=&r" (HI), "=&r" (LO) \
64       : "r" (RSval), "r"(RTval) \
65       : #RS, #RT, "cc", "memory" \
66         ); \
67    printf("%s :: rs 0x%08x rt 0x%08x HI 0x%08x LO 0x%08x \n", \
68         instruction, RSval, RTval, HI, LO); \
69 }
70 
71 #define TESTINST4(instruction, RTval, RSval, RT, RS, pos, size) \
72 { \
73    unsigned int out; \
74    __asm__ volatile( \
75       "move $" #RT ", %1\n\t" \
76       "move $" #RS ", %2\n\t" \
77       instruction "\n\t" \
78       "move %0, $" #RT "\n\t" \
79       : "=&r" (out) \
80       : "r" (RTval), "r" (RSval) \
81       : #RT, #RS, "cc", "memory" \
82         ); \
83         printf("%s :: rt 0x%08x rs 0x%08x, pos 0x%08x, size 0x%08x\n", \
84         instruction, out, RSval, pos, size); \
85 }
86 
87 const unsigned int mem[] = {
88    0x121f1e1f, 0, 3, -1,
89    0x232f2e2f, 0x242c2b2b, 0x252a2e2b, 0x262d2d2a,
90    0x3f343f3e, 0x3e353d3c, 0x363a3c3b, 0x3b373b3a,
91    0x454f4e45, 0x4e464d46, 0x474d474c, 0x4a484a4c
92 };
93 
94 // load $t0, 0($t1)
95 #define TESTINSN5LOAD(instruction, RTval, offset, RT) \
96 { \
97     unsigned int out; \
98    __asm__ volatile( \
99      "move $t1, %1\n\t" \
100      "li $t0, " #RTval"\n\t" \
101      instruction "\n\t" \
102      "move %0, $" #RT "\n\t" \
103      : "=&r" (out) \
104 	 : "r" (mem), "r" (RTval) \
105 	 : #RT, "cc", "memory" \
106 	 ); \
107    printf("%s :: rt 0x%08x\n", \
108           instruction, out); \
109 }
110 
111 #define TESTINSN_HILO(RSval) \
112 { \
113    unsigned int HI; \
114    unsigned int LO; \
115    __asm__ volatile( \
116       "move $t0, %2\n\t" \
117       "mthi $t0\n\t" \
118       "addiu $t0, $t0, 0xffff\n\t" \
119       "mtlo $t0\n\t" \
120       "mfhi %0\n\t" \
121       "mflo %1\n\t" \
122      : "=&r" (HI), "=&r" (LO) \
123 	 : "r" (RSval)\
124 	 : "cc", "memory" \
125 	 ); \
126    printf("mfhi mflo :: HI: 0x%x, LO: 0x%x\n", \
127           HI, LO); \
128 }
129 
main(int argc,char ** argv)130 int main(int argc, char **argv)
131 {
132    printf("ADD\n");
133    TESTINST1("add $t0, $t1, $t2", 0, 0, t0, t1, t2);
134    TESTINST1("add $t0, $t1, $t2", 0, 1, t0, t1, t2);
135    TESTINST1("add $t0, $t1, $t2", 1, 0, t0, t1, t2);
136    TESTINST1("add $t0, $t1, $t2", 1, 1, t0, t1, t2);
137    TESTINST1("add $t0, $t1, $t2", 0, -1, t0, t1, t2);
138    TESTINST1("add $t0, $t1, $t2", 1, -1, t0, t1, t2);
139    TESTINST1("add $t0, $t1, $t2", 0x80000000, 0, t0, t1, t2);
140    TESTINST1("add $t0, $t1, $t2", 0x31415927, 0x27181728, t0, t1, t2);
141    TESTINST1("add $t0, $t1, $t2", 0x31415927, 0x97181728, t0, t1, t2);
142    TESTINST1("add $t0, $t1, $t2", -1,         0,          t0, t1, t2);
143    TESTINST1("add $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
144    TESTINST1("add $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
145 
146    printf("ADDI\n");
147    TESTINST2("addi $t0, $t1, 0", 0, 0, t0, t1);
148    TESTINST2("addi $t0, $t1, 1", 0, 1, t0, t1);
149    TESTINST2("addi $t0, $t1, 1", 1, 0, t0, t1);
150    TESTINST2("addi $t0, $t1, 1", 1, 1, t0, t1);
151    TESTINST2("addi $t0, $t1, -1", 0, -1, t0, t1);
152    TESTINST2("addi $t0, $t1, -1", 1, -1, t0, t1);
153    TESTINST2("addi $t0, $t1, 0", 0x80000000, 0, t0, t1);
154    TESTINST2("addi $t0, $t1, 0", -1,         0,          t0, t1);
155    TESTINST2("addi $t0, $t1, 0", 0x80000000, 0,          t0, t1);
156 
157    printf("ADDIU\n");
158    TESTINST2("addiu $t0, $t1, 0", 0, 0, t0, t1);
159    TESTINST2("addiu $t0, $t1, 1", 0, 1, t0, t1);
160    TESTINST2("addiu $t0, $t1, 1", 1, 0, t0, t1);
161    TESTINST2("addiu $t0, $t1, 1", 1, 1, t0, t1);
162    TESTINST2("addiu $t0, $t1, -1", 0, -1, t0, t1);
163    TESTINST2("addiu $t0, $t1, -1", 1, -1, t0, t1);
164    TESTINST2("addiu $t0, $t1, 0", 0x80000000, 0, t0, t1);
165    TESTINST2("addiu $t0, $t1, 0", -1,         0,          t0, t1);
166    TESTINST2("addiu $t0, $t1, 0", 0x80000000, 0,          t0, t1);
167 
168    printf("ADDU\n");
169    TESTINST1("addu $t0, $t1, $t2", 0, 0, t0, t1, t2);
170    TESTINST1("addu $t0, $t1, $t2", 0, 1, t0, t1, t2);
171    TESTINST1("addu $t0, $t1, $t2", 1, 0, t0, t1, t2);
172    TESTINST1("addu $t0, $t1, $t2", 1, 1, t0, t1, t2);
173    TESTINST1("addu $t0, $t1, $t2", 0, -1, t0, t1, t2);
174    TESTINST1("addu $t0, $t1, $t2", 1, -1, t0, t1, t2);
175    TESTINST1("addu $t0, $t1, $t2", 0x31415927, 0x27181728, t0, t1, t2);
176    TESTINST1("addu $t0, $t1, $t2", 0x31415927, 0x97181728, t0, t1, t2);
177    TESTINST1("addu $t0, $t1, $t2", 0,          0,          t0, t1, t2);
178    TESTINST1("addu $t0, $t1, $t2", 1,          0,          t0, t1, t2);
179    TESTINST1("addu $t0, $t1, $t2", 0,          1,          t0, t1, t2);
180    TESTINST1("addu $t0, $t1, $t2", -1,         0,          t0, t1, t2);
181    TESTINST1("addu $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
182    TESTINST1("addu $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
183    TESTINST1("addu $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
184    TESTINST1("addu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
185    TESTINST1("addu $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
186    TESTINST1("addu $t0, $t1, $t2", 0x80000000, 0x7fffffff, t0, t1, t2);
187    TESTINST1("addu $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
188 
189    printf("AND\n");
190    TESTINST1("and $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
191    TESTINST1("and $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
192    TESTINST1("and $t0, $t1, $t2", 0,          255,        t0, t1, t2);
193    TESTINST1("and $t0, $t1, $t2", -1,         0,          t0, t1, t2);
194    TESTINST1("and $t0, $t1, $t2", 0,          1,          t0, t1, t2);
195    TESTINST1("and $t0, $t1, $t2", 0,          0,          t0, t1, t2);
196    TESTINST1("and $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
197    TESTINST1("and $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
198    TESTINST1("and $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
199    TESTINST1("and $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
200    TESTINST1("and $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
201    TESTINST1("and $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
202    TESTINST1("and $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
203    TESTINST1("and $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
204    TESTINST1("and $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
205    TESTINST1("and $t0, $t1, $t2", 0,          255,        t0, t1, t2);
206    TESTINST1("and $t0, $t1, $t2", 1,          0,          t0, t1, t2);
207    TESTINST1("and $t0, $t1, $t2", 0,          1,          t0, t1, t2);
208    TESTINST1("and $t0, $t1, $t2", -1,         0,          t0, t1, t2);
209    TESTINST1("and $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
210    TESTINST1("and $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
211    TESTINST1("and $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
212    TESTINST1("and $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
213    TESTINST1("and $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
214    TESTINST1("and $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
215    TESTINST1("and $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
216 
217    printf("ANDI\n");
218    TESTINST2("andi $t0, $t1, 1", 0, 1, t0, t1);
219    TESTINST2("andi $t0, $t1, 0", 1, 0, t0, t1);
220    TESTINST2("andi $t0, $t1, 1", 1, 1, t0, t1);
221    TESTINST2("andi $t0, $t1, 1", 0x7fffffff, 0, t0, t1);
222    TESTINST2("andi $t0, $t1, 0", 0x80000000, 0, t0, t1);
223    TESTINST2("andi $t0, $t1, 0x3145", 0xffffffff, 0x3145, t0, t1);
224 
225    printf("CLO\n");
226    TESTINST3("clo  $t0, $t1", 0, t0, t1);
227    TESTINST3("clo  $t0, $t1", 1, t0, t1);
228    TESTINST3("clo  $t0, $t1", 0x10, t0, t1);
229    TESTINST3("clo  $t0, $t1", 0xffffffff, t0, t1);
230 
231    printf("CLZ\n");
232    TESTINST3("clz  $t0, $t1", 0, t0, t1);
233    TESTINST3("clz  $t0, $t1", 1, t0, t1);
234    TESTINST3("clz  $t0, $t1", 0x10, t0, t1);
235    TESTINST3("clz  $t0, $t1", 0xffffffff, t0, t1);
236 
237    printf("DIV\n");
238    TESTINST3a("div  $t0, $t1", 0x6, 0x2, t0, t1);
239    TESTINST3a("div  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
240    TESTINST3a("div  $t0, $t1", 0xffffffff, 0x1, t0, t1);
241    TESTINST3a("div  $t0, $t1", 0x1, 0xffffffff, t0, t1);
242    TESTINST3a("div  $t0, $t1", 0x2, 0x6, t0, t1);
243 
244    printf("DIVU\n");
245    TESTINST3a("divu  $t0, $t1", 0x6, 0x2, t0, t1);
246    TESTINST3a("divu  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
247    TESTINST3a("divu  $t0, $t1", 0xffffffff, 0x1, t0, t1);
248    TESTINST3a("divu  $t0, $t1", 0x1, 0xffffffff, t0, t1);
249    TESTINST3a("divu  $t0, $t1", 0x2, 0x6, t0, t1);
250    TESTINST3a("divu  $t0, $t1", 0x0, 0x2, t0, t1);
251 
252 #if (__mips==32) && (__mips_isa_rev>=2)
253    printf("EXT\n");
254    TESTINST4("ext $t0, $t1, 2, 6", 0, 0xffffffff, t0, t1, 2, 6);
255    TESTINST4("ext $t0, $t1, 2, 6", 0xffffffff, 0xffffffff, t0, t1, 2, 6);
256    TESTINST4("ext $t0, $t1, 2, 6", 0, 0xffffffff, t0, t1, 31, 6);
257    TESTINST4("ext $t0, $t1, 2, 6", 0, 0, t0, t1, 32, 32);
258    TESTINST4("ext $t0, $t1, 2, 6", 0, 0xffff, t0, t1, 31, 0);
259    TESTINST4("ext $t0, $t1, 2, 6", 0, 0xff, t0, t1, 31, 0)
260    TESTINST4("ext $t0, $t1, 2, 6", 0, 0xf0000000, t0, t1, 31, 0)
261    TESTINST4("ext $t0, $t1, 2, 6", 0, 0xf0000000, t0, t1, 0, 31)
262    TESTINST4("ext $t0, $t1, 2, 6", 0, 0x31415927, t0, t1, 3, 25)
263 
264    printf("INS\n");
265    TESTINST4("ins $t0, $t1, 2, 6", 0, 0xffffffff, t0, t1, 2, 6);
266    TESTINST4("ins $t0, $t1, 2, 6", 0xffffffff, 0xffffffff, t0, t1, 2, 6);
267    TESTINST4("ins $t0, $t1, 2, 6", 0, 0xffffffff, t0, t1, 31, 6);
268    TESTINST4("ins $t0, $t1, 2, 6", 0, 0, t0, t1, 32, 32);
269    TESTINST4("ins $t0, $t1, 2, 6", 0, 0xffff, t0, t1, 31, 0);
270    TESTINST4("ins $t0, $t1, 2, 6", 0, 0xff, t0, t1, 31, 0)
271    TESTINST4("ins $t0, $t1, 2, 6", 0, 0xf0000000, t0, t1, 31, 0)
272    TESTINST4("ins $t0, $t1, 2, 6", 0, 0xf0000000, t0, t1, 0, 31)
273    TESTINST4("ins $t0, $t1, 2, 6", 0, 0x31415927, t0, t1, 3, 25)
274 #endif
275 
276    printf("LB\n");
277    TESTINSN5LOAD("lb $t0, 0($t1)", 0, 0, t0);
278    TESTINSN5LOAD("lb $t0, 4($t1)", 0, 4, t0);
279    TESTINSN5LOAD("lb $t0, 8($t1)", 0, 8, t0);
280    TESTINSN5LOAD("lb $t0, 12($t1)", 0, 12, t0);
281    TESTINSN5LOAD("lb $t0, 16($t1)", 0, 16, t0);
282    TESTINSN5LOAD("lb $t0, 20($t1)", 0, 20, t0);
283    TESTINSN5LOAD("lb $t0, 24($t1)", 0, 24, t0);
284    TESTINSN5LOAD("lb $t0, 28($t1)", 0, 28, t0);
285    TESTINSN5LOAD("lb $t0, 32($t1)", 0, 32, t0);
286    TESTINSN5LOAD("lb $t0, 36($t1)", 0, 36, t0);
287    TESTINSN5LOAD("lb $t0, 40($t1)", 0, 40, t0);
288    TESTINSN5LOAD("lb $t0, 44($t1)", 0, 44, t0);
289    TESTINSN5LOAD("lb $t0, 48($t1)", 0, 48, t0);
290    TESTINSN5LOAD("lb $t0, 52($t1)", 0, 52, t0);
291    TESTINSN5LOAD("lb $t0, 56($t1)", 0, 56, t0);
292    TESTINSN5LOAD("lb $t0, 60($t1)", 0, 60, t0);
293    TESTINSN5LOAD("lb $t0, 64($t1)", 0, 64, t0);
294    TESTINSN5LOAD("lb $t0, 2($t1)", 0, 2, t0);
295    TESTINSN5LOAD("lb $t0, 6($t1)", 0, 6, t0);
296    TESTINSN5LOAD("lb $t0, 10($t1)", 0, 10, t0);
297    TESTINSN5LOAD("lb $t0, 14($t1)", 0, 14, t0);
298    TESTINSN5LOAD("lb $t0, 18($t1)", 0, 18, t0);
299    TESTINSN5LOAD("lb $t0, 22($t1)", 0, 22, t0);
300    TESTINSN5LOAD("lb $t0, 26($t1)", 0, 26, t0);
301    TESTINSN5LOAD("lb $t0, 30($t1)", 0, 30, t0);
302    TESTINSN5LOAD("lb $t0, 34($t1)", 0, 34, t0);
303    TESTINSN5LOAD("lb $t0, 38($t1)", 0, 38, t0);
304 
305    printf("LBU\n");
306    TESTINSN5LOAD("lbu $t0, 0($t1)", 0, 0, t0);
307    TESTINSN5LOAD("lbu $t0, 4($t1)", 0, 4, t0);
308    TESTINSN5LOAD("lbu $t0, 8($t1)", 0, 8, t0);
309    TESTINSN5LOAD("lbu $t0, 12($t1)", 0, 12, t0);
310    TESTINSN5LOAD("lbu $t0, 16($t1)", 0, 16, t0);
311    TESTINSN5LOAD("lbu $t0, 20($t1)", 0, 20, t0);
312    TESTINSN5LOAD("lbu $t0, 24($t1)", 0, 24, t0);
313    TESTINSN5LOAD("lbu $t0, 28($t1)", 0, 28, t0);
314    TESTINSN5LOAD("lbu $t0, 32($t1)", 0, 32, t0);
315    TESTINSN5LOAD("lbu $t0, 36($t1)", 0, 36, t0);
316    TESTINSN5LOAD("lbu $t0, 40($t1)", 0, 40, t0);
317    TESTINSN5LOAD("lbu $t0, 44($t1)", 0, 44, t0);
318    TESTINSN5LOAD("lbu $t0, 48($t1)", 0, 48, t0);
319    TESTINSN5LOAD("lbu $t0, 52($t1)", 0, 52, t0);
320    TESTINSN5LOAD("lbu $t0, 56($t1)", 0, 56, t0);
321    TESTINSN5LOAD("lbu $t0, 60($t1)", 0, 60, t0);
322    TESTINSN5LOAD("lbu $t0, 64($t1)", 0, 64, t0);
323    TESTINSN5LOAD("lbu $t0, 2($t1)", 0, 2, t0);
324    TESTINSN5LOAD("lbu $t0, 6($t1)", 0, 6, t0);
325    TESTINSN5LOAD("lbu $t0, 10($t1)", 0, 10, t0);
326    TESTINSN5LOAD("lbu $t0, 14($t1)", 0, 14, t0);
327    TESTINSN5LOAD("lbu $t0, 18($t1)", 0, 18, t0);
328    TESTINSN5LOAD("lbu $t0, 22($t1)", 0, 22, t0);
329    TESTINSN5LOAD("lbu $t0, 26($t1)", 0, 26, t0);
330    TESTINSN5LOAD("lbu $t0, 30($t1)", 0, 30, t0);
331    TESTINSN5LOAD("lbu $t0, 34($t1)", 0, 34, t0);
332    TESTINSN5LOAD("lbu $t0, 38($t1)", 0, 38, t0);
333 
334    printf("LH\n");
335    TESTINSN5LOAD("lh $t0, 0($t1)", 0, 0, t0);
336    TESTINSN5LOAD("lh $t0, 4($t1)", 0, 4, t0);
337    TESTINSN5LOAD("lh $t0, 8($t1)", 0, 8, t0);
338    TESTINSN5LOAD("lh $t0, 12($t1)", 0, 12, t0);
339    TESTINSN5LOAD("lh $t0, 16($t1)", 0, 16, t0);
340    TESTINSN5LOAD("lh $t0, 20($t1)", 0, 20, t0);
341    TESTINSN5LOAD("lh $t0, 24($t1)", 0, 24, t0);
342    TESTINSN5LOAD("lh $t0, 28($t1)", 0, 28, t0);
343    TESTINSN5LOAD("lh $t0, 32($t1)", 0, 32, t0);
344    TESTINSN5LOAD("lh $t0, 36($t1)", 0, 36, t0);
345    TESTINSN5LOAD("lh $t0, 40($t1)", 0, 40, t0);
346    TESTINSN5LOAD("lh $t0, 44($t1)", 0, 44, t0);
347    TESTINSN5LOAD("lh $t0, 48($t1)", 0, 48, t0);
348    TESTINSN5LOAD("lh $t0, 52($t1)", 0, 52, t0);
349    TESTINSN5LOAD("lh $t0, 56($t1)", 0, 56, t0);
350    TESTINSN5LOAD("lh $t0, 60($t1)", 0, 60, t0);
351    TESTINSN5LOAD("lh $t0, 64($t1)", 0, 64, t0);
352    TESTINSN5LOAD("lh $t0, 2($t1)", 0, 2, t0);
353    TESTINSN5LOAD("lh $t0, 6($t1)", 0, 6, t0);
354    TESTINSN5LOAD("lh $t0, 10($t1)", 0, 10, t0);
355    TESTINSN5LOAD("lh $t0, 14($t1)", 0, 14, t0);
356    TESTINSN5LOAD("lh $t0, 18($t1)", 0, 18, t0);
357    TESTINSN5LOAD("lh $t0, 22($t1)", 0, 22, t0);
358    TESTINSN5LOAD("lh $t0, 26($t1)", 0, 26, t0);
359    TESTINSN5LOAD("lh $t0, 30($t1)", 0, 30, t0);
360    TESTINSN5LOAD("lh $t0, 34($t1)", 0, 34, t0);
361    TESTINSN5LOAD("lh $t0, 38($t1)", 0, 38, t0);
362 
363    printf("LHU\n");
364    TESTINSN5LOAD("lhu $t0, 0($t1)", 0, 0, t0);
365    TESTINSN5LOAD("lhu $t0, 4($t1)", 0, 4, t0);
366    TESTINSN5LOAD("lhu $t0, 8($t1)", 0, 8, t0);
367    TESTINSN5LOAD("lhu $t0, 12($t1)", 0, 12, t0);
368    TESTINSN5LOAD("lhu $t0, 16($t1)", 0, 16, t0);
369    TESTINSN5LOAD("lhu $t0, 20($t1)", 0, 20, t0);
370    TESTINSN5LOAD("lhu $t0, 24($t1)", 0, 24, t0);
371    TESTINSN5LOAD("lhu $t0, 28($t1)", 0, 28, t0);
372    TESTINSN5LOAD("lhu $t0, 32($t1)", 0, 32, t0);
373    TESTINSN5LOAD("lhu $t0, 36($t1)", 0, 36, t0);
374    TESTINSN5LOAD("lhu $t0, 40($t1)", 0, 40, t0);
375    TESTINSN5LOAD("lhu $t0, 44($t1)", 0, 44, t0);
376    TESTINSN5LOAD("lhu $t0, 48($t1)", 0, 48, t0);
377    TESTINSN5LOAD("lhu $t0, 52($t1)", 0, 52, t0);
378    TESTINSN5LOAD("lhu $t0, 56($t1)", 0, 56, t0);
379    TESTINSN5LOAD("lhu $t0, 60($t1)", 0, 60, t0);
380    TESTINSN5LOAD("lhu $t0, 64($t1)", 0, 64, t0);
381    TESTINSN5LOAD("lhu $t0, 2($t1)", 0, 2, t0);
382    TESTINSN5LOAD("lhu $t0, 6($t1)", 0, 6, t0);
383    TESTINSN5LOAD("lhu $t0, 10($t1)", 0, 10, t0);
384    TESTINSN5LOAD("lhu $t0, 14($t1)", 0, 14, t0);
385    TESTINSN5LOAD("lhu $t0, 18($t1)", 0, 18, t0);
386    TESTINSN5LOAD("lhu $t0, 22($t1)", 0, 22, t0);
387    TESTINSN5LOAD("lhu $t0, 26($t1)", 0, 26, t0);
388    TESTINSN5LOAD("lhu $t0, 30($t1)", 0, 30, t0);
389    TESTINSN5LOAD("lhu $t0, 34($t1)", 0, 34, t0);
390    TESTINSN5LOAD("lhu $t0, 38($t1)", 0, 38, t0);
391 
392    printf("LUI\n");
393    TESTINST3("lui  $t0, 0xffff", 0xffff, t0, t1);
394    TESTINST3("lui  $t0, 0xff00", 0xff00, t0, t1);
395    TESTINST3("lui  $t0, 0xff", 0xff, t0, t1);
396    TESTINST3("lui  $t0, 0x0", 0x0, t0, t1);
397    TESTINST3("lui  $t0, 0x5", 0x5, t0, t1);
398    TESTINST3("lui  $t0, 0x387", 0x387, t0, t1);
399 
400    printf("LW\n");
401    TESTINSN5LOAD("lw $t0, 0($t1)", 0, 0, t0);
402    TESTINSN5LOAD("lw $t0, 4($t1)", 0, 4, t0);
403    TESTINSN5LOAD("lw $t0, 8($t1)", 0, 8, t0);
404    TESTINSN5LOAD("lw $t0, 12($t1)", 0, 12, t0);
405    TESTINSN5LOAD("lw $t0, 16($t1)", 0, 16, t0);
406    TESTINSN5LOAD("lw $t0, 20($t1)", 0, 20, t0);
407    TESTINSN5LOAD("lw $t0, 24($t1)", 0, 24, t0);
408    TESTINSN5LOAD("lw $t0, 28($t1)", 0, 28, t0);
409    TESTINSN5LOAD("lw $t0, 32($t1)", 0, 32, t0);
410    TESTINSN5LOAD("lw $t0, 36($t1)", 0, 36, t0);
411    TESTINSN5LOAD("lw $t0, 40($t1)", 0, 40, t0);
412    TESTINSN5LOAD("lw $t0, 44($t1)", 0, 44, t0);
413    TESTINSN5LOAD("lw $t0, 48($t1)", 0, 48, t0);
414    TESTINSN5LOAD("lw $t0, 52($t1)", 0, 52, t0);
415    TESTINSN5LOAD("lw $t0, 56($t1)", 0, 56, t0);
416    TESTINSN5LOAD("lw $t0, 60($t1)", 0, 60, t0);
417    TESTINSN5LOAD("lw $t0, 64($t1)", 0, 64, t0);
418    TESTINSN5LOAD("lw $t0, 2($t1)", 0, 2, t0);
419    TESTINSN5LOAD("lw $t0, 6($t1)", 0, 6, t0);
420    TESTINSN5LOAD("lw $t0, 10($t1)", 0, 10, t0);
421    TESTINSN5LOAD("lw $t0, 14($t1)", 0, 14, t0);
422    TESTINSN5LOAD("lw $t0, 18($t1)", 0, 18, t0);
423    TESTINSN5LOAD("lw $t0, 22($t1)", 0, 22, t0);
424    TESTINSN5LOAD("lw $t0, 26($t1)", 0, 26, t0);
425    TESTINSN5LOAD("lw $t0, 30($t1)", 0, 30, t0);
426    TESTINSN5LOAD("lw $t0, 34($t1)", 0, 34, t0);
427    TESTINSN5LOAD("lw $t0, 38($t1)", 0, 38, t0);
428 
429    printf("LWL\n");
430    TESTINSN5LOAD("lwl $t0, 0($t1)", 0, 0, t0);
431    TESTINSN5LOAD("lwl $t0, 4($t1)", 0, 4, t0);
432    TESTINSN5LOAD("lwl $t0, 8($t1)", 0, 8, t0);
433    TESTINSN5LOAD("lwl $t0, 12($t1)", 0, 12, t0);
434    TESTINSN5LOAD("lwl $t0, 16($t1)", 0, 16, t0);
435    TESTINSN5LOAD("lwl $t0, 20($t1)", 0, 20, t0);
436    TESTINSN5LOAD("lwl $t0, 24($t1)", 0, 24, t0);
437    TESTINSN5LOAD("lwl $t0, 28($t1)", 0, 28, t0);
438    TESTINSN5LOAD("lwl $t0, 32($t1)", 0, 32, t0);
439    TESTINSN5LOAD("lwl $t0, 36($t1)", 0, 36, t0);
440    TESTINSN5LOAD("lwl $t0, 40($t1)", 0, 40, t0);
441    TESTINSN5LOAD("lwl $t0, 44($t1)", 0, 44, t0);
442    TESTINSN5LOAD("lwl $t0, 48($t1)", 0, 48, t0);
443    TESTINSN5LOAD("lwl $t0, 52($t1)", 0, 52, t0);
444    TESTINSN5LOAD("lwl $t0, 56($t1)", 0, 56, t0);
445    TESTINSN5LOAD("lwl $t0, 60($t1)", 0, 60, t0);
446    TESTINSN5LOAD("lwl $t0, 64($t1)", 0, 64, t0);
447    TESTINSN5LOAD("lwl $t0, 2($t1)", 0, 2, t0);
448    TESTINSN5LOAD("lwl $t0, 6($t1)", 0, 6, t0);
449    TESTINSN5LOAD("lwl $t0, 10($t1)", 0, 10, t0);
450    TESTINSN5LOAD("lwl $t0, 14($t1)", 0, 14, t0);
451    TESTINSN5LOAD("lwl $t0, 18($t1)", 0, 18, t0);
452    TESTINSN5LOAD("lwl $t0, 22($t1)", 0, 22, t0);
453    TESTINSN5LOAD("lwl $t0, 26($t1)", 0, 26, t0);
454    TESTINSN5LOAD("lwl $t0, 30($t1)", 0, 30, t0);
455    TESTINSN5LOAD("lwl $t0, 34($t1)", 0, 34, t0);
456    TESTINSN5LOAD("lwl $t0, 38($t1)", 0, 38, t0);
457 
458    printf("LWR\n");
459    TESTINSN5LOAD("lwr $t0, 0($t1)", 0, 0, t0);
460    TESTINSN5LOAD("lwr $t0, 4($t1)", 0, 4, t0);
461    TESTINSN5LOAD("lwr $t0, 8($t1)", 0, 8, t0);
462    TESTINSN5LOAD("lwr $t0, 12($t1)", 0, 12, t0);
463    TESTINSN5LOAD("lwr $t0, 16($t1)", 0, 16, t0);
464    TESTINSN5LOAD("lwr $t0, 20($t1)", 0, 20, t0);
465    TESTINSN5LOAD("lwr $t0, 24($t1)", 0, 24, t0);
466    TESTINSN5LOAD("lwr $t0, 28($t1)", 0, 28, t0);
467    TESTINSN5LOAD("lwr $t0, 32($t1)", 0, 32, t0);
468    TESTINSN5LOAD("lwr $t0, 36($t1)", 0, 36, t0);
469    TESTINSN5LOAD("lwr $t0, 40($t1)", 0, 40, t0);
470    TESTINSN5LOAD("lwr $t0, 44($t1)", 0, 44, t0);
471    TESTINSN5LOAD("lwr $t0, 48($t1)", 0, 48, t0);
472    TESTINSN5LOAD("lwr $t0, 52($t1)", 0, 52, t0);
473    TESTINSN5LOAD("lwr $t0, 56($t1)", 0, 56, t0);
474    TESTINSN5LOAD("lwr $t0, 60($t1)", 0, 60, t0);
475    TESTINSN5LOAD("lwr $t0, 64($t1)", 0, 64, t0);
476    TESTINSN5LOAD("lwr $t0, 2($t1)", 0, 2, t0);
477    TESTINSN5LOAD("lwr $t0, 6($t1)", 0, 6, t0);
478    TESTINSN5LOAD("lwr $t0, 10($t1)", 0, 10, t0);
479    TESTINSN5LOAD("lwr $t0, 14($t1)", 0, 14, t0);
480    TESTINSN5LOAD("lwr $t0, 18($t1)", 0, 18, t0);
481    TESTINSN5LOAD("lwr $t0, 22($t1)", 0, 22, t0);
482    TESTINSN5LOAD("lwr $t0, 26($t1)", 0, 26, t0);
483    TESTINSN5LOAD("lwr $t0, 30($t1)", 0, 30, t0);
484    TESTINSN5LOAD("lwr $t0, 34($t1)", 0, 34, t0);
485    TESTINSN5LOAD("lwr $t0, 38($t1)", 0, 38, t0);
486 
487    printf("MADD\n");
488    TESTINST3a("madd  $t0, $t1", 0x6, 0x2, t0, t1);
489    TESTINST3a("madd  $t0, $t1", 0x55, 0x28, t0, t1);
490    TESTINST3a("madd  $t0, $t1", 0x18, 0xfff, t0, t1);
491    TESTINST3a("madd  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
492    TESTINST3a("madd  $t0, $t1", 0xffffffff, 0x1, t0, t1);
493    TESTINST3a("madd  $t0, $t1", 0x1, 0xffffffff, t0, t1);
494    TESTINST3a("madd  $t0, $t1", 0x2, 0x6, t0, t1);
495    TESTINST3a("madd  $t0, $t1", 0x356, 0x555, t0, t1);
496 
497    printf("MADDU\n");
498    TESTINST3a("maddu  $t0, $t1", 0x6, 0x2, t0, t1);
499    TESTINST3a("maddu  $t0, $t1", 0x55, 0x28, t0, t1);
500    TESTINST3a("maddu  $t0, $t1", 0x18, 0xfff, t0, t1);
501    TESTINST3a("maddu  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
502    TESTINST3a("maddu  $t0, $t1", 0xffffffff, 0x1, t0, t1);
503    TESTINST3a("maddu  $t0, $t1", 0x1, 0xffffffff, t0, t1);
504    TESTINST3a("maddu  $t0, $t1", 0x2, 0x6, t0, t1);
505    TESTINST3a("maddu  $t0, $t1", 0x356, 0x555, t0, t1);
506 
507    printf("MOVN\n");
508    TESTINST1("movn $t0, $t1, $t2", 0x31415927, 0,          t0, t1, t2);
509    TESTINST1("movn $t0, $t1, $t2", 0x31415927, 1,          t0, t1, t2);
510    TESTINST1("movn $t0, $t1, $t2", 0,          255,        t0, t1, t2);
511    TESTINST1("movn $t0, $t1, $t2", -1,         0,          t0, t1, t2);
512    TESTINST1("movn $t0, $t1, $t2", 0,          1,          t0, t1, t2);
513    TESTINST1("movn $t0, $t1, $t2", 0,          0,          t0, t1, t2);
514    TESTINST1("movn $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
515    TESTINST1("movn $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
516    TESTINST1("movn $t0, $t1, $t2", 0x7fffffff, 1,          t0, t1, t2);
517    TESTINST1("movn $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
518    TESTINST1("movn $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
519    TESTINST1("movn $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
520    TESTINST1("movn $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
521    TESTINST1("movn $t0, $t1, $t2", 0x31415927, 0,          t0, t1, t2);
522    TESTINST1("movn $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
523    TESTINST1("movn $t0, $t1, $t2", 0,          1,          t0, t1, t2);
524    TESTINST1("movn $t0, $t1, $t2", 1,          0,          t0, t1, t2);
525    TESTINST1("movn $t0, $t1, $t2", 0,          1,          t0, t1, t2);
526    TESTINST1("movn $t0, $t1, $t2", -1,         0,          t0, t1, t2);
527    TESTINST1("movn $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
528    TESTINST1("movn $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
529    TESTINST1("movn $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
530    TESTINST1("movn $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
531    TESTINST1("movn $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
532    TESTINST1("movn $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
533    TESTINST1("movn $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
534 
535    printf("MOVZ\n");
536    TESTINST1("movz $t0, $t1, $t2", 0x31415927, 0,          t0, t1, t2);
537    TESTINST1("movz $t0, $t1, $t2", 0x31415927, 1,          t0, t1, t2);
538    TESTINST1("movz $t0, $t1, $t2", 0,          255,        t0, t1, t2);
539    TESTINST1("movz $t0, $t1, $t2", -1,         0,          t0, t1, t2);
540    TESTINST1("movz $t0, $t1, $t2", 0,          1,          t0, t1, t2);
541    TESTINST1("movz $t0, $t1, $t2", 0,          0,          t0, t1, t2);
542    TESTINST1("movz $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
543    TESTINST1("movz $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
544    TESTINST1("movz $t0, $t1, $t2", 0x7fffffff, 1,          t0, t1, t2);
545    TESTINST1("movz $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
546    TESTINST1("movz $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
547    TESTINST1("movz $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
548    TESTINST1("movz $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
549    TESTINST1("movz $t0, $t1, $t2", 0x31415927, 0,          t0, t1, t2);
550    TESTINST1("movz $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
551    TESTINST1("movz $t0, $t1, $t2", 0,          1,          t0, t1, t2);
552    TESTINST1("movz $t0, $t1, $t2", 1,          0,          t0, t1, t2);
553    TESTINST1("movz $t0, $t1, $t2", 0,          1,          t0, t1, t2);
554    TESTINST1("movz $t0, $t1, $t2", -1,         0,          t0, t1, t2);
555    TESTINST1("movz $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
556    TESTINST1("movz $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
557    TESTINST1("movz $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
558    TESTINST1("movz $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
559    TESTINST1("movz $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
560    TESTINST1("movz $t0, $t1, $t2", 0x80000000, 1,          t0, t1, t2);
561    TESTINST1("movz $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
562 
563    printf("MSUB\n");
564    TESTINST3a("msub  $t0, $t1", 0x6, 0x2, t0, t1);
565    TESTINST3a("msub  $t0, $t1", 0x55, 0x28, t0, t1);
566    TESTINST3a("msub  $t0, $t1", 0x18, 0xfff, t0, t1);
567    TESTINST3a("msub  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
568    TESTINST3a("msub  $t0, $t1", 0xffffffff, 0x1, t0, t1);
569    TESTINST3a("msub  $t0, $t1", 0x1, 0xffffffff, t0, t1);
570    TESTINST3a("msub  $t0, $t1", 0x2, 0x6, t0, t1);
571    TESTINST3a("msub  $t0, $t1", 0x356, 0x555, t0, t1);
572 
573    printf("MSUBU\n");
574    TESTINST3a("msubu  $t0, $t1", 0x31415927, 0xffffffff, t0, t1);
575    TESTINST3a("msubu  $t0, $t1", 0x31415927, 0xee00ee00, t0, t1);
576    TESTINST3a("msubu  $t0, $t1", 0,          255,        t0, t1);
577    TESTINST3a("msubu  $t0, $t1", -1,         0,          t0, t1);
578    TESTINST3a("msubu  $t0, $t1", 0,          1,          t0, t1);
579    TESTINST3a("msubu  $t0, $t1", 0,          0,          t0, t1);
580    TESTINST3a("msubu  $t0, $t1", 0x80000000, -1,         t0, t1);
581    TESTINST3a("msubu  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
582    TESTINST3a("msubu  $t0, $t1", 0x7fffffff, 0,          t0, t1);
583    TESTINST3a("msubu  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
584    TESTINST3a("msubu  $t0, $t1", 0x7fffffff, 0x80000000, t0, t1);
585    TESTINST3a("msubu  $t0, $t1", 0x80000000, 0xff000000, t0, t1);
586    TESTINST3a("msubu  $t0, $t1", 0x7fffffff, 0x0dd00000, t0, t1);
587    TESTINST3a("msubu  $t0, $t1", 0x31415927, 0xffffffff, t0, t1);
588    TESTINST3a("msubu  $t0, $t1", 0x31415927, 0xee00ee00, t0, t1);
589    TESTINST3a("msubu  $t0, $t1", 0,          255,        t0, t1);
590    TESTINST3a("msubu  $t0, $t1", 1,          0,          t0, t1);
591    TESTINST3a("msubu  $t0, $t1", 0,          1,          t0, t1);
592    TESTINST3a("msubu  $t0, $t1", -1,         0,          t0, t1);
593    TESTINST3a("msubu  $t0, $t1", 0,          -1,         t0, t1);
594    TESTINST3a("msubu  $t0, $t1", 0,          0x80000000, t0, t1);
595    TESTINST3a("msubu  $t0, $t1", 0x80000000, 0,          t0, t1);
596    TESTINST3a("msubu  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
597    TESTINST3a("msubu  $t0, $t1", 0x7fffffff, 0x80000000, t0, t1);
598    TESTINST3a("msubu  $t0, $t1", 0x80000000, 0xff000000, t0, t1);
599    TESTINST3a("msubu  $t0, $t1", 0x7fffffff, 0x0dd00000, t0, t1);
600    TESTINST3a("msubu  $t0, $t1", 0xffffffff, 0,          t0, t1);
601    TESTINST3a("msubu  $t0, $t1", 0,          0xffffffff, t0, t1);
602    TESTINST3a("msubu  $t0, $t1", 0xffffffff, 0xffffffff, t0, t1);
603    TESTINST3a("msubu  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
604    TESTINST3a("msubu  $t0, $t1", 0x0000ffff, 0x0000ffff, t0, t1);
605 
606    printf("MUL\n");
607    TESTINST1("mul $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
608    TESTINST1("mul $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
609    TESTINST1("mul $t0, $t1, $t2", 0,          255,        t0, t1, t2);
610    TESTINST1("mul $t0, $t1, $t2", -1,         0,          t0, t1, t2);
611    TESTINST1("mul $t0, $t1, $t2", 0,          1,          t0, t1, t2);
612    TESTINST1("mul $t0, $t1, $t2", 0,          0,          t0, t1, t2);
613    TESTINST1("mul $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
614    TESTINST1("mul $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
615    TESTINST1("mul $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
616    TESTINST1("mul $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
617    TESTINST1("mul $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
618    TESTINST1("mul $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
619    TESTINST1("mul $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
620    TESTINST1("mul $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
621    TESTINST1("mul $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
622    TESTINST1("mul $t0, $t1, $t2", 0,          255,        t0, t1, t2);
623    TESTINST1("mul $t0, $t1, $t2", 1,          0,          t0, t1, t2);
624    TESTINST1("mul $t0, $t1, $t2", 0,          1,          t0, t1, t2);
625    TESTINST1("mul $t0, $t1, $t2", -1,         0,          t0, t1, t2);
626    TESTINST1("mul $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
627    TESTINST1("mul $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
628    TESTINST1("mul $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
629    TESTINST1("mul $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
630    TESTINST1("mul $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
631    TESTINST1("mul $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
632    TESTINST1("mul $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
633    TESTINST1("mul $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
634    TESTINST1("mul $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
635    TESTINST1("mul $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
636    TESTINST1("mul $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
637    TESTINST1("mul $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
638 
639    printf("MULT\n");
640    TESTINST3a("mult  $t0, $t1", 0x31415927, 0xffffffff, t0, t1);
641    TESTINST3a("mult  $t0, $t1", 0x31415927, 0xee00ee00, t0, t1);
642    TESTINST3a("mult  $t0, $t1", 0,          255,        t0, t1);
643    TESTINST3a("mult  $t0, $t1", -1,         0,          t0, t1);
644    TESTINST3a("mult  $t0, $t1", 0,          1,          t0, t1);
645    TESTINST3a("mult  $t0, $t1", 0,          0,          t0, t1);
646    TESTINST3a("mult  $t0, $t1", 0x80000000, -1,         t0, t1);
647    TESTINST3a("mult  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
648    TESTINST3a("mult  $t0, $t1", 0x7fffffff, 0,          t0, t1);
649    TESTINST3a("mult  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
650    TESTINST3a("mult  $t0, $t1", 0x7fffffff, 0x80000000, t0, t1);
651    TESTINST3a("mult  $t0, $t1", 0x80000000, 0xff000000, t0, t1);
652    TESTINST3a("mult  $t0, $t1", 0x7fffffff, 0x0dd00000, t0, t1);
653    TESTINST3a("mult  $t0, $t1", 0x31415927, 0xffffffff, t0, t1);
654    TESTINST3a("mult  $t0, $t1", 0x31415927, 0xee00ee00, t0, t1);
655    TESTINST3a("mult  $t0, $t1", 0,          255,        t0, t1);
656    TESTINST3a("mult  $t0, $t1", 1,          0,          t0, t1);
657    TESTINST3a("mult  $t0, $t1", 0,          1,          t0, t1);
658    TESTINST3a("mult  $t0, $t1", -1,         0,          t0, t1);
659    TESTINST3a("mult  $t0, $t1", 0,          -1,         t0, t1);
660    TESTINST3a("mult  $t0, $t1", 0,          0x80000000, t0, t1);
661    TESTINST3a("mult  $t0, $t1", 0x80000000, 0,          t0, t1);
662    TESTINST3a("mult  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
663    TESTINST3a("mult  $t0, $t1", 0x7fffffff, 0x80000000, t0, t1);
664    TESTINST3a("mult  $t0, $t1", 0x80000000, 0xff000000, t0, t1);
665    TESTINST3a("mult  $t0, $t1", 0x7fffffff, 0x0dd00000, t0, t1);
666    TESTINST3a("mult  $t0, $t1", 0xffffffff, 0,          t0, t1);
667    TESTINST3a("mult  $t0, $t1", 0,          0xffffffff, t0, t1);
668    TESTINST3a("mult  $t0, $t1", 0xffffffff, 0xffffffff, t0, t1);
669    TESTINST3a("mult  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
670    TESTINST3a("mult  $t0, $t1", 0x0000ffff, 0x0000ffff, t0, t1);
671 
672    printf("MULTU\n");
673    TESTINST3a("multu  $t0, $t1", 0x31415927, 0xffffffff, t0, t1);
674    TESTINST3a("multu  $t0, $t1", 0x31415927, 0xee00ee00, t0, t1);
675    TESTINST3a("multu  $t0, $t1", 0,          255,        t0, t1);
676    TESTINST3a("multu  $t0, $t1", -1,         0,          t0, t1);
677    TESTINST3a("multu  $t0, $t1", 0,          1,          t0, t1);
678    TESTINST3a("multu  $t0, $t1", 0,          0,          t0, t1);
679    TESTINST3a("multu  $t0, $t1", 0x80000000, -1,         t0, t1);
680    TESTINST3a("multu  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
681    TESTINST3a("multu  $t0, $t1", 0x7fffffff, 0,          t0, t1);
682    TESTINST3a("multu  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
683    TESTINST3a("multu  $t0, $t1", 0x7fffffff, 0x80000000, t0, t1);
684    TESTINST3a("multu  $t0, $t1", 0x80000000, 0xff000000, t0, t1);
685    TESTINST3a("multu  $t0, $t1", 0x7fffffff, 0x0dd00000, t0, t1);
686    TESTINST3a("multu  $t0, $t1", 0x31415927, 0xffffffff, t0, t1);
687    TESTINST3a("multu  $t0, $t1", 0x31415927, 0xee00ee00, t0, t1);
688    TESTINST3a("multu  $t0, $t1", 0,          255,        t0, t1);
689    TESTINST3a("multu  $t0, $t1", 1,          0,          t0, t1);
690    TESTINST3a("multu  $t0, $t1", 0,          1,          t0, t1);
691    TESTINST3a("multu  $t0, $t1", -1,         0,          t0, t1);
692    TESTINST3a("multu  $t0, $t1", 0,          -1,         t0, t1);
693    TESTINST3a("multu  $t0, $t1", 0,          0x80000000, t0, t1);
694    TESTINST3a("multu  $t0, $t1", 0x80000000, 0,          t0, t1);
695    TESTINST3a("multu  $t0, $t1", 0x80000000, 0x80000000, t0, t1);
696    TESTINST3a("multu  $t0, $t1", 0x7fffffff, 0x80000000, t0, t1);
697    TESTINST3a("multu  $t0, $t1", 0x80000000, 0xff000000, t0, t1);
698    TESTINST3a("multu  $t0, $t1", 0x7fffffff, 0x0dd00000, t0, t1);
699    TESTINST3a("multu  $t0, $t1", 0xffffffff, 0,          t0, t1);
700    TESTINST3a("multu  $t0, $t1", 0,          0xffffffff, t0, t1);
701    TESTINST3a("multu  $t0, $t1", 0xffffffff, 0xffffffff, t0, t1);
702    TESTINST3a("multu  $t0, $t1", 0x7fffffff, 0x7fffffff, t0, t1);
703    TESTINST3a("multu  $t0, $t1", 0x0000ffff, 0x0000ffff, t0, t1);
704 
705    printf("NOR\n");
706    TESTINST1("nor $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
707    TESTINST1("nor $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
708    TESTINST1("nor $t0, $t1, $t2", 0,          255,        t0, t1, t2);
709    TESTINST1("nor $t0, $t1, $t2", -1,         0,          t0, t1, t2);
710    TESTINST1("nor $t0, $t1, $t2", 0,          1,          t0, t1, t2);
711    TESTINST1("nor $t0, $t1, $t2", 0,          0,          t0, t1, t2);
712    TESTINST1("nor $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
713    TESTINST1("nor $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
714    TESTINST1("nor $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
715    TESTINST1("nor $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
716    TESTINST1("nor $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
717    TESTINST1("nor $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
718    TESTINST1("nor $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
719    TESTINST1("nor $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
720    TESTINST1("nor $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
721    TESTINST1("nor $t0, $t1, $t2", 0,          255,        t0, t1, t2);
722    TESTINST1("nor $t0, $t1, $t2", 1,          0,          t0, t1, t2);
723    TESTINST1("nor $t0, $t1, $t2", 0,          1,          t0, t1, t2);
724    TESTINST1("nor $t0, $t1, $t2", -1,         0,          t0, t1, t2);
725    TESTINST1("nor $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
726    TESTINST1("nor $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
727    TESTINST1("nor $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
728    TESTINST1("nor $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
729    TESTINST1("nor $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
730    TESTINST1("nor $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
731    TESTINST1("nor $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
732    TESTINST1("nor $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
733    TESTINST1("nor $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
734    TESTINST1("nor $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
735    TESTINST1("nor $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
736    TESTINST1("nor $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
737 
738 #if (__mips==32) && (__mips_isa_rev>=2)
739    printf("WSBH\n");
740    TESTINST3("wsbh  $t0, $t1", 0x2, t0, t1);
741    TESTINST3("wsbh  $t0, $t1", 0x28, t0, t1);
742    TESTINST3("wsbh  $t0, $t1", -258, t0, t1);
743    TESTINST3("wsbh  $t0, $t1", 0x7fffffff, t0, t1);
744    TESTINST3("wsbh  $t0, $t1", -11, t0, t1);
745    TESTINST3("wsbh  $t0, $t1", 0xffffffff, t0, t1);
746    TESTINST3("wsbh  $t0, $t1", 0x16, t0, t1);
747    TESTINST3("wsbh  $t0, $t1", -1, t0, t1);
748 #endif
749 
750    printf("NOT\n");
751    TESTINST3("not  $t0, $t1", 0x2, t0, t1);
752    TESTINST3("not  $t0, $t1", 0x28, t0, t1);
753    TESTINST3("not  $t0, $t1", -258, t0, t1);
754    TESTINST3("not  $t0, $t1", 0x7fffffff, t0, t1);
755    TESTINST3("not  $t0, $t1", -11, t0, t1);
756    TESTINST3("not  $t0, $t1", 0xffffffff, t0, t1);
757    TESTINST3("not  $t0, $t1", 0x16, t0, t1);
758    TESTINST3("not  $t0, $t1", -1, t0, t1);
759 
760    printf("NEGU\n");
761    TESTINST3("negu  $t0, $t1", 0x2, t0, t1);
762    TESTINST3("negu  $t0, $t1", 0x28, t0, t1);
763    TESTINST3("negu  $t0, $t1", -258, t0, t1);
764    TESTINST3("negu  $t0, $t1", 0x7fffffff, t0, t1);
765    TESTINST3("negu  $t0, $t1", -11, t0, t1);
766    TESTINST3("negu  $t0, $t1", 0xffffffff, t0, t1);
767    TESTINST3("negu  $t0, $t1", 0x16, t0, t1);
768    TESTINST3("negu  $t0, $t1", -1, t0, t1);
769 
770    printf("OR\n");
771    TESTINST1("or $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
772    TESTINST1("or $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
773    TESTINST1("or $t0, $t1, $t2", 0,          255,        t0, t1, t2);
774    TESTINST1("or $t0, $t1, $t2", -1,         0,          t0, t1, t2);
775    TESTINST1("or $t0, $t1, $t2", 0,          1,          t0, t1, t2);
776    TESTINST1("or $t0, $t1, $t2", 0,          0,          t0, t1, t2);
777    TESTINST1("or $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
778    TESTINST1("or $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
779    TESTINST1("or $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
780    TESTINST1("or $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
781    TESTINST1("or $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
782    TESTINST1("or $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
783    TESTINST1("or $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
784    TESTINST1("or $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
785    TESTINST1("or $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
786    TESTINST1("or $t0, $t1, $t2", 0,          255,        t0, t1, t2);
787    TESTINST1("or $t0, $t1, $t2", 1,          0,          t0, t1, t2);
788    TESTINST1("or $t0, $t1, $t2", 0,          1,          t0, t1, t2);
789    TESTINST1("or $t0, $t1, $t2", -1,         0,          t0, t1, t2);
790    TESTINST1("or $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
791    TESTINST1("or $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
792    TESTINST1("or $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
793    TESTINST1("or $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
794    TESTINST1("or $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
795    TESTINST1("or $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
796    TESTINST1("or $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
797    TESTINST1("or $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
798    TESTINST1("or $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
799    TESTINST1("or $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
800    TESTINST1("or $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
801    TESTINST1("or $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
802 
803    printf("ORI\n");
804    TESTINST2("ori $t0, $t1, 0xffff", 0x31415927, 0xffff, t0, t1);
805    TESTINST2("ori $t0, $t1, 0xee00", 0x31415927, 0xee00, t0, t1);
806    TESTINST2("ori $t0, $t1, 255", 0,          255,        t0, t1);
807    TESTINST2("ori $t0, $t1, 0", -1,         0,          t0, t1);
808    TESTINST2("ori $t0, $t1, 1", 0,          1,          t0, t1);
809    TESTINST2("ori $t0, $t1, 0", 0,          0,          t0, t1);
810    TESTINST2("ori $t0, $t1, 0x8000", 0x80000000, 0x8000, t0, t1);
811    TESTINST2("ori $t0, $t1, 0", 0x7fffffff, 0,          t0, t1);
812    TESTINST2("ori $t0, $t1, 0x8000", 0x80000000, 0x8000, t0, t1);
813    TESTINST2("ori $t0, $t1, 0x8000", 0x7fffffff, 0x8000, t0, t1);
814    TESTINST2("ori $t0, $t1, 0xff00", 0x80000000, 0xff00, t0, t1);
815    TESTINST2("ori $t0, $t1, 0x0dd0", 0x7fffffff, 0x0dd0, t0, t1);
816    TESTINST2("ori $t0, $t1, 0xffff", 0x31415927, 0xffff, t0, t1);
817    TESTINST2("ori $t0, $t1, 0xee00", 0x31415927, 0xee00, t0, t1);
818    TESTINST2("ori $t0, $t1, 255", 0,          255,        t0, t1);
819    TESTINST2("ori $t0, $t1, 0", 1,          0,          t0, t1);
820    TESTINST2("ori $t0, $t1, 1", 0,          1,          t0, t1);
821    TESTINST2("ori $t0, $t1, 0", -1,         0,          t0, t1);
822    TESTINST2("ori $t0, $t1, 0x8000", 0,          0x8000, t0, t1);
823    TESTINST2("ori $t0, $t1, 0", 0x8000, 0,          t0, t1);
824    TESTINST2("ori $t0, $t1, 0x8000", 0x80000000, 0x8000, t0, t1);
825    TESTINST2("ori $t0, $t1, 0x8000", 0x7fffffff, 0x8000, t0, t1);
826    TESTINST2("ori $t0, $t1, 0xff00", 0x80000000, 0xff00, t0, t1);
827    TESTINST2("ori $t0, $t1, 0x0dd0", 0x7fffffff, 0x0dd0, t0, t1);
828    TESTINST2("ori $t0, $t1, 0", 0xffff, 0,          t0, t1);
829    TESTINST2("ori $t0, $t1, 0xffff", 0,          0xffff, t0, t1);
830    TESTINST2("ori $t0, $t1, 0xffff", 0xffffffff, 0xffff, t0, t1);
831    TESTINST2("ori $t0, $t1, 0x7fff", 0x7fffffff, 0x7fff, t0, t1);
832    TESTINST2("ori $t0, $t1, 0x0000", 0x0000ffff, 0x0000, t0, t1);
833 
834 #if (__mips==32) && (__mips_isa_rev>=2)
835    printf("ROTR\n");
836    TESTINST2("rotr $t0, $t1, 0x00000000", 0x31415927, 0x00000000, t0, t1);
837    TESTINST2("rotr $t0, $t1, 0x00000001", 0x31415927, 0x00000001, t0, t1);
838    TESTINST2("rotr $t0, $t1, 0x00000002", 0x31415927, 0x00000002, t0, t1);
839    TESTINST2("rotr $t0, $t1, 0x0000000F", 0x31415927, 0x0000000F, t0, t1);
840    TESTINST2("rotr $t0, $t1, 0x00000010", 0x31415927, 0x00000010, t0, t1);
841    TESTINST2("rotr $t0, $t1, 0x0000001F", 0x31415927, 0x0000001F, t0, t1);
842    TESTINST2("rotr $t0, $t1, 0x00000020", 0x31415927, 0x00000020, t0, t1);
843    TESTINST2("rotr $t0, $t1, 0x00000021", 0x31415927, 0x00000021, t0, t1);
844    TESTINST2("rotr $t0, $t1, 0x00000000", 0x00088000, 0x00000000, t0, t1);
845    TESTINST2("rotr $t0, $t1, 0x00000001", 0x00088000, 0x00000001, t0, t1);
846    TESTINST2("rotr $t0, $t1, 31", 0x00088000, 31, t0, t1);
847    TESTINST2("rotr $t0, $t1, 16", 0x00010000, 16, t0, t1);
848    TESTINST2("rotr $t0, $t1, 17", 0x00010000, 17, t0, t1);
849    TESTINST2("rotr $t0, $t1, 18", 0x00010000, 18, t0, t1);
850    TESTINST2("rotr $t0, $t1, 0", 0, 0, t0, t1);
851    TESTINST2("rotr $t0, $t1, 0xffff", 0xffff, 0xffff, t0, t1);
852 #endif
853 
854 #if (__mips==32) && (__mips_isa_rev>=2)
855    printf("ROTRV\n");
856    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
857    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
858    TESTINST1("rotrv $t0, $t1, $t2", 0,          255,        t0, t1, t2);
859    TESTINST1("rotrv $t0, $t1, $t2", -1,         0,          t0, t1, t2);
860    TESTINST1("rotrv $t0, $t1, $t2", 0,          1,          t0, t1, t2);
861    TESTINST1("rotrv $t0, $t1, $t2", 0,          0,          t0, t1, t2);
862    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
863    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
864    TESTINST1("rotrv $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
865    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
866    TESTINST1("rotrv $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
867    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
868    TESTINST1("rotrv $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
869    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
870    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
871    TESTINST1("rotrv $t0, $t1, $t2", 0,          255,        t0, t1, t2);
872    TESTINST1("rotrv $t0, $t1, $t2", 1,          0,          t0, t1, t2);
873    TESTINST1("rotrv $t0, $t1, $t2", 0,          1,          t0, t1, t2);
874    TESTINST1("rotrv $t0, $t1, $t2", -1,         0,          t0, t1, t2);
875    TESTINST1("rotrv $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
876    TESTINST1("rotrv $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
877    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
878    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
879    TESTINST1("rotrv $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
880    TESTINST1("rotrv $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
881    TESTINST1("rotrv $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
882    TESTINST1("rotrv $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
883    TESTINST1("rotrv $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
884    TESTINST1("rotrv $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
885    TESTINST1("rotrv $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
886    TESTINST1("rotrv $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
887    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
888    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
889    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
890    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
891    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
892    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
893    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
894    TESTINST1("rotrv $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
895    TESTINST1("rotrv $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
896    TESTINST1("rotrv $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
897    TESTINST1("rotrv $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
898    TESTINST1("rotrv $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
899    TESTINST1("rotrv $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
900    TESTINST1("rotrv $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
901    TESTINST1("rotrv $t0, $t1, $t2", 0, 0, t0, t1, t2);
902    TESTINST1("rotrv $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
903 
904    printf("SEB\n");
905    TESTINST3("seb  $t0, $t1", 0x2, t0, t1);
906    TESTINST3("seb  $t0, $t1", 0x28, t0, t1);
907    TESTINST3("seb  $t0, $t1", -258, t0, t1);
908    TESTINST3("seb  $t0, $t1", 0x7fffffff, t0, t1);
909    TESTINST3("seb  $t0, $t1", -11, t0, t1);
910    TESTINST3("seb  $t0, $t1", 0xffffffff, t0, t1);
911    TESTINST3("seb  $t0, $t1", 0x16, t0, t1);
912    TESTINST3("seb  $t0, $t1", -1, t0, t1);
913 
914    printf("SEH\n");
915    TESTINST3("seh  $t0, $t1", 0x2, t0, t1);
916    TESTINST3("seh  $t0, $t1", 0x28, t0, t1);
917    TESTINST3("seh  $t0, $t1", -258, t0, t1);
918    TESTINST3("seh  $t0, $t1", 0x7fffffff, t0, t1);
919    TESTINST3("seh  $t0, $t1", -11, t0, t1);
920    TESTINST3("seh  $t0, $t1", 0xffffffff, t0, t1);
921    TESTINST3("seh  $t0, $t1", 0x16, t0, t1);
922    TESTINST3("seh  $t0, $t1", -1, t0, t1);
923 #endif
924 
925    printf("SLL\n");
926    TESTINST2("sll $t0, $t1, 0x00000000", 0x31415927, 0x00000000, t0, t1);
927    TESTINST2("sll $t0, $t1, 0x00000001", 0x31415927, 0x00000001, t0, t1);
928    TESTINST2("sll $t0, $t1, 0x00000002", 0x31415927, 0x00000002, t0, t1);
929    TESTINST2("sll $t0, $t1, 0x0000000F", 0x31415927, 0x0000000F, t0, t1);
930    TESTINST2("sll $t0, $t1, 0x00000010", 0x31415927, 0x00000010, t0, t1);
931    TESTINST2("sll $t0, $t1, 0x0000001F", 0x31415927, 0x0000001F, t0, t1);
932    TESTINST2("sll $t0, $t1, 0x00000009", 0x31415927, 0x00000009, t0, t1);
933    TESTINST2("sll $t0, $t1, 0x0000000A", 0x31415927, 0x0000000A, t0, t1);
934    TESTINST2("sll $t0, $t1, 0x00000000", 0x00088000, 0x00000000, t0, t1);
935    TESTINST2("sll $t0, $t1, 0x00000001", 0x00088000, 0x00000001, t0, t1);
936    TESTINST2("sll $t0, $t1, 31", 0x00088000, 31, t0, t1);
937    TESTINST2("sll $t0, $t1, 16", 0x00010000, 16, t0, t1);
938    TESTINST2("sll $t0, $t1, 17", 0x00010000, 17, t0, t1);
939    TESTINST2("sll $t0, $t1, 18", 0x00010000, 18, t0, t1);
940    TESTINST2("sll $t0, $t1, 0", 0, 0, t0, t1);
941 
942    printf("SLLV\n");
943    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
944    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
945    TESTINST1("sllv $t0, $t1, $t2", 0,          255,        t0, t1, t2);
946    TESTINST1("sllv $t0, $t1, $t2", -1,         0,          t0, t1, t2);
947    TESTINST1("sllv $t0, $t1, $t2", 0,          1,          t0, t1, t2);
948    TESTINST1("sllv $t0, $t1, $t2", 0,          0,          t0, t1, t2);
949    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
950    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
951    TESTINST1("sllv $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
952    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
953    TESTINST1("sllv $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
954    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
955    TESTINST1("sllv $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
956    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
957    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
958    TESTINST1("sllv $t0, $t1, $t2", 0,          255,        t0, t1, t2);
959    TESTINST1("sllv $t0, $t1, $t2", 1,          0,          t0, t1, t2);
960    TESTINST1("sllv $t0, $t1, $t2", 0,          1,          t0, t1, t2);
961    TESTINST1("sllv $t0, $t1, $t2", -1,         0,          t0, t1, t2);
962    TESTINST1("sllv $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
963    TESTINST1("sllv $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
964    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
965    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
966    TESTINST1("sllv $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
967    TESTINST1("sllv $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
968    TESTINST1("sllv $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
969    TESTINST1("sllv $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
970    TESTINST1("sllv $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
971    TESTINST1("sllv $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
972    TESTINST1("sllv $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
973    TESTINST1("sllv $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
974    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
975    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
976    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
977    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
978    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
979    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
980    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
981    TESTINST1("sllv $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
982    TESTINST1("sllv $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
983    TESTINST1("sllv $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
984    TESTINST1("sllv $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
985    TESTINST1("sllv $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
986    TESTINST1("sllv $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
987    TESTINST1("sllv $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
988    TESTINST1("sllv $t0, $t1, $t2", 0, 0, t0, t1, t2);
989    TESTINST1("sllv $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
990 
991    printf("SLT\n");
992    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
993    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
994    TESTINST1("slt $t0, $t1, $t2", 0,          255,        t0, t1, t2);
995    TESTINST1("slt $t0, $t1, $t2", -1,         0,          t0, t1, t2);
996    TESTINST1("slt $t0, $t1, $t2", 0,          1,          t0, t1, t2);
997    TESTINST1("slt $t0, $t1, $t2", 0,          0,          t0, t1, t2);
998    TESTINST1("slt $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
999    TESTINST1("slt $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1000    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
1001    TESTINST1("slt $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1002    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1003    TESTINST1("slt $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1004    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1005    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1006    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1007    TESTINST1("slt $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1008    TESTINST1("slt $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1009    TESTINST1("slt $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1010    TESTINST1("slt $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1011    TESTINST1("slt $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1012    TESTINST1("slt $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1013    TESTINST1("slt $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1014    TESTINST1("slt $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1015    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1016    TESTINST1("slt $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1017    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1018    TESTINST1("slt $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1019    TESTINST1("slt $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1020    TESTINST1("slt $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1021    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1022    TESTINST1("slt $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1023    TESTINST1("slt $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1024    TESTINST1("slt $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1025    TESTINST1("slt $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1026    TESTINST1("slt $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1027    TESTINST1("slt $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1028    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
1029    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
1030    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
1031    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
1032    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
1033    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
1034    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
1035    TESTINST1("slt $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
1036    TESTINST1("slt $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
1037    TESTINST1("slt $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
1038    TESTINST1("slt $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
1039    TESTINST1("slt $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
1040    TESTINST1("slt $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
1041    TESTINST1("slt $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
1042    TESTINST1("slt $t0, $t1, $t2", 0, 0, t0, t1, t2);
1043    TESTINST1("slt $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
1044 
1045    printf("SLTI\n");
1046    TESTINST2("slti $t0, $t1, 0x00000000", 0x00000001, 0x31415927, t0, t1);
1047    TESTINST2("slti $t0, $t1, 0x00000001", 0x31415927, 0x00000001, t0, t1);
1048    TESTINST2("slti $t0, $t1, 0x00000002", 0x31415927, 0x00000002, t0, t1);
1049    TESTINST2("slti $t0, $t1, 0x0000000F", 0x31415927, 0x0000000F, t0, t1);
1050    TESTINST2("slti $t0, $t1, 0x00000010", 0x00000010, 0x00000010, t0, t1);
1051    TESTINST2("slti $t0, $t1, 0x0000001F", 0x00000010, 0x31415927, t0, t1);
1052    TESTINST2("slti $t0, $t1, 0x00000009", 0x31415927, 0x00000009, t0, t1);
1053    TESTINST2("slti $t0, $t1, 0x0000000A", 0x31415927, 0x0000000A, t0, t1);
1054    TESTINST2("slti $t0, $t1, 0x00000000", 0x00088000, 0x0000000A, t0, t1);
1055    TESTINST2("slti $t0, $t1, 0x00000001", 0x00000000, 0x00000001, t0, t1);
1056    TESTINST2("slti $t0, $t1, 31", 0x00088000, 31, t0, t1);
1057    TESTINST2("slti $t0, $t1, 16", 0x00010000, 16, t0, t1);
1058    TESTINST2("slti $t0, $t1, 17", 0x00010000, 17, t0, t1);
1059    TESTINST2("slti $t0, $t1, 18", 0x00010000, 18, t0, t1);
1060    TESTINST2("slti $t0, $t1, 0", 0, 0, t0, t1);
1061 
1062    printf("SLTIU\n");
1063    TESTINST2("sltiu $t0, $t1, 0x00000000", 0x00000001, 0x31415927, t0, t1);
1064    TESTINST2("sltiu $t0, $t1, 0x00000001", 0x31415927, 0x00000001, t0, t1);
1065    TESTINST2("sltiu $t0, $t1, 0x00000002", 0x31415927, 0x00000002, t0, t1);
1066    TESTINST2("sltiu $t0, $t1, 0x0000000F", 0x31415927, 0x0000000F, t0, t1);
1067    TESTINST2("sltiu $t0, $t1, 0x00000010", 0x00000010, 0x00000010, t0, t1);
1068    TESTINST2("sltiu $t0, $t1, 0x0000001F", 0x00000010, 0x31415927, t0, t1);
1069    TESTINST2("sltiu $t0, $t1, 0x00000009", 0x31415927, 0x00000009, t0, t1);
1070    TESTINST2("sltiu $t0, $t1, 0x0000000A", 0x31415927, 0x0000000A, t0, t1);
1071    TESTINST2("sltiu $t0, $t1, 0x00000000", 0x00088000, 0x0000000A, t0, t1);
1072    TESTINST2("sltiu $t0, $t1, 0x00000001", 0x00000000, 0x00000001, t0, t1);
1073    TESTINST2("sltiu $t0, $t1, 31", 0x00088000, 31, t0, t1);
1074    TESTINST2("sltiu $t0, $t1, 16", 0x00010000, 16, t0, t1);
1075    TESTINST2("sltiu $t0, $t1, 17", 0x00010000, 17, t0, t1);
1076    TESTINST2("sltiu $t0, $t1, 18", 0x00010000, 18, t0, t1);
1077    TESTINST2("sltiu $t0, $t1, 0", 0, 0, t0, t1);
1078 
1079    printf("SLTU\n");
1080    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1081    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1082    TESTINST1("sltu $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1083    TESTINST1("sltu $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1084    TESTINST1("sltu $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1085    TESTINST1("sltu $t0, $t1, $t2", 0,          0,          t0, t1, t2);
1086    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
1087    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1088    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
1089    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1090    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1091    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1092    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1093    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1094    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1095    TESTINST1("sltu $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1096    TESTINST1("sltu $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1097    TESTINST1("sltu $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1098    TESTINST1("sltu $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1099    TESTINST1("sltu $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1100    TESTINST1("sltu $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1101    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1102    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1103    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1104    TESTINST1("sltu $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1105    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1106    TESTINST1("sltu $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1107    TESTINST1("sltu $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1108    TESTINST1("sltu $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1109    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1110    TESTINST1("sltu $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1111    TESTINST1("sltu $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1112    TESTINST1("sltu $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1113    TESTINST1("sltu $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1114    TESTINST1("sltu $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1115    TESTINST1("sltu $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1116    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
1117    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
1118    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
1119    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
1120    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
1121    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
1122    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
1123    TESTINST1("sltu $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
1124    TESTINST1("sltu $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
1125    TESTINST1("sltu $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
1126    TESTINST1("sltu $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
1127    TESTINST1("sltu $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
1128    TESTINST1("sltu $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
1129    TESTINST1("sltu $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
1130    TESTINST1("sltu $t0, $t1, $t2", 0, 0, t0, t1, t2);
1131    TESTINST1("sltu $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
1132 
1133    printf("SRA\n");
1134    TESTINST2("sra $t0, $t1, 0x00000000", 0x00000001, 0x31415927, t0, t1);
1135    TESTINST2("sra $t0, $t1, 0x00000001", 0x31415927, 0x00000001, t0, t1);
1136    TESTINST2("sra $t0, $t1, 0x00000002", 0x31415927, 0x00000002, t0, t1);
1137    TESTINST2("sra $t0, $t1, 0x0000000F", 0x31415927, 0x0000000F, t0, t1);
1138    TESTINST2("sra $t0, $t1, 0x00000010", 0x00000010, 0x00000010, t0, t1);
1139    TESTINST2("sra $t0, $t1, 0x0000001F", 0x00000010, 0x31415927, t0, t1);
1140    TESTINST2("sra $t0, $t1, 0x00000009", 0x31415927, 0x00000009, t0, t1);
1141    TESTINST2("sra $t0, $t1, 0x0000000A", 0x31415927, 0x0000000A, t0, t1);
1142    TESTINST2("sra $t0, $t1, 0x00000000", 0x00088000, 0x0000000A, t0, t1);
1143    TESTINST2("sra $t0, $t1, 0x00000001", 0x00000000, 0x00000001, t0, t1);
1144    TESTINST2("sra $t0, $t1, 31", 0x00088000, 31, t0, t1);
1145    TESTINST2("sra $t0, $t1, 16", 0x00010000, 16, t0, t1);
1146    TESTINST2("sra $t0, $t1, 17", 0x00010000, 17, t0, t1);
1147    TESTINST2("sra $t0, $t1, 18", 0x00010000, 18, t0, t1);
1148    TESTINST2("sra $t0, $t1, 0", 0, 0, t0, t1);
1149 
1150    printf("SRAV\n");
1151    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1152    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1153    TESTINST1("srav $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1154    TESTINST1("srav $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1155    TESTINST1("srav $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1156    TESTINST1("srav $t0, $t1, $t2", 0,          0,          t0, t1, t2);
1157    TESTINST1("srav $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
1158    TESTINST1("srav $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1159    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
1160    TESTINST1("srav $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1161    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1162    TESTINST1("srav $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1163    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1164    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1165    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1166    TESTINST1("srav $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1167    TESTINST1("srav $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1168    TESTINST1("srav $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1169    TESTINST1("srav $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1170    TESTINST1("srav $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1171    TESTINST1("srav $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1172    TESTINST1("srav $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1173    TESTINST1("srav $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1174    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1175    TESTINST1("srav $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1176    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1177    TESTINST1("srav $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1178    TESTINST1("srav $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1179    TESTINST1("srav $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1180    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1181    TESTINST1("srav $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1182    TESTINST1("srav $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1183    TESTINST1("srav $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1184    TESTINST1("srav $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1185    TESTINST1("srav $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1186    TESTINST1("srav $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1187    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
1188    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
1189    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
1190    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
1191    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
1192    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
1193    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
1194    TESTINST1("srav $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
1195    TESTINST1("srav $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
1196    TESTINST1("srav $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
1197    TESTINST1("srav $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
1198    TESTINST1("srav $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
1199    TESTINST1("srav $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
1200    TESTINST1("srav $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
1201    TESTINST1("srav $t0, $t1, $t2", 0, 0, t0, t1, t2);
1202    TESTINST1("srav $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
1203 
1204    printf("SRL\n");
1205    TESTINST2("srl $t0, $t1, 0x00000000", 0x00000001, 0x31415927, t0, t1);
1206    TESTINST2("srl $t0, $t1, 0x00000001", 0x31415927, 0x00000001, t0, t1);
1207    TESTINST2("srl $t0, $t1, 0x00000002", 0x31415927, 0x00000002, t0, t1);
1208    TESTINST2("srl $t0, $t1, 0x0000000F", 0x31415927, 0x0000000F, t0, t1);
1209    TESTINST2("srl $t0, $t1, 0x00000010", 0x00000010, 0x00000010, t0, t1);
1210    TESTINST2("srl $t0, $t1, 0x0000001F", 0x00000010, 0x31415927, t0, t1);
1211    TESTINST2("srl $t0, $t1, 0x00000009", 0x31415927, 0x00000009, t0, t1);
1212    TESTINST2("srl $t0, $t1, 0x0000000A", 0x31415927, 0x0000000A, t0, t1);
1213    TESTINST2("srl $t0, $t1, 0x00000000", 0x00088000, 0x0000000A, t0, t1);
1214    TESTINST2("srl $t0, $t1, 0x00000001", 0x00000000, 0x00000001, t0, t1);
1215    TESTINST2("srl $t0, $t1, 31", 0x00088000, 31, t0, t1);
1216    TESTINST2("srl $t0, $t1, 16", 0x00010000, 16, t0, t1);
1217    TESTINST2("srl $t0, $t1, 17", 0x00010000, 17, t0, t1);
1218    TESTINST2("srl $t0, $t1, 18", 0x00010000, 18, t0, t1);
1219    TESTINST2("srl $t0, $t1, 0", 0, 0, t0, t1);
1220 
1221    printf("SRLV\n");
1222    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1223    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1224    TESTINST1("srlv $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1225    TESTINST1("srlv $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1226    TESTINST1("srlv $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1227    TESTINST1("srlv $t0, $t1, $t2", 0,          0,          t0, t1, t2);
1228    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
1229    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1230    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
1231    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1232    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1233    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1234    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1235    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1236    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1237    TESTINST1("srlv $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1238    TESTINST1("srlv $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1239    TESTINST1("srlv $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1240    TESTINST1("srlv $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1241    TESTINST1("srlv $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1242    TESTINST1("srlv $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1243    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1244    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1245    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1246    TESTINST1("srlv $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1247    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1248    TESTINST1("srlv $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1249    TESTINST1("srlv $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1250    TESTINST1("srlv $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1251    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1252    TESTINST1("srlv $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1253    TESTINST1("srlv $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1254    TESTINST1("srlv $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1255    TESTINST1("srlv $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1256    TESTINST1("srlv $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1257    TESTINST1("srlv $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1258    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
1259    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
1260    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
1261    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
1262    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
1263    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
1264    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
1265    TESTINST1("srlv $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
1266    TESTINST1("srlv $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
1267    TESTINST1("srlv $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
1268    TESTINST1("srlv $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
1269    TESTINST1("srlv $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
1270    TESTINST1("srlv $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
1271    TESTINST1("srlv $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
1272    TESTINST1("srlv $t0, $t1, $t2", 0, 0, t0, t1, t2);
1273    TESTINST1("srlv $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
1274 
1275    printf("SUBU\n");
1276    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
1277    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00001110, t0, t1, t2);
1278    TESTINST1("subu $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1279    TESTINST1("subu $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1280    TESTINST1("subu $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1281    TESTINST1("subu $t0, $t1, $t2", 0,          0,          t0, t1, t2);
1282    TESTINST1("subu $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
1283    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1284    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
1285    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1286    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1287    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1288    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1289    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1290    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1291    TESTINST1("subu $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1292    TESTINST1("subu $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1293    TESTINST1("subu $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1294    TESTINST1("subu $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1295    TESTINST1("subu $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1296    TESTINST1("subu $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1297    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1298    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1299    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1300    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1301    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1302    TESTINST1("subu $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1303    TESTINST1("subu $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1304    TESTINST1("subu $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1305    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1306    TESTINST1("subu $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1307    TESTINST1("subu $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1308    TESTINST1("subu $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1309    TESTINST1("subu $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1310    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1311    TESTINST1("subu $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1312    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000000, t0, t1, t2);
1313    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000001, t0, t1, t2);
1314    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000002, t0, t1, t2);
1315    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x0000000F, t0, t1, t2);
1316    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000010, t0, t1, t2);
1317    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x0000001F, t0, t1, t2);
1318    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000020, t0, t1, t2);
1319    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x00000021, t0, t1, t2);
1320    TESTINST1("subu $t0, $t1, $t2", 0x00088000, 0x00000000, t0, t1, t2);
1321    TESTINST1("subu $t0, $t1, $t2", 0x00088000, 0x00000001, t0, t1, t2);
1322    TESTINST1("subu $t0, $t1, $t2", 0x00088000, 31, t0, t1, t2);
1323    TESTINST1("subu $t0, $t1, $t2", 0x00010000, 16, t0, t1, t2);
1324    TESTINST1("subu $t0, $t1, $t2", 0x00010000, 17, t0, t1, t2);
1325    TESTINST1("subu $t0, $t1, $t2", 0x00010000, 18, t0, t1, t2);
1326    TESTINST1("subu $t0, $t1, $t2", 0, 0, t0, t1, t2);
1327    TESTINST1("subu $t0, $t1, $t2", 0xffff, 0xffff, t0, t1, t2);
1328 
1329    printf("SUB\n");
1330    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1331    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x27181728, t0, t1, t2);
1332    TESTINST1("subu $t0, $t1, $t2", 0x31415927, 0x97181728, t0, t1, t2);
1333    TESTINST1("subu $t0, $t1, $t2", 0,          0,          t0, t1, t2);
1334    TESTINST1("subu $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1335    TESTINST1("subu $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1336    TESTINST1("subu $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1337    TESTINST1("subu $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1338    TESTINST1("subu $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1339    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1340    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1341    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1342    TESTINST1("subu $t0, $t1, $t2", 0x80000000, 0x7fffffff, t0, t1, t2);
1343    TESTINST1("subu $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1344 
1345    printf("XOR\n");
1346    TESTINST1("xor $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1347    TESTINST1("xor $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1348    TESTINST1("xor $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1349    TESTINST1("xor $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1350    TESTINST1("xor $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1351    TESTINST1("xor $t0, $t1, $t2", 0,          0,          t0, t1, t2);
1352    TESTINST1("xor $t0, $t1, $t2", 0x80000000, -1,         t0, t1, t2);
1353    TESTINST1("xor $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1354    TESTINST1("xor $t0, $t1, $t2", 0x7fffffff, 0,          t0, t1, t2);
1355    TESTINST1("xor $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1356    TESTINST1("xor $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1357    TESTINST1("xor $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1358    TESTINST1("xor $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1359    TESTINST1("xor $t0, $t1, $t2", 0x31415927, 0xffffffff, t0, t1, t2);
1360    TESTINST1("xor $t0, $t1, $t2", 0x31415927, 0xee00ee00, t0, t1, t2);
1361    TESTINST1("xor $t0, $t1, $t2", 0,          255,        t0, t1, t2);
1362    TESTINST1("xor $t0, $t1, $t2", 1,          0,          t0, t1, t2);
1363    TESTINST1("xor $t0, $t1, $t2", 0,          1,          t0, t1, t2);
1364    TESTINST1("xor $t0, $t1, $t2", -1,         0,          t0, t1, t2);
1365    TESTINST1("xor $t0, $t1, $t2", 0,          -1,         t0, t1, t2);
1366    TESTINST1("xor $t0, $t1, $t2", 0,          0x80000000, t0, t1, t2);
1367    TESTINST1("xor $t0, $t1, $t2", 0x80000000, 0,          t0, t1, t2);
1368    TESTINST1("xor $t0, $t1, $t2", 0x80000000, 0x80000000, t0, t1, t2);
1369    TESTINST1("xor $t0, $t1, $t2", 0x7fffffff, 0x80000000, t0, t1, t2);
1370    TESTINST1("xor $t0, $t1, $t2", 0x80000000, 0xff000000, t0, t1, t2);
1371    TESTINST1("xor $t0, $t1, $t2", 0x7fffffff, 0x0dd00000, t0, t1, t2);
1372    TESTINST1("xor $t0, $t1, $t2", 0xffffffff, 0,          t0, t1, t2);
1373    TESTINST1("xor $t0, $t1, $t2", 0,          0xffffffff, t0, t1, t2);
1374    TESTINST1("xor $t0, $t1, $t2", 0xffffffff, 0xffffffff, t0, t1, t2);
1375    TESTINST1("xor $t0, $t1, $t2", 0x7fffffff, 0x7fffffff, t0, t1, t2);
1376    TESTINST1("xor $t0, $t1, $t2", 0x0000ffff, 0x0000ffff, t0, t1, t2);
1377 
1378    printf("XORI\n");
1379    TESTINST2("xori $t0, $t1, 0xffff", 0x31415927, 0xffff, t0, t1);
1380    TESTINST2("xori $t0, $t1, 0xee00", 0x31415927, 0xee00, t0, t1);
1381    TESTINST2("xori $t0, $t1, 255", 0,          255,        t0, t1);
1382    TESTINST2("xori $t0, $t1, 0", -1,         0,          t0, t1);
1383    TESTINST2("xori $t0, $t1, 1", 0,          1,          t0, t1);
1384    TESTINST2("xori $t0, $t1, 0", 0,          0,          t0, t1);
1385    TESTINST2("xori $t0, $t1, 0x8000", 0x80000000, 0x8000, t0, t1);
1386    TESTINST2("xori $t0, $t1, 0", 0x7fffffff, 0,          t0, t1);
1387    TESTINST2("xori $t0, $t1, 0x8000", 0x80000000, 0x8000, t0, t1);
1388    TESTINST2("xori $t0, $t1, 0x8000", 0x7fffffff, 0x8000, t0, t1);
1389    TESTINST2("xori $t0, $t1, 0xff00", 0x80000000, 0xff00, t0, t1);
1390    TESTINST2("xori $t0, $t1, 0x0dd0", 0x7fffffff, 0x0dd0, t0, t1);
1391    TESTINST2("xori $t0, $t1, 0xffff", 0x31415927, 0xffff, t0, t1);
1392    TESTINST2("xori $t0, $t1, 0xee00", 0x31415927, 0xee00, t0, t1);
1393    TESTINST2("xori $t0, $t1, 255", 0,          255,        t0, t1);
1394    TESTINST2("xori $t0, $t1, 0", 1,          0,          t0, t1);
1395    TESTINST2("xori $t0, $t1, 1", 0,          1,          t0, t1);
1396    TESTINST2("xori $t0, $t1, 0", -1,         0,          t0, t1);
1397    TESTINST2("xori $t0, $t1, 0x8000", 0,          0x8000, t0, t1);
1398    TESTINST2("xori $t0, $t1, 0", 0x8000, 0,          t0, t1);
1399    TESTINST2("xori $t0, $t1, 0x8000", 0x80000000, 0x8000, t0, t1);
1400    TESTINST2("xori $t0, $t1, 0x8000", 0x7fffffff, 0x8000, t0, t1);
1401    TESTINST2("xori $t0, $t1, 0xff00", 0x80000000, 0xff00, t0, t1);
1402    TESTINST2("xori $t0, $t1, 0x0dd0", 0x7fffffff, 0x0dd0, t0, t1);
1403    TESTINST2("xori $t0, $t1, 0", 0xffff, 0,          t0, t1);
1404    TESTINST2("xori $t0, $t1, 0xffff", 0,          0xffff, t0, t1);
1405    TESTINST2("xori $t0, $t1, 0xffff", 0xffffffff, 0xffff, t0, t1);
1406    TESTINST2("xori $t0, $t1, 0x7fff", 0x7fffffff, 0x7fff, t0, t1);
1407    TESTINST2("xori $t0, $t1, 0x0000", 0x0000ffff, 0x0000, t0, t1);
1408 
1409    printf("MFHI MFLO\n");
1410    TESTINSN_HILO(0x31415927);
1411    TESTINSN_HILO(0);
1412    TESTINSN_HILO(-1);
1413    TESTINSN_HILO(0xffffffff);
1414    TESTINSN_HILO(0x8000);
1415    TESTINSN_HILO(0x80000000);
1416    TESTINSN_HILO(0x0000ffff);
1417    TESTINSN_HILO(0x7fff);
1418    TESTINSN_HILO(0x0dd0);
1419    TESTINSN_HILO(0xff00);
1420 
1421    return 0;
1422 }
1423