MIPS64 R2/R6: Fix FP to integer conversions.

Thanks to Peter Cawley. #1146
This commit is contained in:
Mike Pall 2024-01-22 19:12:13 +01:00
parent 4b90f6c4d7
commit 2f35cb45fd

View File

@ -656,8 +656,8 @@ static void asm_conv(ASMState *as, IRIns *ir)
emit_branch(as, MIPSI_BC1T, 0, 0, l_end); emit_branch(as, MIPSI_BC1T, 0, 0, l_end);
emit_fgh(as, MIPSI_C_OLT_D, 0, left, tmp); emit_fgh(as, MIPSI_C_OLT_D, 0, left, tmp);
#else #else
emit_branch(as, MIPSI_BC1NEZ, 0, (left&31), l_end); emit_branch(as, MIPSI_BC1NEZ, 0, (tmp&31), l_end);
emit_fgh(as, MIPSI_CMP_LT_D, left, left, tmp); emit_fgh(as, MIPSI_CMP_LT_D, tmp, left, tmp);
#endif #endif
emit_lsptr(as, MIPSI_LDC1, (tmp & 31), emit_lsptr(as, MIPSI_LDC1, (tmp & 31),
(void *)&as->J->k64[LJ_K64_2P63], (void *)&as->J->k64[LJ_K64_2P63],
@ -673,8 +673,8 @@ static void asm_conv(ASMState *as, IRIns *ir)
emit_branch(as, MIPSI_BC1T, 0, 0, l_end); emit_branch(as, MIPSI_BC1T, 0, 0, l_end);
emit_fgh(as, MIPSI_C_OLT_S, 0, left, tmp); emit_fgh(as, MIPSI_C_OLT_S, 0, left, tmp);
#else #else
emit_branch(as, MIPSI_BC1NEZ, 0, (left&31), l_end); emit_branch(as, MIPSI_BC1NEZ, 0, (tmp&31), l_end);
emit_fgh(as, MIPSI_CMP_LT_S, left, left, tmp); emit_fgh(as, MIPSI_CMP_LT_S, tmp, left, tmp);
#endif #endif
emit_lsptr(as, MIPSI_LWC1, (tmp & 31), emit_lsptr(as, MIPSI_LWC1, (tmp & 31),
(void *)&as->J->k32[LJ_K32_2P63], (void *)&as->J->k32[LJ_K32_2P63],
@ -690,8 +690,8 @@ static void asm_conv(ASMState *as, IRIns *ir)
MIPSIns mi = irt_is64(ir->t) ? MIPSIns mi = irt_is64(ir->t) ?
(st == IRT_NUM ? MIPSI_TRUNC_L_D : MIPSI_TRUNC_L_S) : (st == IRT_NUM ? MIPSI_TRUNC_L_D : MIPSI_TRUNC_L_S) :
(st == IRT_NUM ? MIPSI_TRUNC_W_D : MIPSI_TRUNC_W_S); (st == IRT_NUM ? MIPSI_TRUNC_W_D : MIPSI_TRUNC_W_S);
emit_tg(as, irt_is64(ir->t) ? MIPSI_DMFC1 : MIPSI_MFC1, dest, left); emit_tg(as, irt_is64(ir->t) ? MIPSI_DMFC1 : MIPSI_MFC1, dest, tmp);
emit_fg(as, mi, left, left); emit_fg(as, mi, tmp, left);
#endif #endif
} }
} }