[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 38/69] target/arm: Convert CLS, CLZ (vector) to decodetree
From: |
Richard Henderson |
Subject: |
[PATCH v3 38/69] target/arm: Convert CLS, CLZ (vector) to decodetree |
Date: |
Wed, 11 Dec 2024 10:30:05 -0600 |
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/tcg/translate-a64.c | 37 ++++++++++++++++------------------
target/arm/tcg/a64.decode | 2 ++
2 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
index 387bbbf906..ecb4578998 100644
--- a/target/arm/tcg/translate-a64.c
+++ b/target/arm/tcg/translate-a64.c
@@ -8916,6 +8916,20 @@ static bool do_gvec_fn2(DisasContext *s, arg_qrr_e *a,
GVecGen2Fn *fn)
TRANS(ABS_v, do_gvec_fn2, a, tcg_gen_gvec_abs)
TRANS(NEG_v, do_gvec_fn2, a, tcg_gen_gvec_neg)
+static bool do_gvec_fn2_bhs(DisasContext *s, arg_qrr_e *a, GVecGen2Fn *fn)
+{
+ if (a->esz == MO_64) {
+ return false;
+ }
+ if (fp_access_check(s)) {
+ gen_gvec_fn2(s, a->q, a->rd, a->rn, fn, a->esz);
+ }
+ return true;
+}
+
+TRANS(CLS_v, do_gvec_fn2_bhs, a, gen_gvec_cls)
+TRANS(CLZ_v, do_gvec_fn2_bhs, a, gen_gvec_clz)
+
/* Common vector code for handling integer to FP conversion */
static void handle_simd_intfp_conv(DisasContext *s, int rd, int rn,
int elements, int is_signed,
@@ -9215,13 +9229,6 @@ static void handle_2misc_64(DisasContext *s, int opcode,
bool u,
TCGCond cond;
switch (opcode) {
- case 0x4: /* CLS, CLZ */
- if (u) {
- tcg_gen_clzi_i64(tcg_rd, tcg_rn, 64);
- } else {
- tcg_gen_clrsb_i64(tcg_rd, tcg_rn);
- }
- break;
case 0x5: /* NOT */
/* This opcode is shared with CNT and RBIT but we have earlier
* enforced that size == 3 if and only if this is the NOT insn.
@@ -9283,6 +9290,7 @@ static void handle_2misc_64(DisasContext *s, int opcode,
bool u,
gen_helper_frint64_d(tcg_rd, tcg_rn, tcg_fpstatus);
break;
default:
+ case 0x4: /* CLS, CLZ */
case 0x7: /* SQABS, SQNEG */
case 0xb: /* ABS, NEG */
g_assert_not_reached();
@@ -10089,12 +10097,6 @@ static void disas_simd_two_reg_misc(DisasContext *s,
uint32_t insn)
handle_2misc_narrow(s, false, opcode, u, is_q, size, rn, rd);
return;
- case 0x4: /* CLS, CLZ */
- if (size == 3) {
- unallocated_encoding(s);
- return;
- }
- break;
case 0x2: /* SADDLP, UADDLP */
case 0x6: /* SADALP, UADALP */
if (size == 3) {
@@ -10299,6 +10301,7 @@ static void disas_simd_two_reg_misc(DisasContext *s,
uint32_t insn)
}
default:
case 0x3: /* SUQADD, USQADD */
+ case 0x4: /* CLS, CLZ */
case 0x7: /* SQABS, SQNEG */
case 0xb: /* ABS, NEG */
unallocated_encoding(s);
@@ -10321,13 +10324,6 @@ static void disas_simd_two_reg_misc(DisasContext *s,
uint32_t insn)
}
switch (opcode) {
- case 0x4: /* CLZ, CLS */
- if (u) {
- gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clz, size);
- } else {
- gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_cls, size);
- }
- return;
case 0x5:
if (u && size == 0) { /* NOT */
gen_gvec_fn2(s, is_q, rd, rn, tcg_gen_gvec_not, 0);
@@ -10351,6 +10347,7 @@ static void disas_simd_two_reg_misc(DisasContext *s,
uint32_t insn)
case 0xa: /* CMLT */
gen_gvec_fn2(s, is_q, rd, rn, gen_gvec_clt0, size);
return;
+ case 0x4: /* CLZ, CLS */
case 0xb:
g_assert_not_reached();
}
diff --git a/target/arm/tcg/a64.decode b/target/arm/tcg/a64.decode
index f112951df7..32355ee633 100644
--- a/target/arm/tcg/a64.decode
+++ b/target/arm/tcg/a64.decode
@@ -1641,3 +1641,5 @@ SQABS_v 0.00 1110 ..1 00000 01111 0 ..... .....
@qrr_e
SQNEG_v 0.10 1110 ..1 00000 01111 0 ..... ..... @qrr_e
ABS_v 0.00 1110 ..1 00000 10111 0 ..... ..... @qrr_e
NEG_v 0.10 1110 ..1 00000 10111 0 ..... ..... @qrr_e
+CLS_v 0.00 1110 ..1 00000 01001 0 ..... ..... @qrr_e
+CLZ_v 0.10 1110 ..1 00000 01001 0 ..... ..... @qrr_e
--
2.43.0
- [PATCH v3 30/69] target/arm: Convert FRINT{32, 64}[ZX] (scalar) to decodetree, (continued)
- [PATCH v3 30/69] target/arm: Convert FRINT{32, 64}[ZX] (scalar) to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 31/69] target/arm: Convert FCVT (scalar) to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 39/69] target/arm: Introduce gen_gvec_cnt, gen_gvec_rbit, Richard Henderson, 2024/12/11
- [PATCH v3 34/69] target/arm: Convert handle_fmov to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 35/69] target/arm: Convert SQABS, SQNEG to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 21/69] target/arm: Introduce fp_access_check_vector_hsd, Richard Henderson, 2024/12/11
- [PATCH v3 26/69] target/arm: Remove helper_sqrt_f16, Richard Henderson, 2024/12/11
- [PATCH v3 32/69] target/arm: Convert handle_fpfpcvt to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 37/69] target/arm: Introduce gen_gvec_cls, gen_gvec_clz, Richard Henderson, 2024/12/11
- [PATCH v3 36/69] target/arm: Convert ABS, NEG to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 38/69] target/arm: Convert CLS, CLZ (vector) to decodetree,
Richard Henderson <=
- [PATCH v3 41/69] target/arm: Convert CMGT, CMGE, GMLT, GMLE, CMEQ (zero) to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 42/69] target/arm: Introduce gen_gvec_rev{16,32,64}, Richard Henderson, 2024/12/11
- [PATCH v3 40/69] target/arm: Convert CNT, NOT, RBIT (vector) to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 44/69] target/arm: Move helper_neon_addlp_{s8, s16} to neon_helper.c, Richard Henderson, 2024/12/11
- [PATCH v3 43/69] target/arm: Convert handle_rev to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 46/69] target/arm: Convert handle_2misc_pairwise to decodetree, Richard Henderson, 2024/12/11
- [PATCH v3 45/69] target/arm: Introduce gen_gvec_{s,u}{add,ada}lp, Richard Henderson, 2024/12/11
- [PATCH v3 47/69] target/arm: Remove helper_neon_{add,sub}l_u{16,32}, Richard Henderson, 2024/12/11
- Prev by Date:
[PATCH v3 36/69] target/arm: Convert ABS, NEG to decodetree
- Next by Date:
[PATCH v3 41/69] target/arm: Convert CMGT, CMGE, GMLT, GMLE, CMEQ (zero) to decodetree
- Previous by thread:
[PATCH v3 36/69] target/arm: Convert ABS, NEG to decodetree
- Next by thread:
[PATCH v3 41/69] target/arm: Convert CMGT, CMGE, GMLT, GMLE, CMEQ (zero) to decodetree
- Index(es):