void genfloor_w_s() { #ifdef INTERPRET_FLOOR_W_S gencallinterp((u32)FLOOR_W_S, 0); #else gencheck_cop1_unusable(); fldcw_m16((unsigned short*)&floor_mode); mov_eax_memoffs32((u32 *)(®_cop1_simple[dst->f.cf.fs])); fld_preg32_dword(EAX); mov_eax_memoffs32((u32 *)(®_cop1_simple[dst->f.cf.fd])); fistp_preg32_dword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif }
void genfloor_w_d(usf_state_t * state) { #ifdef INTERPRET_FLOOR_W_D gencallinterp(state, (unsigned int)state->current_instruction_table.FLOOR_W_D, 0); #else gencheck_cop1_unusable(state); fldcw_m16(state, (unsigned short*)&state->floor_mode); mov_eax_memoffs32(state, (unsigned int*)(&state->reg_cop1_double[state->dst->f.cf.fs])); fld_preg32_qword(state, EAX); mov_eax_memoffs32(state, (unsigned int*)(&state->reg_cop1_simple[state->dst->f.cf.fd])); fistp_preg32_dword(state, EAX); fldcw_m16(state, (unsigned short*)&state->rounding_mode); #endif }
void genceil_l_s() { #ifdef INTERPRET_CEIL_L_S gencallinterp((u32)CEIL_L_S, 0); #else gencheck_cop1_unusable(); fldcw_m16((unsigned short*)&ceil_mode); mov_eax_memoffs32((u32 *)(®_cop1_simple[dst->f.cf.fs])); fld_preg32_dword(EAX); mov_eax_memoffs32((u32 *)(®_cop1_double[dst->f.cf.fd])); fistp_preg32_qword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif }
void gentrunc_w_d() { #ifdef INTERPRET_TRUNC_W_D gencallinterp((unsigned long)TRUNC_W_D, 0); #else gencheck_cop1_unusable(); fldcw_m16((unsigned short*)&trunc_mode); mov_eax_memoffs32((unsigned long*)(®_cop1_double[dst->f.cf.fs])); fld_preg32_qword(EAX); mov_eax_memoffs32((unsigned long*)(®_cop1_simple[dst->f.cf.fd])); fistp_preg32_dword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif }
void genfloor_l_d() { #ifdef INTERPRET_FLOOR_L_D gencallinterp((unsigned long)FLOOR_L_D, 0); #else gencheck_cop1_unusable(); fldcw_m16((unsigned short*)&floor_mode); mov_eax_memoffs32((unsigned long*)(®_cop1_double[dst->f.cf.fs])); fld_preg32_qword(EAX); mov_eax_memoffs32((unsigned long*)(®_cop1_double[dst->f.cf.fd])); fistp_preg32_qword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif }
void genround_l_d(void) { #ifdef INTERPRET_ROUND_L_D gencallinterp((unsigned int)ROUND_L_D, 0); #else gencheck_cop1_unusable(); fldcw_m16((unsigned short*)&round_mode); mov_eax_memoffs32((unsigned int*)(®_cop1_double[dst->f.cf.fs])); fld_preg32_qword(EAX); mov_eax_memoffs32((unsigned int*)(®_cop1_double[dst->f.cf.fd])); fistp_preg32_qword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif }
void genceil_w_s(void) { #ifdef INTERPRET_CEIL_W_S gencallinterp((unsigned int)cached_interpreter_table.CEIL_W_S, 0); #else gencheck_cop1_unusable(); fldcw_m16((unsigned short*)&ceil_mode); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fs])); fld_preg32_dword(EAX); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fd])); fistp_preg32_dword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif }
void genctc1(void) { #ifdef INTERPRET_CTC1 gencallinterp((unsigned int)CTC1, 0); #else gencheck_cop1_unusable(); if (dst->f.r.nrd != 31) return; mov_eax_memoffs32((unsigned int*)dst->f.r.rt); mov_memoffs32_eax((unsigned int*)&FCR31); and_eax_imm32(3); cmp_eax_imm32(0); jne_rj(12); mov_m32_imm32((unsigned int*)&rounding_mode, 0x33F); // 10 jmp_imm_short(48); // 2 cmp_eax_imm32(1); // 5 jne_rj(12); // 2 mov_m32_imm32((unsigned int*)&rounding_mode, 0xF3F); // 10 jmp_imm_short(29); // 2 cmp_eax_imm32(2); // 5 jne_rj(12); // 2 mov_m32_imm32((unsigned int*)&rounding_mode, 0xB3F); // 10 jmp_imm_short(10); // 2 mov_m32_imm32((unsigned int*)&rounding_mode, 0x73F); // 10 fldcw_m16((unsigned short*)&rounding_mode); #endif }
void genctc1(void) { #ifdef INTERPRET_CTC1 gencallinterp((native_type)cached_interpreter_table.CTC1, 0); #else gencheck_cop1_unusable(); if (dst->f.r.nrd != 31) return; #ifdef __x86_64__ mov_xreg32_m32rel(EAX, (unsigned int*)dst->f.r.rt); mov_m32rel_xreg32((unsigned int*)&FCR31, EAX); and_eax_imm32(3); cmp_eax_imm32(0); jne_rj(13); mov_m32rel_imm32((unsigned int*)&rounding_mode, 0x33F); // 11 jmp_imm_short(51); // 2 cmp_eax_imm32(1); // 5 jne_rj(13); // 2 mov_m32rel_imm32((unsigned int*)&rounding_mode, 0xF3F); // 11 jmp_imm_short(31); // 2 cmp_eax_imm32(2); // 5 jne_rj(13); // 2 mov_m32rel_imm32((unsigned int*)&rounding_mode, 0xB3F); // 11 jmp_imm_short(11); // 2 mov_m32rel_imm32((unsigned int*)&rounding_mode, 0x73F); // 11 fldcw_m16rel((unsigned short*)&rounding_mode); #else mov_eax_memoffs32((unsigned int*)dst->f.r.rt); mov_memoffs32_eax((unsigned int*)&FCR31); and_eax_imm32(3); cmp_eax_imm32(0); jne_rj(12); mov_m32_imm32((unsigned int*)&rounding_mode, 0x33F); // 10 jmp_imm_short(48); // 2 cmp_eax_imm32(1); // 5 jne_rj(12); // 2 mov_m32_imm32((unsigned int*)&rounding_mode, 0xF3F); // 10 jmp_imm_short(29); // 2 cmp_eax_imm32(2); // 5 jne_rj(12); // 2 mov_m32_imm32((unsigned int*)&rounding_mode, 0xB3F); // 10 jmp_imm_short(10); // 2 mov_m32_imm32((unsigned int*)&rounding_mode, 0x73F); // 10 fldcw_m16((unsigned short*)&rounding_mode); #endif #endif }
void genfloor_w_s(void) { #ifdef INTERPRET_FLOOR_W_S gencallinterp((native_type)cached_interpreter_table.FLOOR_W_S, 0); #else gencheck_cop1_unusable(); #ifdef __x86_64__ fldcw_m16rel((unsigned short*)&floor_mode); mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fs])); fld_preg64_dword(RAX); mov_xreg64_m64rel(RAX, (unsigned long long *)(®_cop1_simple[dst->f.cf.fd])); fistp_preg64_dword(RAX); fldcw_m16rel((unsigned short*)&rounding_mode); #else fldcw_m16((unsigned short*)&floor_mode); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fs])); fld_preg32_dword(EAX); mov_eax_memoffs32((unsigned int *)(®_cop1_simple[dst->f.cf.fd])); fistp_preg32_dword(EAX); fldcw_m16((unsigned short*)&rounding_mode); #endif #endif }