Signed-off-by: Richard Henderson <[email protected]>
---
include/tcg/tcg-op-common.h | 2 --
include/tcg/tcg-op-def2.h.inc | 1 +
tcg/tcg-op.c | 43 ++++++++++++-----------------------
3 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index 20ccdbd0c95..cd9d6f17003 100644
--- a/include/tcg/tcg-op-common.h
+++ b/include/tcg/tcg-op-common.h
@@ -121,7 +121,6 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned meminfo);
/* 32 bit ops */
-void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_andc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
void tcg_gen_eqv_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
@@ -201,7 +200,6 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2,
tcg_target_long offset);
/* 64 bit ops */
-void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_andc_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
void tcg_gen_eqv_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2);
diff --git a/include/tcg/tcg-op-def2.h.inc b/include/tcg/tcg-op-def2.h.inc
index 56d7d2c6bfc..d7fca267eea 100644
--- a/include/tcg/tcg-op-def2.h.inc
+++ b/include/tcg/tcg-op-def2.h.inc
@@ -18,6 +18,7 @@ DEF_RRI(xori)
DEF_RRR(add)
DEF_RRR(and)
DEF_RRR(div)
+DEF_RRR(divu)
DEF_RRR(mul)
DEF_RRR(or)
DEF_RRR(rem)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index bdbd9244864..a01056fe3a7 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -431,6 +431,21 @@ static void gen_div(TCGType type, TCGTemp *dst, TCGTemp
*src1, TCGTemp *src2)
}
}
+static void gen_divu(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
+{
+ if (tcg_op_supported(INDEX_op_divu, type, 0)) {
+ gen_op_ttt(INDEX_op_divu, type, dst, src1, src2);
+ } else if (tcg_op_supported(INDEX_op_divu2, type, 0)) {
+ TCGTemp *tmp = tcg_temp_new_internal(type, TEMP_EBB);
+ TCGTemp *zero = tcg_constant_internal(type, 0);
+
+ gen_op_ttttt(INDEX_op_divu2, type, dst, tmp, src1, zero, src2);
+ tcg_temp_free_internal(tmp);
+ } else {
+ g_assert_not_reached();
+ }
+}
+
static void gen_mov(TCGType type, TCGTemp *dst, TCGTemp *src)
{
if (src != dst) {
@@ -688,20 +703,6 @@ void tcg_gen_negsetcondi_i32(TCGCond cond, TCGv_i32 ret,
tcg_gen_negsetcond_i32(cond, ret, arg1, tcg_constant_i32(arg2));
}
-void tcg_gen_divu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
-{
- if (tcg_op_supported(INDEX_op_divu, TCG_TYPE_I32, 0)) {
- tcg_gen_op3_i32(INDEX_op_divu, ret, arg1, arg2);
- } else if (tcg_op_supported(INDEX_op_divu2, TCG_TYPE_I32, 0)) {
- TCGv_i32 t0 = tcg_temp_ebb_new_i32();
- TCGv_i32 zero = tcg_constant_i32(0);
- tcg_gen_op5_i32(INDEX_op_divu2, ret, t0, arg1, zero, arg2);
- tcg_temp_free_i32(t0);
- } else {
- g_assert_not_reached();
- }
-}
-
void tcg_gen_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
{
if (tcg_op_supported(INDEX_op_remu, TCG_TYPE_I32, 0)) {
@@ -1582,20 +1583,6 @@ void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret,
}
}
-void tcg_gen_divu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
-{
- if (tcg_op_supported(INDEX_op_divu, TCG_TYPE_I64, 0)) {
- tcg_gen_op3_i64(INDEX_op_divu, ret, arg1, arg2);
- } else if (tcg_op_supported(INDEX_op_divu2, TCG_TYPE_I64, 0)) {
- TCGv_i64 t0 = tcg_temp_ebb_new_i64();
- TCGv_i64 zero = tcg_constant_i64(0);
- tcg_gen_op5_i64(INDEX_op_divu2, ret, t0, arg1, zero, arg2);
- tcg_temp_free_i64(t0);
- } else {
- g_assert_not_reached();
- }
-}
-
void tcg_gen_remu_i64(TCGv_i64 ret, TCGv_i64 arg1, TCGv_i64 arg2)
{
if (tcg_op_supported(INDEX_op_remu, TCG_TYPE_I64, 0)) {
--
2.53.0