mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
MIPS: Fix emitted code for U32 to float conversion.
This commit is contained in:
parent
1abd779907
commit
ee33a1f9b3
@ -443,15 +443,11 @@ static void asm_conv(ASMState *as, IRIns *ir)
|
|||||||
/* y = (x ^ 0x8000000) + 2147483648.0 */
|
/* y = (x ^ 0x8000000) + 2147483648.0 */
|
||||||
Reg left = ra_alloc1(as, lref, RSET_GPR);
|
Reg left = ra_alloc1(as, lref, RSET_GPR);
|
||||||
Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, dest));
|
Reg tmp = ra_scratch(as, rset_exclude(RSET_FPR, dest));
|
||||||
emit_fgh(as, irt_isfloat(ir->t) ? MIPSI_ADD_S : MIPSI_ADD_D,
|
|
||||||
dest, dest, tmp);
|
|
||||||
emit_fg(as, irt_isfloat(ir->t) ? MIPSI_CVT_S_W : MIPSI_CVT_D_W,
|
|
||||||
dest, dest);
|
|
||||||
if (irt_isfloat(ir->t))
|
if (irt_isfloat(ir->t))
|
||||||
emit_lsptr(as, MIPSI_LWC1, (tmp & 31),
|
emit_fg(as, MIPSI_CVT_S_D, dest, dest);
|
||||||
(void *)lj_ir_k64_find(as->J, U64x(4f000000,4f000000)),
|
/* Must perform arithmetic with doubles to keep the precision. */
|
||||||
RSET_GPR);
|
emit_fgh(as, MIPSI_ADD_D, dest, dest, tmp);
|
||||||
else
|
emit_fg(as, MIPSI_CVT_D_W, dest, dest);
|
||||||
emit_lsptr(as, MIPSI_LDC1, (tmp & 31),
|
emit_lsptr(as, MIPSI_LDC1, (tmp & 31),
|
||||||
(void *)lj_ir_k64_find(as->J, U64x(41e00000,00000000)),
|
(void *)lj_ir_k64_find(as->J, U64x(41e00000,00000000)),
|
||||||
RSET_GPR);
|
RSET_GPR);
|
||||||
|
Loading…
Reference in New Issue
Block a user