Skip to content

Commit 4008b00

Browse files
committed
[RISCV] Use RVInst16CB for C_SRLI64_HINT and C_SRAI64_HINT.
c.srli(64) and c.srai(64) are encoded differently than c.slli(64). The former have a 3-bit register, while the latter has a 5-bit register. The "let Inst{11-10} =" prevented this from causing any functional issues by dropping the upper 2 bits of the reigster. The ins/outs list uses GPRC so the register class is constrained.
1 parent 3c4f009 commit 4008b00

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfoC.td

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -705,23 +705,23 @@ def C_SLLI64_HINT : RVInst16CI<0b000, 0b10, (outs GPR:$rd_wb), (ins GPR:$rd),
705705
let Inst{12} = 0;
706706
}
707707

708-
def C_SRLI64_HINT : RVInst16CI<0b100, 0b01, (outs GPRC:$rd_wb),
709-
(ins GPRC:$rd),
710-
"c.srli64", "$rd">,
708+
def C_SRLI64_HINT : RVInst16CB<0b100, 0b01, (outs GPRC:$rs1_wb),
709+
(ins GPRC:$rs1),
710+
"c.srli64", "$rs1">,
711711
Sched<[WriteShiftImm, ReadShiftImm]> {
712-
let Constraints = "$rd = $rd_wb";
712+
let Constraints = "$rs1 = $rs1_wb";
713713
let Inst{6-2} = 0;
714-
let Inst{11-10} = 0;
714+
let Inst{11-10} = 0b00;
715715
let Inst{12} = 0;
716716
}
717717

718-
def C_SRAI64_HINT : RVInst16CI<0b100, 0b01, (outs GPRC:$rd_wb),
719-
(ins GPRC:$rd),
720-
"c.srai64", "$rd">,
718+
def C_SRAI64_HINT : RVInst16CB<0b100, 0b01, (outs GPRC:$rs1_wb),
719+
(ins GPRC:$rs1),
720+
"c.srai64", "$rs1">,
721721
Sched<[WriteShiftImm, ReadShiftImm]> {
722-
let Constraints = "$rd = $rd_wb";
722+
let Constraints = "$rs1 = $rs1_wb";
723723
let Inst{6-2} = 0;
724-
let Inst{11-10} = 1;
724+
let Inst{11-10} = 0b01;
725725
let Inst{12} = 0;
726726
}
727727

0 commit comments

Comments
 (0)