This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
C.ADDI x0, 4: illegal instruction ?
- From: Alex Rocha Prado <alex dot prado at nxp dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Wed, 26 Jun 2019 16:45:31 +0000
- Subject: C.ADDI x0, 4: illegal instruction ?
- Arc-authentication-results: i=1; test.office365.com 1;spf=none;dmarc=none;dkim=none;arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=testarcselector01; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6OpvX0w5W1gzYlpHVHtN9pKGlwPUu7aOEZgLtXR4MOI=; b=ST6Sh+xxo+fK8rxpKOYcpitb6t4Ol1Yn7hWHxlODnkiIv2+Tf4E7fY9+Q27HM6tb19xafmtT1/Ty4hj3mcZIaa+OUJ3vMXRIu/Ue/Tc+9TOWPeXR4vGypLdXZQV3CoKjqdQhmcEsW5BWpBWRzjNnkZTX0tStvXQFtTiSj/PrbRg=
- Arc-seal: i=1; a=rsa-sha256; s=testarcselector01; d=microsoft.com; cv=none; b=nmHZkkZ0Ux+9ipnovo2F1eut8iwOd+4SKQp2qhl0Y9kFGh7RrmJb3OEtlKkUsuCRLedrwd2j+0IXY0phN0PShRWupUpJ+AF5kkp/JKMKgHVIAJ4kDWc8GZux72aqZvIqI1eyfAtVWEtjsh5yqsLOzkbHqP2u7Q2tFBtDXoTwXPY=
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