451ab91e |
1 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
2 | * Mupen64plus - gcop1_s.c * |
3 | * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ * |
4 | * Copyright (C) 2007 Richard Goedeken (Richard42) * |
5 | * Copyright (C) 2002 Hacktarux * |
6 | * * |
7 | * This program is free software; you can redistribute it and/or modify * |
8 | * it under the terms of the GNU General Public License as published by * |
9 | * the Free Software Foundation; either version 2 of the License, or * |
10 | * (at your option) any later version. * |
11 | * * |
12 | * This program is distributed in the hope that it will be useful, * |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
15 | * GNU General Public License for more details. * |
16 | * * |
17 | * You should have received a copy of the GNU General Public License * |
18 | * along with this program; if not, write to the * |
19 | * Free Software Foundation, Inc., * |
20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
21 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
22 | |
23 | #include <stdio.h> |
24 | |
25 | #include "assemble.h" |
26 | #include "interpret.h" |
27 | |
28 | #include "r4300/recomph.h" |
29 | #include "r4300/r4300.h" |
30 | #include "r4300/ops.h" |
31 | #include "r4300/macros.h" |
32 | |
33 | void genadd_s(void) |
34 | { |
35 | #if defined(COUNT_INSTR) |
36 | inc_m32rel(&instr_count[119]); |
37 | #endif |
38 | #ifdef INTERPRET_ADD_S |
39 | gencallinterp((unsigned long long)cached_interpreter_table.ADD_S, 0); |
40 | #else |
41 | gencheck_cop1_unusable(); |
42 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
43 | fld_preg64_dword(RAX); |
44 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
45 | fadd_preg64_dword(RAX); |
46 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
47 | fstp_preg64_dword(RAX); |
48 | #endif |
49 | } |
50 | |
51 | void gensub_s(void) |
52 | { |
53 | #if defined(COUNT_INSTR) |
54 | inc_m32rel(&instr_count[120]); |
55 | #endif |
56 | #ifdef INTERPRET_SUB_S |
57 | gencallinterp((unsigned long long)cached_interpreter_table.SUB_S, 0); |
58 | #else |
59 | gencheck_cop1_unusable(); |
60 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
61 | fld_preg64_dword(RAX); |
62 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
63 | fsub_preg64_dword(RAX); |
64 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
65 | fstp_preg64_dword(RAX); |
66 | #endif |
67 | } |
68 | |
69 | void genmul_s(void) |
70 | { |
71 | #if defined(COUNT_INSTR) |
72 | inc_m32rel(&instr_count[121]); |
73 | #endif |
74 | #ifdef INTERPRET_MUL_S |
75 | gencallinterp((unsigned long long)cached_interpreter_table.MUL_S, 0); |
76 | #else |
77 | gencheck_cop1_unusable(); |
78 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
79 | fld_preg64_dword(RAX); |
80 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
81 | fmul_preg64_dword(RAX); |
82 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
83 | fstp_preg64_dword(RAX); |
84 | #endif |
85 | } |
86 | |
87 | void gendiv_s(void) |
88 | { |
89 | #if defined(COUNT_INSTR) |
90 | inc_m32rel(&instr_count[122]); |
91 | #endif |
92 | #ifdef INTERPRET_DIV_S |
93 | gencallinterp((unsigned long long)cached_interpreter_table.DIV_S, 0); |
94 | #else |
95 | gencheck_cop1_unusable(); |
96 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
97 | fld_preg64_dword(RAX); |
98 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
99 | fdiv_preg64_dword(RAX); |
100 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
101 | fstp_preg64_dword(RAX); |
102 | #endif |
103 | } |
104 | |
105 | void gensqrt_s(void) |
106 | { |
107 | #if defined(COUNT_INSTR) |
108 | inc_m32rel(&instr_count[123]); |
109 | #endif |
110 | #ifdef INTERPRET_SQRT_S |
111 | gencallinterp((unsigned long long)cached_interpreter_table.SQRT_S, 0); |
112 | #else |
113 | gencheck_cop1_unusable(); |
114 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
115 | fld_preg64_dword(RAX); |
116 | fsqrt(); |
117 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
118 | fstp_preg64_dword(RAX); |
119 | #endif |
120 | } |
121 | |
122 | void genabs_s(void) |
123 | { |
124 | #if defined(COUNT_INSTR) |
125 | inc_m32rel(&instr_count[124]); |
126 | #endif |
127 | #ifdef INTERPRET_ABS_S |
128 | gencallinterp((unsigned long long)cached_interpreter_table.ABS_S, 0); |
129 | #else |
130 | gencheck_cop1_unusable(); |
131 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
132 | fld_preg64_dword(RAX); |
133 | fabs_(); |
134 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
135 | fstp_preg64_dword(RAX); |
136 | #endif |
137 | } |
138 | |
139 | void genmov_s(void) |
140 | { |
141 | #if defined(COUNT_INSTR) |
142 | inc_m32rel(&instr_count[125]); |
143 | #endif |
144 | #ifdef INTERPRET_MOV_S |
145 | gencallinterp((unsigned long long)cached_interpreter_table.MOV_S, 0); |
146 | #else |
147 | gencheck_cop1_unusable(); |
148 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
149 | mov_reg32_preg64(EBX, RAX); |
150 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
151 | mov_preg64_reg32(RAX, EBX); |
152 | #endif |
153 | } |
154 | |
155 | void genneg_s(void) |
156 | { |
157 | #if defined(COUNT_INSTR) |
158 | inc_m32rel(&instr_count[126]); |
159 | #endif |
160 | #ifdef INTERPRET_NEG_S |
161 | gencallinterp((unsigned long long)cached_interpreter_table.NEG_S, 0); |
162 | #else |
163 | gencheck_cop1_unusable(); |
164 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
165 | fld_preg64_dword(RAX); |
166 | fchs(); |
167 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
168 | fstp_preg64_dword(RAX); |
169 | #endif |
170 | } |
171 | |
172 | void genround_l_s(void) |
173 | { |
174 | #if defined(COUNT_INSTR) |
175 | inc_m32rel(&instr_count[127]); |
176 | #endif |
177 | #ifdef INTERPRET_ROUND_L_S |
178 | gencallinterp((unsigned long long)cached_interpreter_table.ROUND_L_S, 0); |
179 | #else |
180 | gencheck_cop1_unusable(); |
181 | fldcw_m16rel((unsigned short*)&round_mode); |
182 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
183 | fld_preg64_dword(RAX); |
184 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); |
185 | fistp_preg64_qword(RAX); |
186 | fldcw_m16rel((unsigned short*)&rounding_mode); |
187 | #endif |
188 | } |
189 | |
190 | void gentrunc_l_s(void) |
191 | { |
192 | #if defined(COUNT_INSTR) |
193 | inc_m32rel(&instr_count[128]); |
194 | #endif |
195 | #ifdef INTERPRET_TRUNC_L_S |
196 | gencallinterp((unsigned long long)cached_interpreter_table.TRUNC_L_S, 0); |
197 | #else |
198 | gencheck_cop1_unusable(); |
199 | fldcw_m16rel((unsigned short*)&trunc_mode); |
200 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
201 | fld_preg64_dword(RAX); |
202 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); |
203 | fistp_preg64_qword(RAX); |
204 | fldcw_m16rel((unsigned short*)&rounding_mode); |
205 | #endif |
206 | } |
207 | |
208 | void genceil_l_s(void) |
209 | { |
210 | #if defined(COUNT_INSTR) |
211 | inc_m32rel(&instr_count[129]); |
212 | #endif |
213 | #ifdef INTERPRET_CEIL_L_S |
214 | gencallinterp((unsigned long long)cached_interpreter_table.CEIL_L_S, 0); |
215 | #else |
216 | gencheck_cop1_unusable(); |
217 | fldcw_m16rel((unsigned short*)&ceil_mode); |
218 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
219 | fld_preg64_dword(RAX); |
220 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); |
221 | fistp_preg64_qword(RAX); |
222 | fldcw_m16rel((unsigned short*)&rounding_mode); |
223 | #endif |
224 | } |
225 | |
226 | void genfloor_l_s(void) |
227 | { |
228 | #if defined(COUNT_INSTR) |
229 | inc_m32rel(&instr_count[130]); |
230 | #endif |
231 | #ifdef INTERPRET_FLOOR_L_S |
232 | gencallinterp((unsigned long long)cached_interpreter_table.FLOOR_L_S, 0); |
233 | #else |
234 | gencheck_cop1_unusable(); |
235 | fldcw_m16rel((unsigned short*)&floor_mode); |
236 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
237 | fld_preg64_dword(RAX); |
238 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); |
239 | fistp_preg64_qword(RAX); |
240 | fldcw_m16rel((unsigned short*)&rounding_mode); |
241 | #endif |
242 | } |
243 | |
244 | void genround_w_s(void) |
245 | { |
246 | #if defined(COUNT_INSTR) |
247 | inc_m32rel(&instr_count[127]); |
248 | #endif |
249 | #ifdef INTERPRET_ROUND_W_S |
250 | gencallinterp((unsigned long long)cached_interpreter_table.ROUND_W_S, 0); |
251 | #else |
252 | gencheck_cop1_unusable(); |
253 | fldcw_m16rel((unsigned short*)&round_mode); |
254 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
255 | fld_preg64_dword(RAX); |
256 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
257 | fistp_preg64_dword(RAX); |
258 | fldcw_m16rel((unsigned short*)&rounding_mode); |
259 | #endif |
260 | } |
261 | |
262 | void gentrunc_w_s(void) |
263 | { |
264 | #if defined(COUNT_INSTR) |
265 | inc_m32rel(&instr_count[128]); |
266 | #endif |
267 | #ifdef INTERPRET_TRUNC_W_S |
268 | gencallinterp((unsigned long long)cached_interpreter_table.TRUNC_W_S, 0); |
269 | #else |
270 | gencheck_cop1_unusable(); |
271 | fldcw_m16rel((unsigned short*)&trunc_mode); |
272 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
273 | fld_preg64_dword(RAX); |
274 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
275 | fistp_preg64_dword(RAX); |
276 | fldcw_m16rel((unsigned short*)&rounding_mode); |
277 | #endif |
278 | } |
279 | |
280 | void genceil_w_s(void) |
281 | { |
282 | #if defined(COUNT_INSTR) |
283 | inc_m32rel(&instr_count[129]); |
284 | #endif |
285 | #ifdef INTERPRET_CEIL_W_S |
286 | gencallinterp((unsigned long long)cached_interpreter_table.CEIL_W_S, 0); |
287 | #else |
288 | gencheck_cop1_unusable(); |
289 | fldcw_m16rel((unsigned short*)&ceil_mode); |
290 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
291 | fld_preg64_dword(RAX); |
292 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
293 | fistp_preg64_dword(RAX); |
294 | fldcw_m16rel((unsigned short*)&rounding_mode); |
295 | #endif |
296 | } |
297 | |
298 | void genfloor_w_s(void) |
299 | { |
300 | #if defined(COUNT_INSTR) |
301 | inc_m32rel(&instr_count[130]); |
302 | #endif |
303 | #ifdef INTERPRET_FLOOR_W_S |
304 | gencallinterp((unsigned long long)cached_interpreter_table.FLOOR_W_S, 0); |
305 | #else |
306 | gencheck_cop1_unusable(); |
307 | fldcw_m16rel((unsigned short*)&floor_mode); |
308 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
309 | fld_preg64_dword(RAX); |
310 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
311 | fistp_preg64_dword(RAX); |
312 | fldcw_m16rel((unsigned short*)&rounding_mode); |
313 | #endif |
314 | } |
315 | |
316 | void gencvt_d_s(void) |
317 | { |
318 | #if defined(COUNT_INSTR) |
319 | inc_m32rel(&instr_count[117]); |
320 | #endif |
321 | #ifdef INTERPRET_CVT_D_S |
322 | gencallinterp((unsigned long long)cached_interpreter_table.CVT_D_S, 0); |
323 | #else |
324 | gencheck_cop1_unusable(); |
325 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
326 | fld_preg64_dword(RAX); |
327 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); |
328 | fstp_preg64_qword(RAX); |
329 | #endif |
330 | } |
331 | |
332 | void gencvt_w_s(void) |
333 | { |
334 | #if defined(COUNT_INSTR) |
335 | inc_m32rel(&instr_count[117]); |
336 | #endif |
337 | #ifdef INTERPRET_CVT_W_S |
338 | gencallinterp((unsigned long long)cached_interpreter_table.CVT_W_S, 0); |
339 | #else |
340 | gencheck_cop1_unusable(); |
341 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
342 | fld_preg64_dword(RAX); |
343 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); |
344 | fistp_preg64_dword(RAX); |
345 | #endif |
346 | } |
347 | |
348 | void gencvt_l_s(void) |
349 | { |
350 | #if defined(COUNT_INSTR) |
351 | inc_m32rel(&instr_count[117]); |
352 | #endif |
353 | #ifdef INTERPRET_CVT_L_S |
354 | gencallinterp((unsigned long long)cached_interpreter_table.CVT_L_S, 0); |
355 | #else |
356 | gencheck_cop1_unusable(); |
357 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
358 | fld_preg64_dword(RAX); |
359 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_double[dst->f.cf.fd])); |
360 | fistp_preg64_qword(RAX); |
361 | #endif |
362 | } |
363 | |
364 | void genc_f_s(void) |
365 | { |
366 | #if defined(COUNT_INSTR) |
367 | inc_m32rel(&instr_count[118]); |
368 | #endif |
369 | #ifdef INTERPRET_C_F_S |
370 | gencallinterp((unsigned long long)cached_interpreter_table.C_F_S, 0); |
371 | #else |
372 | gencheck_cop1_unusable(); |
373 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); |
374 | #endif |
375 | } |
376 | |
377 | void genc_un_s(void) |
378 | { |
379 | #if defined(COUNT_INSTR) |
380 | inc_m32rel(&instr_count[118]); |
381 | #endif |
382 | #ifdef INTERPRET_C_UN_S |
383 | gencallinterp((unsigned long long)cached_interpreter_table.C_UN_S, 0); |
384 | #else |
385 | gencheck_cop1_unusable(); |
386 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
387 | fld_preg64_dword(RAX); |
388 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
389 | fld_preg64_dword(RAX); |
390 | fucomip_fpreg(1); |
391 | ffree_fpreg(0); |
392 | jp_rj(13); |
393 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
394 | jmp_imm_short(11); // 2 |
395 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
396 | #endif |
397 | } |
398 | |
399 | void genc_eq_s(void) |
400 | { |
401 | #if defined(COUNT_INSTR) |
402 | inc_m32rel(&instr_count[118]); |
403 | #endif |
404 | #ifdef INTERPRET_C_EQ_S |
405 | gencallinterp((unsigned long long)cached_interpreter_table.C_EQ_S, 0); |
406 | #else |
407 | gencheck_cop1_unusable(); |
408 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
409 | fld_preg64_dword(RAX); |
410 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
411 | fld_preg64_dword(RAX); |
412 | fucomip_fpreg(1); |
413 | ffree_fpreg(0); |
414 | jne_rj(13); |
415 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
416 | jmp_imm_short(11); // 2 |
417 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
418 | #endif |
419 | } |
420 | |
421 | void genc_ueq_s(void) |
422 | { |
423 | #if defined(COUNT_INSTR) |
424 | inc_m32rel(&instr_count[118]); |
425 | #endif |
426 | #ifdef INTERPRET_C_UEQ_S |
427 | gencallinterp((unsigned long long)cached_interpreter_table.C_UEQ_S, 0); |
428 | #else |
429 | gencheck_cop1_unusable(); |
430 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
431 | fld_preg64_dword(RAX); |
432 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
433 | fld_preg64_dword(RAX); |
434 | fucomip_fpreg(1); |
435 | ffree_fpreg(0); |
436 | jp_rj(15); |
437 | jne_rj(13); |
438 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
439 | jmp_imm_short(11); // 2 |
440 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
441 | #endif |
442 | } |
443 | |
444 | void genc_olt_s(void) |
445 | { |
446 | #if defined(COUNT_INSTR) |
447 | inc_m32rel(&instr_count[118]); |
448 | #endif |
449 | #ifdef INTERPRET_C_OLT_S |
450 | gencallinterp((unsigned long long)cached_interpreter_table.C_OLT_S, 0); |
451 | #else |
452 | gencheck_cop1_unusable(); |
453 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
454 | fld_preg64_dword(RAX); |
455 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
456 | fld_preg64_dword(RAX); |
457 | fucomip_fpreg(1); |
458 | ffree_fpreg(0); |
459 | jae_rj(13); |
460 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
461 | jmp_imm_short(11); // 2 |
462 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
463 | #endif |
464 | } |
465 | |
466 | void genc_ult_s(void) |
467 | { |
468 | #if defined(COUNT_INSTR) |
469 | inc_m32rel(&instr_count[118]); |
470 | #endif |
471 | #ifdef INTERPRET_C_ULT_S |
472 | gencallinterp((unsigned long long)cached_interpreter_table.C_ULT_S, 0); |
473 | #else |
474 | gencheck_cop1_unusable(); |
475 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
476 | fld_preg64_dword(RAX); |
477 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
478 | fld_preg64_dword(RAX); |
479 | fucomip_fpreg(1); |
480 | ffree_fpreg(0); |
481 | jp_rj(15); |
482 | jae_rj(13); |
483 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
484 | jmp_imm_short(11); // 2 |
485 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
486 | #endif |
487 | } |
488 | |
489 | void genc_ole_s(void) |
490 | { |
491 | #if defined(COUNT_INSTR) |
492 | inc_m32rel(&instr_count[118]); |
493 | #endif |
494 | #ifdef INTERPRET_C_OLE_S |
495 | gencallinterp((unsigned long long)cached_interpreter_table.C_OLE_S, 0); |
496 | #else |
497 | gencheck_cop1_unusable(); |
498 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
499 | fld_preg64_dword(RAX); |
500 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
501 | fld_preg64_dword(RAX); |
502 | fucomip_fpreg(1); |
503 | ffree_fpreg(0); |
504 | ja_rj(13); |
505 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
506 | jmp_imm_short(11); // 2 |
507 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
508 | #endif |
509 | } |
510 | |
511 | void genc_ule_s(void) |
512 | { |
513 | #if defined(COUNT_INSTR) |
514 | inc_m32rel(&instr_count[118]); |
515 | #endif |
516 | #ifdef INTERPRET_C_ULE_S |
517 | gencallinterp((unsigned long long)cached_interpreter_table.C_ULE_S, 0); |
518 | #else |
519 | gencheck_cop1_unusable(); |
520 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
521 | fld_preg64_dword(RAX); |
522 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
523 | fld_preg64_dword(RAX); |
524 | fucomip_fpreg(1); |
525 | ffree_fpreg(0); |
526 | jp_rj(15); |
527 | ja_rj(13); |
528 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
529 | jmp_imm_short(11); // 2 |
530 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
531 | #endif |
532 | } |
533 | |
534 | void genc_sf_s(void) |
535 | { |
536 | #if defined(COUNT_INSTR) |
537 | inc_m32rel(&instr_count[118]); |
538 | #endif |
539 | #ifdef INTERPRET_C_SF_S |
540 | gencallinterp((unsigned long long)cached_interpreter_table.C_SF_S, 0); |
541 | #else |
542 | gencheck_cop1_unusable(); |
543 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
544 | fld_preg64_dword(RAX); |
545 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
546 | fld_preg64_dword(RAX); |
547 | fcomip_fpreg(1); |
548 | ffree_fpreg(0); |
549 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); |
550 | #endif |
551 | } |
552 | |
553 | void genc_ngle_s(void) |
554 | { |
555 | #if defined(COUNT_INSTR) |
556 | inc_m32rel(&instr_count[118]); |
557 | #endif |
558 | #ifdef INTERPRET_C_NGLE_S |
559 | gencallinterp((unsigned long long)cached_interpreter_table.C_NGLE_S, 0); |
560 | #else |
561 | gencheck_cop1_unusable(); |
562 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
563 | fld_preg64_dword(RAX); |
564 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
565 | fld_preg64_dword(RAX); |
566 | fcomip_fpreg(1); |
567 | ffree_fpreg(0); |
568 | jp_rj(13); |
569 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
570 | jmp_imm_short(11); // 2 |
571 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
572 | #endif |
573 | } |
574 | |
575 | void genc_seq_s(void) |
576 | { |
577 | #if defined(COUNT_INSTR) |
578 | inc_m32rel(&instr_count[118]); |
579 | #endif |
580 | #ifdef INTERPRET_C_SEQ_S |
581 | gencallinterp((unsigned long long)cached_interpreter_table.C_SEQ_S, 0); |
582 | #else |
583 | gencheck_cop1_unusable(); |
584 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
585 | fld_preg64_dword(RAX); |
586 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
587 | fld_preg64_dword(RAX); |
588 | fcomip_fpreg(1); |
589 | ffree_fpreg(0); |
590 | jne_rj(13); |
591 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
592 | jmp_imm_short(11); // 2 |
593 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
594 | #endif |
595 | } |
596 | |
597 | void genc_ngl_s(void) |
598 | { |
599 | #if defined(COUNT_INSTR) |
600 | inc_m32rel(&instr_count[118]); |
601 | #endif |
602 | #ifdef INTERPRET_C_NGL_S |
603 | gencallinterp((unsigned long long)cached_interpreter_table.C_NGL_S, 0); |
604 | #else |
605 | gencheck_cop1_unusable(); |
606 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
607 | fld_preg64_dword(RAX); |
608 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
609 | fld_preg64_dword(RAX); |
610 | fcomip_fpreg(1); |
611 | ffree_fpreg(0); |
612 | jp_rj(15); |
613 | jne_rj(13); |
614 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
615 | jmp_imm_short(11); // 2 |
616 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
617 | #endif |
618 | } |
619 | |
620 | void genc_lt_s(void) |
621 | { |
622 | #if defined(COUNT_INSTR) |
623 | inc_m32rel(&instr_count[118]); |
624 | #endif |
625 | #ifdef INTERPRET_C_LT_S |
626 | gencallinterp((unsigned long long)cached_interpreter_table.C_LT_S, 0); |
627 | #else |
628 | gencheck_cop1_unusable(); |
629 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
630 | fld_preg64_dword(RAX); |
631 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
632 | fld_preg64_dword(RAX); |
633 | fcomip_fpreg(1); |
634 | ffree_fpreg(0); |
635 | jae_rj(13); |
636 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
637 | jmp_imm_short(11); // 2 |
638 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
639 | #endif |
640 | } |
641 | |
642 | void genc_nge_s(void) |
643 | { |
644 | #if defined(COUNT_INSTR) |
645 | inc_m32rel(&instr_count[118]); |
646 | #endif |
647 | #ifdef INTERPRET_C_NGE_S |
648 | gencallinterp((unsigned long long)cached_interpreter_table.C_NGE_S, 0); |
649 | #else |
650 | gencheck_cop1_unusable(); |
651 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
652 | fld_preg64_dword(RAX); |
653 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
654 | fld_preg64_dword(RAX); |
655 | fcomip_fpreg(1); |
656 | ffree_fpreg(0); |
657 | jp_rj(15); |
658 | jae_rj(13); |
659 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
660 | jmp_imm_short(11); // 2 |
661 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
662 | #endif |
663 | } |
664 | |
665 | void genc_le_s(void) |
666 | { |
667 | #if defined(COUNT_INSTR) |
668 | inc_m32rel(&instr_count[118]); |
669 | #endif |
670 | #ifdef INTERPRET_C_LE_S |
671 | gencallinterp((unsigned long long)cached_interpreter_table.C_LE_S, 0); |
672 | #else |
673 | gencheck_cop1_unusable(); |
674 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
675 | fld_preg64_dword(RAX); |
676 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
677 | fld_preg64_dword(RAX); |
678 | fcomip_fpreg(1); |
679 | ffree_fpreg(0); |
680 | ja_rj(13); |
681 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
682 | jmp_imm_short(11); // 2 |
683 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
684 | #endif |
685 | } |
686 | |
687 | void genc_ngt_s(void) |
688 | { |
689 | #if defined(COUNT_INSTR) |
690 | inc_m32rel(&instr_count[118]); |
691 | #endif |
692 | #ifdef INTERPRET_C_NGT_S |
693 | gencallinterp((unsigned long long)cached_interpreter_table.C_NGT_S, 0); |
694 | #else |
695 | gencheck_cop1_unusable(); |
696 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.ft])); |
697 | fld_preg64_dword(RAX); |
698 | mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); |
699 | fld_preg64_dword(RAX); |
700 | fcomip_fpreg(1); |
701 | ffree_fpreg(0); |
702 | jp_rj(15); |
703 | ja_rj(13); |
704 | or_m32rel_imm32((unsigned int*)&FCR31, 0x800000); // 11 |
705 | jmp_imm_short(11); // 2 |
706 | and_m32rel_imm32((unsigned int*)&FCR31, ~0x800000); // 11 |
707 | #endif |
708 | } |
709 | |