[llvm] 844355a - [RISC-V] remove I ext when E ext has been enabled (#92070)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 15:26:49 PDT 2024
Author: VincentWu
Date: 2024-05-15T08:26:45+10:00
New Revision: 844355a8cb4b4fa4a6fa39ac47e1169233bb7130
URL: https://github.com/llvm/llvm-project/commit/844355a8cb4b4fa4a6fa39ac47e1169233bb7130
DIFF: https://github.com/llvm/llvm-project/commit/844355a8cb4b4fa4a6fa39ac47e1169233bb7130.diff
LOG: [RISC-V] remove I ext when E ext has been enabled (#92070)
After patch https://github.com/llvm/llvm-project/pull/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, at function
```
This patch reset the I ext in FeatureBit when `+e` has been specify
Added:
Modified:
llvm/lib/TargetParser/RISCVISAInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index e22dd6032cb0c..575c9dbad5156 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -758,6 +758,8 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
}
Error RISCVISAInfo::checkDependency() {
+ bool HasE = Exts.count("e") != 0;
+ bool HasI = Exts.count("i") != 0;
bool HasC = Exts.count("c") != 0;
bool HasF = Exts.count("f") != 0;
bool HasZfinx = Exts.count("zfinx") != 0;
@@ -765,6 +767,10 @@ Error RISCVISAInfo::checkDependency() {
bool HasZvl = MinVLen != 0;
bool HasZcmt = Exts.count("zcmt") != 0;
+ if (HasI && HasE)
+ return createStringError(errc::invalid_argument,
+ "'I' and 'E' extensions are incompatible");
+
if (HasF && HasZfinx)
return createStringError(errc::invalid_argument,
"'f' and 'zfinx' extensions are incompatible");
@@ -852,6 +858,9 @@ void RISCVISAInfo::updateImplication() {
addExtension("i", Version.value());
}
+ if (HasE && HasI)
+ Exts.erase("i");
+
assert(llvm::is_sorted(ImpliedExts) && "Table not sorted by Name");
// This loop may execute over 1 iteration since implication can be layered
More information about the llvm-commits
mailing list