Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 5 +++--
include/tcg/tcg-op-def.h.inc | 1 +
tcg/tcg-op.c | 29 +++++++++++++++++++----------
3 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 1ef342e6c44..2933db9f869 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -96,6 +96,8 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
void glue(glue(tcg_gen_,NAME),TEXT)(T1);
#define DEF2(NAME, T1, T2) \
void glue(glue(tcg_gen_,NAME),TEXT)(T1, T2);
+#define DEF3(NAME, T1, T2, T3) \
+ void glue(glue(tcg_gen_,NAME),TEXT)(T1, T2, T3);
#define TCGV glue(TCGv,TEXT)
#define TEXT _i32
@@ -117,6 +119,7 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
#undef DEF1
#undef DEF2
+#undef DEF3
/* 32 bit ops */
@@ -210,7 +213,6 @@ void tcg_gen_st8_i32(TCGv_i32 arg1, TCGv_ptr arg2,
tcg_target_long offset);
void tcg_gen_st16_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset);
void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, tcg_target_long offset);
-void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_and_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_or_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
@@ -315,7 +317,6 @@ void tcg_gen_st8_i64(TCGv_i64 arg1, TCGv_ptr arg2,
tcg_target_long offset);
void tcg_gen_st16_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset);
void tcg_gen_st32_i64(TCGv_i64 arg1, TCGv_ptr arg2, tcg_target_long offset);
-void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset);
diff --git a/include/tcg/tcg-op-def.h.inc b/include/tcg/tcg-op-def.h.inc
index 6ff97260dc6..deb3484fc60 100644
--- a/include/tcg/tcg-op-def.h.inc
+++ b/include/tcg/tcg-op-def.h.inc
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: MIT */
+DEF3(add, TCGV, TCGV, TCGV)
DEF1(discard, TCGV)
DEF2(mov, TCGV, TCGV)
DEF2(movi, TCGV, TINT)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 88f06afafab..243f56493df 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -109,6 +109,12 @@ static void gen_op_tt(TCGOpcode opc, TCGType type, TCGTemp
*t0, TCGTemp *t1)
tcg_gen_op2(opc, type, temp_arg(t0), temp_arg(t1));
}
+static TCGOp *gen_op_ttt(TCGOpcode opc, TCGType type,
+ TCGTemp *t0, TCGTemp *t1, TCGTemp *t2)
+{
+ return tcg_gen_op3(opc, type, temp_arg(t0), temp_arg(t1), temp_arg(t2));
+}
+
/*
* With CONFIG_DEBUG_TCG, tcgv_*_tmp via tcgv_*_arg, is an out-of-line
* assertion check. Force tail calls to avoid too much code expansion.
@@ -318,6 +324,8 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
static void glue(gen_,NAME)(TCGType, T1);
#define DEF2(NAME, T1, T2) \
static void glue(gen_,NAME)(TCGType, T1, T2);
+#define DEF3(NAME, T1, T2, T3) \
+ static void glue(gen_,NAME)(TCGType, T1, T2, T3);
#define TCGV TCGTemp *
#define TINT int64_t
@@ -329,6 +337,7 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
#undef DEF1
#undef DEF2
+#undef DEF3
/*
* Templated operations.
@@ -342,6 +351,10 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
void glue(glue(tcg_gen_,NAME),TEXT)(T1 a, T2 b) \
{ gen_##NAME(TYPE, glue(C_,T1)(a), glue(C_,T2)(b)); }
+#define DEF3(NAME, T1, T2, T3) \
+ void glue(glue(tcg_gen_,NAME),TEXT)(T1 a, T2 b, T3 c) \
+ { gen_##NAME(TYPE, glue(C_,T1)(a), glue(C_,T2)(b), glue(C_,T3)(c)); }
+
#define C_TCGv_i32 tcgv_i32_temp
#define C_TCGv_i64 tcgv_i64_temp
#define C_int32_t
@@ -376,6 +389,7 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
#undef DEF1
#undef DEF2
+#undef DEF3
/*
* Generic expansions for templated operations.
@@ -383,6 +397,11 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
* are of the proper type.
*/
+static void gen_add(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
+{
+ gen_op_ttt(INDEX_op_add, type, dst, src1, src2);
+}
+
static void gen_discard(TCGType type, TCGTemp *src)
{
tcg_gen_op1(INDEX_op_discard, type, temp_arg(src));
@@ -402,11 +421,6 @@ static void gen_movi(TCGType type, TCGTemp *dst, int64_t
src)
/* 32 bit ops */
-void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
-{
- tcg_gen_op3_i32(INDEX_op_add, ret, arg1, arg2);
-}
-
void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
{
/* some cases can be optimized here */
@@ -1514,11 +1528,6 @@ void tcg_gen_st_i64(TCGv_i64 arg1, TCGv_ptr arg2,
tcg_target_long offset)
tcg_gen_ldst_op_i64(INDEX_op_st, arg1, arg2, offset);
}
-void tcg_gen_add_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
-{
- tcg_gen_op3_i64(INDEX_op_add, ret, arg1, arg2);
-}
-
void tcg_gen_sub_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
{
tcg_gen_op3_i64(INDEX_op_sub, ret, arg1, arg2);
--
2.53.0