mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[ARM][TargetParser] Improve handling of dependencies between target features
The patch at https://reviews.llvm.org/D64048 added "negative" dependency handling in `ARM::appendArchExtFeatures`: feature "noX" removes all features, which imply "X". This patch adds the "positive" handling: feature "X" adds all the feature strings implied by "X". (This patch also comes from the suggestion here https://reviews.llvm.org/D72633#inline-658582) Differential Revision: https://reviews.llvm.org/D72762
This commit is contained in:
parent
16edf004ac
commit
ad184987b8
@ -498,11 +498,14 @@ bool ARM::appendArchExtFeatures(
|
||||
return false;
|
||||
|
||||
for (const auto AE : ARCHExtNames) {
|
||||
if (Negated && (AE.ID & ID) == ID && AE.NegFeature)
|
||||
if (Negated) {
|
||||
if ((AE.ID & ID) == ID && AE.NegFeature)
|
||||
Features.push_back(AE.NegFeature);
|
||||
else if (AE.ID == ID && AE.Feature)
|
||||
} else {
|
||||
if ((AE.ID & ID) == AE.ID && AE.Feature)
|
||||
Features.push_back(AE.Feature);
|
||||
}
|
||||
}
|
||||
|
||||
if (CPU == "")
|
||||
CPU = "generic";
|
||||
|
@ -637,6 +637,27 @@ TEST(TargetParserTest, ARMArchExtFeature) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
testArchExtDependency(const char *ArchExt,
|
||||
const std::initializer_list<const char *> &Expected) {
|
||||
std::vector<StringRef> Features;
|
||||
|
||||
if (!ARM::appendArchExtFeatures("", ARM::ArchKind::ARMV8_1MMainline, ArchExt,
|
||||
Features))
|
||||
return false;
|
||||
|
||||
return llvm::all_of(Expected, [&](StringRef Ext) {
|
||||
return llvm::is_contained(Features, Ext);
|
||||
});
|
||||
}
|
||||
|
||||
TEST(TargetParserTest, ARMArchExtDependencies) {
|
||||
EXPECT_TRUE(testArchExtDependency("mve", {"+mve", "+dsp"}));
|
||||
EXPECT_TRUE(testArchExtDependency("mve.fp", {"+mve.fp", "+mve", "+dsp"}));
|
||||
EXPECT_TRUE(testArchExtDependency("nodsp", {"-dsp", "-mve", "-mve.fp"}));
|
||||
EXPECT_TRUE(testArchExtDependency("nomve", {"-mve", "-mve.fp"}));
|
||||
}
|
||||
|
||||
TEST(TargetParserTest, ARMparseHWDiv) {
|
||||
const char *hwdiv[] = {"thumb", "arm", "arm,thumb", "thumb,arm"};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user