1 #include <stdio.h>
2 
3 const float fs_f[] = {
4    0, 456.2489562, 3, -1,
5    1384.6, -7.2945676, 1000000000, -5786.47,
6    1752, 0.0024575, 0.00000001, -248562.76,
7    -45786.476, 456.2489562, 34.00046, 45786.476,
8    1752065, 107, -45667.24, -7.2945676,
9    -347856.475, 356047.56, -1.0, 23.04
10 };
11 
12 unsigned int mem[] = {
13    0x4095A266, 0x66666666,
14    0xBFF00000, 0x00000000,
15    0x3FF00000, 0x00000000,
16    0x252a2e2b, 0x262d2d2a,
17    0xFFFFFFFF, 0xFFFFFFFF,
18    0x41D26580, 0xB487E5C9,
19    0x42026580, 0xB750E388,
20    0x3E45798E, 0xE2308C3A,
21    0x3FBF9ADD, 0x3746F65F
22 };
23 
24 // mfc1 rt, fs
25 #define TESTINSNMOVE(instruction, offset, FS, RT) \
26 { \
27     float out; \
28     int out1; \
29    __asm__ volatile( \
30      "move $t0, %2\n\t" \
31      "lwc1 $" #FS ", "#offset"($t0)\n\t" \
32      instruction "\n\t" \
33      "mov.s %0, $" #FS"\n\t" \
34      "move %1, $" #RT "\n\t" \
35      : "=&f" (out), "=&r" (out1) \
36 	 : "r" (mem) \
37 	 : #RT, "cc", "memory" \
38 	 ); \
39    printf("%s :: fs %f, rt 0x%x\n", \
40           instruction, out, out1); \
41 }
42 
43 // mfhc1 rt, fs
44 #define TESTINSNMOVEd(instruction, offset, FS, RT) \
45 { \
46     double out; \
47     int out1; \
48    __asm__ volatile( \
49      "move $t0, %2\n\t" \
50      "ldc1 $" #FS ", "#offset"($t0)\n\t" \
51      instruction "\n\t" \
52      "mov.d %0, $" #FS"\n\t" \
53      "move %1, $" #RT "\n\t" \
54      : "=&f" (out), "=&r" (out1) \
55 	 : "r" (mem) \
56 	 : #RT, "cc", "memory" \
57 	 ); \
58    printf("%s :: fs %lf, rt 0x%x\n", \
59           instruction, out, out1); \
60 }
61 
62 // mtc1 rt, fs
63 #define TESTINSNMOVEt(instruction, offset, FS, RT) \
64 { \
65     float out; \
66     int out1; \
67    __asm__ volatile( \
68      "move $t0, %2\n\t" \
69      "lw $" #RT ", "#offset"($t0)\n\t" \
70      instruction "\n\t" \
71      "mov.s %0, $" #FS"\n\t" \
72      "move %1, $" #RT "\n\t" \
73      : "=&f" (out), "=&r" (out1) \
74 	 : "r" (mem) \
75 	 : #RT, "cc", "memory" \
76 	 ); \
77    printf("%s :: fs %f, rt 0x%x\n", \
78           instruction, out, out1); \
79 }
80 
81 // mthc1 rt, fs
82 #define TESTINSNMOVEtd(instruction, offset, FS, RT) \
83 { \
84     double out; \
85     int out1; \
86    __asm__ volatile( \
87      "move $t0, %2\n\t" \
88      "lw $" #RT ", "#offset"($t0)\n\t" \
89      instruction "\n\t" \
90      "mov.d %0, $" #FS"\n\t" \
91      "move %1, $" #RT "\n\t" \
92      : "=&f" (out), "=&r" (out1) \
93 	 : "r" (mem) \
94 	 : #RT, "cc", "memory" \
95 	 ); \
96    printf("%s :: fs %lf, rt 0x%x\n", \
97           instruction, out, out1); \
98 }
99 
100 // mov.s fd, fs
101 #define TESTINSNMOVE1s(instruction, offset, FD, FS) \
102 { \
103     float out; \
104     int out1; \
105    __asm__ volatile( \
106      "move $t0, %2\n\t" \
107      "lwc1 $" #FS ", "#offset"($t0)\n\t" \
108      instruction "\n\t" \
109      "mov.s %0, $" #FD"\n\t" \
110      "mfc1 %1, $" #FD"\n\t" \
111      : "=&f" (out), "=&r" (out1) \
112 	 : "r" (fs_f) \
113 	 : "cc", "memory" \
114 	 ); \
115    printf("%s :: fs %f, rt 0x%x\n", \
116           instruction, out, out1); \
117 }
118 
119 // mov.d fd, fs
120 #define TESTINSNMOVE1d(instruction, offset, FD, FS) \
121 { \
122     double out; \
123     int out1; \
124    __asm__ volatile( \
125      "move $t0, %2\n\t" \
126      "ldc1 $" #FS ", "#offset"($t0)\n\t" \
127      instruction "\n\t" \
128      "mov.d %0, $" #FD"\n\t" \
129      "mfc1 %1, $" #FD"\n\t" \
130      : "=&f" (out), "=&r" (out1) \
131 	 : "r" (fs_f) \
132 	 : "cc", "memory" \
133 	 ); \
134    printf("%s ::fs %f, rt 0x%x\n", \
135           instruction, out, out1); \
136 }
137 
138 // movf rd, rs
139 #define TESTINSNMOVE2(instruction, RDval, RSval, RD, RS, cc) \
140 { \
141     int out; \
142    __asm__ volatile( \
143      "li $t0, 1\n\t" \
144      "move $t1, %3\n\t" \
145      "mtc1 $t0, $f0\n\t" \
146      "mtc1 $t1, $f2\n\t" \
147      "c.eq.s $f0, $f2\n\t" \
148      "move $" #RS ", %1\n\t" \
149      "move $" #RD ", %2\n\t" \
150      instruction "\n\t" \
151      "move %0, $" #RD "\n\t" \
152      : "=&r" (out) \
153 	 : "r" (RSval), "r" (RDval), "r" (cc) \
154 	 : "t0", "t1", #RD, #RS, "cc", "memory" \
155 	 ); \
156    printf("%s :: out: 0x%x, RDval: 0x%x, RSval: 0x%x, cc: %d\n", \
157           instruction, out, RDval, RSval, cc); \
158 }
159 
160 // movf.s fd, fs
161 #define TESTINSNMOVE2s(instruction, FD, FS, cc, offset) \
162 { \
163    float out; \
164    __asm__ volatile( \
165      "li $t0, 1\n\t" \
166      "move $t1, %1\n\t" \
167      "mtc1 $t0, $f0\n\t" \
168      "mtc1 $t1, $f2\n\t" \
169      "c.eq.s $f0, $f2\n\t" \
170      "move $t0, %2\n\t" \
171      "lwc1 $" #FD ", 4($t0)\n\t" \
172      "lwc1 $" #FS ", "#offset"($t0)\n\t" \
173      instruction "\n\t" \
174      "mov.s %0, $" #FD"\n\t" \
175      : "=&f" (out) \
176 	 : "r" (cc), "r" (fs_f) \
177 	 : "t0", "t1", "cc", "memory" \
178 	 ); \
179    printf("%s :: out: %f, cc: %d\n", \
180           instruction, out, cc); \
181 }
182 
183 // movf.d fd, fs
184 #if (__mips_fpr==64)
185 #define TESTINSNMOVE2d(instruction, FD, FS, cc, offset) \
186 { \
187    double out; \
188    int out1; \
189    int out2; \
190    __asm__ volatile( \
191      "li $t0, 1\n\t" \
192      "mtc1 $t0, $f0\n\t" \
193      "mtc1 %3,  $f2\n\t" \
194      "move $t0, %4\n\t" \
195      "ldc1 $f4, 8($t0)\n\t" \
196      "c.eq.s $f0, $f2\n\t" \
197      "ldc1 $" #FS ", "#offset"($t0)\n\t" \
198      instruction "\n\t" \
199      "mov.d %0, $" #FD"\n\t" \
200      "mfc1 %1, $f4\n\t" \
201      "mfhc1 %2, $f4\n\t" \
202      : "=&f" (out), "=&r" (out1), "=&r" (out2) \
203 	 : "r" (cc), "r" (mem) \
204 	 : "t0", "t1", "cc", "memory" \
205 	 ); \
206    printf("%s :: out: 0x%x 0x%x, cc: %d\n", \
207           instruction, out1, out2, cc); \
208 }
209 #else
210 #define TESTINSNMOVE2d(instruction, FD, FS, cc, offset) \
211 { \
212    double out; \
213    int out1; \
214    int out2; \
215    __asm__ volatile( \
216      "li $t0, 1\n\t" \
217      "move $t1, %3\n\t" \
218      "mtc1 $t0, $f0\n\t" \
219      "mtc1 $t1, $f2\n\t" \
220      "move $t0, %4\n\t" \
221      "ldc1 $f4, 8($t0)\n\t" \
222      "c.eq.s $f0, $f2\n\t" \
223      "ldc1 $" #FS ", "#offset"($t0)\n\t" \
224      instruction "\n\t" \
225      "mov.d %0, $" #FD"\n\t" \
226      "mfc1 %1, $f4\n\t" \
227      "mfc1 %2, $f5\n\t" \
228      : "=&f" (out), "=&r" (out1), "=&r" (out2) \
229 	 : "r" (cc), "r" (mem) \
230 	 : "t0", "t1", "cc", "memory" \
231 	 ); \
232    printf("%s :: out: 0x%x 0x%x, cc: %d\n", \
233           instruction, out1, out2, cc); \
234 }
235 #endif
236 
237 // movn.s fd, fs, rt
238 #define TESTINSNMOVEN1s(instruction, offset, RTval, FD, FS, RT) \
239 { \
240     float out; \
241     int out1; \
242    __asm__ volatile( \
243      "move $" #RT ", %3\n\t" \
244      "move $t0, %2\n\t" \
245      "lwc1 $" #FS ", "#offset"($t0)\n\t" \
246      "mtc1 $0, $" #FD "\n\t" \
247      instruction "\n\t" \
248      "mov.s %0, $" #FD"\n\t" \
249      "mfc1 %1, $" #FD"\n\t" \
250      : "=&f" (out), "=&r" (out1) \
251 	 : "r" (fs_f), "r" (RTval) \
252 	 : #RT, "cc", "memory" \
253 	 ); \
254    printf("%s :: fs rt 0x%x\n", \
255           instruction, out1); \
256 }
257 
258 // movn.d fd, fs, rt
259 #define TESTINSNMOVEN1d(instruction, offset, RTval, FD, FS, RT) \
260 { \
261     double out; \
262     int out1; \
263    __asm__ volatile( \
264      "move $" #RT ", %3\n\t" \
265      "move $t0, %2\n\t" \
266      "ldc1 $" #FS ", "#offset"($t0)\n\t" \
267      "mtc1 $0, $" #FD "\n\t" \
268      "mtc1 $0, $" #FD + 1"\n\t" \
269      instruction "\n\t" \
270      "mov.d %0, $" #FD"\n\t" \
271      "mfc1 %1, $" #FD"\n\t" \
272      : "=&f" (out), "=&r" (out1) \
273 	 : "r" (fs_f), "r" (RTval) \
274 	 : #RT, "cc", "memory" \
275 	 ); \
276    printf("%s :: fs %lf, rt 0x%x\n", \
277           instruction, out, out1); \
278 }
279 
main()280 int main()
281 {
282    printf("MFC1\n");
283    TESTINSNMOVE("mfc1 $t1, $f0",  0, f0, t1);
284    TESTINSNMOVE("mfc1 $t2, $f1", 4, f1, t2);
285    TESTINSNMOVE("mfc1 $t3, $f2",  8, f2, t3);
286    TESTINSNMOVE("mfc1 $t4, $f3", 12, f3, t4);
287    TESTINSNMOVE("mfc1 $t5, $f4", 16, f4, t5);
288    TESTINSNMOVE("mfc1 $t6, $f5", 20, f5, t6);
289    TESTINSNMOVE("mfc1 $t7, $f6", 24, f6, t7);
290    TESTINSNMOVE("mfc1 $v0, $f7", 28, f7, v0);
291    TESTINSNMOVE("mfc1 $v1, $f8", 32, f8, v1);
292    TESTINSNMOVE("mfc1 $s0, $f9", 36, f9, s0);
293    TESTINSNMOVE("mfc1 $s1, $f10", 40, f10, s1);
294    TESTINSNMOVE("mfc1 $s2, $f11", 44, f11, s2);
295    TESTINSNMOVE("mfc1 $s3, $f12", 48, f12, s3);
296    TESTINSNMOVE("mfc1 $s4, $f13", 52, f13, s4);
297    TESTINSNMOVE("mfc1 $s5, $f14", 56, f14, s5);
298    TESTINSNMOVE("mfc1 $s6, $f15", 60, f15, s6);
299    TESTINSNMOVE("mfc1 $s7, $f16", 64, f16, s7);
300    TESTINSNMOVE("mfc1 $a0, $f17", 0, f17, a0);
301    TESTINSNMOVE("mfc1 $a1, $f18", 4, f18, a1);
302    TESTINSNMOVE("mfc1 $a2, $f19", 8, f19, a2);
303    TESTINSNMOVE("mfc1 $a3, $f20", 12, f20, a3);
304    TESTINSNMOVE("mfc1 $v0, $f21", 16, f21, v0);
305    TESTINSNMOVE("mfc1 $v1, $f22", 20, f22, v1);
306    TESTINSNMOVE("mfc1 $t8, $f23", 24, f23, t8);
307    TESTINSNMOVE("mfc1 $t9, $f24", 28, f24, t9);
308    TESTINSNMOVE("mfc1 $t1, $f25", 32, f25, t1);
309    TESTINSNMOVE("mfc1 $t2, $f26", 36, f26, t2);
310 
311    printf("MTC1\n");
312    TESTINSNMOVEt("mtc1 $t1, $f0",  0, f0, t1);
313    TESTINSNMOVEt("mtc1 $t2, $f1", 4, f1, t2);
314    TESTINSNMOVEt("mtc1 $t3, $f2",  8, f2, t3);
315    TESTINSNMOVEt("mtc1 $t4, $f3", 12, f3, t4);
316    TESTINSNMOVEt("mtc1 $t5, $f4", 16, f4, t5);
317    TESTINSNMOVEt("mtc1 $t6, $f5", 20, f5, t6);
318    TESTINSNMOVEt("mtc1 $t7, $f6", 24, f6, t7);
319    TESTINSNMOVEt("mtc1 $v0, $f7", 28, f7, v0);
320    TESTINSNMOVEt("mtc1 $v1, $f8", 32, f8, v1);
321    TESTINSNMOVEt("mtc1 $s0, $f9", 36, f9, s0);
322    TESTINSNMOVEt("mtc1 $s1, $f10", 40, f10, s1);
323    TESTINSNMOVEt("mtc1 $s2, $f11", 44, f11, s2);
324    TESTINSNMOVEt("mtc1 $s3, $f12", 48, f12, s3);
325    TESTINSNMOVEt("mtc1 $s4, $f13", 52, f13, s4);
326    TESTINSNMOVEt("mtc1 $s5, $f14", 56, f14, s5);
327    TESTINSNMOVEt("mtc1 $s6, $f15", 60, f15, s6);
328    TESTINSNMOVEt("mtc1 $s7, $f16", 64, f16, s7);
329    TESTINSNMOVEt("mtc1 $a0, $f17", 2, f17, a0);
330    TESTINSNMOVEt("mtc1 $a1, $f18", 6, f18, a1);
331    TESTINSNMOVEt("mtc1 $a2, $f19", 10, f19, a2);
332    TESTINSNMOVEt("mtc1 $a3, $f20", 14, f20, a3);
333    TESTINSNMOVEt("mtc1 $v0, $f21", 18, f21, v0);
334    TESTINSNMOVEt("mtc1 $v1, $f22", 22, f22, v1);
335    TESTINSNMOVEt("mtc1 $t8, $f23", 26, f23, t8);
336    TESTINSNMOVEt("mtc1 $t9, $f24", 30, f24, t9);
337    TESTINSNMOVEt("mtc1 $t1, $f25", 34, f25, t1);
338    TESTINSNMOVEt("mtc1 $t2, $f26", 38, f26, t2);
339 
340    printf("MOV.S\n");
341    TESTINSNMOVE1s("mov.s $f0, $f0",  0, f0, f0);
342    TESTINSNMOVE1s("mov.s $f0, $f1", 4, f0, f1);
343    TESTINSNMOVE1s("mov.s $f1, $f2",  8, f1, f2);
344    TESTINSNMOVE1s("mov.s $f2, $f3", 12, f2, f3);
345    TESTINSNMOVE1s("mov.s $f3, $f4", 16, f3, f4);
346    TESTINSNMOVE1s("mov.s $f4, $f5", 20, f4, f5);
347    TESTINSNMOVE1s("mov.s $f5, $f6", 24, f5, f6);
348    TESTINSNMOVE1s("mov.s $f6, $f7", 28, f6, f7);
349    TESTINSNMOVE1s("mov.s $f7, $f8", 32, f7, f8);
350    TESTINSNMOVE1s("mov.s $f8, $f9", 36, f8, f9);
351    TESTINSNMOVE1s("mov.s $f9, $f10", 40, f9, f10);
352    TESTINSNMOVE1s("mov.s $f10, $f11", 44, f10, f11);
353    TESTINSNMOVE1s("mov.s $f11, $f12", 48, f11, f12);
354    TESTINSNMOVE1s("mov.s $f12, $f13", 52, f12, f13);
355    TESTINSNMOVE1s("mov.s $f13, $f14", 56, f13, f14);
356    TESTINSNMOVE1s("mov.s $f14, $f15", 60, f14, f15);
357    TESTINSNMOVE1s("mov.s $f15, $f16", 64, f15, f16);
358    TESTINSNMOVE1s("mov.s $f16, $f17", 0, f16, f17);
359    TESTINSNMOVE1s("mov.s $f17, $f18", 4, f17, f18);
360    TESTINSNMOVE1s("mov.s $f18, $f19", 8, f18, f19);
361    TESTINSNMOVE1s("mov.s $f19, $f20", 12, f19, f20);
362    TESTINSNMOVE1s("mov.s $f20, $f21", 16, f20, f21);
363    TESTINSNMOVE1s("mov.s $f21, $f22", 20, f21, f22);
364    TESTINSNMOVE1s("mov.s $f22, $f23", 24, f22, f23);
365    TESTINSNMOVE1s("mov.s $f23, $f24", 28, f23, f24);
366    TESTINSNMOVE1s("mov.s $f24, $f25", 32, f24, f25);
367    TESTINSNMOVE1s("mov.s $f25, $f26", 36, f25, f26);
368 
369    printf("MOV.D\n");
370    TESTINSNMOVE1d("mov.d $f0, $f0",  0, f0, f0);
371    TESTINSNMOVE1d("mov.d $f0, $f0", 8, f0, f0);
372    TESTINSNMOVE1d("mov.d $f0, $f2",  16, f0, f2);
373    TESTINSNMOVE1d("mov.d $f2, $f4", 24, f2, f4);
374    TESTINSNMOVE1d("mov.d $f2, $f4", 32, f2, f4);
375    TESTINSNMOVE1d("mov.d $f4, $f6", 40, f4, f6);
376    TESTINSNMOVE1d("mov.d $f4, $f6", 48, f4, f6);
377    TESTINSNMOVE1d("mov.d $f6, $f8", 56, f6, f8);
378    TESTINSNMOVE1d("mov.d $f6, $f8", 64, f6, f8);
379    TESTINSNMOVE1d("mov.d $f8, $f10", 0, f8, f10);
380    TESTINSNMOVE1d("mov.d $f8, $f10", 8, f8, f10);
381    TESTINSNMOVE1d("mov.d $f10, $f12", 16, f10, f12);
382    TESTINSNMOVE1d("mov.d $f10, $f12", 24, f10, f12);
383    TESTINSNMOVE1d("mov.d $f12, $f14", 32, f12, f14);
384    TESTINSNMOVE1d("mov.d $f12, $f14", 40, f12, f14);
385    TESTINSNMOVE1d("mov.d $f14, $f16", 48, f14, f16);
386    TESTINSNMOVE1d("mov.d $f14, $f16", 56, f14, f16);
387    TESTINSNMOVE1d("mov.d $f16, $f18", 64, f16, f18);
388    TESTINSNMOVE1d("mov.d $f16, $f18", 0, f16, f18);
389    TESTINSNMOVE1d("mov.d $f18, $f20", 8, f18, f20);
390    TESTINSNMOVE1d("mov.d $f18, $f20", 16, f18, f20);
391    TESTINSNMOVE1d("mov.d $f20, $f22", 24, f20, f22);
392    TESTINSNMOVE1d("mov.d $f20, $f22", 32, f20, f22);
393    TESTINSNMOVE1d("mov.d $f22, $f24", 40, f22, f24);
394    TESTINSNMOVE1d("mov.d $f22, $f24", 48, f22, f24);
395    TESTINSNMOVE1d("mov.d $f24, $f26", 56, f24, f26);
396    TESTINSNMOVE1d("mov.d $f24, $f26", 64, f24, f26);
397 
398    printf("MOVF\n");
399    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0, 0xffffffff, t0, t1, 1);
400    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0xffffffff, 0xffffffff, t0, t1, 0);
401    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  555, 0xffffffff, t0, t1, 1);
402    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0, 5, t0, t1, 0);
403    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0, -1, t0, t1, 1);
404    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0xffffffff, 25, t0, t1, 0);
405    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0xffffffff, 0, t0, t1, 1);
406    TESTINSNMOVE2("movf $t0, $t1, $fcc0",  0xffffffff, 66, t0, t1, 0);
407    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0, 0xffffffff, t0, t1, 1);
408    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0xffffffff, 0xffffffff, t0, t1, 0);
409    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  555, 0xffffffff, t0, t1, 1);
410    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0, 5, t0, t1, 0);
411    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0, -1, t0, t1, 1);
412    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0xffffffff, 25, t0, t1, 0);
413    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0xffffffff, 0, t0, t1, 1);
414    TESTINSNMOVE2("movf $t0, $t1, $fcc4",  0xffffffff, 66, t0, t1, 0);
415 
416    printf("MOVF.S\n");
417    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 0);
418    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 4);
419    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 8);
420    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 12);
421    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 16);
422    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 20);
423    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 24);
424    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 28);
425    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 32);
426    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 36)
427    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 40)
428    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 44)
429    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 48)
430    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 52)
431    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 1, 56)
432    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 0);
433    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 4);
434    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 8);
435    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 12);
436    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 16);
437    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 20);
438    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 24);
439    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 28);
440    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 32);
441    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 36);
442    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 40);
443    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 44);
444    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 48);
445    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 52);
446    TESTINSNMOVE2s("movf.s $f4, $f6, $fcc0", f4, f6, 0, 56);
447 
448    printf("MOVF.D\n");
449    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 0);
450    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 8);
451    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 16);
452    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 24);
453    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 32);
454    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 40);
455    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 48);
456    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 56);
457    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 64);
458    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 0)
459    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 8)
460    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 16)
461    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 24)
462    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 32)
463    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 1, 40)
464    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 48);
465    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 56);
466    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 64);
467    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 0);
468    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 8);
469    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 16);
470    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 24);
471    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 32);
472    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 40);
473    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 48);
474    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 56);
475    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 64);
476    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 0);
477    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 8);
478    TESTINSNMOVE2d("movf.d $f4, $f6, $fcc0", f4, f6, 0, 16);
479 
480    printf("MOVN.S\n");
481    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 0, 0, f0, f2, t3);
482    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 4, 1, f0, f2, t3);
483    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 8, 0xffff, f0, f2, t3);
484    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 12, -1, f0, f2, t3);
485    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 16, 5, f0, f2, t3);
486    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 20, 0, f0, f2, t3);
487    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 24, 0, f0, f2, t3);
488    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 28, 5, f0, f2, t3);
489    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 32, 125487, f0, f2, t3);
490    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 36, 68, f0, f2, t3);
491    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 40, -122544, f0, f2, t3);
492    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 44, 0, f0, f2, t3);
493    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 48, 0, f0, f2, t3);
494    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 52, 0xffffffff, f0, f2, t3);
495    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 56, 0x80000000, f0, f2, t3);
496    TESTINSNMOVEN1s("movn.s $f0, $f2, $t3", 60, 0x7fffffff, f0, f2, t3);
497 
498    printf("MOVN.D\n");
499    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 0, 0, f0, f2, t3);
500    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 4, 1, f0, f2, t3);
501    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 8, 0xffff, f0, f2, t3);
502    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 12, -1, f0, f2, t3);
503    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 16, 5, f0, f2, t3);
504    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 20, 0, f0, f2, t3);
505    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 24, 0, f0, f2, t3);
506    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 28, 5, f0, f2, t3);
507    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 32, 125487, f0, f2, t3);
508    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 36, 68, f0, f2, t3);
509    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 40, -122544, f0, f2, t3);
510    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 44, 0, f0, f2, t3);
511    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 48, 0, f0, f2, t3);
512    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 52, 0xffffffff, f0, f2, t3);
513    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 56, 0x80000000, f0, f2, t3);
514    TESTINSNMOVEN1s("movn.d $f0, $f2, $t3", 60, 0x7fffffff, f0, f2, t3);
515 
516    printf("MOVT\n");
517    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0, 0xffffffff, t0, t1, 1);
518    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0xffffffff, 0xffffffff, t0, t1, 0);
519    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  555, 0xffffffff, t0, t1, 1);
520    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0, 5, t0, t1, 0);
521    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0, -1, t0, t1, 1);
522    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0xffffffff, 25, t0, t1, 0);
523    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0xffffffff, 0, t0, t1, 1);
524    TESTINSNMOVE2("movt $t0, $t1, $fcc0",  0xffffffff, 66, t0, t1, 0);
525    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0, 0xffffffff, t0, t1, 1);
526    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0xffffffff, 0xffffffff, t0, t1, 0);
527    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  555, 0xffffffff, t0, t1, 1);
528    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0, 5, t0, t1, 0);
529    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0, -1, t0, t1, 1);
530    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0xffffffff, 25, t0, t1, 0);
531    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0xffffffff, 0, t0, t1, 1);
532    TESTINSNMOVE2("movt $t0, $t1, $fcc4",  0xffffffff, 66, t0, t1, 0);
533 
534    printf("MOVT.S\n");
535    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 0);
536    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 4);
537    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 8);
538    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 12);
539    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 16);
540    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 20);
541    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 24);
542    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 28);
543    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 32);
544    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 36)
545    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 40)
546    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 44)
547    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 48)
548    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 52)
549    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 1, 56)
550    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 0);
551    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 4);
552    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 8);
553    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 12);
554    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 16);
555    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 20);
556    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 24);
557    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 28);
558    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 32);
559    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 36);
560    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 40);
561    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 44);
562    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 48);
563    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 52);
564    TESTINSNMOVE2s("movt.s $f4, $f6, $fcc0", f4, f6, 0, 56);
565 
566    printf("MOVT.D\n");
567    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 0);
568    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 8);
569    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 16);
570    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 24);
571    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 32);
572    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 40);
573    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 48);
574    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 56);
575    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 64);
576    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 0)
577    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 8)
578    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 16)
579    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 24)
580    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 32)
581    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 1, 40)
582    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 48);
583    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 56);
584    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 64);
585    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 0);
586    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 8);
587    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 16);
588    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 24);
589    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 32);
590    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 40);
591    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 48);
592    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 56);
593    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 64);
594    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 0);
595    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 8);
596    TESTINSNMOVE2d("movt.d $f4, $f6, $fcc0", f4, f6, 0, 16);
597 
598    printf("MOVZ.S\n");
599    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 0, 0, f0, f2, t3);
600    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 4, 1, f0, f2, t3);
601    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 8, 0xffff, f0, f2, t3);
602    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 12, -1, f0, f2, t3);
603    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 16, 5, f0, f2, t3);
604    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 20, 0, f0, f2, t3);
605    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 24, 0, f0, f2, t3);
606    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 24, 0, f0, f2, t3);
607    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 28, 5, f0, f2, t3);
608    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 32, 125487, f0, f2, t3);
609    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 36, 68, f0, f2, t3);
610    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 40, -122544, f0, f2, t3);
611    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 44, 0, f0, f2, t3);
612    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 48, 0, f0, f2, t3);
613    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 52, 0xffffffff, f0, f2, t3);
614    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 56, 0x80000000, f0, f2, t3);
615    TESTINSNMOVEN1s("movz.s $f0, $f2, $t3", 60, 0x7fffffff, f0, f2, t3);
616 
617    printf("MOVZ.D\n");
618    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 0, 0, f0, f2, t3);
619    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 4, 1, f0, f2, t3);
620    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 8, 0xffff, f0, f2, t3);
621    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 12, -1, f0, f2, t3);
622    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 16, 5, f0, f2, t3);
623    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 20, 0, f0, f2, t3);
624    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 24, 0, f0, f2, t3);
625    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 28, 5, f0, f2, t3);
626    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 32, 125487, f0, f2, t3);
627    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 36, 68, f0, f2, t3);
628    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 40, -122544, f0, f2, t3);
629    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 44, 0, f0, f2, t3);
630    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 48, 0, f0, f2, t3);
631    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 52, 0xffffffff, f0, f2, t3);
632    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 56, 0x80000000, f0, f2, t3);
633    TESTINSNMOVEN1s("movz.d $f0, $f2, $t3", 60, 0x7fffffff, f0, f2, t3);
634    return 0;
635 }
636