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 | 75 ++++++++++-------------------------
3 files changed, 22 insertions(+), 56 deletions(-)
diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
index cd9d6f17003..15c24010828 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_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);
void tcg_gen_nand_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2);
@@ -200,7 +199,6 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2,
tcg_target_long offset);
/* 64 bit ops */
-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);
void tcg_gen_nand_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 d7fca267eea..b92fdc8126a 100644
--- a/include/tcg/tcg-op-def2.h.inc
+++ b/include/tcg/tcg-op-def2.h.inc
@@ -22,6 +22,7 @@ DEF_RRR(divu)
DEF_RRR(mul)
DEF_RRR(or)
DEF_RRR(rem)
+DEF_RRR(remu)
DEF_RRR(sar)
DEF_RRR(shl)
DEF_RRR(shr)
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index a01056fe3a7..4253e3eaaec 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -236,20 +236,6 @@ static TCGOp * DNI tcg_gen_op4ii_i64(TCGOpcode opc,
TCGv_i64 a1, TCGv_i64 a2,
tcgv_i64_arg(a1), tcgv_i64_arg(a2), a3, a4);
}
-static void DNI tcg_gen_op5_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2,
- TCGv_i32 a3, TCGv_i32 a4, TCGv_i32 a5)
-{
- tcg_gen_op5(opc, TCG_TYPE_I32, tcgv_i32_arg(a1), tcgv_i32_arg(a2),
- tcgv_i32_arg(a3), tcgv_i32_arg(a4), tcgv_i32_arg(a5));
-}
-
-static void DNI tcg_gen_op5_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2,
- TCGv_i64 a3, TCGv_i64 a4, TCGv_i64 a5)
-{
- tcg_gen_op5(opc, TCG_TYPE_I64, tcgv_i64_arg(a1), tcgv_i64_arg(a2),
- tcgv_i64_arg(a3), tcgv_i64_arg(a4), tcgv_i64_arg(a5));
-}
-
static void DNI tcg_gen_op5ii_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2,
TCGv_i32 a3, TCGArg a4, TCGArg a5)
{
@@ -527,6 +513,27 @@ static void gen_rem(TCGType type, TCGTemp *dst, TCGTemp
*src1, TCGTemp *src2)
}
}
+static void gen_remu(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
+{
+ if (tcg_op_supported(INDEX_op_remu, type, 0)) {
+ gen_op_ttt(INDEX_op_remu, type, dst, src1, src2);
+ } else {
+ TCGTemp *tmp = tcg_temp_new_internal(type, TEMP_EBB);
+
+ if (tcg_op_supported(INDEX_op_divu, type, 0)) {
+ gen_op_ttt(INDEX_op_divu, type, tmp, src1, src2);
+ gen_mul(type, tmp, tmp, src2);
+ gen_sub(type, dst, src1, tmp);
+ } else if (tcg_op_supported(INDEX_op_divu2, type, 0)) {
+ TCGTemp *zero = tcg_constant_internal(type, 0);
+ gen_op_ttttt(INDEX_op_divu2, type, tmp, dst, src1, zero, src2);
+ } else {
+ g_assert_not_reached();
+ }
+ tcg_temp_free_internal(tmp);
+ }
+}
+
static void gen_sar(TCGType type, TCGTemp *dst, TCGTemp *src1, TCGTemp *src2)
{
gen_op_ttt(INDEX_op_sar, type, dst, src1, src2);
@@ -703,26 +710,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_remu_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
-{
- if (tcg_op_supported(INDEX_op_remu, TCG_TYPE_I32, 0)) {
- tcg_gen_op3_i32(INDEX_op_remu, ret, arg1, arg2);
- } else if (tcg_op_supported(INDEX_op_divu, TCG_TYPE_I32, 0)) {
- TCGv_i32 t0 = tcg_temp_ebb_new_i32();
- tcg_gen_op3_i32(INDEX_op_divu, t0, arg1, arg2);
- tcg_gen_mul_i32(t0, t0, arg2);
- tcg_gen_sub_i32(ret, arg1, t0);
- tcg_temp_free_i32(t0);
- } 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, t0, ret, arg1, zero, arg2);
- tcg_temp_free_i32(t0);
- } else {
- g_assert_not_reached();
- }
-}
-
void tcg_gen_andc_i32(TCGv_i32 ret, TCGv_i32 arg1, TCGv_i32 arg2)
{
if (tcg_op_supported(INDEX_op_andc, TCG_TYPE_I32, 0)) {
@@ -1583,26 +1570,6 @@ void tcg_gen_negsetcond_i64(TCGCond cond, TCGv_i64 ret,
}
}
-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)) {
- tcg_gen_op3_i64(INDEX_op_remu, ret, arg1, arg2);
- } else if (tcg_op_supported(INDEX_op_divu, TCG_TYPE_I64, 0)) {
- TCGv_i64 t0 = tcg_temp_ebb_new_i64();
- tcg_gen_op3_i64(INDEX_op_divu, t0, arg1, arg2);
- tcg_gen_mul_i64(t0, t0, arg2);
- tcg_gen_sub_i64(ret, arg1, t0);
- tcg_temp_free_i64(t0);
- } 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, t0, ret, arg1, zero, arg2);
- tcg_temp_free_i64(t0);
- } else {
- g_assert_not_reached();
- }
-}
-
void tcg_gen_ext8s_i64(TCGv_i64 ret, TCGv_i64 arg)
{
tcg_gen_sextract_i64(ret, arg, 0, 8);
--
2.53.0