Skip to content

Commit

Permalink
target/hppa: Fix bb_sar for hppa64
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Nov 7, 2023
1 parent bdcccc1 commit 1e9ab9f
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions target/hppa/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3073,27 +3073,37 @@ static bool trans_bb_sar(DisasContext *ctx, arg_bb_sar *a)
{
TCGv_reg tmp, tcg_r;
DisasCond cond;
bool d = false;

nullify_over(ctx);

tmp = tcg_temp_new();
tcg_r = load_gpr(ctx, a->r);
tcg_gen_shl_reg(tmp, tcg_r, cpu_sar);
if (cond_need_ext(ctx, d)) {
/* Force shift into [32,63] */
tcg_gen_ori_reg(tmp, cpu_sar, 32);
tcg_gen_shl_reg(tmp, tcg_r, tmp);
} else {
tcg_gen_shl_reg(tmp, tcg_r, cpu_sar);
}

cond = cond_make_0(a->c ? TCG_COND_GE : TCG_COND_LT, tmp);
cond = cond_make_0_tmp(a->c ? TCG_COND_GE : TCG_COND_LT, tmp);
return do_cbranch(ctx, a->disp, a->n, &cond);
}

static bool trans_bb_imm(DisasContext *ctx, arg_bb_imm *a)
{
TCGv_reg tmp, tcg_r;
DisasCond cond;
bool d = false;
int p;

nullify_over(ctx);

tmp = tcg_temp_new();
tcg_r = load_gpr(ctx, a->r);
tcg_gen_shli_reg(tmp, tcg_r, a->p);
p = a->p | (cond_need_ext(ctx, d) ? 32 : 0);
tcg_gen_shli_reg(tmp, tcg_r, p);

cond = cond_make_0(a->c ? TCG_COND_GE : TCG_COND_LT, tmp);
return do_cbranch(ctx, a->disp, a->n, &cond);
Expand Down

0 comments on commit 1e9ab9f

Please sign in to comment.