[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 109/114] target/arm: Use TRANS_FEAT for do_shll_tb
From: |
Richard Henderson |
Subject: |
[PATCH 109/114] target/arm: Use TRANS_FEAT for do_shll_tb |
Date: |
Fri, 27 May 2022 11:19:02 -0700 |
Rename from do_sve2_shll_tb and hoist the sve2
check into the TRANS_FEAT macro.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/translate-sve.c | 102 ++++++++++++++++---------------------
1 file changed, 45 insertions(+), 57 deletions(-)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 8e7f8308c7..0fb118f6ef 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -6194,46 +6194,11 @@ static void gen_ushll_vec(unsigned vece, TCGv_vec d,
TCGv_vec n, int64_t imm)
}
}
-static bool do_sve2_shll_tb(DisasContext *s, arg_rri_esz *a,
- bool sel, bool uns)
+static bool do_shll_tb(DisasContext *s, arg_rri_esz *a,
+ const GVecGen2i ops[3], bool sel)
{
- static const TCGOpcode sshll_list[] = {
- INDEX_op_shli_vec, INDEX_op_sari_vec, 0
- };
- static const TCGOpcode ushll_list[] = {
- INDEX_op_shli_vec, INDEX_op_shri_vec, 0
- };
- static const GVecGen2i ops[2][3] = {
- { { .fniv = gen_sshll_vec,
- .opt_opc = sshll_list,
- .fno = gen_helper_sve2_sshll_h,
- .vece = MO_16 },
- { .fniv = gen_sshll_vec,
- .opt_opc = sshll_list,
- .fno = gen_helper_sve2_sshll_s,
- .vece = MO_32 },
- { .fniv = gen_sshll_vec,
- .opt_opc = sshll_list,
- .fno = gen_helper_sve2_sshll_d,
- .vece = MO_64 } },
- { { .fni8 = gen_ushll16_i64,
- .fniv = gen_ushll_vec,
- .opt_opc = ushll_list,
- .fno = gen_helper_sve2_ushll_h,
- .vece = MO_16 },
- { .fni8 = gen_ushll32_i64,
- .fniv = gen_ushll_vec,
- .opt_opc = ushll_list,
- .fno = gen_helper_sve2_ushll_s,
- .vece = MO_32 },
- { .fni8 = gen_ushll64_i64,
- .fniv = gen_ushll_vec,
- .opt_opc = ushll_list,
- .fno = gen_helper_sve2_ushll_d,
- .vece = MO_64 } },
- };
- if (a->esz < 0 || a->esz > 2 || !dc_isar_feature(aa64_sve2, s)) {
+ if (a->esz < 0 || a->esz > 2) {
return false;
}
if (sve_access_check(s)) {
@@ -6241,30 +6206,53 @@ static bool do_sve2_shll_tb(DisasContext *s,
arg_rri_esz *a,
tcg_gen_gvec_2i(vec_full_reg_offset(s, a->rd),
vec_full_reg_offset(s, a->rn),
vsz, vsz, (a->imm << 1) | sel,
- &ops[uns][a->esz]);
+ &ops[a->esz]);
}
return true;
}
-static bool trans_SSHLLB(DisasContext *s, arg_rri_esz *a)
-{
- return do_sve2_shll_tb(s, a, false, false);
-}
+static const TCGOpcode sshll_list[] = {
+ INDEX_op_shli_vec, INDEX_op_sari_vec, 0
+};
+static const GVecGen2i sshll_ops[3] = {
+ { .fniv = gen_sshll_vec,
+ .opt_opc = sshll_list,
+ .fno = gen_helper_sve2_sshll_h,
+ .vece = MO_16 },
+ { .fniv = gen_sshll_vec,
+ .opt_opc = sshll_list,
+ .fno = gen_helper_sve2_sshll_s,
+ .vece = MO_32 },
+ { .fniv = gen_sshll_vec,
+ .opt_opc = sshll_list,
+ .fno = gen_helper_sve2_sshll_d,
+ .vece = MO_64 }
+};
+TRANS_FEAT(SSHLLB, aa64_sve2, do_shll_tb, a, sshll_ops, false)
+TRANS_FEAT(SSHLLT, aa64_sve2, do_shll_tb, a, sshll_ops, true)
-static bool trans_SSHLLT(DisasContext *s, arg_rri_esz *a)
-{
- return do_sve2_shll_tb(s, a, true, false);
-}
-
-static bool trans_USHLLB(DisasContext *s, arg_rri_esz *a)
-{
- return do_sve2_shll_tb(s, a, false, true);
-}
-
-static bool trans_USHLLT(DisasContext *s, arg_rri_esz *a)
-{
- return do_sve2_shll_tb(s, a, true, true);
-}
+static const TCGOpcode ushll_list[] = {
+ INDEX_op_shli_vec, INDEX_op_shri_vec, 0
+};
+static const GVecGen2i ushll_ops[3] = {
+ { .fni8 = gen_ushll16_i64,
+ .fniv = gen_ushll_vec,
+ .opt_opc = ushll_list,
+ .fno = gen_helper_sve2_ushll_h,
+ .vece = MO_16 },
+ { .fni8 = gen_ushll32_i64,
+ .fniv = gen_ushll_vec,
+ .opt_opc = ushll_list,
+ .fno = gen_helper_sve2_ushll_s,
+ .vece = MO_32 },
+ { .fni8 = gen_ushll64_i64,
+ .fniv = gen_ushll_vec,
+ .opt_opc = ushll_list,
+ .fno = gen_helper_sve2_ushll_d,
+ .vece = MO_64 },
+};
+TRANS_FEAT(USHLLB, aa64_sve2, do_shll_tb, a, ushll_ops, false)
+TRANS_FEAT(USHLLT, aa64_sve2, do_shll_tb, a, ushll_ops, true)
static gen_helper_gvec_3 * const bext_fns[4] = {
gen_helper_sve2_bext_b, gen_helper_sve2_bext_h,
--
2.34.1
- [PATCH 101/114] target/arm: Introduce gen_gvec_fpst_zzzzp, (continued)
- [PATCH 101/114] target/arm: Introduce gen_gvec_fpst_zzzzp, Richard Henderson, 2022/05/27
- [PATCH 102/114] target/arm: Use TRANS_FEAT for gen_gvec_fpst_zzzzp, Richard Henderson, 2022/05/27
- [PATCH 096/114] target/arm: Use TRANS_FEAT for FLOGB, Richard Henderson, 2022/05/27
- [PATCH 108/114] target/arm: Use TRANS_FEAT for do_narrow_extract, Richard Henderson, 2022/05/27
- [PATCH 104/114] target/arm: Use TRANS_FEAT for DO_FP_IMM, Richard Henderson, 2022/05/27
- [PATCH 106/114] target/arm: Remove assert in trans_FCMLA_zzxz, Richard Henderson, 2022/05/27
- [PATCH 103/114] target/arm: Move null function and sve check into do_fp_imm, Richard Henderson, 2022/05/27
- [PATCH 110/114] target/arm: Use TRANS_FEAT for do_shr_narrow, Richard Henderson, 2022/05/27
- [PATCH 111/114] target/arm: Use TRANS_FEAT for do_FMLAL_zzzw, Richard Henderson, 2022/05/27
- [PATCH 105/114] target/arm: Use TRANS_FEAT for DO_FPCMP, Richard Henderson, 2022/05/27
- [PATCH 109/114] target/arm: Use TRANS_FEAT for do_shll_tb,
Richard Henderson <=
- [PATCH 112/114] target/arm: Use TRANS_FEAT for do_FMLAL_zzxw, Richard Henderson, 2022/05/27
- [PATCH 099/114] target/arm: Use TRANS_FEAT for gen_gvec_fpst_arg_zpzz, Richard Henderson, 2022/05/27
- [PATCH 113/114] target/arm: Add sve feature check for remaining trans_* functions, Richard Henderson, 2022/05/27
- [PATCH 114/114] target/arm: Remove aa64_sve check from before disas_sve, Richard Henderson, 2022/05/27
- [PATCH 107/114] target/arm: Use TRANS_FEAT for FCMLA_zzxz, Richard Henderson, 2022/05/27
- Re: [PATCH 000/114] target/arm: Rewrite sve feature tests, Peter Maydell, 2022/05/30