Skip to content

Commit 844355a

Browse files
authored
[RISC-V] remove I ext when E ext has been enabled (#92070)
After patch #88805 `I` Ext will be added automatically when we running the command like `./build/bin/llc -mtriple=riscv32 -mattr=+e -target-abi ilp32e -verify-machineinstrs llvm/test/CodeGen/RISCV/zcmp-additional-stack.ll` it will generate ``` .text .attribute 4, 16 .attribute 5, "rv32i2p1_e2pe" .file "zcmp-additional-stack.ll" .globl func # -- Begin function func .p2align 1 .type func,@function ``` This patch reset the I ext in FeatureBit when `+e` has been specify
1 parent 99fad7e commit 844355a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,13 +758,19 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
758758
}
759759

760760
Error RISCVISAInfo::checkDependency() {
761+
bool HasE = Exts.count("e") != 0;
762+
bool HasI = Exts.count("i") != 0;
761763
bool HasC = Exts.count("c") != 0;
762764
bool HasF = Exts.count("f") != 0;
763765
bool HasZfinx = Exts.count("zfinx") != 0;
764766
bool HasVector = Exts.count("zve32x") != 0;
765767
bool HasZvl = MinVLen != 0;
766768
bool HasZcmt = Exts.count("zcmt") != 0;
767769

770+
if (HasI && HasE)
771+
return createStringError(errc::invalid_argument,
772+
"'I' and 'E' extensions are incompatible");
773+
768774
if (HasF && HasZfinx)
769775
return createStringError(errc::invalid_argument,
770776
"'f' and 'zfinx' extensions are incompatible");
@@ -852,6 +858,9 @@ void RISCVISAInfo::updateImplication() {
852858
addExtension("i", Version.value());
853859
}
854860

861+
if (HasE && HasI)
862+
Exts.erase("i");
863+
855864
assert(llvm::is_sorted(ImpliedExts) && "Table not sorted by Name");
856865

857866
// This loop may execute over 1 iteration since implication can be layered

0 commit comments

Comments
 (0)