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 I don't see why the former is more accurate, but it would be an aid to the assembly programmer. I have recommended internally that if the current format cannot support both, then it might be worthwhile to propose a pseudo instruction for RISCV for precisely this syntax variant: lui.s r1.-1 Richard On Mon, Jul 31, 2023 at 1:37 PM Richard Henderson < [email protected]> wrote: > 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 representation of the > > 20-bit field (which includes a sign bit). > > Why would you want that? Surely > > lui r1, -1 > > is more accurate than > > lui r1, 0xfffff > > > r~ >
