You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 17, 2022. It is now read-only.
According to the "Assembly Programmer's Handbook" in the ISA manual, nop is a pseudo-instruction and is equivalent to addi x0, x0, 0. However the current assembler treats them differently and is unable to output a compressed encoding for the latter:
It looks like an oversight. In the base instruction set, nop is an alias for addi, but in the compressed intsruction set, c.nop and a.addi are different instructions with similar encodings. c.addi with a zero immediate is a hint. c.nop with a non-zero immediate is a hint (in v2.3 draft). So we can't compress addi x0,x0,0 to c.addi, but we could compress it to c.nop. A rule for that is missing in the opcode table.
My perspective is that there are four C instructions corresponding to base addi, c.addi, c.addi4spn, c.addi16sp, and c.nop, and they should all be handled; the current behavior additionally breaks the conceptual model where pseudoinstructions are expanded before compression.
I added a patch upstream. This just missed the binutils 2.30 branch. I don't think it is important enough to backport to that release branch, which would require additional testing for little or no gain.
According to the "Assembly Programmer's Handbook" in the ISA manual,
nop
is a pseudo-instruction and is equivalent toaddi x0, x0, 0
. However the current assembler treats them differently and is unable to output a compressed encoding for the latter:If this behavior is deliberate it should be documented somewhere.
Context: http://lkml.iu.edu/hypermail/linux/kernel/1801.1/06322.html
The text was updated successfully, but these errors were encountered: