Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/test/Driver/print-supported-extensions-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
// CHECK-NEXT: svukte 0.3 'Svukte' (Address-Independent Latency of User-Mode Faults to Supervisor Addresses)
// CHECK-NEXT: xqcia 0.2 'Xqcia' (Qualcomm uC Arithmetic Extension)
// CHECK-NEXT: xqciac 0.2 'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)
// CHECK-NEXT: xqcicli 0.2 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
// CHECK-NEXT: xqcics 0.2 'Xqcics' (Qualcomm uC Conditional Select Extension)
// CHECK-NEXT: xqcicsr 0.2 'Xqcicsr' (Qualcomm uC CSR Extension)
// CHECK-NEXT: xqcilsm 0.2 'Xqcilsm' (Qualcomm uC Load Store Multiple Extension)
Expand Down
3 changes: 3 additions & 0 deletions llvm/docs/RISCVUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ The current vendor extensions supported are:
``experimental-Xqciac``
LLVM implements `version 0.2 of the Qualcomm uC Load-Store Address Calculation extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.

``experimental-Xqcicli``
LLVM implements `version 0.2 of the Qualcomm uC Conditional Load Immediate extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.

``experimental-Xqcics``
LLVM implements `version 0.2 of the Qualcomm uC Conditional Select extension specification <https://github.com/quic/riscv-unified-db/releases/latest>`__ by Qualcomm. All instructions are prefixed with `qc.` as described in the specification. These instructions are only available for riscv32.

Expand Down
2 changes: 2 additions & 0 deletions llvm/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ Changes to the RISC-V Backend
extension.
* Adds experimental assembler support for the Qualcomm uC 'Xqcilsm` (Load Store Multiple)
extension.
* Adds experimental assembler support for the Qualcomm uC 'Xqcicli` (Conditional Load Immediate)
extension.

Changes to the WebAssembly Backend
----------------------------------
Expand Down
3 changes: 3 additions & 0 deletions llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,9 @@ DecodeStatus RISCVDisassembler::getInstruction32(MCInst &MI, uint64_t &Size,
TRY_TO_DECODE_FEATURE(
RISCV::FeatureVendorXqciac, DecoderTableXqciac32,
"Qualcomm uC Load-Store Address Calculation custom opcode table");
TRY_TO_DECODE_FEATURE(
RISCV::FeatureVendorXqcicli, DecoderTableXqcicli32,
"Qualcomm uC Conditional Load Immediate custom opcode table");
TRY_TO_DECODE(true, DecoderTable32, "RISCV32 table");

return MCDisassembler::Fail;
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/Target/RISCV/RISCVFeatures.td
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,14 @@ def HasVendorXqciac
AssemblerPredicate<(all_of FeatureVendorXqciac),
"'Xqciac' (Qualcomm uC Load-Store Address Calculation Extension)">;

def FeatureVendorXqcicli
: RISCVExperimentalExtension<0, 2,
"Qualcomm uC Conditional Load Immediate Extension">;
def HasVendorXqcicli
: Predicate<"Subtarget->hasVendorXqcicli()">,
AssemblerPredicate<(all_of FeatureVendorXqcicli),
"'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)">;

//===----------------------------------------------------------------------===//
// LLVM specific features and extensions
//===----------------------------------------------------------------------===//
Expand Down
27 changes: 27 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ class QCIStoreMultiple<bits<2> funct2, DAGOperand InTyRs2, string opcodestr>
let Inst{31-25} = {funct2, imm{6-2}};
}

let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in
class QCILICC<bits<3> funct3, bits<2> funct2, DAGOperand InTyRs2, string opcodestr>
: RVInstRBase<funct3, OPC_CUSTOM_2, (outs GPRNoX0:$rd_wb),
(ins GPRNoX0:$rd, GPRNoX0:$rs1, InTyRs2:$rs2, simm5:$simm),
opcodestr, "$rd, $rs1, $rs2, $simm"> {
let Constraints = "$rd = $rd_wb";
bits<5> simm;

let Inst{31-25} = {simm, funct2};
}

//===----------------------------------------------------------------------===//
// Instructions
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -243,6 +254,22 @@ let Predicates = [HasVendorXqcilsm, IsRV32], DecoderNamespace = "Xqcilsm" in {
def QC_LWMI : QCILoadMultiple<0b01, uimm5nonzero, "qc.lwmi">;
} // Predicates = [HasVendorXqcilsm, IsRV32], DecoderNamespace = "Xqcilsm"

