On 11/18/20 12:29 AM, [email protected] wrote:
> +static void gen_pack(TCGv ret, TCGv arg1, TCGv arg2)
> +{
> +    TCGv lower, higher;
> +    lower = tcg_temp_new();
> +    higher = tcg_temp_new();
> +
> +#ifdef TARGET_RISCV64
> +    tcg_gen_ext32u_tl(lower, arg1);
> +    tcg_gen_shli_tl(higher, arg2, 32);
> +#else
> +    tcg_gen_ext16u_tl(lower, arg1);
> +    tcg_gen_shli_tl(higher, arg2, 16);
> +#endif
> +

tcg_gen_deposit(ret, arg1, arg2,
                TARGET_LONG_BITS / 2,
                TARGET_LONG_BITS / 2);

> +static void gen_packu(TCGv ret, TCGv arg1, TCGv arg2)
> +{
> +    TCGv lower, higher;
> +    lower = tcg_temp_new();
> +    higher = tcg_temp_new();
> +
> +#ifdef TARGET_RISCV64
> +    tcg_gen_shri_tl(lower, arg1, 32);
> +    tcg_gen_shri_tl(higher, arg2, 32);
> +    tcg_gen_shli_tl(higher, higher, 32);
> +#else
> +    tcg_gen_shri_tl(lower, arg1, 16);
> +    tcg_gen_shri_tl(higher, arg2, 16);
> +    tcg_gen_shli_tl(higher, higher, 16);
> +#endif
> +
> +    tcg_gen_or_tl(ret, higher, lower);

tcg_gen_shri_tl(t, arg1, TARGET_LONG_BITS / 2);
tcg_gen_deposit_tl(ret, arg2, t, 0, TARGET_LONG_BITS / 2);

> +static void gen_packh(TCGv ret, TCGv arg1, TCGv arg2)
> +{
> +    TCGv lower, higher;
> +    lower = tcg_temp_new();
> +    higher = tcg_temp_new();
> +
> +    tcg_gen_ext8u_tl(lower, arg1);
> +    tcg_gen_ext8u_tl(higher, arg2);
> +    tcg_gen_shli_tl(higher, higher, 8);
> +
> +    tcg_gen_or_tl(ret, higher, lower);

tcg_gen_ext8u_tl(t, arg2);
tcg_gen_deposit_tl(ret, arg1, t, 8, TARGET_LONG_BITS - 8);

> +static void gen_packw(TCGv ret, TCGv arg1, TCGv arg2)
> +{
> +    TCGv lower, higher;
> +    lower = tcg_temp_new();
> +    higher = tcg_temp_new();
> +
> +    tcg_gen_ext16u_tl(lower, arg1);
> +    tcg_gen_shli_tl(higher, arg2, 16);
> +    tcg_gen_or_tl(ret, higher, lower);
> +
> +    tcg_gen_ext32s_tl(ret, ret);
> +
> +    tcg_temp_free(lower);
> +    tcg_temp_free(higher);
> +}

tcg_gen_ext16s_i64(t, arg2);
tcg_gen_deposit_i64(ret, arg1, t, 16, 48);

> +static void gen_packuw(TCGv ret, TCGv arg1, TCGv arg2)
> +{
> +    TCGv lower, higher;
> +    lower = tcg_temp_new();
> +    higher = tcg_temp_new();
> +
> +    tcg_gen_shri_tl(lower, arg1, 16);
> +    tcg_gen_shri_tl(higher, arg2, 16);
> +    tcg_gen_shli_tl(higher, higher, 16);
> +    tcg_gen_or_tl(ret, higher, lower);
> +
> +    tcg_gen_ext32s_tl(ret, ret);

tcg_gen_shri_i64(t, arg1, 16);
tcg_gen_deposit_i64(ret, arg2, t, 0, 16);
tcg_gen_ext32s_i64(ret, ret);


r~

Reply via email to