C.ADDIW is reserved for rd=0
authorAndrew Waterman <waterman@cs.berkeley.edu>
Fri, 20 Nov 2015 03:00:14 +0000 (19:00 -0800)
committerAndrew Waterman <waterman@cs.berkeley.edu>
Fri, 20 Nov 2015 03:00:14 +0000 (19:00 -0800)
riscv/insns/c_jal.h

index 068c441ee2c3f02f36c94d0b49af63371c89f036..4f156f61fbe3dc22b9565225ee7dcf5bfc57fdea 100644 (file)
@@ -3,6 +3,7 @@ if (xlen == 32) {
   reg_t tmp = npc;
   set_pc(pc + insn.rvc_j_imm());
   WRITE_REG(X_RA, tmp);
-} else {
+} else { // c.addiw
+  require(insn.rvc_rd() != 0);
   WRITE_RD(sext32(RVC_RS1 + insn.rvc_imm()));
 }