mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-03-12 00:45:28 +00:00
Fix fast jit issue of translating opcode i32.rem_s/i64.rem_s (#1731)
This commit is contained in:
parent
cf7b01ad82
commit
89f9d695ed
|
@ -770,16 +770,21 @@ compile_int_div(JitCompContext *cc, IntArithmetic arith_op, bool is_i32,
|
||||||
}
|
}
|
||||||
case INT_REM_S:
|
case INT_REM_S:
|
||||||
{
|
{
|
||||||
|
JitReg left1 =
|
||||||
|
is_i32 ? jit_cc_new_reg_I32(cc) : jit_cc_new_reg_I64(cc);
|
||||||
|
|
||||||
GEN_INSN(CMP, cc->cmp_reg, right,
|
GEN_INSN(CMP, cc->cmp_reg, right,
|
||||||
is_i32 ? NEW_CONST(I32, -1) : NEW_CONST(I64, -1LL));
|
is_i32 ? NEW_CONST(I32, -1) : NEW_CONST(I64, -1LL));
|
||||||
|
/* Don't generate `SELECTEQ left, cmp_reg, 0, left` since
|
||||||
|
left might be const, use left1 instead */
|
||||||
if (is_i32)
|
if (is_i32)
|
||||||
GEN_INSN(SELECTEQ, left, cc->cmp_reg, NEW_CONST(I32, 0),
|
GEN_INSN(SELECTEQ, left1, cc->cmp_reg, NEW_CONST(I32, 0),
|
||||||
left);
|
left);
|
||||||
else
|
else
|
||||||
GEN_INSN(SELECTEQ, left, cc->cmp_reg, NEW_CONST(I64, 0),
|
GEN_INSN(SELECTEQ, left1, cc->cmp_reg, NEW_CONST(I64, 0),
|
||||||
left);
|
left);
|
||||||
/* Build default div and rem */
|
/* Build default div and rem */
|
||||||
return compile_int_div_no_check(cc, arith_op, is_i32, left,
|
return compile_int_div_no_check(cc, arith_op, is_i32, left1,
|
||||||
right, res);
|
right, res);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user