qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 04/30] tcg/loongarch: Add generated instruction opcodes and e


From: WANG Xuerui
Subject: Re: [PATCH 04/30] tcg/loongarch: Add generated instruction opcodes and encoding helpers
Date: Tue, 21 Sep 2021 19:40:42 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Thunderbird/94.0a1

Hi Philippe,

On 9/21/21 17:58, Philippe Mathieu-Daudé wrote:
On 9/20/21 10:04, WANG Xuerui wrote:
Signed-off-by: WANG Xuerui <git@xen0n.name>
---
  tcg/loongarch/tcg-insn-defs.c.inc | 1080 +++++++++++++++++++++++++++++
  1 file changed, 1080 insertions(+)
  create mode 100644 tcg/loongarch/tcg-insn-defs.c.inc

+static int32_t encode_dj_slots(LoongArchInsn opc, uint32_t d, uint32_t j)
+{
Can we move the range check to the callee and avoid masking the values
in the caller?

       tcg_debug_assert(d < 0x20);
       tcg_debug_assert(j < 0x20);

Making use of tcg_debug_assert would be rather nice, but in fact different instructions could have differently sized fields start from the same offset. Take the "bstrpick.w" and "bstrpick.d" instructions, they belong to DJUk5Um5 and DJUk6Um6 formats respectively; the "Uk5" and "Uk6" fields both start from the 10th bit but have different value ranges. So the range checks necessarily live in encoders for the individual formats.




reply via email to

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