Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 2 --
include/tcg/tcg-op-def.h.inc | 1 +
tcg/tcg-op.c | 29 +++++++++--------------------
3 files changed, 10 insertions(+), 22 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 2933db9f869..62487268a2f 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -123,7 +123,6 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
/* 32 bit ops */
-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);
void tcg_gen_andi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
@@ -226,7 +225,6 @@ void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg);
/* 64 bit ops */
-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);
void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
diff --git a/include/tcg/tcg-op-def.h.inc b/include/tcg/tcg-op-def.h.inc
index deb3484fc60..31982e2dc6e 100644
--- a/include/tcg/tcg-op-def.h.inc
+++ b/include/tcg/tcg-op-def.h.inc
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: MIT */
DEF3(add, TCGV, TCGV, TCGV)
+DEF3(addi, TCGV, TCGV, TINT)
DEF1(discard, TCGV)
DEF2(mov, TCGV, TCGV)
DEF2(movi, TCGV, TINT)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 243f56493df..548fe84b233 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -402,6 +402,15 @@ 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_addi(TCGType type, TCGTemp *dst, TCGTemp *src1, int64_t src2)
+{
+ if (src2 == 0) {
+ gen_mov(type, dst, src1);
+ } else {
+ gen_add(type, dst, src1, tcg_constant_internal(type, src2));
+ }
+}
+
static void gen_discard(TCGType type, TCGTemp *src)
{
tcg_gen_op1(INDEX_op_discard, type, temp_arg(src));
@@ -421,16 +430,6 @@ static void gen_movi(TCGType type, TCGTemp *dst, int64_t
src)
/* 32 bit ops */
-void tcg_gen_addi_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
-{
- /* some cases can be optimized here */
- if (arg2 == 0) {
- tcg_gen_mov_i32(ret, arg1);
- } else {
- tcg_gen_add_i32(ret, arg1, tcg_constant_i32(arg2));
- }
-}
-
void tcg_gen_sub_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
{
tcg_gen_op3_i32(INDEX_op_sub, ret, arg1, arg2);
@@ -1568,16 +1567,6 @@ void tcg_gen_mul_i64(TCGv_i64 ret, TCGv_i64 arg1,
TCGv_i64 arg2)
tcg_gen_op3_i64(INDEX_op_mul, ret, arg1, arg2);
}
-void tcg_gen_addi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
-{
- /* some cases can be optimized here */
- if (arg2 == 0) {
- tcg_gen_mov_i64(ret, arg1);
- } else {
- tcg_gen_add_i64(ret, arg1, tcg_constant_i64(arg2));
- }
-}
-
void tcg_gen_subfi_i64(TCGv_i64 ret, int64_t arg1, TCGv_i64 arg2)
{
if (arg1 == 0) {
--
2.53.0