aboutsummaryrefslogtreecommitdiff
path: root/tcg
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-12-24 17:32:06 -0800
committerRichard Henderson <richard.henderson@linaro.org>2025-01-16 20:57:16 -0800
commit0e4c6424d639b1e2e2b780a2692d47491b7260ae (patch)
treefd577c4194bb970ec7cd64fa6a9b71df89bec071 /tcg
parent80a3a9423a86cc5dae6c6e1794328465d105d73c (diff)
downloadqemu-0e4c6424d639b1e2e2b780a2692d47491b7260ae.zip
qemu-0e4c6424d639b1e2e2b780a2692d47491b7260ae.tar.gz
qemu-0e4c6424d639b1e2e2b780a2692d47491b7260ae.tar.bz2
tcg: Add tcg_op_deposit_valid
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tcg')
-rw-r--r--tcg/tcg.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 43293ca..6b31887 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2238,6 +2238,27 @@ bool tcg_op_supported(TCGOpcode op, TCGType type, unsigned flags)
}
}
+bool tcg_op_deposit_valid(TCGType type, unsigned ofs, unsigned len)
+{
+ tcg_debug_assert(len > 0);
+ switch (type) {
+ case TCG_TYPE_I32:
+ tcg_debug_assert(ofs < 32);
+ 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 <= 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, unsigned nargs);
static void tcg_gen_callN(void *func, TCGHelperInfo *info,