Bug 497723 - forgot to restore callgrind output cleanup
[valgrind.git] / none / tests / nanomips / branches.c
blob1723402bf16979c25a84b6d99cd086e7ab5193ad
1 #include <stdio.h>
3 #define TESTINST1(RSval, RD) \
4 { \
5 unsigned int out = 0; \
6 __asm__ volatile( \
7 ".set push \n\t" \
8 ".set noreorder \n\t" \
9 "move $" #RD ", %1\n\t" \
10 "bc end1"#RSval"\n\t" \
11 "addiu $" #RD ", $" #RD", 5\n\t" \
12 "end1"#RSval":\n\t" \
13 "addiu $" #RD ", $" #RD", 1\n\t" \
14 "move %0, $" #RD "\n\t" \
15 ".set pop \n\t" \
16 : "=&r" (out) \
17 : "r" (RSval) \
18 : #RD, "memory" \
19 ); \
20 printf("BC :: %d, RSval: %d\n", \
21 out, RSval); \
24 #define TESTINST2(RSval, RD) \
25 { \
26 unsigned int out = 0; \
27 __asm__ volatile( \
28 ".set push \n\t" \
29 ".set noreorder \n\t" \
30 "move $" #RD ", %1\n\t" \
31 "bc end2"#RSval"\n\t" \
32 "addiu $" #RD ", $" #RD", 3\n\t" \
33 "addiu $" #RD ", $" #RD", 5\n\t" \
34 "end2"#RSval":\n\t" \
35 "addiu $" #RD ", $" #RD", 3\n\t" \
36 "move %0, $" #RD "\n\t" \
37 ".set pop \n\t" \
38 : "=&r" (out) \
39 : "r" (RSval) \
40 : #RD, "memory" \
41 ); \
42 printf("bc :: %d, RSval: %d\n", \
43 out, RSval); \
46 #define TESTINST3(RSval, RD) \
47 { \
48 unsigned int out = 0; \
49 __asm__ volatile( \
50 ".set push \n\t" \
51 ".set noreorder \n\t" \
52 "move $" #RD ", %1\n\t" \
53 "balc end3"#RSval"\n\t" \
54 "addiu $" #RD ", $" #RD", 5\n\t" \
55 "bc r_end3"#RSval"\n\t" \
56 "end3"#RSval":\n\t" \
57 "addiu $" #RD ", $" #RD", 1\n\t" \
58 "jrc $ra\n\t" \
59 "r_end3"#RSval":\n\t" \
60 "move %0, $" #RD "\n\t" \
61 ".set pop \n\t" \
62 : "=&r" (out) \
63 : "r" (RSval) \
64 : #RD, "memory" \
65 ); \
66 printf("bc balc jrc :: %d, RSval: %d\n", \
67 out, RSval); \
71 #define TESTINST3j(RSval, RD) \
72 { \
73 unsigned int out = 0; \
74 __asm__ volatile( \
75 ".set push \n\t" \
76 ".set noreorder \n\t" \
77 "move $" #RD ", %1\n\t" \
78 "la $t0, end3j"#RSval"\n\t" \
79 "jalrc $t1, $t0\n\t" \
80 "addiu $" #RD ", $" #RD", 5\n\t" \
81 "la $t0, r_end3j"#RSval"\n\t" \
82 "jrc $t0\n\t" \
83 "end3j"#RSval":\n\t" \
84 "addiu $" #RD ", $" #RD", 1\n\t" \
85 "jrc $t1\n\t" \
86 "r_end3j"#RSval":\n\t" \
87 "move %0, $" #RD "\n\t" \
88 ".set pop \n\t" \
89 : "=&r" (out) \
90 : "r" (RSval) \
91 : #RD, "t0", "t1", "memory" \
92 ); \
93 printf("jalrc jrc :: %d, RSval: %d\n", \
94 out, RSval); \
98 #define TESTINST3b(RSval, RS, RT) \
99 { \
100 unsigned int out = 0; \
101 __asm__ volatile( \
102 ".set push \n\t" \
103 ".set noreorder \n\t" \
104 "move $t0, %1\n\t" \
105 "li $" #RS", 5\n\t" \
106 "balrsc $" #RT ", $" #RS "\n\t" \
107 "addiu[32] $t0, $t0, 5\n\t" \
108 "la $t1, end3b"#RSval"\n\t" \
109 "jrc $t1 \n\t" \
110 "jrc $" #RT " \n\t"\
111 "end3b"#RSval":\n\t" \
112 "addiu $t0, $t0, 1\n\t" \
113 "move %0, $t0\n\t" \
114 ".set pop \n\t" \
115 : "=&r" (out) \
116 : "r" (RSval) \
117 : #RS, #RT, "t0", "memory" \
118 ); \
119 printf("balrsc :: %d, RSval: %d\n", \
120 out, RSval); \
124 #define TESTINST4(instruction, RDval, RSval, RTval, RD, RS, RT) \
126 unsigned int out = 0; \
127 __asm__ volatile( \
128 ".set push \n\t" \
129 ".set noreorder \n\t" \
130 "move $" #RS ", %1\n\t" \
131 "move $" #RT ", %2\n\t" \
132 "move $" #RD ", %3\n\t" \
133 instruction" $" #RS ", $" #RT ", end"instruction#RDval"\n\t" \
134 "addiu $" #RD ", $" #RD", 5\n\t" \
135 "end"instruction#RDval":\n\t" \
136 "addiu $" #RD ", $" #RD", 1\n\t" \
137 "move %0, $" #RD "\n\t" \
138 ".set pop \n\t" \
139 : "=&r" (out) \
140 : "r" (RSval), "r" (RTval), "r" (RDval) \
141 : #RD, #RS, #RT, "memory" \
142 ); \
143 printf(instruction" :: %d, RSval: %d, RTval: %d\n", \
144 out, RSval, RTval); \
147 #define TESTINST5(instruction, RDval, RSval, RD, RS) \
149 unsigned int out = 0; \
150 __asm__ volatile( \
151 ".set push \n\t" \
152 ".set noreorder \n\t" \
153 "move $" #RS ", %1\n\t" \
154 "move $" #RD ", %2\n\t" \
155 instruction" $" #RS ", end"instruction#RDval"\n\t" \
156 "addiu $" #RD ", $" #RD", 5\n\t" \
157 "end"instruction#RDval":\n\t" \
158 "addiu $" #RD ", $" #RD", 1\n\t" \
159 "move %0, $" #RD "\n\t" \
160 ".set pop \n\t" \
161 : "=&r" (out) \
162 : "r" (RSval), "r" (RDval) \
163 : #RD, #RS, "memory" \
164 ); \
165 printf(instruction" :: %d, RSval: %d\n", \
166 out, RSval); \
169 #define TESTINST5i(instruction, RDval, RSval, immVal, RD, RS) \
171 unsigned int out = 0; \
172 __asm__ volatile( \
173 ".set push \n\t" \
174 ".set noreorder \n\t" \
175 "move $" #RS ", %1\n\t" \
176 "move $" #RD ", %2\n\t" \
177 instruction" $" #RS "," #immVal ", end"instruction#RDval"\n\t" \
178 "addiu $" #RD ", $" #RD", 5\n\t" \
179 "end"instruction#RDval":\n\t" \
180 "addiu $" #RD ", $" #RD", 1\n\t" \
181 "move %0, $" #RD "\n\t" \
182 ".set pop \n\t" \
183 : "=&r" (out) \
184 : "r" (RSval), "r" (RDval) \
185 : #RD, #RS, "memory" \
186 ); \
187 printf(instruction" :: %d, RSval: %d\n", \
188 out, RSval); \
191 #define TESTINST6(RSval, RD) \
193 unsigned int out = 0; \
194 __asm__ volatile( \
195 ".set push \n\t" \
196 ".set noreorder \n\t" \
197 "move $" #RD ", %1\n\t" \
198 "move $t0, $" #RD "\n\t" \
199 "addiu $t1, $zero, -7\n\t" \
200 "end60"#RSval":\n\t" \
201 "beqzc $t0, end6"#RSval"\n\t" \
202 "addiu $t0, $t0, -1 \n\t" \
203 "addiu[32] $" #RD ", $" #RD", 5\n\t" \
204 "brsc $t1\n\t" \
205 "bc end60"#RSval" \n\t"\
206 "end6"#RSval":\n\t" \
207 "addiu $" #RD ", $" #RD", 1\n\t" \
208 "move %0, $" #RD "\n\t" \
209 ".set pop \n\t" \
210 : "=&r" (out) \
211 : "r" (RSval) \
212 : #RD, "t0", "t1", "memory" \
213 ); \
214 printf("brsc :: %d, RSval: %d\n", \
215 out, RSval); \
218 int main()
220 printf("---bc---\n");
221 TESTINST1(0, t4);
222 TESTINST1(1, t5);
223 TESTINST1(2, a0);
224 TESTINST1(3, a1);
225 TESTINST1(4, a2);
226 TESTINST1(5, a3);
227 TESTINST1(6, a4);
228 TESTINST1(7, a5);
229 TESTINST1(8, a6);
230 TESTINST1(9, a7);
231 TESTINST1(10, t0);
232 TESTINST1(11, t1);
233 TESTINST1(12, t2);
234 TESTINST1(13, t3);
235 TESTINST1(14, s0);
236 TESTINST1(15, s1);
237 TESTINST1(16, s2);
238 TESTINST1(17, s3);
239 TESTINST1(18, s4);
240 TESTINST1(19, s5);
241 TESTINST1(20, s6);
242 TESTINST1(21, s7);
243 TESTINST1(22, t8);
244 TESTINST1(23, t9);
246 printf("---bc---\n");
247 TESTINST2(0, t4);
248 TESTINST2(1, t5);
249 TESTINST2(2, a0);
250 TESTINST2(3, a1);
251 TESTINST2(4, a2);
252 TESTINST2(5, a3);
253 TESTINST2(6, a4);
254 TESTINST2(7, a5);
255 TESTINST2(8, a6);
256 TESTINST2(9, a7);
257 TESTINST2(10, t0);
258 TESTINST2(11, t1);
259 TESTINST2(12, t2);
260 TESTINST2(13, t3);
261 TESTINST2(14, s0);
262 TESTINST2(15, s1);
263 TESTINST2(16, s2);
264 TESTINST2(17, s3);
265 TESTINST2(18, s4);
266 TESTINST2(19, s5);
267 TESTINST2(20, s6);
268 TESTINST2(21, s7);
269 TESTINST2(22, t8);
270 TESTINST2(23, t9);
272 printf("---bc, balc, jrc---\n");
273 TESTINST3(0, t4);
274 TESTINST3(1, t5);
275 TESTINST3(2, a0);
276 TESTINST3(3, a1);
277 TESTINST3(4, a2);
278 TESTINST3(5, a3);
279 TESTINST3(6, a4);
280 TESTINST3(7, a5);
281 TESTINST3(8, a6);
282 TESTINST3(9, a7);
283 TESTINST3(10, t0);
284 TESTINST3(11, t1);
285 TESTINST3(12, t2);
286 TESTINST3(13, t3);
287 TESTINST3(14, s0);
288 TESTINST3(15, s1);
289 TESTINST3(16, s2);
290 TESTINST3(17, s3);
291 TESTINST3(18, s4);
292 TESTINST3(19, s5);
293 TESTINST3(20, s6);
294 TESTINST3(21, s7);
295 TESTINST3(22, t8);
296 TESTINST3(23, t9);
298 printf("---balrsc---\n");
299 TESTINST3b(0, t4, t5);
300 TESTINST3b(1, t5, a0);
301 TESTINST3b(2, a0, a1);
302 TESTINST3b(3, a1, a2);
303 TESTINST3b(4, a2, a3);
304 TESTINST3b(5, a3, a4);
305 TESTINST3b(6, a4, a5);
306 TESTINST3b(7, a5, a6);
307 TESTINST3b(8, a6, a7);
308 TESTINST3b(9, a7, t2);
309 TESTINST3b(10, t2, t3);
310 TESTINST3b(11, t3, s0);
311 TESTINST3b(12, s0, s1);
312 TESTINST3b(13, s1, s2);
313 TESTINST3b(14, s2, s3);
314 TESTINST3b(15, s3, s4);
315 TESTINST3b(16, s4, s5);
316 TESTINST3b(17, s5, s6);
317 TESTINST3b(18, s6, s7);
318 TESTINST3b(19, s7, t8);
319 TESTINST3b(20, t8, t9);
320 TESTINST3b(21, t9, t4);
322 printf("---bbeqzc---\n");
323 TESTINST5i("bbeqzc", 0, 0, 0, t4, t5);
324 TESTINST5i("bbeqzc", 1, 1, 1, t5, a0);
325 TESTINST5i("bbeqzc", 2, 0xFFFF, 5, a0, a1);
326 TESTINST5i("bbeqzc", 3, 0xFFCF, 5, a1, a2);
327 TESTINST5i("bbeqzc", 4, 0xFFFF0000, 16 , a2, a3);
328 TESTINST5i("bbeqzc", 5, 0xFFFC0000, 16, a3, t4);
329 TESTINST5i("bbeqzc", 6, 0x0, 30, a4, a5);
330 TESTINST5i("bbeqzc", 7, 0xF0000000, 30, a6, a7);
331 TESTINST5i("bbeqzc", 8, 125, 8, t0, t1);
332 TESTINST5i("bbeqzc", 9, 125, 9, t1, t2);
333 TESTINST5i("bbeqzc", 10, 0xFFFFFFFF, 0x10, t2, t3);
334 TESTINST5i("bbeqzc", 11, 0xFFFFFFFF, 0x15, t3, t4);
335 TESTINST5i("bbeqzc", 12, 0x55, 2, t4, t5);
336 TESTINST5i("bbeqzc", 13, 0x10, 3, t5, s0);
337 TESTINST5i("bbeqzc", 14, -1, 0, s0, s1);
338 TESTINST5i("bbeqzc", 15, -1, 5, s1, s2);
340 printf("---bbnezc---\n");
341 TESTINST5i("bbnezc", 0, 0, 0, t4, t5);
342 TESTINST5i("bbnezc", 1, 1, 1, t5, a0);
343 TESTINST5i("bbnezc", 2, 0xFFFF, 5, a0, a1);
344 TESTINST5i("bbnezc", 3, 0xFFCF, 5, a1, a2);
345 TESTINST5i("bbnezc", 4, 0xFFFF0000, 16 , a2, a3);
346 TESTINST5i("bbnezc", 5, 0xFFFC0000, 16, a3, t4);
347 TESTINST5i("bbnezc", 6, 0x0, 30, a4, a5);
348 TESTINST5i("bbnezc", 7, 0xF0000000, 30, a6, a7);
349 TESTINST5i("bbnezc", 8, 125, 8, t0, t1);
350 TESTINST5i("bbnezc", 9, 125, 9, t1, t2);
351 TESTINST5i("bbnezc", 10, 0xFFFFFFFF, 0x10, t2, t3);
352 TESTINST5i("bbnezc", 11, 0xFFFFFFFF, 0x15, t3, t4);
353 TESTINST5i("bbnezc", 12, 0x55, 2, t4, t5);
354 TESTINST5i("bbnezc", 13, 0x10, 3, t5, s0);
355 TESTINST5i("bbnezc", 14, -1, 0, s0, s1);
356 TESTINST5i("bbnezc", 15, -1, 5, s1, s2);
358 printf("---jalrc jrc---\n");
359 TESTINST3j(0, t4);
360 TESTINST3j(1, t5);
361 TESTINST3j(2, a0);
362 TESTINST3j(3, a1);
363 TESTINST3j(4, a2);
364 TESTINST3j(5, a3);
365 TESTINST3j(6, a4);
366 TESTINST3j(7, a5);
367 TESTINST3j(8, a6);
368 TESTINST3j(9, a7);
369 TESTINST3j(10, a0);
370 TESTINST3j(11, a1);
371 TESTINST3j(12, t2);
372 TESTINST3j(13, t3);
373 TESTINST3j(14, s0);
374 TESTINST3j(15, s1);
375 TESTINST3j(16, s2);
376 TESTINST3j(17, s3);
377 TESTINST3j(18, s4);
378 TESTINST3j(19, s5);
379 TESTINST3j(20, s6);
380 TESTINST3j(21, s7);
381 TESTINST3j(22, t8);
382 TESTINST3j(23, t9);
384 printf("---beqc---\n");
385 TESTINST4("beqc", 0, 0, 1, t4, t5, a0);
386 TESTINST4("beqc", 1, 1, 1, t5, a0, a1);
387 TESTINST4("beqc", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
388 TESTINST4("beqc", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
389 TESTINST4("beqc", 4, 0xfffffffe, 0xffffffff, a2, a3, a4);
390 TESTINST4("beqc", 5, 0xffffffff, 0xffffffff, a3, a4, a5);
391 TESTINST4("beqc", 6, 0x5, 0x5, a4, a5, a6);
392 TESTINST4("beqc", 7, -3, -4, a5, a6, a7);
393 TESTINST4("beqc", 8, 125, 125, a6, a7, t0);
394 TESTINST4("beqc", 9, 0x80000000, 0x80000000, t0, t1, t2);
395 TESTINST4("beqc", 10, 0xffffffff, 0x80000000, t1, t2, t3);
396 TESTINST4("beqc", 11, 0x256, 0x256, t4, t5, t8);
397 TESTINST4("beqc", 12, 0x55, 0x55, t5, t8, t9);
398 TESTINST4("beqc", 13, 0xfff, 0xdd, t8, t9, s0);
399 TESTINST4("beqc", 14, -1, 0x5, t9, s0, s1);
400 TESTINST4("beqc", 15, -1, -1, s0, s1, s2);
402 printf("---beqic---\n");
403 TESTINST5i("beqic", 0, 0, 0, t4, t5);
404 TESTINST5i("beqic", 1, 1, 1, t5, a0);
405 TESTINST5i("beqic", 2, 0x7f, 0x7f, a0, a1);
406 TESTINST5i("beqic", 3, 0x7f, 0x7e, a1, a2);
407 TESTINST5i("beqic", 4, 0x7e, 0x7f, a2, a3);
408 TESTINST5i("beqic", 5, 0x70, 0x71, a3, t4);
409 TESTINST5i("beqic", 6, 0x5,0x4, a4, a5);
410 TESTINST5i("beqic", 7, -3, 0x7E, a6, a7);
411 TESTINST5i("beqic", 8, 125, 124, t0, t1);
412 TESTINST5i("beqic", 9, 0x0, 0x1, t1, t2);
413 TESTINST5i("beqic", 10, 0xf, 0x10, t2, t3);
414 TESTINST5i("beqic", 11, 0x26, 0x25, t3, t4);
415 TESTINST5i("beqic", 12, 0x55, 0x54, t4, t5);
416 TESTINST5i("beqic", 13, 0x10, 0xf, t5, s0);
417 TESTINST5i("beqic", 14, -1, 0, s0, s1);
418 TESTINST5i("beqic", 15, -1, 0x7E, s1, s2);
420 printf("---beqzc---\n");
421 TESTINST5("beqzc", 0, 0, t4, t5);
422 TESTINST5("beqzc", 1, 1, t5, a0);
423 TESTINST5("beqzc", 2, 0xffffffff, a0, a1);
424 TESTINST5("beqzc", 3, 0xffffffff, a1, a2);
425 TESTINST5("beqzc", 4, 0xfffffffe, a2, a3);
426 TESTINST5("beqzc", 5, 0xffffffff, a3, t4);
427 TESTINST5("beqzc", 6, 0x5, a4, a5);
428 TESTINST5("beqzc", 7, -3, a6, a7);
429 TESTINST5("beqzc", 8, 125, t0, t1);
430 TESTINST5("beqzc", 9, 0x80000000, t1, t2);
431 TESTINST5("beqzc", 10, 0xffffffff, t2, t3);
432 TESTINST5("beqzc", 11, 0x256, t3, t4);
433 TESTINST5("beqzc", 12, 0x55, t4, t5);
434 TESTINST5("beqzc", 13, 0xfff, t5, s0);
435 TESTINST5("beqzc", 14, -1, s0, s1);
436 TESTINST5("beqzc", 15, -1, s1, s2);
438 printf("---bgec---\n");
439 TESTINST4("bgec", 0, 0, 1, t4, t5, a0);
440 TESTINST4("bgec", 1, 1, 1, t5, a0, a1);
441 TESTINST4("bgec", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
442 TESTINST4("bgec", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
443 TESTINST4("bgec", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
444 TESTINST4("bgec", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
445 TESTINST4("bgec", 6, 0x5, 0x5, t0, t1, t2);
446 TESTINST4("bgec", 7, -3, -4, t1, t2, t3);
447 TESTINST4("bgec", 8, 125, 125, t2, t3, t4);
448 TESTINST4("bgec", 9, 0x80000000, 0x80000000, t3, t4, t5);
449 TESTINST4("bgec", 10, 0xffffffff, 0x80000000, t4, t5, a5);
450 TESTINST4("bgec", 11, 0x256, 0x256, t5, a5, a6);
451 TESTINST4("bgec", 12, 0x55, 0x55, a5, a6, s0);
452 TESTINST4("bgec", 13, 0xfff, 0xdd, s0, s1, s2);
453 TESTINST4("bgec", 14, -1, 0x5, t4, t9, t8);
454 TESTINST4("bgec", 15, -1, -1, t9, t8, a3);
456 printf("---bgeic---\n");
457 TESTINST5i("bgeic", 0, 0, 0, t4, t5);
458 TESTINST5i("bgeic", 1, 1, 1, t5, a0);
459 TESTINST5i("bgeic", 2, 0x7f, 0x7f, a0, a1);
460 TESTINST5i("bgeic", 3, 0x7f, 0x7e, a1, a2);
461 TESTINST5i("bgeic", 4, 0x7e, 0x7f, a2, a3);
462 TESTINST5i("bgeic", 5, 0x70, 0x71, a3, t4);
463 TESTINST5i("bgeic", 6, 0x5,0x4, a4, a5);
464 TESTINST5i("bgeic", 7, -3, 0x7E, a6, a7);
465 TESTINST5i("bgeic", 8, 125, 124, t0, t1);
466 TESTINST5i("bgeic", 9, 0x0, 0x1, t1, t2);
467 TESTINST5i("bgeic", 10, 0xf, 0x10, t2, t3);
468 TESTINST5i("bgeic", 11, 0x26, 0x25, t3, t4);
469 TESTINST5i("bgeic", 12, 0x55, 0x54, t4, t5);
470 TESTINST5i("bgeic", 13, 0x10, 0xf, t5, s0);
471 TESTINST5i("bgeic", 14, -1, 0, s0, s1);
472 TESTINST5i("bgeic", 15, -1, 0x7E, s1, s2);
474 printf("---bgeiuc---\n");
475 TESTINST5i("bgeiuc", 0, 0, 0, t4, t5);
476 TESTINST5i("bgeiuc", 1, 1, 1, t5, a0);
477 TESTINST5i("bgeiuc", 2, 0x7f, 0x7f, a0, a1);
478 TESTINST5i("bgeiuc", 3, 0x7f, 0x7e, a1, a2);
479 TESTINST5i("bgeiuc", 4, 0x7e, 0x7f, a2, a3);
480 TESTINST5i("bgeiuc", 5, 0x70, 0x71, a3, t4);
481 TESTINST5i("bgeiuc", 6, 0x5,0x4, a4, a5);
482 TESTINST5i("bgeiuc", 7, -3, 0x7E, a6, a7);
483 TESTINST5i("bgeiuc", 8, 125, 124, t0, t1);
484 TESTINST5i("bgeiuc", 9, 0x0, 0x1, t1, t2);
485 TESTINST5i("bgeiuc", 10, 0xf, 0x10, t2, t3);
486 TESTINST5i("bgeiuc", 11, 0x26, 0x25, t3, t4);
487 TESTINST5i("bgeiuc", 12, 0x55, 0x54, t4, t5);
488 TESTINST5i("bgeiuc", 13, 0x10, 0xf, t5, s0);
489 TESTINST5i("bgeiuc", 14, -1, 0, s0, s1);
490 TESTINST5i("bgeiuc", 15, -1, 0x7E, s1, s2);
492 printf("---bgeuc---\n");
493 TESTINST4("bgeuc", 0, 0, 1, t4, t5, a0);
494 TESTINST4("bgeuc", 1, 1, 1, t5, a0, a1);
495 TESTINST4("bgeuc", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
496 TESTINST4("bgeuc", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
497 TESTINST4("bgeuc", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
498 TESTINST4("bgeuc", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
499 TESTINST4("bgeuc", 6, 0x5, 0x5, t0, t1, t2);
500 TESTINST4("bgeuc", 7, -3, -4, t1, t2, t3);
501 TESTINST4("bgeuc", 8, 125, 125, t2, t3, t4);
502 TESTINST4("bgeuc", 9, 0x80000000, 0x80000000, t3, t4, t5);
503 TESTINST4("bgeuc", 10, 0xffffffff, 0x80000000, t4, t5, a5);
504 TESTINST4("bgeuc", 11, 0x256, 0x256, t5, a5, a6);
505 TESTINST4("bgeuc", 12, 0x55, 0x55, a5, a6, s0);
506 TESTINST4("bgeuc", 13, 0xfff, 0xdd, s0, s1, s2);
507 TESTINST4("bgeuc", 14, -1, 0x5, t4, t9, t8);
508 TESTINST4("bgeuc", 15, -1, -1, t9, t8, a3);
510 printf("---bltc---\n");
511 TESTINST4("bltc", 0, 0, 1, t4, t5, a0);
512 TESTINST4("bltc", 1, 1, 1, t5, a0, a1);
513 TESTINST4("bltc", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
514 TESTINST4("bltc", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
515 TESTINST4("bltc", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
516 TESTINST4("bltc", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
517 TESTINST4("bltc", 6, 0x5, 0x5, t0, t1, t2);
518 TESTINST4("bltc", 7, -3, -4, t1, t2, t3);
519 TESTINST4("bltc", 8, 125, 125, t2, t3, t4);
520 TESTINST4("bltc", 9, 0x80000000, 0x80000000, t3, t4, t5);
521 TESTINST4("bltc", 10, 0xffffffff, 0x80000000, t4, t5, a5);
522 TESTINST4("bltc", 11, 0x256, 0x256, t5, a5, a6);
523 TESTINST4("bltc", 12, 0x55, 0x55, a5, a6, s0);
524 TESTINST4("bltc", 13, 0xfff, 0xdd, s0, s1, s2);
525 TESTINST4("bltc", 14, -1, 0x5, t4, t9, t8);
526 TESTINST4("bltc", 15, -1, -1, t9, t8, a3);
528 printf("---bltic---\n");
529 TESTINST5i("bltic", 0, 0, 0, t4, t5);
530 TESTINST5i("bltic", 1, 1, 1, t5, a0);
531 TESTINST5i("bltic", 2, 0x7f, 0x7f, a0, a1);
532 TESTINST5i("bltic", 3, 0x7f, 0x7e, a1, a2);
533 TESTINST5i("bltic", 4, 0x7e, 0x7f, a2, a3);
534 TESTINST5i("bltic", 5, 0x70, 0x71, a3, t4);
535 TESTINST5i("bltic", 6, 0x5,0x4, a4, a5);
536 TESTINST5i("bltic", 7, -3, 0x7E, a6, a7);
537 TESTINST5i("bltic", 8, 125, 124, t0, t1);
538 TESTINST5i("bltic", 9, 0x0, 0x1, t1, t2);
539 TESTINST5i("bltic", 10, 0xf, 0x10, t2, t3);
540 TESTINST5i("bltic", 11, 0x26, 0x25, t3, t4);
541 TESTINST5i("bltic", 12, 0x55, 0x54, t4, t5);
542 TESTINST5i("bltic", 13, 0x10, 0xf, t5, s0);
543 TESTINST5i("bltic", 14, -1, 0, s0, s1);
544 TESTINST5i("bltic", 15, -1, 0x7E, s1, s2);
546 printf("---bltiuc---\n");
547 TESTINST5i("bltiuc", 0, 0, 0, t4, t5);
548 TESTINST5i("bltiuc", 1, 1, 1, t5, a0);
549 TESTINST5i("bltiuc", 2, 0x7f, 0x7f, a0, a1);
550 TESTINST5i("bltiuc", 3, 0x7f, 0x7e, a1, a2);
551 TESTINST5i("bltiuc", 4, 0x7e, 0x7f, a2, a3);
552 TESTINST5i("bltiuc", 5, 0x70, 0x71, a3, t4);
553 TESTINST5i("bltiuc", 6, 0x5,0x4, a4, a5);
554 TESTINST5i("bltiuc", 7, -3, 0x7E, a6, a7);
555 TESTINST5i("bltiuc", 8, 125, 124, t0, t1);
556 TESTINST5i("bltiuc", 9, 0x0, 0x1, t1, t2);
557 TESTINST5i("bltiuc", 10, 0xf, 0x10, t2, t3);
558 TESTINST5i("bltiuc", 11, 0x26, 0x25, t3, t4);
559 TESTINST5i("bltiuc", 12, 0x55, 0x54, t4, t5);
560 TESTINST5i("bltiuc", 13, 0x10, 0xf, t5, s0);
561 TESTINST5i("bltiuc", 14, -1, 0, s0, s1);
562 TESTINST5i("bltiuc", 15, -1, 0x7E, s1, s2);
564 printf("---bltuc---\n");
565 TESTINST4("bltuc", 0, 0, 1, t4, t5, a0);
566 TESTINST4("bltuc", 1, 1, 1, t5, a0, a1);
567 TESTINST4("bltuc", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
568 TESTINST4("bltuc", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
569 TESTINST4("bltuc", 4, 0xfffffffe, 0xffffffff, a2, t0, t1);
570 TESTINST4("bltuc", 5, 0xffffffff, 0xffffffff, a3, t0, t1);
571 TESTINST4("bltuc", 6, 0x5, 0x5, t0, t1, t2);
572 TESTINST4("bltuc", 7, -3, -4, t1, t2, t3);
573 TESTINST4("bltuc", 8, 125, 125, t2, t3, t4);
574 TESTINST4("bltuc", 9, 0x80000000, 0x80000000, t3, t4, t5);
575 TESTINST4("bltuc", 10, 0xffffffff, 0x80000000, t4, t5, a5);
576 TESTINST4("bltuc", 11, 0x256, 0x256, t5, a5, a6);
577 TESTINST4("bltuc", 12, 0x55, 0x55, a5, a6, s0);
578 TESTINST4("bltuc", 13, 0xfff, 0xdd, s0, s1, s2);
579 TESTINST4("bltuc", 14, -1, 0x5, t4, t9, t8);
580 TESTINST4("bltuc", 15, -1, -1, t9, t8, a3);
582 printf("---bnec---\n");
583 TESTINST4("bnec", 0, 0, 1, t4, t5, a0);
584 TESTINST4("bnec", 1, 1, 1, t5, a0, a1);
585 TESTINST4("bnec", 2, 0xffffffff, 0xffffffff, a0, a1, a2);
586 TESTINST4("bnec", 3, 0xffffffff, 0xfffffffe, a1, a2, a3);
587 TESTINST4("bnec", 4, 0xfffffffe, 0xffffffff, a2, a3, a4);
588 TESTINST4("bnec", 5, 0xffffffff, 0xffffffff, a3, a4, a5);
589 TESTINST4("bnec", 6, 0x5, 0x5, a4, a5, a6);
590 TESTINST4("bnec", 7, -3, -4, a5, a6, a7);
591 TESTINST4("bnec", 8, 125, 125, a6, a7, t0);
592 TESTINST4("bnec", 9, 0x80000000, 0x80000000, t0, t1, t2);
593 TESTINST4("bnec", 10, 0xffffffff, 0x80000000, t1, t2, t3);
594 TESTINST4("bnec", 11, 0x256, 0x256, t4, t5, t8);
595 TESTINST4("bnec", 12, 0x55, 0x55, t5, t8, t9);
596 TESTINST4("bnec", 13, 0xfff, 0xdd, t8, t9, s0);
597 TESTINST4("bnec", 14, -1, 0x5, t9, s0, s1);
598 TESTINST4("bnec", 15, -1, -1, s0, s1, s2);
600 printf("---bneic---\n");
601 TESTINST5i("bneic", 0, 0, 0, t4, t5);
602 TESTINST5i("bneic", 1, 1, 1, t5, a0);
603 TESTINST5i("bneic", 2, 0x7f, 0x7f, a0, a1);
604 TESTINST5i("bneic", 3, 0x7f, 0x7e, a1, a2);
605 TESTINST5i("bneic", 4, 0x7e, 0x7f, a2, a3);
606 TESTINST5i("bneic", 5, 0x70, 0x71, a3, t4);
607 TESTINST5i("bneic", 6, 0x5,0x4, a4, a5);
608 TESTINST5i("bneic", 7, -3, 0x7E, a6, a7);
609 TESTINST5i("bneic", 8, 125, 124, t0, t1);
610 TESTINST5i("bneic", 9, 0x0, 0x1, t1, t2);
611 TESTINST5i("bneic", 10, 0xf, 0x10, t2, t3);
612 TESTINST5i("bneic", 11, 0x26, 0x25, t3, t4);
613 TESTINST5i("bneic", 12, 0x55, 0x54, t4, t5);
614 TESTINST5i("bneic", 13, 0x10, 0xf, t5, s0);
615 TESTINST5i("bneic", 14, -1, 0, s0, s1);
616 TESTINST5i("bneic", 15, -1, 0x7E, s1, s2);
618 printf("---bnezc---\n");
619 TESTINST5("bnezc", 0, 0, t4, t5);
620 TESTINST5("bnezc", 1, 1, t5, a0);
621 TESTINST5("bnezc", 2, 0xffffffff, a0, a1);
622 TESTINST5("bnezc", 3, 0xffffffff, a1, a2);
623 TESTINST5("bnezc", 4, 0xfffffffe, a2, a3);
624 TESTINST5("bnezc", 5, 0xffffffff, a3, t4);
625 TESTINST5("bnezc", 6, 0x5, a4, a5);
626 TESTINST5("bnezc", 7, -3, a6, a7);
627 TESTINST5("bnezc", 8, 125, t0, t1);
628 TESTINST5("bnezc", 9, 0x80000000, t1, t2);
629 TESTINST5("bnezc", 10, 0xffffffff, t2, t3);
630 TESTINST5("bnezc", 11, 0x256, t3, t4);
631 TESTINST5("bnezc", 12, 0x55, t4, t5);
632 TESTINST5("bnezc", 13, 0xfff, t5, s0);
633 TESTINST5("bnezc", 14, -1, s0, s1);
634 TESTINST5("bnezc", 15, -1, s1, s2);
636 printf("---brsc---\n");
637 TESTINST6(0, a0);
638 TESTINST6(1, a1);
639 TESTINST6(2, a2);
640 TESTINST6(3, a3);
641 TESTINST6(4, a4);
642 TESTINST6(5, a5);
643 TESTINST6(6, a6);
644 TESTINST6(7, a7);
645 TESTINST6(8, t4);
646 TESTINST6(9, t5);
647 TESTINST6(10, s0);
648 TESTINST6(11, s1);
649 TESTINST6(12, s2);
650 TESTINST6(13, s3);
651 TESTINST6(14, t2);
652 TESTINST6(15, t3);
654 printf("---bgezc---\n");
655 TESTINST5("bgezc", 0, 0, t4, t5);
656 TESTINST5("bgezc", 1, 1, t5, a0);
657 TESTINST5("bgezc", 2, 0xffffffff, a0, a1);
658 TESTINST5("bgezc", 3, 0xffffffff, a1, a2);
659 TESTINST5("bgezc", 4, 0xfffffffe, a2, a3);
660 TESTINST5("bgezc", 5, 0xffffffff, a3, t4);
661 TESTINST5("bgezc", 6, 0x5, a4, a5);
662 TESTINST5("bgezc", 7, -3, a6, a7);
663 TESTINST5("bgezc", 8, 125, t0, t1);
664 TESTINST5("bgezc", 9, 0x80000000, t1, t2);
665 TESTINST5("bgezc", 10, 0xffffffff, t2, t3);
666 TESTINST5("bgezc", 11, 0x256, t3, t4);
667 TESTINST5("bgezc", 12, 0x55, t4, t5);
668 TESTINST5("bgezc", 13, 0xfff, t5, s0);
669 TESTINST5("bgezc", 14, -1, s0, s1);
670 TESTINST5("bgezc", 15, -1, s1, s2);
672 printf("---bgtzc---\n");
673 TESTINST5("bgtzc", 0, 0, t4, t5);
674 TESTINST5("bgtzc", 1, 1, t5, a0);
675 TESTINST5("bgtzc", 2, 0xffffffff, a0, a1);
676 TESTINST5("bgtzc", 3, 0xffffffff, a1, a2);
677 TESTINST5("bgtzc", 4, 0xfffffffe, a2, a3);
678 TESTINST5("bgtzc", 5, 0xffffffff, a3, t4);
679 TESTINST5("bgtzc", 6, 0x5, a4, a5);
680 TESTINST5("bgtzc", 7, -3, a6, a7);
681 TESTINST5("bgtzc", 8, 125, t0, t1);
682 TESTINST5("bgtzc", 9, 0x80000000, t1, t2);
683 TESTINST5("bgtzc", 10, 0xffffffff, t2, t3);
684 TESTINST5("bgtzc", 11, 0x256, t3, t4);
685 TESTINST5("bgtzc", 12, 0x55, t4, t5);
686 TESTINST5("bgtzc", 13, 0xfff, t5, s0);
687 TESTINST5("bgtzc", 14, -1, s0, s1);
688 TESTINST5("bgtzc", 15, -1, s1, s2);
690 printf("---blezc---\n");
691 TESTINST5("blezc", 0, 0, t4, t5);
692 TESTINST5("blezc", 1, 1, t5, a0);
693 TESTINST5("blezc", 2, 0xffffffff, a0, a1);
694 TESTINST5("blezc", 3, 0xffffffff, a1, a2);
695 TESTINST5("blezc", 4, 0xfffffffe, a2, a3);
696 TESTINST5("blezc", 5, 0xffffffff, a3, t4);
697 TESTINST5("blezc", 6, 0x5, a4, a5);
698 TESTINST5("blezc", 7, -3, a6, a7);
699 TESTINST5("blezc", 8, 125, t0, t1);
700 TESTINST5("blezc", 9, 0x80000000, t1, t2);
701 TESTINST5("blezc", 10, 0xffffffff, t2, t3);
702 TESTINST5("blezc", 11, 0x256, t3, t4);
703 TESTINST5("blezc", 12, 0x55, t4, t5);
704 TESTINST5("blezc", 13, 0xfff, t5, s0);
705 TESTINST5("blezc", 14, -1, s0, s1);
706 TESTINST5("blezc", 15, -1, s1, s2);
708 printf("---bltzc---\n");
709 TESTINST5("bltzc", 0, 0, t4, t5);
710 TESTINST5("bltzc", 1, 1, t5, a0);
711 TESTINST5("bltzc", 2, 0xffffffff, a0, a1);
712 TESTINST5("bltzc", 3, 0xffffffff, a1, a2);
713 TESTINST5("bltzc", 4, 0xfffffffe, a2, a3);
714 TESTINST5("bltzc", 5, 0xffffffff, a3, t4);
715 TESTINST5("bltzc", 6, 0x5, a4, a5);
716 TESTINST5("bltzc", 7, -3, a6, a7);
717 TESTINST5("bltzc", 8, 125, t0, t1);
718 TESTINST5("bltzc", 9, 0x80000000, t1, t2);
719 TESTINST5("bltzc", 10, 0xffffffff, t2, t3);
720 TESTINST5("bltzc", 11, 0x256, t3, t4);
721 TESTINST5("bltzc", 12, 0x55, t4, t5);
722 TESTINST5("bltzc", 13, 0xfff, t5, s0);
723 TESTINST5("bltzc", 14, -1, s0, s1);
724 TESTINST5("bltzc", 15, -1, s1, s2);
726 return 0;