Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 6 ++++--
include/tcg/tcg-op-def2.h.inc | 1 +
tcg/tcg-op.c | 24 ++++++++++++++----------
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 2f5276c8a2c..5fc8b43d083 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -95,13 +95,16 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
#define DEF_RR(NAME) \
void glue(glue(tcg_gen_,NAME),TEXT)(TCGV a, TCGV b);
+#define DEF_RI(NAME) \
+ void glue(glue(tcg_gen_,NAME),TEXT)(TCGV a, TINT b);
+
#include "tcg-op-def.h.inc"
#undef DEF_RR
+#undef DEF_RI
/* 32 bit ops */
-void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg);
void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
void tcg_gen_subfi_i32(TCGv_i32 ret, int32_t arg1, TCGv_i32 arg2);
void tcg_gen_subi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
@@ -208,7 +211,6 @@ void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg);
/* 64 bit ops */
-void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg);
void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2);
void tcg_gen_subi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
diff --git a/include/tcg/tcg-op-def2.h.inc b/include/tcg/tcg-op-def2.h.inc
index 86777f54bad..0f8ee5f9976 100644
--- a/include/tcg/tcg-op-def2.h.inc
+++ b/include/tcg/tcg-op-def2.h.inc
@@ -1,3 +1,4 @@
/* SPDX-License-Identifier: MIT */
+DEF_RI(movi)
DEF_RR(mov)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index eda87960380..8350110ebae 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -327,9 +327,13 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
#define DEF_RR(NAME) \
static void glue(gen_,NAME)(TCGType, TCGTemp *, TCGTemp *);
+#define DEF_RI(NAME) \
+ static void glue(gen_,NAME)(TCGType, TCGTemp *, int64_t);
+
#include "tcg/tcg-op-def2.h.inc"
#undef DEF_RR
+#undef DEF_RI
/*
* Generic expansions for templated operations.
@@ -344,6 +348,11 @@ static void gen_mov(TCGType type, TCGTemp *dst, TCGTemp
*src)
}
}
+static void gen_movi(TCGType type, TCGTemp *dst, int64_t src)
+{
+ gen_op_tt(INDEX_op_mov, type, dst, tcg_constant_internal(type, src));
+}
+
/*
* Templated operations.
*/
@@ -352,9 +361,14 @@ static void gen_mov(TCGType type, TCGTemp *dst, TCGTemp
*src)
DNI void glue(glue(tcg_gen_,NAME),TEXT)(TCGV a, TCGV b) \
{ gen_##NAME(TYPE, TTMP(a), TTMP(b)); }
+#define DEF_RI(NAME) \
+ DNI void glue(glue(tcg_gen_,NAME),TEXT)(TCGV a, TINT b) \
+ { gen_##NAME(TYPE, TTMP(a), b); }
+
#include "tcg/tcg-op-def.h.inc"
#undef DEF_RR
+#undef DEF_RI
/* 32 bit ops */
@@ -363,11 +377,6 @@ void tcg_gen_discard_i32(TCGv_i32 arg)
tcg_gen_op1_i32(INDEX_op_discard, TCG_TYPE_I32, arg);
}
-void tcg_gen_movi_i32(TCGv_i32 ret, int32_t arg)
-{
- tcg_gen_mov_i32(ret, tcg_constant_i32(arg));
-}
-
void tcg_gen_add_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
{
tcg_gen_op3_i32(INDEX_op_add, ret, arg1, arg2);
@@ -1430,11 +1439,6 @@ void tcg_gen_discard_i64(TCGv_i64 arg)
tcg_gen_op1_i64(INDEX_op_discard, TCG_TYPE_I64, arg);
}
-void tcg_gen_movi_i64(TCGv_i64 ret, int64_t arg)
-{
- tcg_gen_mov_i64(ret, tcg_constant_i64(arg));
-}
-
void tcg_gen_ld8u_i64(TCGv_i64 ret, TCGv_ptr arg2, tcg_target_long offset)
{
tcg_gen_ldst_op_i64(INDEX_op_ld8u, ret, arg2, offset);
--
2.53.0