target/arm: Use TRANS_FEAT for do_narrow_extract

Rename from do_sve2_narrow_extract and hoist the sve2
check into the TRANS_FEAT macro.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220527181907.189259-109-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Richard Henderson 2022-05-27 11:19:01 -07:00 committed by Peter Maydell
parent e600d64980
commit 6100d08493

View File

@ -6345,11 +6345,10 @@ TRANS_FEAT(SLI, aa64_sve2, gen_gvec_fn_arg_zzi, gen_gvec_sli, a)
TRANS_FEAT(SABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_saba, a) TRANS_FEAT(SABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_saba, a)
TRANS_FEAT(UABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_uaba, a) TRANS_FEAT(UABA, aa64_sve2, gen_gvec_fn_arg_zzz, gen_gvec_uaba, a)
static bool do_sve2_narrow_extract(DisasContext *s, arg_rri_esz *a, static bool do_narrow_extract(DisasContext *s, arg_rri_esz *a,
const GVecGen2 ops[3]) const GVecGen2 ops[3])
{ {
if (a->esz < 0 || a->esz > MO_32 || a->imm != 0 || if (a->esz < 0 || a->esz > MO_32 || a->imm != 0) {
!dc_isar_feature(aa64_sve2, s)) {
return false; return false;
} }
if (sve_access_check(s)) { if (sve_access_check(s)) {
@ -6382,24 +6381,21 @@ static void gen_sqxtnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
tcg_temp_free_vec(t); tcg_temp_free_vec(t);
} }
static bool trans_SQXTNB(DisasContext *s, arg_rri_esz *a) static const GVecGen2 sqxtnb_ops[3] = {
{ { .fniv = gen_sqxtnb_vec,
static const GVecGen2 ops[3] = { .opt_opc = sqxtn_list,
{ .fniv = gen_sqxtnb_vec, .fno = gen_helper_sve2_sqxtnb_h,
.opt_opc = sqxtn_list, .vece = MO_16 },
.fno = gen_helper_sve2_sqxtnb_h, { .fniv = gen_sqxtnb_vec,
.vece = MO_16 }, .opt_opc = sqxtn_list,
{ .fniv = gen_sqxtnb_vec, .fno = gen_helper_sve2_sqxtnb_s,
.opt_opc = sqxtn_list, .vece = MO_32 },
.fno = gen_helper_sve2_sqxtnb_s, { .fniv = gen_sqxtnb_vec,
.vece = MO_32 }, .opt_opc = sqxtn_list,
{ .fniv = gen_sqxtnb_vec, .fno = gen_helper_sve2_sqxtnb_d,
.opt_opc = sqxtn_list, .vece = MO_64 },
.fno = gen_helper_sve2_sqxtnb_d, };
.vece = MO_64 }, TRANS_FEAT(SQXTNB, aa64_sve2, do_narrow_extract, a, sqxtnb_ops)
};
return do_sve2_narrow_extract(s, a, ops);
}
static void gen_sqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n) static void gen_sqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
{ {
@ -6419,27 +6415,24 @@ static void gen_sqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
tcg_temp_free_vec(t); tcg_temp_free_vec(t);
} }
static bool trans_SQXTNT(DisasContext *s, arg_rri_esz *a) static const GVecGen2 sqxtnt_ops[3] = {
{ { .fniv = gen_sqxtnt_vec,
static const GVecGen2 ops[3] = { .opt_opc = sqxtn_list,
{ .fniv = gen_sqxtnt_vec, .load_dest = true,
.opt_opc = sqxtn_list, .fno = gen_helper_sve2_sqxtnt_h,
.load_dest = true, .vece = MO_16 },
.fno = gen_helper_sve2_sqxtnt_h, { .fniv = gen_sqxtnt_vec,
.vece = MO_16 }, .opt_opc = sqxtn_list,
{ .fniv = gen_sqxtnt_vec, .load_dest = true,
.opt_opc = sqxtn_list, .fno = gen_helper_sve2_sqxtnt_s,
.load_dest = true, .vece = MO_32 },
.fno = gen_helper_sve2_sqxtnt_s, { .fniv = gen_sqxtnt_vec,
.vece = MO_32 }, .opt_opc = sqxtn_list,
{ .fniv = gen_sqxtnt_vec, .load_dest = true,
.opt_opc = sqxtn_list, .fno = gen_helper_sve2_sqxtnt_d,
.load_dest = true, .vece = MO_64 },
.fno = gen_helper_sve2_sqxtnt_d, };
.vece = MO_64 }, TRANS_FEAT(SQXTNT, aa64_sve2, do_narrow_extract, a, sqxtnt_ops)
};
return do_sve2_narrow_extract(s, a, ops);
}
static const TCGOpcode uqxtn_list[] = { static const TCGOpcode uqxtn_list[] = {
INDEX_op_shli_vec, INDEX_op_umin_vec, 0 INDEX_op_shli_vec, INDEX_op_umin_vec, 0
@ -6456,24 +6449,21 @@ static void gen_uqxtnb_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
tcg_temp_free_vec(t); tcg_temp_free_vec(t);
} }
static bool trans_UQXTNB(DisasContext *s, arg_rri_esz *a) static const GVecGen2 uqxtnb_ops[3] = {
{ { .fniv = gen_uqxtnb_vec,
static const GVecGen2 ops[3] = { .opt_opc = uqxtn_list,
{ .fniv = gen_uqxtnb_vec, .fno = gen_helper_sve2_uqxtnb_h,
.opt_opc = uqxtn_list, .vece = MO_16 },
.fno = gen_helper_sve2_uqxtnb_h, { .fniv = gen_uqxtnb_vec,
.vece = MO_16 }, .opt_opc = uqxtn_list,
{ .fniv = gen_uqxtnb_vec, .fno = gen_helper_sve2_uqxtnb_s,
.opt_opc = uqxtn_list, .vece = MO_32 },
.fno = gen_helper_sve2_uqxtnb_s, { .fniv = gen_uqxtnb_vec,
.vece = MO_32 }, .opt_opc = uqxtn_list,
{ .fniv = gen_uqxtnb_vec, .fno = gen_helper_sve2_uqxtnb_d,
.opt_opc = uqxtn_list, .vece = MO_64 },
.fno = gen_helper_sve2_uqxtnb_d, };
.vece = MO_64 }, TRANS_FEAT(UQXTNB, aa64_sve2, do_narrow_extract, a, uqxtnb_ops)
};
return do_sve2_narrow_extract(s, a, ops);
}
static void gen_uqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n) static void gen_uqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
{ {
@ -6488,27 +6478,24 @@ static void gen_uqxtnt_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
tcg_temp_free_vec(t); tcg_temp_free_vec(t);
} }
static bool trans_UQXTNT(DisasContext *s, arg_rri_esz *a) static const GVecGen2 uqxtnt_ops[3] = {
{ { .fniv = gen_uqxtnt_vec,
static const GVecGen2 ops[3] = { .opt_opc = uqxtn_list,
{ .fniv = gen_uqxtnt_vec, .load_dest = true,
.opt_opc = uqxtn_list, .fno = gen_helper_sve2_uqxtnt_h,
.load_dest = true, .vece = MO_16 },
.fno = gen_helper_sve2_uqxtnt_h, { .fniv = gen_uqxtnt_vec,
.vece = MO_16 }, .opt_opc = uqxtn_list,
{ .fniv = gen_uqxtnt_vec, .load_dest = true,
.opt_opc = uqxtn_list, .fno = gen_helper_sve2_uqxtnt_s,
.load_dest = true, .vece = MO_32 },
.fno = gen_helper_sve2_uqxtnt_s, { .fniv = gen_uqxtnt_vec,
.vece = MO_32 }, .opt_opc = uqxtn_list,
{ .fniv = gen_uqxtnt_vec, .load_dest = true,
.opt_opc = uqxtn_list, .fno = gen_helper_sve2_uqxtnt_d,
.load_dest = true, .vece = MO_64 },
.fno = gen_helper_sve2_uqxtnt_d, };
.vece = MO_64 }, TRANS_FEAT(UQXTNT, aa64_sve2, do_narrow_extract, a, uqxtnt_ops)
};
return do_sve2_narrow_extract(s, a, ops);
}
static const TCGOpcode sqxtun_list[] = { static const TCGOpcode sqxtun_list[] = {
INDEX_op_shli_vec, INDEX_op_umin_vec, INDEX_op_smax_vec, 0 INDEX_op_shli_vec, INDEX_op_umin_vec, INDEX_op_smax_vec, 0
@ -6527,24 +6514,21 @@ static void gen_sqxtunb_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
tcg_temp_free_vec(t); tcg_temp_free_vec(t);
} }
static bool trans_SQXTUNB(DisasContext *s, arg_rri_esz *a) static const GVecGen2 sqxtunb_ops[3] = {
{ { .fniv = gen_sqxtunb_vec,
static const GVecGen2 ops[3] = { .opt_opc = sqxtun_list,
{ .fniv = gen_sqxtunb_vec, .fno = gen_helper_sve2_sqxtunb_h,
.opt_opc = sqxtun_list, .vece = MO_16 },
.fno = gen_helper_sve2_sqxtunb_h, { .fniv = gen_sqxtunb_vec,
.vece = MO_16 }, .opt_opc = sqxtun_list,
{ .fniv = gen_sqxtunb_vec, .fno = gen_helper_sve2_sqxtunb_s,
.opt_opc = sqxtun_list, .vece = MO_32 },
.fno = gen_helper_sve2_sqxtunb_s, { .fniv = gen_sqxtunb_vec,
.vece = MO_32 }, .opt_opc = sqxtun_list,
{ .fniv = gen_sqxtunb_vec, .fno = gen_helper_sve2_sqxtunb_d,
.opt_opc = sqxtun_list, .vece = MO_64 },
.fno = gen_helper_sve2_sqxtunb_d, };
.vece = MO_64 }, TRANS_FEAT(SQXTUNB, aa64_sve2, do_narrow_extract, a, sqxtunb_ops)
};
return do_sve2_narrow_extract(s, a, ops);
}
static void gen_sqxtunt_vec(unsigned vece, TCGv_vec d, TCGv_vec n) static void gen_sqxtunt_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
{ {
@ -6561,27 +6545,24 @@ static void gen_sqxtunt_vec(unsigned vece, TCGv_vec d, TCGv_vec n)
tcg_temp_free_vec(t); tcg_temp_free_vec(t);
} }
static bool trans_SQXTUNT(DisasContext *s, arg_rri_esz *a) static const GVecGen2 sqxtunt_ops[3] = {
{ { .fniv = gen_sqxtunt_vec,
static const GVecGen2 ops[3] = { .opt_opc = sqxtun_list,
{ .fniv = gen_sqxtunt_vec, .load_dest = true,
.opt_opc = sqxtun_list, .fno = gen_helper_sve2_sqxtunt_h,
.load_dest = true, .vece = MO_16 },
.fno = gen_helper_sve2_sqxtunt_h, { .fniv = gen_sqxtunt_vec,
.vece = MO_16 }, .opt_opc = sqxtun_list,
{ .fniv = gen_sqxtunt_vec, .load_dest = true,
.opt_opc = sqxtun_list, .fno = gen_helper_sve2_sqxtunt_s,
.load_dest = true, .vece = MO_32 },
.fno = gen_helper_sve2_sqxtunt_s, { .fniv = gen_sqxtunt_vec,
.vece = MO_32 }, .opt_opc = sqxtun_list,
{ .fniv = gen_sqxtunt_vec, .load_dest = true,
.opt_opc = sqxtun_list, .fno = gen_helper_sve2_sqxtunt_d,
.load_dest = true, .vece = MO_64 },
.fno = gen_helper_sve2_sqxtunt_d, };
.vece = MO_64 }, TRANS_FEAT(SQXTUNT, aa64_sve2, do_narrow_extract, a, sqxtunt_ops)
};
return do_sve2_narrow_extract(s, a, ops);
}
static bool do_sve2_shr_narrow(DisasContext *s, arg_rri_esz *a, static bool do_sve2_shr_narrow(DisasContext *s, arg_rri_esz *a,
const GVecGen2i ops[3]) const GVecGen2i ops[3])