Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in extrh_i64_i32 operation #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions tcg/tcg-op.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,28 @@ void tcg_gen_discard_i32(TCGv_i32 arg)
tcg_gen_op1_i32(INDEX_op_discard, arg);
}

void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg)
static void tcg_gen_mov_i32_internal(TCGv_i32 ret, TCGv_i32 arg, bool concrete)
{
if (ret != arg) {
tcg_gen_op2_i64(INDEX_op_mov_i64, tcgv_i32_expr_num(ret),
tcgv_i32_expr_num(arg));
if (!concrete) {
tcg_gen_op2_i64(INDEX_op_mov_i64, tcgv_i32_expr_num(ret),
tcgv_i32_expr_num(arg));
}

tcg_gen_op2_i32(INDEX_op_mov_i32, ret, arg);
}
}

void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg)
{
tcg_gen_mov_i32_internal(ret, arg, false);
}

void tcg_gen_mov_i32_concrete(TCGv_i32 ret, TCGv_i32 arg)
{
tcg_gen_mov_i32_internal(ret, arg, true);
}

void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg)
{
/* TODO : Make movi rely on the inline mov_i32 */
Expand Down Expand Up @@ -3504,8 +3517,7 @@ void tcg_gen_extrl_i64_i32(TCGv_i32 ret, TCGv_i64 arg)
} else {*/
gen_helper_sym_trunc_i64_i32(tcgv_i32_expr(ret), tcgv_i64_expr(arg));
/* We don't want symbolic handling of this mov. */
if (ret != (TCGv_i32)arg)
tcg_gen_op2_i32(INDEX_op_mov_i32, ret, (TCGv_i32)arg);
tcg_gen_mov_i32_concrete(ret, (TCGv_i32)arg);
/* } */
}

Expand All @@ -3521,7 +3533,7 @@ void tcg_gen_extrh_i64_i32(TCGv_i32 ret, TCGv_i64 arg)
tcg_gen_shri_i64(t, arg, 32);
gen_helper_sym_trunc_i64_i32(tcgv_i32_expr(ret), tcgv_i64_expr(t));
/* We don't want symbolic handling of this mov. */
tcg_gen_op2_i32(INDEX_op_mov_i32, ret, (TCGv_i32)t);
tcg_gen_mov_i32_concrete(ret, (TCGv_i32)t);
tcg_temp_free_i64(t);
/*}*/
}
Expand Down