mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
target/riscv: Add DisasExtend to gen_arith*
Most arithmetic does not require extending the inputs. Exceptions include division, comparison and minmax. Begin using ctx->w, which allows elimination of gen_addw, gen_subw, gen_mulw. Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20210823195529.560295-7-richard.henderson@linaro.org Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
ecda15d137
commit
191d1dafae
4 changed files with 64 additions and 90 deletions
|
@ -38,61 +38,61 @@ static bool trans_cpop(DisasContext *ctx, arg_cpop *a)
|
|||
static bool trans_andn(DisasContext *ctx, arg_andn *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_andc_tl);
|
||||
return gen_arith(ctx, a, EXT_NONE, tcg_gen_andc_tl);
|
||||
}
|
||||
|
||||
static bool trans_orn(DisasContext *ctx, arg_orn *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_orc_tl);
|
||||
return gen_arith(ctx, a, EXT_NONE, tcg_gen_orc_tl);
|
||||
}
|
||||
|
||||
static bool trans_xnor(DisasContext *ctx, arg_xnor *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_eqv_tl);
|
||||
return gen_arith(ctx, a, EXT_NONE, tcg_gen_eqv_tl);
|
||||
}
|
||||
|
||||
static bool trans_pack(DisasContext *ctx, arg_pack *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, gen_pack);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_pack);
|
||||
}
|
||||
|
||||
static bool trans_packu(DisasContext *ctx, arg_packu *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, gen_packu);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_packu);
|
||||
}
|
||||
|
||||
static bool trans_packh(DisasContext *ctx, arg_packh *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, gen_packh);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_packh);
|
||||
}
|
||||
|
||||
static bool trans_min(DisasContext *ctx, arg_min *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_smin_tl);
|
||||
return gen_arith(ctx, a, EXT_SIGN, tcg_gen_smin_tl);
|
||||
}
|
||||
|
||||
static bool trans_max(DisasContext *ctx, arg_max *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_smax_tl);
|
||||
return gen_arith(ctx, a, EXT_SIGN, tcg_gen_smax_tl);
|
||||
}
|
||||
|
||||
static bool trans_minu(DisasContext *ctx, arg_minu *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_umin_tl);
|
||||
return gen_arith(ctx, a, EXT_SIGN, tcg_gen_umin_tl);
|
||||
}
|
||||
|
||||
static bool trans_maxu(DisasContext *ctx, arg_maxu *a)
|
||||
{
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, tcg_gen_umax_tl);
|
||||
return gen_arith(ctx, a, EXT_SIGN, tcg_gen_umax_tl);
|
||||
}
|
||||
|
||||
static bool trans_sext_b(DisasContext *ctx, arg_sext_b *a)
|
||||
|
@ -230,7 +230,7 @@ static bool trans_gorci(DisasContext *ctx, arg_gorci *a)
|
|||
static bool trans_sh##SHAMT##add(DisasContext *ctx, arg_sh##SHAMT##add *a) \
|
||||
{ \
|
||||
REQUIRE_EXT(ctx, RVB); \
|
||||
return gen_arith(ctx, a, gen_sh##SHAMT##add); \
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_sh##SHAMT##add); \
|
||||
}
|
||||
|
||||
GEN_TRANS_SHADD(1)
|
||||
|
@ -262,14 +262,14 @@ static bool trans_packw(DisasContext *ctx, arg_packw *a)
|
|||
{
|
||||
REQUIRE_64BIT(ctx);
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, gen_packw);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_packw);
|
||||
}
|
||||
|
||||
static bool trans_packuw(DisasContext *ctx, arg_packuw *a)
|
||||
{
|
||||
REQUIRE_64BIT(ctx);
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, gen_packuw);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_packuw);
|
||||
}
|
||||
|
||||
static bool trans_bsetw(DisasContext *ctx, arg_bsetw *a)
|
||||
|
@ -404,7 +404,7 @@ static bool trans_sh##SHAMT##add_uw(DisasContext *ctx, \
|
|||
{ \
|
||||
REQUIRE_64BIT(ctx); \
|
||||
REQUIRE_EXT(ctx, RVB); \
|
||||
return gen_arith(ctx, a, gen_sh##SHAMT##add_uw); \
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_sh##SHAMT##add_uw); \
|
||||
}
|
||||
|
||||
GEN_TRANS_SHADD_UW(1)
|
||||
|
@ -415,7 +415,7 @@ static bool trans_add_uw(DisasContext *ctx, arg_add_uw *a)
|
|||
{
|
||||
REQUIRE_64BIT(ctx);
|
||||
REQUIRE_EXT(ctx, RVB);
|
||||
return gen_arith(ctx, a, gen_add_uw);
|
||||
return gen_arith(ctx, a, EXT_NONE, gen_add_uw);
|
||||
}
|
||||
|
||||
static bool trans_slli_uw(DisasContext *ctx, arg_slli_uw *a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue