[clang] [llvm] [AArch64TargetParser]Fix reconstructFromParsedFeatures ignoring negative features (PR #142236)
Alexandros Lamprineas via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 5 12:42:00 PDT 2025
================
@@ -1831,6 +1831,22 @@ TEST_P(AArch64ExtensionDependenciesBaseCPUTestFixture,
}
}
+TEST(TargetParserTest, testAArch64ReconstructFromParsedFeatures) {
+ AArch64::ExtensionSet Extensions;
+ std::vector<std::string> FeatureOptions = {
+ "-sve2", "-Baz", "+sve", "+FooBar", "+sve2", "+neon", "-sve",
+ };
+ std::vector<std::string> NonExtensions;
+ Extensions.reconstructFromParsedFeatures(FeatureOptions, NonExtensions);
+
+ std::vector<std::string> NonExtensionsExpected = {"-Baz", "+FooBar"};
+ ASSERT_THAT(NonExtensions, testing::ContainerEq(NonExtensionsExpected));
+ std::vector<StringRef> Features;
+ Extensions.toLLVMFeatureList(Features);
+ std::vector<StringRef> FeaturesExpected = {"+neon", "-sve", "+sve2"};
----------------
labrinea wrote:
I would expect the following:
```
Touched: sve2, sve, neon
Enabled: neon
```
If an extension is Touched but not Enabled it should be printed with a '-'. That said I don't understand why we expect +sve2 and not -sve2. I would expect -sve to transitively disable sve2 since it is dependant.
https://github.com/llvm/llvm-project/pull/142236
More information about the llvm-commits
mailing list