qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Richard Bagley <rbagley@ventanamicro.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
	alistair.francis@wdc.com, bmeng@tinylab.org,
	liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com,
	palmer@rivosinc.com, dbarboza@ventanamicro.com
Subject: Re: [PATCH] disas/riscv: Further correction to LUI disassembly
Date: Mon, 7 Aug 2023 15:59:53 -0700	[thread overview]
Message-ID: <cb6a9e96-0767-9980-03a5-10d22aa0ec21@linaro.org> (raw)
In-Reply-To: <CAARkPA_6=u6fM6F4RYC9Zdfw0iQ6sE5Zp1649gAr3_BBR-GRMg@mail.gmail.com>

On 8/7/23 15:01, Richard Bagley wrote:
> I do apologize, but I do not understand your remark at all. Could I trouble you to spell 
> this out.
> 
> In:
> +                snprintf(tmp, sizeof(tmp), "%d", dec->imm >> 12 & 0xfffff);
> 0xfffff is a mask which recovers the 20 bit field used to represent the immediate in the 
> instruction encoding.
> 
> You seem to be responding to the syntax, which is unrelated to my change.
> But I did notice it is the case that both GCC and LLVM disassemblers do not accept signed 
> integer arguments to LUI:
> lui r1, -1
> but instead require
> lui r1, 0xfffff

Your language is confusing.  Disassembler or assembler?  A disassembler would not "accept" 
but "output" arguments for LUI.

If the assembler rejects "lui r1, -1", that would be a bug, because the field *is* signed.

For the disassembler, the field *is* signed, therefore outputting a signed value is 
correct.  Outputting an unsigned hex value hides the fact that bit 31 is the sign.

To my mind this is exactly the same as emitting a signed value for the immediate in ADDI.


r~


  reply	other threads:[~2023-08-07 23:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 18:33 [PATCH] disas/riscv: Further correction to LUI disassembly Richard Bagley
2023-07-31 20:37 ` Richard Henderson
2023-08-07 22:01   ` Richard Bagley
2023-08-07 22:59     ` Richard Henderson [this message]
2023-08-10 15:31 ` Andrew Jones
2023-08-10 16:12   ` Palmer Dabbelt
2023-08-10 16:27     ` Andrew Jones
2023-08-11  8:25       ` Andrew Jones
2023-08-11 11:55         ` Andrew Jones
2024-03-08  0:08           ` Richard Bagley
2024-03-09  4:22             ` Richard Bagley
2024-03-09 12:01               ` Andrew Jones
2024-03-11 18:56                 ` Richard Bagley
2024-03-11 20:00                   ` Richard Bagley
2024-03-12 11:09                   ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb6a9e96-0767-9980-03a5-10d22aa0ec21@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bmeng@tinylab.org \
    --cc=dbarboza@ventanamicro.com \
    --cc=liweiwei@iscas.ac.cn \
    --cc=palmer@rivosinc.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=rbagley@ventanamicro.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).