[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 48/69] target/arm: Introduce clear_vec
From: |
Richard Henderson |
Subject: |
[PATCH v2 48/69] target/arm: Introduce clear_vec |
Date: |
Tue, 10 Dec 2024 10:17:12 -0600 |
In a couple of places, clearing the entire vector before storing one
element is the easiest solution. Wrap that into a helper function.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/translate-a64.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 29d55bcedd..6655468df0 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -628,7 +628,16 @@ static TCGv_i32 read_fp_hreg(DisasContext *s, int reg)
return v;
}
-/* Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
+static void clear_vec(DisasContext *s, int rd)
+{
+ unsigned ofs = fp_reg_offset(s, rd, MO_64);
+ unsigned vsz = vec_full_reg_size(s);
+
+ tcg_gen_gvec_dup_imm(MO_64, ofs, vsz, vsz, 0);
+}
+
+/*
+ * Clear the bits above an N-bit vector, for N = (is_q ? 128 : 64).
* If SVE is not enabled, then there are only 128 bits in the vector.
*/
static void clear_vec_high(DisasContext *s, bool is_q, int rd)
@@ -4851,7 +4860,6 @@ static bool trans_SM3SS1(DisasContext *s, arg_SM3SS1 *a)
TCGv_i32 tcg_op2 = tcg_temp_new_i32();
TCGv_i32 tcg_op3 = tcg_temp_new_i32();
TCGv_i32 tcg_res = tcg_temp_new_i32();
- unsigned vsz, dofs;
read_vec_element_i32(s, tcg_op1, a->rn, 3, MO_32);
read_vec_element_i32(s, tcg_op2, a->rm, 3, MO_32);
@@ -4863,9 +4871,7 @@ static bool trans_SM3SS1(DisasContext *s, arg_SM3SS1 *a)
tcg_gen_rotri_i32(tcg_res, tcg_res, 25);
/* Clear the whole register first, then store bits [127:96]. */
- vsz = vec_full_reg_size(s);
- dofs = vec_full_reg_offset(s, a->rd);
- tcg_gen_gvec_dup_imm(MO_64, dofs, vsz, vsz, 0);
+ clear_vec(s, a->rd);
write_vec_element_i32(s, tcg_res, a->rd, 3, MO_32);
}
return true;
@@ -6307,7 +6313,6 @@ static bool do_scalar_muladd_widening_idx(DisasContext
*s, arg_rrx_e *a,
TCGv_i64 t0 = tcg_temp_new_i64();
TCGv_i64 t1 = tcg_temp_new_i64();
TCGv_i64 t2 = tcg_temp_new_i64();
- unsigned vsz, dofs;
if (acc) {
read_vec_element(s, t0, a->rd, 0, a->esz + 1);
@@ -6317,9 +6322,7 @@ static bool do_scalar_muladd_widening_idx(DisasContext
*s, arg_rrx_e *a,
fn(t0, t1, t2);
/* Clear the whole register first, then store scalar. */
- vsz = vec_full_reg_size(s);
- dofs = vec_full_reg_offset(s, a->rd);
- tcg_gen_gvec_dup_imm(MO_64, dofs, vsz, vsz, 0);
+ clear_vec(s, a->rd);
write_vec_element(s, t0, a->rd, 0, a->esz + 1);
}
return true;
--
2.43.0
- [PATCH v2 39/69] target/arm: Introduce gen_gvec_cnt, gen_gvec_rbit, (continued)
- [PATCH v2 39/69] target/arm: Introduce gen_gvec_cnt, gen_gvec_rbit, Richard Henderson, 2024/12/10
- [PATCH v2 40/69] target/arm: Convert CNT, NOT, RBIT (vector) to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 42/69] target/arm: Introduce gen_gvec_rev{16,32,64}, Richard Henderson, 2024/12/10
- [PATCH v2 41/69] target/arm: Convert CMGT, CMGE, GMLT, GMLE, CMEQ (zero) to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 43/69] target/arm: Convert handle_rev to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 44/69] target/arm: Move helper_neon_addlp_{s8, s16} to neon_helper.c, Richard Henderson, 2024/12/10
- [PATCH v2 45/69] target/arm: Introduce gen_gvec_{s,u}{add,ada}lp, Richard Henderson, 2024/12/10
- [PATCH v2 46/69] target/arm: Convert handle_2misc_pairwise to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 47/69] target/arm: Remove helper_neon_{add,sub}l_u{16,32}, Richard Henderson, 2024/12/10
- [PATCH v2 48/69] target/arm: Introduce clear_vec,
Richard Henderson <=
- [PATCH v2 49/69] target/arm: Convert XTN, SQXTUN, SQXTN, UQXTN to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 50/69] target/arm: Convert FCVTN, BFCVTN to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 51/69] target/arm: Convert FCVTXN to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 52/69] target/arm: Convert SHLL to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 53/69] target/arm: Implement gen_gvec_fabs, gen_gvec_fneg, Richard Henderson, 2024/12/10
- [PATCH v2 55/69] target/arm: Convert FSQRT (vector) to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 57/69] target/arm: Convert FCVT* (vector, integer) scalar to decodetree, Richard Henderson, 2024/12/10
- [PATCH v2 58/69] target/arm: Convert FCVT* (vector, fixed-point) scalar to decodetree, Richard Henderson, 2024/12/10
- Prev by Date:
[PATCH v2 47/69] target/arm: Remove helper_neon_{add,sub}l_u{16,32}
- Next by Date:
[PATCH v2 49/69] target/arm: Convert XTN, SQXTUN, SQXTN, UQXTN to decodetree
- Previous by thread:
[PATCH v2 47/69] target/arm: Remove helper_neon_{add,sub}l_u{16,32}
- Next by thread:
[PATCH v2 49/69] target/arm: Convert XTN, SQXTUN, SQXTN, UQXTN to decodetree
- Index(es):