C.ADDI x0, 4: illegal instruction ?

Alex Rocha Prado alex.prado@nxp.com
Wed Jun 26 16:45:00 GMT 2019


    Hi all,

    I noticed binuntils 2.32 assembles the instruction c.addi x0, 4 without any error but from my understanding RISC-V spec defines that as an illegal instruction.

    Latest official user-level  spec version is 2.2, on page 82, C.ADDI instruction are not allowed to have rs1/rd equal to 0 if nzimm field different from 0. If both rd/rs1 and nzimm are 0, then instruction is actually C.NOP. So, "c.addi x0, 4" is an illegal instruction and assembler should give an error.

    Am I missing anything ?

Regards,
Alex Rocha Prado



More information about the Binutils mailing list