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