target/loongarch: bstrins.w src register need EXT_NONE

use gen_bstrins/gen_bstrpic to replace gen_rr_ms_ls.

Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220930024510.800005-2-gaosong@loongson.cn>
This commit is contained in:
Song Gao 2022-09-30 10:45:08 +08:00
parent 5c2439a92c
commit 68e35a2b75
No known key found for this signature in database
GPG Key ID: 40A2FFF239263EDF

View File

@ -27,26 +27,34 @@ static void gen_bytepick_d(TCGv dest, TCGv src1, TCGv src2, target_long sa)
tcg_gen_extract2_i64(dest, src1, src2, (64 - sa * 8)); tcg_gen_extract2_i64(dest, src1, src2, (64 - sa * 8));
} }
static void gen_bstrins(TCGv dest, TCGv src1, static bool gen_bstrins(DisasContext *ctx, arg_rr_ms_ls *a,
unsigned int ls, unsigned int len) DisasExtend dst_ext)
{ {
tcg_gen_deposit_tl(dest, dest, src1, ls, len); TCGv src1 = gpr_src(ctx, a->rd, EXT_NONE);
} TCGv src2 = gpr_src(ctx, a->rj, EXT_NONE);
TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
static bool gen_rr_ms_ls(DisasContext *ctx, arg_rr_ms_ls *a,
DisasExtend src_ext, DisasExtend dst_ext,
void (*func)(TCGv, TCGv, unsigned int, unsigned int))
{
TCGv dest = gpr_dst(ctx, a->rd, dst_ext);
TCGv src1 = gpr_src(ctx, a->rj, src_ext);
if (a->ls > a->ms) { if (a->ls > a->ms) {
return false; return false;
} }
func(dest, src1, a->ls, a->ms - a->ls + 1); tcg_gen_deposit_tl(dest, src1, src2, a->ls, a->ms - a->ls + 1);
gen_set_gpr(a->rd, dest, dst_ext); gen_set_gpr(a->rd, dest, dst_ext);
return true;
}
static bool gen_bstrpick(DisasContext *ctx, arg_rr_ms_ls *a,
DisasExtend dst_ext)
{
TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
if (a->ls > a->ms) {
return false;
}
tcg_gen_extract_tl(dest, src1, a->ls, a->ms - a->ls + 1);
gen_set_gpr(a->rd, dest, dst_ext);
return true; return true;
} }
@ -206,7 +214,7 @@ TRANS(maskeqz, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_maskeqz)
TRANS(masknez, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_masknez) TRANS(masknez, gen_rrr, EXT_NONE, EXT_NONE, EXT_NONE, gen_masknez)
TRANS(bytepick_w, gen_rrr_sa, EXT_NONE, EXT_NONE, gen_bytepick_w) TRANS(bytepick_w, gen_rrr_sa, EXT_NONE, EXT_NONE, gen_bytepick_w)
TRANS(bytepick_d, gen_rrr_sa, EXT_NONE, EXT_NONE, gen_bytepick_d) TRANS(bytepick_d, gen_rrr_sa, EXT_NONE, EXT_NONE, gen_bytepick_d)
TRANS(bstrins_w, gen_rr_ms_ls, EXT_NONE, EXT_NONE, gen_bstrins) TRANS(bstrins_w, gen_bstrins, EXT_SIGN)
TRANS(bstrins_d, gen_rr_ms_ls, EXT_NONE, EXT_NONE, gen_bstrins) TRANS(bstrins_d, gen_bstrins, EXT_NONE)
TRANS(bstrpick_w, gen_rr_ms_ls, EXT_NONE, EXT_SIGN, tcg_gen_extract_tl) TRANS(bstrpick_w, gen_bstrpick, EXT_SIGN)
TRANS(bstrpick_d, gen_rr_ms_ls, EXT_NONE, EXT_NONE, tcg_gen_extract_tl) TRANS(bstrpick_d, gen_bstrpick, EXT_NONE)