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                  | 30 ++++++++++++++++--------------
 3 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index e243ed93b55..b859af38355 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -113,6 +113,9 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
 #define DEF_CRRL(NAME) \
     void glue(glue(tcg_gen_,NAME),TEXT)(TCGCond a, TCGV b, TCGV c, TCGLabel 
*d);
 
+#define DEF_CRIL(NAME) \
+    void glue(glue(tcg_gen_,NAME),TEXT)(TCGCond a, TCGV b, TINT c, TCGLabel 
*d);
+
 #include "tcg-op-def.h.inc"
 
 #undef DEF_R
@@ -122,6 +125,7 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
 #undef DEF_RRI
 #undef DEF_RIR
 #undef DEF_CRRL
+#undef DEF_CRIL
 
 /* 32 bit ops */
 
@@ -145,7 +149,6 @@ void tcg_gen_sextract_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_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel 
*);
 void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret,
                          TCGv_i32 arg1, TCGv_i32 arg2);
 void tcg_gen_setcondi_i32(TCGCond cond, TCGv_i32 ret,
@@ -217,7 +220,6 @@ void tcg_gen_sextract_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_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel 
*);
 void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret,
                          TCGv_i64 arg1, TCGv_i64 arg2);
 void tcg_gen_setcondi_i64(TCGCond cond, TCGv_i64 ret,
diff --git a/include/tcg/tcg-op-def2.h.inc b/include/tcg/tcg-op-def2.h.inc
index 7721c708e9c..da15a647e2e 100644
--- a/include/tcg/tcg-op-def2.h.inc
+++ b/include/tcg/tcg-op-def2.h.inc
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: MIT */
 
+DEF_CRIL(brcondi)
 DEF_CRRL(brcond)
 DEF_R(discard)
 DEF_RI(movi)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index c2ae691622f..e1974aac41c 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -341,6 +341,9 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
 #define DEF_CRRL(NAME) \
     static void glue(gen_,NAME)(TCGType, TCGCond, TCGTemp *, TCGTemp *, 
TCGLabel *);
 
+#define DEF_CRIL(NAME) \
+    static void glue(gen_,NAME)(TCGType, TCGCond, TCGTemp *, int64_t, TCGLabel 
*);
+
 #include "tcg/tcg-op-def2.h.inc"
 
 #undef DEF_R
@@ -350,6 +353,7 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo)
 #undef DEF_RRI
 #undef DEF_RIR
 #undef DEF_CRRL
+#undef DEF_CRIL
 
 /*
  * Generic expansions for templated operations.
@@ -425,6 +429,12 @@ static void gen_brcond(TCGType type, TCGCond cond, TCGTemp 
*src1,
     }
 }
 
+static void gen_brcondi(TCGType type, TCGCond cond, TCGTemp *src1,
+                        int64_t src2, TCGLabel *l)
+{
+    gen_brcond(type, cond, src1, tcg_constant_internal(type, src2), l);
+}
+
 static void gen_discard(TCGType type, TCGTemp *src)
 {
     tcg_gen_op1(INDEX_op_discard, type, temp_arg(src));
@@ -720,6 +730,11 @@ static void gen_xori(TCGType type, TCGTemp *dst, TCGTemp 
*src1, int64_t src2)
                                         TCGV c, TCGLabel *d)            \
     { gen_##NAME(TYPE, a, TTMP(b), TTMP(c), d); }
 
+#define DEF_CRIL(NAME)                                                  \
+    void glue(glue(tcg_gen_,NAME),TEXT)(TCGCond a, TCGV b,              \
+                                        TINT c, TCGLabel *d)            \
+    { gen_##NAME(TYPE, a, TTMP(b), c, d); }
+
 #include "tcg/tcg-op-def.h.inc"
 
 #undef DEF_R
@@ -729,18 +744,10 @@ static void gen_xori(TCGType type, TCGTemp *dst, TCGTemp 
*src1, int64_t src2)
 #undef DEF_RRI
 #undef DEF_RIR
 #undef DEF_CRRL
+#undef DEF_CRIL
 
 /* 32 bit ops */
 
-void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, TCGLabel 
*l)
-{
-    if (cond == TCG_COND_ALWAYS) {
-        tcg_gen_br(l);
-    } else if (cond != TCG_COND_NEVER) {
-        tcg_gen_brcond_i32(cond, arg1, tcg_constant_i32(arg2), l);
-    }
-}
-
 void tcg_gen_setcond_i32(TCGCond cond, TCGv_i32 ret,
                          TCGv_i32 arg1, TCGv_i32 arg2)
 {
@@ -1531,11 +1538,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_brcondi_i64(TCGCond cond, TCGv_i64 arg1, int64_t arg2, TCGLabel 
*l)
-{
-    tcg_gen_brcond_i64(cond, arg1, tcg_constant_i64(arg2), l);
-}
-
 void tcg_gen_setcond_i64(TCGCond cond, TCGv_i64 ret,
                          TCGv_i64 arg1, TCGv_i64 arg2)
 {
-- 
2.53.0


Reply via email to