let Predicates = [HasVendorXqcicli, IsRV32], DecoderNamespace = "Xqcicli" in {
def QC_LIEQ : QCILICC<0b000, 0b01, GPRNoX0, "qc.lieq">;
def QC_LINE : QCILICC<0b001, 0b01, GPRNoX0, "qc.line">;
def QC_LILT : QCILICC<0b100, 0b01, GPRNoX0, "qc.lilt">;
def QC_LIGE : QCILICC<0b101, 0b01, GPRNoX0, "qc.lige">;
def QC_LILTU : QCILICC<0b110, 0b01, GPRNoX0, "qc.liltu">;
def QC_LIGEU : QCILICC<0b111, 0b01, GPRNoX0, "qc.ligeu">;

def QC_LIEQI : QCILICC<0b000, 0b11, simm5, "qc.lieqi">;
def QC_LINEI : QCILICC<0b001, 0b11, simm5, "qc.linei">;
def QC_LILTI : QCILICC<0b100, 0b11, simm5, "qc.lilti">;
def QC_LIGEI : QCILICC<0b101, 0b11, simm5, "qc.ligei">;
def QC_LILTUI : QCILICC<0b110, 0b11, uimm5, "qc.liltui">;
def QC_LIGEUI : QCILICC<0b111, 0b11, uimm5, "qc.ligeui">;
} // Predicates = [HasVendorXqcicli, IsRV32], DecoderNamespace = "Xqcicli"

//===----------------------------------------------------------------------===//
// Aliases
//===----------------------------------------------------------------------===//
Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/TargetParser/RISCVISAInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ Error RISCVISAInfo::checkDependency() {
bool HasZvl = MinVLen != 0;
bool HasZcmt = Exts.count("zcmt") != 0;
static constexpr StringLiteral XqciExts[] = {
{"xqcia"}, {"xqciac"}, {"xqcics"}, {"xqcicsr"}, {"xqcilsm"}, {"xqcisls"}};
{"xqcia"}, {"xqciac"}, {"xqcicli"}, {"xqcics"},
{"xqcicsr"}, {"xqcilsm"}, {"xqcisls"}};

if (HasI && HasE)
return getIncompatibleError("i", "e");
Expand Down
2 changes: 2 additions & 0 deletions llvm/test/CodeGen/RISCV/attributes.ll
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
; RUN: llc -mtriple=riscv32 -mattr=+xwchc %s -o - | FileCheck --check-prefix=RV32XWCHC %s
; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcia %s -o - | FileCheck --check-prefix=RV32XQCIA %s
; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqciac %s -o - | FileCheck --check-prefix=RV32XQCIAC %s
; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcicli %s -o - | FileCheck --check-prefix=RV32XQCICLI %s
; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcics %s -o - | FileCheck --check-prefix=RV32XQCICS %s
; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcicsr %s -o - | FileCheck --check-prefix=RV32XQCICSR %s
; RUN: llc -mtriple=riscv32 -mattr=+experimental-xqcilsm %s -o - | FileCheck --check-prefix=RV32XQCILSM %s
Expand Down Expand Up @@ -393,6 +394,7 @@
; RV32XWCHC: .attribute 5, "rv32i2p1_xwchc2p2"
; RV32XQCIA: .attribute 5, "rv32i2p1_xqcia0p2"
; RV32XQCIAC: .attribute 5, "rv32i2p1_zca1p0_xqciac0p2"
; RV32XQCICLI: .attribute 5, "rv32i2p1_xqcicli0p2"
; RV32XQCICS: .attribute 5, "rv32i2p1_xqcics0p2"
; RV32XQCICSR: .attribute 5, "rv32i2p1_xqcicsr0p2"
; RV32XQCILSM: .attribute 5, "rv32i2p1_xqcilsm0p2"
Expand Down
232 changes: 232 additions & 0 deletions llvm/test/MC/RISCV/xqcicli-invalid.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# Xqcicli - Qualcomm uC Conditional Load Immediate Instructions
# RUN: not llvm-mc -triple riscv32 -mattr=+experimental-xqcicli < %s 2>&1 \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-PLUS %s
# RUN: not llvm-mc -triple riscv32 -mattr=-experimental-xqcicli < %s 2>&1 \
# RUN: | FileCheck -check-prefixes=CHECK,CHECK-MINUS %s

# CHECK: :[[@LINE+1]]:9: error: invalid operand for instruction
qc.lieq x0, x4, x6, 10

# CHECK: :[[@LINE+1]]:13: error: invalid operand for instruction
qc.lieq x2, x0, x6, 10

# CHECK: :[[@LINE+1]]:17: error: invalid operand for instruction
qc.lieq x2, x4, x0, 10

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.lieq x2, x4, x6

# CHECK-PLUS: :[[@LINE+1]]:21: error: immediate must be an integer in the range [-16, 15]
qc.lieq x2, x4, x6, 40

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.lieq x2, x4, x6, 10


# CHECK: :[[@LINE+1]]:9: error: invalid operand for instruction
qc.lige x0, x8, x20, 2

# CHECK: :[[@LINE+1]]:13: error: invalid operand for instruction
qc.lige x4, x0, x20, 2

# CHECK: :[[@LINE+1]]:17: error: invalid operand for instruction
qc.lige x4, x8, x0, 2

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.lige x4, x8, x20

# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
qc.lige x4, x8, x20, -18

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.lige x4, x8, x20, 2


# CHECK: :[[@LINE+1]]:9: error: invalid operand for instruction
qc.lilt x0, x9, x10, 3

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.lilt x19, x0, x10, 3

