qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 02/14] target/riscv: rvk: add support for zbkb extension


From: Weiwei Li
Subject: Re: [PATCH v6 02/14] target/riscv: rvk: add support for zbkb extension
Date: Mon, 28 Feb 2022 11:02:47 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

Thanks for your comments.

在 2022/2/28 上午2:47, Richard Henderson 写道:
On 2/27/22 04:25, Weiwei Li wrote:
+static void gen_packh(TCGv ret, TCGv src1, TCGv src2)
+{
+    TCGv t = tcg_temp_new();
+
+    tcg_gen_ext8u_tl(t, src2);
+    tcg_gen_deposit_tl(ret, src1, t, 8, TARGET_LONG_BITS - 8);
+    tcg_temp_free(t);
+}
+
+static void gen_packw(TCGv ret, TCGv src1, TCGv src2)
+{
+    TCGv t = tcg_temp_new();
+
+    tcg_gen_ext16s_tl(t, src2);
+    tcg_gen_deposit_tl(ret, src1, t, 16, 48);
+    tcg_temp_free(t);
+}

Missing TARGET_LONG_BITS here; would break on RV32.
packw is RV64-only instruction. Is it necessary to use TARGET_LONG_BITS here?


+static bool trans_brev8(DisasContext *ctx, arg_brev8 *a)
+{
+    REQUIRE_ZBKB(ctx);
+
+    TCGv dest = dest_gpr(ctx, a->rd);
+    TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+
+    gen_helper_brev8(dest, src1);
+    gen_set_gpr(ctx, a->rd, dest);
+
+    return true;
+}
...

+static bool trans_unzip(DisasContext *ctx, arg_unzip *a)
+{
+    REQUIRE_ZBKB(ctx);
+    REQUIRE_32BIT(ctx);
+
+    TCGv dest = dest_gpr(ctx, a->rd);
+    TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+
+    gen_helper_unzip(dest, src1);
+    gen_set_gpr(ctx, a->rd, dest);
+
+    return true;
+}
+
+static bool trans_zip(DisasContext *ctx, arg_zip *a)
+{
+    REQUIRE_ZBKB(ctx);
+    REQUIRE_32BIT(ctx);
+
+    TCGv dest = dest_gpr(ctx, a->rd);
+    TCGv src1 = get_gpr(ctx, a->rs1, EXT_NONE);
+
+    gen_helper_zip(dest, src1);
+    gen_set_gpr(ctx, a->rd, dest);
+
+    return true;
+}

Use gen_unary.

OK. I'll fix it.

Regards,

Weiwei Li


r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]