[llvm] [RISCV] Add Tied operands to insert instructions in Qualcomm uC extension Xqcibm (PR #151339)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 07:06:27 PDT 2025
https://github.com/hchandel updated https://github.com/llvm/llvm-project/pull/151339
>From d357d2731e68bca20f302a266c43b76b86fec076 Mon Sep 17 00:00:00 2001
From: Harsh Chandel <hchandel at qti.qualcomm.com>
Date: Wed, 30 Jul 2025 17:34:09 +0530
Subject: [PATCH] [RISCV] Add Tied operands to insert instructions in Qualcomm
uC XQCI extension
Change-Id: Ie84a7b894470377ba71817822be2dc0dcb8270c0
---
llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td | 38 ++++++++++++++++-----
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
index 52656134b7774..cd24304ce5939 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
@@ -457,6 +457,13 @@ class QCIRVInstRR<bits<5> funct5, DAGOperand InTyRs1, string opcodestr>
: RVInstR<{0b00, funct5}, 0b011, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
(ins InTyRs1:$rs1, GPRNoX0:$rs2), opcodestr, "$rd, $rs1, $rs2">;
+class QCIRVInstRRTied<bits<5> funct5, DAGOperand InTyRs1, string opcodestr>
+ : RVInstR<{0b00, funct5}, 0b011, OPC_CUSTOM_0, (outs GPRNoX0:$rd_wb),
+ (ins GPRNoX0:$rd, InTyRs1:$rs1, GPRNoX0:$rs2), opcodestr,
+ "$rd, $rs1, $rs2"> {
+ let Constraints = "$rd = $rd_wb";
+}
+
class QCIBitManipRII<bits<3> funct3, bits<2> funct2,
DAGOperand InTyRs1, string opcodestr>
: RVInstIBase<funct3, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
@@ -470,11 +477,26 @@ class QCIBitManipRII<bits<3> funct3, bits<2> funct2,
let Inst{24-20} = shamt;
}
+class QCIBitManipRIITied<bits<3> funct3, bits<2> funct2,
+ DAGOperand InTyRs1, string opcodestr>
+ : RVInstIBase<funct3, OPC_CUSTOM_0, (outs GPRNoX0:$rd_wb), (ins GPRNoX0:$rd,
+ InTyRs1:$rs1, uimm5_plus1:$width, uimm5:$shamt),
+ opcodestr, "$rd, $rs1, $width, $shamt"> {
+ let Constraints = "$rd = $rd_wb";
+ bits<5> shamt;
+ bits<5> width;
+
+ let Inst{31-30} = funct2;
+ let Inst{29-25} = width;
+ let Inst{24-20} = shamt;
+}
+
class QCIRVInstRI<bits<1> funct1, DAGOperand InTyImm11,
string opcodestr>
- : RVInstIBase<0b000, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
- (ins GPRNoX0:$rs1, InTyImm11:$imm11), opcodestr,
+ : RVInstIBase<0b000, OPC_CUSTOM_0, (outs GPRNoX0:$rd_wb),
+ (ins GPRNoX0:$rd, GPRNoX0:$rs1, InTyImm11:$imm11), opcodestr,
"$rd, $rs1, $imm11"> {
+ let Constraints = "$rd = $rd_wb";
bits<11> imm11;
let Inst{31-31} = funct1;
@@ -858,12 +880,12 @@ let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
let Inst{29-25} = width;
let Inst{24-20} = shamt;
}
- def QC_INSB : QCIBitManipRII<0b001, 0b01, GPR, "qc.insb">;
- def QC_INSBH : QCIBitManipRII<0b001, 0b10, GPR, "qc.insbh">;
- def QC_INSBR : QCIRVInstRR<0b00000, GPR, "qc.insbr">;
- def QC_INSBHR : QCIRVInstRR<0b00001, GPR, "qc.insbhr">;
- def QC_INSBPR : QCIRVInstRR<0b00010, GPR, "qc.insbpr">;
- def QC_INSBPRH : QCIRVInstRR<0b00011, GPR, "qc.insbprh">;
+ def QC_INSB : QCIBitManipRIITied<0b001, 0b01, GPR, "qc.insb">;
+ def QC_INSBH : QCIBitManipRIITied<0b001, 0b10, GPR, "qc.insbh">;
+ def QC_INSBR : QCIRVInstRRTied<0b00000, GPR, "qc.insbr">;
+ def QC_INSBHR : QCIRVInstRRTied<0b00001, GPR, "qc.insbhr">;
+ def QC_INSBPR : QCIRVInstRRTied<0b00010, GPR, "qc.insbpr">;
+ def QC_INSBPRH : QCIRVInstRRTied<0b00011, GPR, "qc.insbprh">;
def QC_EXTU : QCIBitManipRII<0b010, 0b00, GPRNoX0, "qc.extu">;
def QC_EXTDU : QCIBitManipRII<0b010, 0b10, GPRNoX31, "qc.extdu">;
def QC_EXTDUR : QCIRVInstRR<0b00100, GPRNoX31, "qc.extdur">;
More information about the llvm-commits
mailing list