qemu-devel
[Top][All Lists]
Advanced

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

Re: [RFC PATCH 2/8] riscv: Generate payload scripts


From: LIU Zhiwei
Subject: Re: [RFC PATCH 2/8] riscv: Generate payload scripts
Date: Wed, 20 May 2020 17:06:39 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0



On 2020/5/20 13:41, Richard Henderson wrote:
On 5/19/20 7:37 PM, LIU Zhiwei wrote:
On 2020/5/12 1:40, Richard Henderson wrote:
On 4/30/20 12:21 AM, LIU Zhiwei wrote:
+    # sequence of li rd, 0x1234567887654321
+    #
+    #  0:   002471b7                lui     rd,0x247
+    #  4:   8ad1819b                addiw   rd,rd,-1875
+    #  8:   00c19193                slli    rd,rd,0xc
+    #  c:   f1118193                addi    rd,rd,-239 # 0x246f11
+    # 10:   00d19193                slli    rd,rd,0xd
+    # 14:   d9518193                addi    rd,rd,-619
+    # 18:   00e19193                slli    rd,rd,0xe
+    # 1c:   32118193                addi    rd,rd,801
You don't really need to use addiw.  Removing that special case would really
simplify this.
I think I don't get it. Do you mean that the immediate will not be 64 bit?
Well, mostly the immediate will be small, actually.  But the interface must
support 64-bit immediates.

I'm saying that for this computation,

        lui
        addi
        slli
        addi
        ...

is the same.  You don't *have* to use addiw.
I see addiw is not good, as it is a RV64 only instruction. I think addi is right and better.

But I'm afraid I don't get

"Removing that special case would really
simplify this."

Do you mean I need not the decode_li function if I use addi instead of addiw?

Zhiwei

r~




reply via email to

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