This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: C.ADDI x0, 4: illegal instruction ?
- From: Jim Wilson <jimw at sifive dot com>
- To: Palmer Dabbelt <palmer at sifive dot com>
- Cc: Alex Rocha Prado <alex dot prado at nxp dot com>, Binutils <binutils at sourceware dot org>
- Date: Thu, 27 Jun 2019 13:10:20 -0700
- Subject: Re: C.ADDI x0, 4: illegal instruction ?
- References: <AM0PR04MB43872062F1248F041D65C41885E20@AM0PR04MB4387.eurprd04.prod.outlook.com> <mhng-84230b3d-c52f-44c8-9834-5e5ab05b71c8@palmer-si-x1e>
On Wed, Jun 26, 2019 at 11:34 PM Palmer Dabbelt <palmer@sifive.com> wrote:
> The ISA manual says
>
> C.ADDI adds the non-zero sign-extended 6-bit immediate to the value in register
> rd then writes the result to rd. C.ADDI expands into addi rd, rd, nzimm[5:0].
> C.ADDI is only valid when rd = x0. The code point with both rd=x0 and nzimm=0
> encodes the C.NOP instruction; the remaining code points with either rd=x0 or
> nzimm=0 encode HINTs. C.ADDIW is an RV64C/RV128C-only instruction that
> performs the same computation but pro-
This text changed yesterday by the way, because it was ambiguous.
This is the c.addi documentation, stating that rd=x0 is a hint,
thereby clearly implying that "c.addi x0,4" is a valid hint
instruction. The text is now changed to mention that only nzimm=0 is
a hint, and the rd=x0 hint text was moved to the c.nop documentation.
Jim