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 | 34 +++++++++-------------------------
3 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index cee21891451..80e6f77c379 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_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
void tcg_gen_muli_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2);
void tcg_gen_div_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_rem_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
@@ -209,7 +208,6 @@ void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg);
/* 64 bit ops */
-void tcg_gen_xori_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
void tcg_gen_muli_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2);
void tcg_gen_div_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_rem_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
diff --git a/include/tcg/tcg-op-def.h.inc b/include/tcg/tcg-op-def.h.inc
index 2c3604cc7ed..b620a314480 100644
--- a/include/tcg/tcg-op-def.h.inc
+++ b/include/tcg/tcg-op-def.h.inc
@@ -21,3 +21,4 @@ DEF3(sub, TCGV, TCGV, TCGV)
DEF3(subi, TCGV, TCGV, TINT)
DEF3(subfi, TCGV, TINT, TCGV)
DEF3(xor, TCGV, TCGV, TCGV)
+DEF3(xori, TCGV, TCGV, TINT)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index b2bd2f51e1a..0e6c21e9077 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -558,22 +558,20 @@ static void gen_xor(TCGType type, TCGTemp *dst, TCGTemp
*src1, TCGTemp *src2)
gen_op_ttt(INDEX_op_xor, type, dst, src1, src2);
}
-/* 32 bit ops */
-
-void tcg_gen_xori_i32(TCGv_i32 ret, TCGv_i32 arg1, int32_t arg2)
+static void gen_xori(TCGType type, TCGTemp *dst, TCGTemp *src1, int64_t src2)
{
- /* Some cases can be optimized here. */
- if (arg2 == 0) {
- tcg_gen_mov_i32(ret, arg1);
- } else if (arg2 == -1 &&
- tcg_op_supported(INDEX_op_not, TCG_TYPE_I32, 0)) {
- /* Don't recurse with tcg_gen_not_i32. */
- tcg_gen_op2_i32(INDEX_op_not, ret, arg1);
+ if (src2 == 0) {
+ gen_mov(type, dst, src1);
+ } else if (src2 == -1 && tcg_op_supported(INDEX_op_not, type, 0)) {
+ /* Do not recurse with gen_not. */
+ gen_op_tt(INDEX_op_not, type, dst, src1);
} else {
- tcg_gen_xor_i32(ret, arg1, tcg_constant_i32(arg2));
+ gen_xor(type, dst, src1, tcg_constant_internal(type, src2));
}
}
+/* 32 bit ops */
+
void tcg_gen_not_i32(TCGv_i32 ret, TCGv_i32 arg)
{
if (tcg_op_supported(INDEX_op_not, TCG_TYPE_I32, 0)) {
@@ -1526,20 +1524,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_xori_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 if (arg2 == -1 &&
- tcg_op_supported(INDEX_op_not, TCG_TYPE_I64, 0)) {
- /* Don't recurse with tcg_gen_not_i64. */
- tcg_gen_op2_i64(INDEX_op_not, ret, arg1);
- } else {
- tcg_gen_xor_i64(ret, arg1, tcg_constant_i64(arg2));
- }
-}
-
void tcg_gen_brcond_i64(TCGCond cond, TCGv_i64 arg1, TCGv_i64 arg2, TCGLabel
*l)
{
if (cond == TCG_COND_ALWAYS) {
--
2.53.0