[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/44] Hexagon (target/hexagon) Add overrides for loop setup instr
|
From: |
Taylor Simpson |
|
Subject: |
[PULL 12/44] Hexagon (target/hexagon) Add overrides for loop setup instructions |
|
Date: |
Fri, 12 May 2023 14:46:34 -0700 |
These instructions have implicit writes to registers, so we don't
want them to be helpers when idef-parser is off.
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230427230012.3800327-4-tsimpson@quicinc.com>
---
target/hexagon/gen_tcg.h | 21 +++++++++++++++++++
target/hexagon/genptr.c | 44 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/target/hexagon/gen_tcg.h b/target/hexagon/gen_tcg.h
index d4bd38810e..8d5e9826a0 100644
--- a/target/hexagon/gen_tcg.h
+++ b/target/hexagon/gen_tcg.h
@@ -665,6 +665,27 @@
#define fGEN_TCG_J2_callrf(SHORTCODE) \
gen_cond_callr(ctx, TCG_COND_NE, PuV, RsV)
+#define fGEN_TCG_J2_loop0r(SHORTCODE) \
+ gen_loop0r(ctx, RsV, riV)
+#define fGEN_TCG_J2_loop1r(SHORTCODE) \
+ gen_loop1r(ctx, RsV, riV)
+#define fGEN_TCG_J2_loop0i(SHORTCODE) \
+ gen_loop0i(ctx, UiV, riV)
+#define fGEN_TCG_J2_loop1i(SHORTCODE) \
+ gen_loop1i(ctx, UiV, riV)
+#define fGEN_TCG_J2_ploop1sr(SHORTCODE) \
+ gen_ploopNsr(ctx, 1, RsV, riV)
+#define fGEN_TCG_J2_ploop1si(SHORTCODE) \
+ gen_ploopNsi(ctx, 1, UiV, riV)
+#define fGEN_TCG_J2_ploop2sr(SHORTCODE) \
+ gen_ploopNsr(ctx, 2, RsV, riV)
+#define fGEN_TCG_J2_ploop2si(SHORTCODE) \
+ gen_ploopNsi(ctx, 2, UiV, riV)
+#define fGEN_TCG_J2_ploop3sr(SHORTCODE) \
+ gen_ploopNsr(ctx, 3, RsV, riV)
+#define fGEN_TCG_J2_ploop3si(SHORTCODE) \
+ gen_ploopNsi(ctx, 3, UiV, riV)
+
#define fGEN_TCG_J2_endloop0(SHORTCODE) \
gen_endloop0(ctx)
#define fGEN_TCG_J2_endloop1(SHORTCODE) \
diff --git a/target/hexagon/genptr.c b/target/hexagon/genptr.c
index dd707a9dc7..6e5767ec5e 100644
--- a/target/hexagon/genptr.c
+++ b/target/hexagon/genptr.c
@@ -518,6 +518,50 @@ static void gen_compare(TCGCond cond, TCGv res, TCGv arg1,
TCGv arg2)
tcg_gen_movcond_tl(cond, res, arg1, arg2, one, zero);
}
+#ifndef CONFIG_HEXAGON_IDEF_PARSER
+static inline void gen_loop0r(DisasContext *ctx, TCGv RsV, int riV)
+{
+ fIMMEXT(riV);
+ fPCALIGN(riV);
+ gen_log_reg_write(ctx, HEX_REG_LC0, RsV);
+ gen_log_reg_write(ctx, HEX_REG_SA0, tcg_constant_tl(ctx->pkt->pc + riV));
+ gen_set_usr_fieldi(ctx, USR_LPCFG, 0);
+}
+
+static void gen_loop0i(DisasContext *ctx, int count, int riV)
+{
+ gen_loop0r(ctx, tcg_constant_tl(count), riV);
+}
+
+static inline void gen_loop1r(DisasContext *ctx, TCGv RsV, int riV)
+{
+ fIMMEXT(riV);
+ fPCALIGN(riV);
+ gen_log_reg_write(ctx, HEX_REG_LC1, RsV);
+ gen_log_reg_write(ctx, HEX_REG_SA1, tcg_constant_tl(ctx->pkt->pc + riV));
+}
+
+static void gen_loop1i(DisasContext *ctx, int count, int riV)
+{
+ gen_loop1r(ctx, tcg_constant_tl(count), riV);
+}
+
+static void gen_ploopNsr(DisasContext *ctx, int N, TCGv RsV, int riV)
+{
+ fIMMEXT(riV);
+ fPCALIGN(riV);
+ gen_log_reg_write(ctx, HEX_REG_LC0, RsV);
+ gen_log_reg_write(ctx, HEX_REG_SA0, tcg_constant_tl(ctx->pkt->pc + riV));
+ gen_set_usr_fieldi(ctx, USR_LPCFG, N);
+ gen_log_pred_write(ctx, 3, tcg_constant_tl(0));
+}
+
+static void gen_ploopNsi(DisasContext *ctx, int N, int count, int riV)
+{
+ gen_ploopNsr(ctx, N, tcg_constant_tl(count), riV);
+}
+#endif
+
static void gen_cond_jumpr(DisasContext *ctx, TCGv dst_pc,
TCGCond cond, TCGv pred)
{
--
2.25.1
- [PULL 00/44] Hexagon update, Taylor Simpson, 2023/05/12
- [PULL 37/44] Hexagon (decode): look for pkts with multiple insns at the same slot, Taylor Simpson, 2023/05/12
- [PULL 38/44] Remove test_vshuff from hvx_misc tests, Taylor Simpson, 2023/05/12
- [PULL 12/44] Hexagon (target/hexagon) Add overrides for loop setup instructions,
Taylor Simpson <=
- [PULL 32/44] target/hexagon: fix = vs. == mishap, Taylor Simpson, 2023/05/12
- [PULL 05/44] Hexagon (tests/tcg/hexagon) Add v68 HVX tests, Taylor Simpson, 2023/05/12
- [PULL 14/44] Hexagon (target/hexagon) Add overrides for clr[tf]new, Taylor Simpson, 2023/05/12
- [PULL 36/44] Hexagon (iclass): update J4_hintjumpr slot constraints, Taylor Simpson, 2023/05/12
- [PULL 17/44] Hexagon (target/hexagon) Clean up pred_written usage, Taylor Simpson, 2023/05/12
- [PULL 06/44] Hexagon (target/hexagon) Add v69 HVX instructions, Taylor Simpson, 2023/05/12
- [PULL 01/44] Hexagon (target/hexagon) Add support for v68/v69/v71/v73, Taylor Simpson, 2023/05/12
- [PULL 23/44] Hexagon (target/hexagon) Short-circuit more HVX single instruction packets, Taylor Simpson, 2023/05/12
- [PULL 02/44] Hexagon (target/hexagon) Add v68 scalar instructions, Taylor Simpson, 2023/05/12
- [PULL 08/44] Hexagon (target/hexagon) Add v73 scalar instructions, Taylor Simpson, 2023/05/12