qemu-riscv
[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: Richard Henderson
Subject: Re: [PATCH v6 02/14] target/riscv: rvk: add support for zbkb extension
Date: Mon, 28 Feb 2022 08:16:37 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2/27/22 17:02, Weiwei Li wrote:
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?

Ah, I see. So it's not buggy, as-is, but it certainly looks odd next to the previous, and it wouldn't be buggy to use TARGET_LONG_BITS either.

This points out that it would be a good idea to keep these generator functions next to the trans function that uses them, for context.


r~



reply via email to

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