[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/73] tcg: Add tcg_op_deposit_valid
From: |
Richard Henderson |
Subject: |
[PATCH 11/73] tcg: Add tcg_op_deposit_valid |
Date: |
Thu, 2 Jan 2025 10:05:51 -0800 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/tcg/tcg.h | 1 +
tcg/tcg.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index d8591d6c9e..a27b8d77e9 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -831,6 +831,7 @@ typedef struct TCGTargetOpDef {
} TCGTargetOpDef;
bool tcg_op_supported(TCGOpcode op, TCGType type);
+bool tcg_op_deposit_valid(TCGType type, unsigned ofs, unsigned len);
void tcg_gen_call0(void *func, TCGHelperInfo *, TCGTemp *ret);
void tcg_gen_call1(void *func, TCGHelperInfo *, TCGTemp *ret, TCGTemp *);
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 3a0ad03fd5..657534c6a9 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2254,6 +2254,28 @@ bool tcg_op_supported(TCGOpcode op, TCGType type)
}
}
+bool tcg_op_deposit_valid(TCGType type, unsigned ofs, unsigned len)
+{
+ switch (type) {
+ case TCG_TYPE_I32:
+ tcg_debug_assert(ofs < 32);
+ tcg_debug_assert(len > 0);
+ tcg_debug_assert(len <= 32);
+ tcg_debug_assert(ofs + len <= 32);
+ return TCG_TARGET_HAS_deposit_i32 && TCG_TARGET_deposit_i32_valid(ofs,
len);
+
+ case TCG_TYPE_I64:
+ tcg_debug_assert(ofs < 64);
+ tcg_debug_assert(len > 0);
+ tcg_debug_assert(len <= 64);
+ tcg_debug_assert(ofs + len <= 64);
+ return TCG_TARGET_HAS_deposit_i64 && TCG_TARGET_deposit_i64_valid(ofs,
len);
+
+ default:
+ g_assert_not_reached();
+ }
+}
+
static TCGOp *tcg_op_alloc(TCGOpcode opc, TCGType type, unsigned nargs);
static void tcg_gen_callN(void *func, TCGHelperInfo *info,
--
2.43.0
- [PATCH 00/73] tcg: Merge *_i32 and *_i64 opcodes, Richard Henderson, 2025/01/02
- [PATCH 01/73] tcg: Add TCGOp.type, Richard Henderson, 2025/01/02
- [PATCH 02/73] tcg: Add TCGHelperInfo.out_type, Richard Henderson, 2025/01/02
- [PATCH 04/73] tcg: Add TCGType argument to tcg_gen_op*, Richard Henderson, 2025/01/02
- [PATCH 05/73] tcg: Remove TCGOP_VECL, Richard Henderson, 2025/01/02
- [PATCH 16/73] tcg: Rename tcg-target.opc.h to tcg-target-opc.h.inc, Richard Henderson, 2025/01/02
- [PATCH 03/73] tcg: Add TCGType argument to tcg_emit_op, tcg_op_insert_*, Richard Henderson, 2025/01/02
- [PATCH 11/73] tcg: Add tcg_op_deposit_valid,
Richard Henderson <=
- [PATCH 15/73] tcg: Remove TCG_TARGET_NEED_LDST_LABELS and TCG_TARGET_NEED_POOL_LABELS, Richard Henderson, 2025/01/02
- [PATCH 22/73] tcg: Merge TCG_TARGET_HAS_{andc,orc,nand,nor,eqv,not}, Richard Henderson, 2025/01/02
- [PATCH 17/73] tcg/tci: Move TCI specific opcodes to tcg-target-opc.h.inc, Richard Henderson, 2025/01/02
- [PATCH 07/73] tcg: Add TCGType argument to tcg_op_supported, Richard Henderson, 2025/01/02
- [PATCH 18/73] tcg: Move fallback tcg_can_emit_vec_op out of line, Richard Henderson, 2025/01/02
- [PATCH 23/73] tcg/mips: Expand bswap unconditionally, Richard Henderson, 2025/01/02