Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2024-03-12 Thread Andrew Jones
On Mon, Mar 11, 2024 at 11:56:42AM -0700, Richard Bagley wrote: > I have realized that *the patch is indeed a fix*, not a workaround. > > In fact, the argument to LUI and AUIPC in assembly *must* be a number > between [0x0, 0xf]. > RISC-V Assembly Programmer's Manual : Load Upper Immediate's

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2024-03-11 Thread Richard Bagley
LUI and AUIPC would naturally be used to build an address. If you want to supply a signed decimal number to build an immediate, there is always the pseudo-instruction LI. On Mon, Mar 11, 2024 at 11:56 AM Richard Bagley wrote: > I have realized that *the patch is indeed a fix*, not a workaround.

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2024-03-11 Thread Richard Bagley
I have realized that *the patch is indeed a fix*, not a workaround. In fact, the argument to LUI and AUIPC in assembly *must* be a number between [0x0, 0xf]. RISC-V Assembly Programmer's Manual : Load Upper Immediate's Immediate

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2024-03-09 Thread Andrew Jones
On Fri, Mar 08, 2024 at 08:22:01PM -0800, Richard Bagley wrote: > post-nack, one further comment: > > One could argue that this change also aligns QEMU with supporting tools (as > Andrew observed), and it makes sense to merge this change into QEMU until > those tools update to supporting signed

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2024-03-08 Thread Richard Bagley
post-nack, one further comment: One could argue that this change also aligns QEMU with supporting tools (as Andrew observed), and it makes sense to merge this change into QEMU until those tools update to supporting signed decimal numbers with immediates. As it is, both GNU assembler and the LLVM

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2024-03-07 Thread Richard Bagley
NACK We have established that the change is a workaround for a bug in the assembler. I withdraw the merge request. Thank you for this careful review. On Fri, Aug 11, 2023 at 4:55 AM Andrew Jones wrote: > On Fri, Aug 11, 2023 at 10:25:52AM +0200, Andrew Jones wrote: > > On Thu, Aug 10, 2023 at

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-11 Thread Andrew Jones
On Fri, Aug 11, 2023 at 10:25:52AM +0200, Andrew Jones wrote: > On Thu, Aug 10, 2023 at 06:27:50PM +0200, Andrew Jones wrote: > > On Thu, Aug 10, 2023 at 09:12:42AM -0700, Palmer Dabbelt wrote: > > > On Thu, 10 Aug 2023 08:31:46 PDT (-0700), ajo...@ventanamicro.com wrote: > > > > On Mon, Jul 31,

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-11 Thread Andrew Jones
On Thu, Aug 10, 2023 at 06:27:50PM +0200, Andrew Jones wrote: > On Thu, Aug 10, 2023 at 09:12:42AM -0700, Palmer Dabbelt wrote: > > On Thu, 10 Aug 2023 08:31:46 PDT (-0700), ajo...@ventanamicro.com wrote: > > > On Mon, Jul 31, 2023 at 11:33:20AM -0700, Richard Bagley wrote: > > > > The recent

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-10 Thread Andrew Jones
On Thu, Aug 10, 2023 at 09:12:42AM -0700, Palmer Dabbelt wrote: > On Thu, 10 Aug 2023 08:31:46 PDT (-0700), ajo...@ventanamicro.com wrote: > > On Mon, Jul 31, 2023 at 11:33:20AM -0700, Richard Bagley wrote: > > > The recent commit 36df75a0a9 corrected one aspect of LUI disassembly > > > by

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-10 Thread Palmer Dabbelt
On Thu, 10 Aug 2023 08:31:46 PDT (-0700), ajo...@ventanamicro.com wrote: On Mon, Jul 31, 2023 at 11:33:20AM -0700, Richard Bagley wrote: The recent commit 36df75a0a9 corrected one aspect of LUI disassembly by recovering the immediate argument from the result of LUI with a shift right by 12.

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-10 Thread Andrew Jones
On Mon, Jul 31, 2023 at 11:33:20AM -0700, Richard Bagley wrote: > The recent commit 36df75a0a9 corrected one aspect of LUI disassembly > by recovering the immediate argument from the result of LUI with a > shift right by 12. However, the shift right will left-fill with the > sign. By applying a

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-07 Thread Richard Henderson
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 & 0xf); 0xf is a mask which recovers the 20 bit field used to represent the

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-08-07 Thread Richard Bagley
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 & 0xf); 0xf is a mask which recovers the 20 bit field used to represent the immediate in the instruction encoding. You

Re: [PATCH] disas/riscv: Further correction to LUI disassembly

2023-07-31 Thread Richard Henderson
On 7/31/23 11:33, Richard Bagley wrote: The recent commit 36df75a0a9 corrected one aspect of LUI disassembly by recovering the immediate argument from the result of LUI with a shift right by 12. However, the shift right will left-fill with the sign. By applying a mask we recover an unsigned

[PATCH] disas/riscv: Further correction to LUI disassembly

2023-07-31 Thread Richard Bagley
The recent commit 36df75a0a9 corrected one aspect of LUI disassembly by recovering the immediate argument from the result of LUI with a shift right by 12. However, the shift right will left-fill with the sign. By applying a mask we recover an unsigned representation of the 20-bit field (which