On Sun, Sep 27, 2026 at 5:07 AM Richard Henderson
<[email protected]> wrote:
>
> 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                 | 131 +++++++++++++----------------------
>  3 files changed, 51 insertions(+), 83 deletions(-)
>
> diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h
> index 41a4d52d497..5f73601ddf7 100644
> --- a/include/tcg/tcg-op-common.h
> +++ b/include/tcg/tcg-op-common.h
> @@ -132,7 +132,6 @@ void tcg_gen_plugin_mem_cb(TCGv_i64 addr, unsigned 
> meminfo);
>
>  /* 32 bit ops */
>
> -void tcg_gen_muls2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 
> arg2);
>  void tcg_gen_mulsu2_i32(TCGv_i32 rl, TCGv_i32 rh, TCGv_i32 arg1, TCGv_i32 
> arg2);
>  void tcg_gen_bswap16_i32(TCGv_i32 ret, TCGv_i32 arg, int flags);
>  void tcg_gen_bswap32_i32(TCGv_i32 ret, TCGv_i32 arg);
> @@ -156,7 +155,6 @@ void tcg_gen_st_i32(TCGv_i32 arg1, TCGv_ptr arg2, 
> tcg_target_long offset);
>  /* 64 bit ops */
>
>  void tcg_gen_addN_i64(int n, TCGv_i64 *r, TCGv_i64 *a, TCGv_i64 *b);
> -void tcg_gen_muls2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 
> arg2);
>  void tcg_gen_mulsu2_i64(TCGv_i64 rl, TCGv_i64 rh, TCGv_i64 arg1, TCGv_i64 
> arg2);
>  void tcg_gen_ext32s_i64(TCGv_i64 ret, TCGv_i64 arg);
>  void tcg_gen_ext32u_i64(TCGv_i64 ret, TCGv_i64 arg);
> diff --git a/include/tcg/tcg-op-def.h.inc b/include/tcg/tcg-op-def.h.inc
> index b24122173a2..b606aaab128 100644
> --- a/include/tcg/tcg-op-def.h.inc
> +++ b/include/tcg/tcg-op-def.h.inc
> @@ -35,6 +35,7 @@ DEF2(movi, TCGV, TINT)
>  DEF6(movcond, TCGCond, TCGV, TCGV, TCGV, TCGV, TCGV)
>  DEF3(mul, TCGV, TCGV, TCGV)
>  DEF3(muli, TCGV, TCGV, TINT)
> +DEF4(muls2, TCGV, TCGV, TCGV, TCGV)
>  DEF4(mulu2, TCGV, TCGV, TCGV, TCGV)
>  DEF3(nand, TCGV, TCGV, TCGV)
>  DEF2(neg, TCGV, TCGV)
> diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
> index f107e3a85ea..61d50294a68 100644
> --- a/tcg/tcg-op.c
> +++ b/tcg/tcg-op.c
> @@ -129,13 +129,6 @@ static void DNI tcg_gen_op2_i64(TCGOpcode opc, TCGv_i64 
> a1, TCGv_i64 a2)
>      tcg_gen_op2(opc, TCG_TYPE_I64, tcgv_i64_arg(a1), tcgv_i64_arg(a2));
>  }
>
> -static void DNI tcg_gen_op3_i32(TCGOpcode opc, TCGv_i32 a1,
> -                                TCGv_i32 a2, TCGv_i32 a3)
> -{
> -    tcg_gen_op3(opc, TCG_TYPE_I32, tcgv_i32_arg(a1),
> -                tcgv_i32_arg(a2), tcgv_i32_arg(a3));
> -}
> -
>  static void DNI tcg_gen_op3_i64(TCGOpcode opc, TCGv_i64 a1,
>                                  TCGv_i64 a2, TCGv_i64 a3)
>  {
> @@ -169,20 +162,6 @@ static void DNI tcg_gen_ldst_op_i64(TCGOpcode opc, 
> TCGv_i64 val,
>                  tcgv_ptr_arg(base), offset);
>  }
>
> -static void DNI tcg_gen_op4_i32(TCGOpcode opc, TCGv_i32 a1, TCGv_i32 a2,
> -                                TCGv_i32 a3, TCGv_i32 a4)
> -{
> -    tcg_gen_op4(opc, TCG_TYPE_I32, tcgv_i32_arg(a1), tcgv_i32_arg(a2),
> -                tcgv_i32_arg(a3), tcgv_i32_arg(a4));
> -}
> -
> -static void DNI tcg_gen_op4_i64(TCGOpcode opc, TCGv_i64 a1, TCGv_i64 a2,
> -                                TCGv_i64 a3, TCGv_i64 a4)
> -{
> -    tcg_gen_op4(opc, TCG_TYPE_I64, tcgv_i64_arg(a1), tcgv_i64_arg(a2),
> -                tcgv_i64_arg(a3), tcgv_i64_arg(a4));
> -}
> -
>  /* Generic ops.  */
>
>  void gen_set_label(TCGLabel *l)
> @@ -778,6 +757,56 @@ void tcg_gen_muli(TCGType type, TCGTemp *dst, TCGTemp 
> *src1, int64_t src2)
>      }
>  }
>
> +void tcg_gen_muls2(TCGType type, TCGTemp *rl, TCGTemp *rh,
> +                   TCGTemp *src1, TCGTemp *src2)
> +{
> +    if (tcg_op_supported(INDEX_op_muls2, type, 0)) {
> +        tcg_gen_op_tttt(INDEX_op_muls2, type, rl, rh, src1, src2);
> +    } else if (tcg_op_supported(INDEX_op_mulsh, TCG_TYPE_I32, 0)) {

s/TCG_TYPE_I32/type/ since that's how mulsh is emitted a couple lines below.

> +        g_autoptr(TCGTemp) t = tcg_temp_new_ebb(type);
> +
> +        tcg_gen_mul(type, t, src1, src2);
> +        tcg_gen_op_ttt(INDEX_op_mulsh, type, rh, src1, src2);
> +        tcg_gen_mov(type, rl, t);

Reply via email to