On 11/18/20 12:29 AM, [email protected] wrote:
> +static bool gen_cxzw(DisasContext *ctx, arg_r2 *a,
> + void(*func)(TCGv_i32, TCGv_i32, uint32_t))
...
> +static bool gen_cxz(DisasContext *ctx, arg_r2 *a,
> + void(*func)(TCGv, TCGv, target_ulong))
I think both of these are unnecessary and you should use the gen_unary that you
introduce in the next patch. ctz/clz cannot produce a negative number and do
not need extension.
You should simply add wrappers like you do for gen_pcntw to truncate and
operate:
static void gen_ctz(TCGv ret, TCGv arg1)
{
tcg_gen_ctz_tl(ret, arg1, TARGET_LONG_BITS);
}
static void gen_clz(TCGv ret, TCGv arg1)
{
tcg_gen_clz_tl(ret, arg1, TARGET_LONG_BITS);
}
static void gen_ctzw(TCGv ret, TCGv arg1)
{
tcg_gen_ori_i64(ret, arg1, MAKE_64BIT_MASK(32, 32));
tcg_gen_ctz_i64(ret, ret, 32);
}
static void gen_clzw(TCGv ret, TCGv arg1)
{
tcg_gen_ext32u_i64(ret, arg1);
tcg_gen_ctz_i64(ret, ret, 64);
tcg_gen_subi_i64(ret, ret, 32);
}
r~