[llvm] r366031 - [TargetParser][ARM] Account dependencies when processing target features
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 14 13:31:15 PDT 2019
Author: alelab01
Date: Sun Jul 14 13:31:15 2019
New Revision: 366031
URL: http://llvm.org/viewvc/llvm-project?rev=366031&view=rev
Log:
[TargetParser][ARM] Account dependencies when processing target features
Teaches ARM::appendArchExtFeatures to account dependencies when processing
target features: i.e. when you say -march=armv8.1-m.main+mve.fp+nofp it
means mve.fp should get discarded too. (Split from D63936)
Differential Revision: https://reviews.llvm.org/D64048
Modified:
llvm/trunk/include/llvm/Support/ARMTargetParser.def
llvm/trunk/lib/Support/ARMTargetParser.cpp
Modified: llvm/trunk/include/llvm/Support/ARMTargetParser.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ARMTargetParser.def?rev=366031&r1=366030&r2=366031&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ARMTargetParser.def (original)
+++ llvm/trunk/include/llvm/Support/ARMTargetParser.def Sun Jul 14 13:31:15 2019
@@ -149,8 +149,8 @@ ARM_ARCH_EXT_NAME("dotprod", ARM::AEK_D
ARM_ARCH_EXT_NAME("dsp", ARM::AEK_DSP, "+dsp", "-dsp")
ARM_ARCH_EXT_NAME("fp", ARM::AEK_FP, nullptr, nullptr)
ARM_ARCH_EXT_NAME("fp.dp", ARM::AEK_FP_DP, nullptr, nullptr)
-ARM_ARCH_EXT_NAME("mve", ARM::AEK_SIMD, "+mve", "-mve")
-ARM_ARCH_EXT_NAME("mve.fp", (ARM::AEK_SIMD | ARM::AEK_FP), "+mve.fp", "-mve.fp")
+ARM_ARCH_EXT_NAME("mve", (ARM::AEK_DSP | ARM::AEK_SIMD), "+mve", "-mve")
+ARM_ARCH_EXT_NAME("mve.fp", (ARM::AEK_DSP | ARM::AEK_SIMD | ARM::AEK_FP), "+mve.fp", "-mve.fp")
ARM_ARCH_EXT_NAME("idiv", (ARM::AEK_HWDIVARM | ARM::AEK_HWDIVTHUMB), nullptr, nullptr)
ARM_ARCH_EXT_NAME("mp", ARM::AEK_MP, nullptr, nullptr)
ARM_ARCH_EXT_NAME("simd", ARM::AEK_SIMD, nullptr, nullptr)
Modified: llvm/trunk/lib/Support/ARMTargetParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/ARMTargetParser.cpp?rev=366031&r1=366030&r2=366031&view=diff
==============================================================================
--- llvm/trunk/lib/Support/ARMTargetParser.cpp (original)
+++ llvm/trunk/lib/Support/ARMTargetParser.cpp Sun Jul 14 13:31:15 2019
@@ -490,16 +490,30 @@ static unsigned findDoublePrecisionFPU(u
return ARM::FK_INVALID;
}
+static unsigned getAEKID(StringRef ArchExtName) {
+ for (const auto AE : ARM::ARCHExtNames)
+ if (AE.getName() == ArchExtName)
+ return AE.ID;
+ return ARM::AEK_INVALID;
+}
+
bool ARM::appendArchExtFeatures(
StringRef CPU, ARM::ArchKind AK, StringRef ArchExt,
std::vector<StringRef> &Features) {
- StringRef StandardFeature = getArchExtFeature(ArchExt);
- if (!StandardFeature.empty()) {
- Features.push_back(StandardFeature);
- return true;
- }
+ size_t StartingNumFeatures = Features.size();
const bool Negated = stripNegationPrefix(ArchExt);
+ unsigned ID = getAEKID(ArchExt);
+
+ if (ID == AEK_INVALID)
+ return false;
+
+ for (const auto AE : ARCHExtNames) {
+ if (Negated && (AE.ID & ID) == ID && AE.NegFeature)
+ Features.push_back(AE.NegFeature);
+ else if (AE.ID == ID && AE.Feature)
+ Features.push_back(AE.Feature);
+ }
if (CPU == "")
CPU = "generic";
@@ -519,7 +533,7 @@ bool ARM::appendArchExtFeatures(
}
return ARM::getFPUFeatures(FPUKind, Features);
}
- return false;
+ return StartingNumFeatures != Features.size();
}
StringRef ARM::getHWDivName(unsigned HWDivKind) {
More information about the llvm-commits
mailing list