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
8 changes: 8 additions & 0 deletions llvm/lib/Target/RISCV/RISCVInstrInfo.td
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ def simm12 : RISCVSImmLeafOp<12> {
int64_t Imm;
if (MCOp.evaluateAsConstantImm(Imm))
return isInt<12>(Imm);
// Needed to make CHERIOT mnemonic aliases work.
if (STI.hasFeature(RISCV::FeatureVendorXCheriot) &&
MCOp.isExpr())
return true;
return MCOp.isBareSymbolRef();
}];
}
Expand Down Expand Up @@ -292,6 +296,10 @@ class UImm20OperandMaybeSym : RISCVUImmOp<20> {
int64_t Imm;
if (MCOp.evaluateAsConstantImm(Imm))
return isUInt<20>(Imm);
// Needed to make CHERIOT mnemonic aliases work.
if (STI.hasFeature(RISCV::FeatureVendorXCheriot) &&
MCOp.isExpr())
return true;
return MCOp.isBareSymbolRef();
}];
}
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Target/RISCV/RISCVInstrInfoXCheri.td
Original file line number Diff line number Diff line change
Expand Up @@ -2056,9 +2056,8 @@ def PseudoCTAIL : Pseudo<(outs), (ins cap_call_symbol:$dst), []> {
let AsmString = "ctail\t$dst";
}

let Predicates = [HasCheriot] in def : InstAlias<
"ct.ctail $dst",
(PseudoCTAIL cap_call_symbol:$dst)>;
let Predicates = [HasCheriot] in
def : InstAlias<"ct.ctail $dst", (PseudoCTAIL cap_call_symbol:$dst)>;

let Predicates = [HasCheri, IsCapMode, IsPureCapABI],
isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, Uses = [C2] in
Expand Down
9 changes: 9 additions & 0 deletions llvm/test/MC/RISCV/cheri/cheriot-only.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// NOTE: Assertions have been autogenerated by utils/update_mc_test_checks.py UTC_ARGS: --version 5
// RUN: llvm-mc %s -triple=riscv32cheriot -mcpu=cheriot -mattr=+xcheri,+xcheriot | FileCheck %s -check-prefixes=CHERIOT

foo:
// CHERIOT: foo:
auipcc ct3, %cheriot_compartment_hi(foo)
// CHERIOT: ct.auipcc ct3, %cheriot_compartment_hi(foo)
clc ct2, %cheriot_compartment_lo_i(foo)(ct2)
// CHERIOT: ct.clc ct2, %cheriot_compartment_lo_i(foo)(ct2)
2 changes: 1 addition & 1 deletion llvm/test/MC/RISCV/cheri/cheriot.s
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,4 @@ ctestsubset x7, ca5, ca3
// CHERI: ctestsubset t2, ca5, ca3 # encoding: [0xdb,0x83,0xd7,0x40]
cunseal ca5, ca3, ca1
// CHERIOT: ct.cunseal ca5, ca3, ca1 # encoding: [0xdb,0x87,0xb6,0x18]
// CHERI: cunseal ca5, ca3, ca1 # encoding: [0xdb,0x87,0xb6,0x18]
// CHERI: cunseal ca5, ca3, ca1 # encoding: [0xdb,0x87,0xb6,0x18]