Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 4 ---
include/tcg/tcg-op-def.h.inc | 1 +
tcg/tcg-op.c | 70 +++++++++++-------------------------
3 files changed, 21 insertions(+), 54 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index ceaa4b7fe01..4838e06f1d4 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -132,8 +132,6 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
/* 32 bit ops */
-void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg,
- unsigned int ofs, unsigned int len);
void tcg_gen_extract2_i32(TCGv_i32 ret, TCGv_i32 al, TCGv_i32 ah,
unsigned int ofs);
void tcg_gen_add2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 al,
@@ -177,8 +175,6 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2,
tcg_target_long offset);
/* 64 bit ops */
-void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg,
- unsigned int ofs, unsigned int len);
void tcg_gen_extract2_i64(TCGv_i64 ret, TCGv_i64 al, TCGv_i64 ah,
unsigned int ofs);
void tcg_gen_add2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 al,
diff --git a/include/tcg/tcg-op-def.h.inc b/include/tcg/tcg-op-def.h.inc
index 21a941f5458..3b44db51f55 100644
--- a/include/tcg/tcg-op-def.h.inc
+++ b/include/tcg/tcg-op-def.h.inc
@@ -14,6 +14,7 @@ DEF2(ctpop, TCGV, TCGV)
DEF3(ctz, TCGV, TCGV, TCGV)
DEF3(ctzi, TCGV, TCGV, TINT)
DEF5(deposit, TCGV, TCGV, TCGV, unsigned, unsigned)
+DEF4(deposit_z, TCGV, TCGV, unsigned, unsigned)
DEF1(discard, TCGV)
DEF3(div, TCGV, TCGV, TCGV)
DEF3(divu, TCGV, TCGV, TCGV)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 599f21470c5..fdcff596a03 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -244,20 +244,6 @@ static void DNI tcg_gen_op4i_i64(TCGOpcode opc, TCGv_i64
a1, TCGv_i64 a2,
tcgv_i64_arg(a3), a4);
}
-static void DNI tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2,
- TCGv_i32 a3, TCGArg a4, TCGArg a5)
-{
- tcg_gen_op5(opc, TCG_TYPE_I32, tcgv_i32_arg(a1), tcgv_i32_arg(a2),
- tcgv_i32_arg(a3), a4, a5);
-}
-
-static void DNI tcg_gen_op5ii_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2,
- TCGv_i64 a3, TCGArg a4, TCGArg a5)
-{
- tcg_gen_op5(opc, TCG_TYPE_I64, tcgv_i64_arg(a1), tcgv_i64_arg(a2),
- tcgv_i64_arg(a3), a4, a5);
-}
-
/* Generic ops. */
void gen_set_label(TCGLabel *l)
@@ -634,6 +620,26 @@ static void gen_deposit(TCGType type, TCGTemp *dst,
TCGTemp *src1,
}
}
+static void gen_deposit_z(TCGType type, TCGTemp *dst, TCGTemp *src,
+ unsigned int ofs, unsigned int len)
+{
+ unsigned width = tcg_type_size(type) * 8;
+
+ tcg_debug_assert(ofs < width);
+ tcg_debug_assert(len > 0);
+ tcg_debug_assert(len <= width);
+ tcg_debug_assert(ofs + len <= width);
+
+ if (ofs + len == width) {
+ gen_shli(type, dst, src, ofs);
+ } else if (ofs == 0) {
+ gen_extract(type, dst, src, 0, len);
+ } else {
+ TCGTemp *zero = tcg_constant_internal(type, 0);
+ gen_op_tttii(INDEX_op_deposit, type, dst, zero, src, ofs, len);
+ }
+}
+
static void gen_discard(TCGType type, TCGTemp *src)
{
tcg_gen_op1(INDEX_op_discard, type, temp_arg(src));
@@ -1117,24 +1123,6 @@ static void gen_xori(TCGType type, TCGTemp *dst, TCGTemp
*src1, int64_t src2)
/* 32 bit ops */
-void tcg_gen_deposit_z_i32(TCGv_i32 ret, TCGv_i32 arg,
- unsigned int ofs, unsigned int len)
-{
- tcg_debug_assert(ofs < 32);
- tcg_debug_assert(len > 0);
- tcg_debug_assert(len <= 32);
- tcg_debug_assert(ofs + len <= 32);
-
- if (ofs + len == 32) {
- tcg_gen_shli_i32(ret, arg, ofs);
- } else if (ofs == 0) {
- tcg_gen_extract_i32(ret, arg, 0, len);
- } else {
- TCGv_i32 zero = tcg_constant_i32(0);
- tcg_gen_op5ii_i32(INDEX_op_deposit, ret, zero, arg, ofs, len);
- }
-}
-
/*
* Extract 32-bits from a 64-bit input, ah:al, starting from ofs.
* Unlike tcg_gen_extract_i32 above, len is fixed at 32.
@@ -1786,24 +1774,6 @@ void tcg_gen_revbit64_i64(TCGv_i64 ret, TCGv_i64 arg)
}
}
-void tcg_gen_deposit_z_i64(TCGv_i64 ret, TCGv_i64 arg,
- unsigned int ofs, unsigned int len)
-{
- tcg_debug_assert(ofs < 64);
- tcg_debug_assert(len > 0);
- tcg_debug_assert(len <= 64);
- tcg_debug_assert(ofs + len <= 64);
-
- if (ofs + len == 64) {
- tcg_gen_shli_i64(ret, arg, ofs);
- } else if (ofs == 0) {
- tcg_gen_andi_i64(ret, arg, (1ull << len) - 1);
- } else {
- TCGv_i64 zero = tcg_constant_i64(0);
- tcg_gen_op5ii_i64(INDEX_op_deposit, ret, zero, arg, ofs, len);
- }
-}
-
/*
* Extract 64 bits from a 128-bit input, ah:al, starting from ofs.
* Unlike tcg_gen_extract_i64 above, len is fixed at 64.
--
2.53.0