[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 48/85] target/arm: Introduce clear_vec
From: |
Peter Maydell |
Subject: |
[PULL 48/85] target/arm: Introduce clear_vec |
Date: |
Fri, 13 Dec 2024 17:31:52 +0000 |
From: Richard Henderson <richard.henderson@linaro.org>
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>
Message-id: 20241211163036.2297116-49-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@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 717d30dd5b9..0e8e8670582 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.34.1
- [PULL 29/85] target/arm: Convert BFCVT to decodetree, (continued)
- [PULL 29/85] target/arm: Convert BFCVT to decodetree, Peter Maydell, 2024/12/13
- [PULL 33/85] target/arm: Convert FJCVTZS to decodetree, Peter Maydell, 2024/12/13
- [PULL 34/85] target/arm: Convert handle_fmov to decodetree, Peter Maydell, 2024/12/13
- [PULL 36/85] target/arm: Convert ABS, NEG to decodetree, Peter Maydell, 2024/12/13
- [PULL 38/85] target/arm: Convert CLS, CLZ (vector) to decodetree, Peter Maydell, 2024/12/13
- [PULL 09/85] target/arm: Convert PAC[ID]*, AUT[ID]* to decodetree, Peter Maydell, 2024/12/13
- [PULL 25/85] target/arm: Pass fpstatus to vfp_sqrt*, Peter Maydell, 2024/12/13
- [PULL 32/85] target/arm: Convert handle_fpfpcvt to decodetree, Peter Maydell, 2024/12/13
- [PULL 44/85] target/arm: Move helper_neon_addlp_{s8, s16} to neon_helper.c, Peter Maydell, 2024/12/13
- [PULL 49/85] target/arm: Convert XTN, SQXTUN, SQXTN, UQXTN to decodetree, Peter Maydell, 2024/12/13
- [PULL 48/85] target/arm: Introduce clear_vec,
Peter Maydell <=
- [PULL 51/85] target/arm: Convert FCVTXN to decodetree, Peter Maydell, 2024/12/13
- [PULL 57/85] target/arm: Convert FCVT* (vector, integer) scalar to decodetree, Peter Maydell, 2024/12/13
- [PULL 55/85] target/arm: Convert FSQRT (vector) to decodetree, Peter Maydell, 2024/12/13
- [PULL 11/85] target/arm: Convert disas_logic_reg to decodetree, Peter Maydell, 2024/12/13
- [PULL 68/85] target/arm: Convert URECPE and URSQRTE to decodetree, Peter Maydell, 2024/12/13
- [PULL 59/85] target/arm: Convert [US]CVTF (vector, integer) scalar to decodetree, Peter Maydell, 2024/12/13
- [PULL 62/85] target/arm: Convert [US]CVTF (vector) to decodetree, Peter Maydell, 2024/12/13
- [PULL 66/85] target/arm: Convert FRECPE, FRECPX, FRSQRTE to decodetree, Peter Maydell, 2024/12/13
- [PULL 75/85] MAINTAINERS: correct my email address, Peter Maydell, 2024/12/13
- [PULL 70/85] target/arm: Use float_round_to_odd in helper_fcvtx_f64_to_f32, Peter Maydell, 2024/12/13