# CHECK: :[[@LINE+1]]:18: error: invalid operand for instruction
qc.lilt x19, x9, x0, 3

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.lilt x19, x9, x10

# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
qc.lilt x19, x9, x10, 39

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.lilt x19, x9, x10, 3


# CHECK: :[[@LINE+1]]:9: error: invalid operand for instruction
qc.line x0, x14, x6, 10

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.line x18, x0, x6, 10

# CHECK: :[[@LINE+1]]:19: error: invalid operand for instruction
qc.line x18, x14, x0, 10

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.line x18, x14, x6

# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
qc.line x18, x14, x6, 100

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.line x18, x14, x6, 10


# CHECK: :[[@LINE+1]]:10: error: invalid operand for instruction
qc.ligeu x0, x4, x6, 10

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.ligeu x2, x0, x6, 10

# CHECK: :[[@LINE+1]]:18: error: invalid operand for instruction
qc.ligeu x2, x4, x0, 10

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.ligeu x2, x4, x6

# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
qc.ligeu x2, x4, x6, 70

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.ligeu x2, x4, x6, 10


# CHECK: :[[@LINE+1]]:10: error: invalid operand for instruction
qc.liltu x0, x19, x12, 13

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.liltu x1, x0, x12, 13

# CHECK: :[[@LINE+1]]:19: error: invalid operand for instruction
qc.liltu x1, x19, x0, 13

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.liltu x1, x19, x12

# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
qc.liltu x1, x19, x12, 73

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.liltu x1, x19, x12, 13


# CHECK: :[[@LINE+1]]:10: error: invalid operand for instruction
qc.lieqi x0, x1, 15, 12

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.lieqi x7, x0, 15, 12

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.lieqi x7, x1, 15

# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be an integer in the range [-16, 15]
qc.lieqi x7, x1, 25, 12

# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
qc.lieqi x7, x1, 15, -22

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.lieqi x7, x1, 15, 12


# CHECK: :[[@LINE+1]]:10: error: invalid operand for instruction
qc.ligei x0, x11, -4, 9

# CHECK: :[[@LINE+1]]:15: error: invalid operand for instruction
qc.ligei x17, x0, -4, 9

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.ligei x17, x11, -4

# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [-16, 15]
qc.ligei x17, x11, -24, 9

# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
qc.ligei x17, x11, -4, 59

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.ligei x17, x11, -4, 9


# CHECK: :[[@LINE+1]]:10: error: invalid operand for instruction
qc.lilti x0, x11, -14, 2

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.lilti x9, x0, -14, 2

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.lilti x9, x11, -14

# CHECK-PLUS: :[[@LINE+1]]:19: error: immediate must be an integer in the range [-16, 15]
qc.lilti x9, x11, -84, 2

# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
qc.lilti x9, x11, -14, 52

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.lilti x9, x11, -14, 2


# CHECK: :[[@LINE+1]]:10: error: invalid operand for instruction
qc.linei x0, x1, 10, 12

# CHECK: :[[@LINE+1]]:14: error: invalid operand for instruction
qc.linei x5, x0, 10, 12

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.linei x5, x1, 10

# CHECK-PLUS: :[[@LINE+1]]:18: error: immediate must be an integer in the range [-16, 15]
qc.linei x5, x1, 130, 12

# CHECK-PLUS: :[[@LINE+1]]:22: error: immediate must be an integer in the range [-16, 15]
qc.linei x5, x1, 10, 124

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.linei x5, x1, 10, 12


# CHECK: :[[@LINE+1]]:11: error: invalid operand for instruction
qc.ligeui x0, x12, 7, -12

# CHECK: :[[@LINE+1]]:15: error: invalid operand for instruction
qc.ligeui x2, x0, 7, -12

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.ligeui x2, x12, 7

# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [0, 31]
qc.ligeui x2, x12, -7, -12

# CHECK-PLUS: :[[@LINE+1]]:23: error: immediate must be an integer in the range [-16, 15]
qc.ligeui x2, x12, 7, -17

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.ligeui x2, x12, 7, -12


# CHECK: :[[@LINE+1]]:11: error: invalid operand for instruction
qc.liltui x0, x25, 31, 12

# CHECK: :[[@LINE+1]]:15: error: invalid operand for instruction
qc.liltui x3, x0, 31, 12

# CHECK: :[[@LINE+1]]:1: error: too few operands for instruction
qc.liltui x3, x25, 31

# CHECK-PLUS: :[[@LINE+1]]:20: error: immediate must be an integer in the range [0, 31]
qc.liltui x3, x25, 32, 12

# CHECK-PLUS: :[[@LINE+1]]:24: error: immediate must be an integer in the range [-16, 15]
qc.liltui x3, x25, 31, 112

# CHECK-MINUS: :[[@LINE+1]]:1: error: instruction requires the following: 'Xqcicli' (Qualcomm uC Conditional Load Immediate Extension)
qc.liltui x3, x25, 31, 12
Loading
Loading