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
1 changed files with 102 additions and 121 deletions

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,9 +6381,7 @@ 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] = {
{
static const GVecGen2 ops[3] = {
{ .fniv = gen_sqxtnb_vec, { .fniv = gen_sqxtnb_vec,
.opt_opc = sqxtn_list, .opt_opc = sqxtn_list,
.fno = gen_helper_sve2_sqxtnb_h, .fno = gen_helper_sve2_sqxtnb_h,
@ -6398,8 +6395,7 @@ static bool trans_SQXTNB(DisasContext *s, arg_rri_esz *a)
.fno = gen_helper_sve2_sqxtnb_d, .fno = gen_helper_sve2_sqxtnb_d,
.vece = MO_64 }, .vece = MO_64 },
}; };
return do_sve2_narrow_extract(s, a, ops); TRANS_FEAT(SQXTNB, aa64_sve2, do_narrow_extract, a, sqxtnb_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,9 +6415,7 @@ 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] = {
{
static const GVecGen2 ops[3] = {
{ .fniv = gen_sqxtnt_vec, { .fniv = gen_sqxtnt_vec,
.opt_opc = sqxtn_list, .opt_opc = sqxtn_list,
.load_dest = true, .load_dest = true,
@ -6438,8 +6432,7 @@ static bool trans_SQXTNT(DisasContext *s, arg_rri_esz *a)
.fno = gen_helper_sve2_sqxtnt_d, .fno = gen_helper_sve2_sqxtnt_d,
.vece = MO_64 }, .vece = MO_64 },
}; };
return do_sve2_narrow_extract(s, a, ops); TRANS_FEAT(SQXTNT, aa64_sve2, do_narrow_extract, a, sqxtnt_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,9 +6449,7 @@ 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] = {
{
static const GVecGen2 ops[3] = {
{ .fniv = gen_uqxtnb_vec, { .fniv = gen_uqxtnb_vec,
.opt_opc = uqxtn_list, .opt_opc = uqxtn_list,
.fno = gen_helper_sve2_uqxtnb_h, .fno = gen_helper_sve2_uqxtnb_h,
@ -6472,8 +6463,7 @@ static bool trans_UQXTNB(DisasContext *s, arg_rri_esz *a)
.fno = gen_helper_sve2_uqxtnb_d, .fno = gen_helper_sve2_uqxtnb_d,
.vece = MO_64 }, .vece = MO_64 },
}; };
return do_sve2_narrow_extract(s, a, ops); TRANS_FEAT(UQXTNB, aa64_sve2, do_narrow_extract, a, uqxtnb_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,9 +6478,7 @@ 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] = {
{
static const GVecGen2 ops[3] = {
{ .fniv = gen_uqxtnt_vec, { .fniv = gen_uqxtnt_vec,
.opt_opc = uqxtn_list, .opt_opc = uqxtn_list,
.load_dest = true, .load_dest = true,
@ -6507,8 +6495,7 @@ static bool trans_UQXTNT(DisasContext *s, arg_rri_esz *a)
.fno = gen_helper_sve2_uqxtnt_d, .fno = gen_helper_sve2_uqxtnt_d,
.vece = MO_64 }, .vece = MO_64 },
}; };
return do_sve2_narrow_extract(s, a, ops); TRANS_FEAT(UQXTNT, aa64_sve2, do_narrow_extract, a, uqxtnt_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,9 +6514,7 @@ 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] = {
{
static const GVecGen2 ops[3] = {
{ .fniv = gen_sqxtunb_vec, { .fniv = gen_sqxtunb_vec,
.opt_opc = sqxtun_list, .opt_opc = sqxtun_list,
.fno = gen_helper_sve2_sqxtunb_h, .fno = gen_helper_sve2_sqxtunb_h,
@ -6543,8 +6528,7 @@ static bool trans_SQXTUNB(DisasContext *s, arg_rri_esz *a)
.fno = gen_helper_sve2_sqxtunb_d, .fno = gen_helper_sve2_sqxtunb_d,
.vece = MO_64 }, .vece = MO_64 },
}; };
return do_sve2_narrow_extract(s, a, ops); TRANS_FEAT(SQXTUNB, aa64_sve2, do_narrow_extract, a, sqxtunb_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,9 +6545,7 @@ 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] = {
{
static const GVecGen2 ops[3] = {
{ .fniv = gen_sqxtunt_vec, { .fniv = gen_sqxtunt_vec,
.opt_opc = sqxtun_list, .opt_opc = sqxtun_list,
.load_dest = true, .load_dest = true,
@ -6580,8 +6562,7 @@ static bool trans_SQXTUNT(DisasContext *s, arg_rri_esz *a)
.fno = gen_helper_sve2_sqxtunt_d, .fno = gen_helper_sve2_sqxtunt_d,
.vece = MO_64 }, .vece = MO_64 },
}; };
return do_sve2_narrow_extract(s, a, ops); TRANS_FEAT(SQXTUNT, aa64_sve2, do_narrow_extract, a, sqxtunt_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])