Skip to content

Commit

Permalink
[AArch64] remove pointless AEK_NONE (llvm#97569)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmatheson-arm committed Jul 4, 2024
1 parent 94b2b1d commit 81660bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
15 changes: 4 additions & 11 deletions llvm/unittests/TargetParser/TargetParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ std::string FormatExtensionFlags(int64_t Flags) {

std::string FormatExtensionFlags(AArch64::ExtensionBitset Flags) {
std::vector<StringRef> Features;

// AEK_NONE is not meant to be shown to the user so the target parser
// does not recognise it. It is relevant here though.
if (Flags.test(AArch64::AEK_NONE))
Features.push_back("none");
AArch64::getExtensionFeatures(Flags, Features);

// The target parser also includes every extension you don't have.
Expand Down Expand Up @@ -2009,10 +2004,9 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
for (auto Ext : Extensions)
ExtVal.set(Ext);

// NONE has no feature names.
// We return True here because NONE is a valid choice.
EXPECT_TRUE(AArch64::getExtensionFeatures({AArch64::AEK_NONE}, Features));
EXPECT_TRUE(!Features.size());
// Test an empty set of features.
EXPECT_TRUE(AArch64::getExtensionFeatures({}, Features));
EXPECT_TRUE(Features.size() == 0);

AArch64::getExtensionFeatures(ExtVal, Features);
EXPECT_EQ(Extensions.size(), Features.size());
Expand Down Expand Up @@ -2092,8 +2086,7 @@ TEST(TargetParserTest, AArch64ExtensionFeatures) {
EXPECT_TRUE(llvm::is_contained(Features, "+complxnum"));

// Assuming we listed every extension above, this should produce the same
// result. (note that AEK_NONE doesn't have a name so it won't be in the
// result despite its bit being set)
// result.
std::vector<StringRef> AllFeatures;
EXPECT_TRUE(AArch64::getExtensionFeatures(ExtVal, AllFeatures));
EXPECT_THAT(Features, ::testing::ContainerEq(AllFeatures));
Expand Down
7 changes: 2 additions & 5 deletions llvm/utils/TableGen/ARMTargetDefEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) {

// Emit the ArchExtKind enum
OS << "#ifdef EMIT_ARCHEXTKIND_ENUM\n"
<< "enum ArchExtKind : unsigned {\n"
<< " AEK_NONE = 1,\n";
<< "enum ArchExtKind : unsigned {\n";
for (const Record *Rec : SortedExtensions) {
auto AEK = Rec->getValueAsString("ArchExtKindSpelling").upper();
if (AEK != "AEK_NONE")
OS << " " << AEK << ",\n";
OS << " " << AEK << ",\n";
}
OS << " AEK_NUM_EXTENSIONS\n"
<< "};\n"
Expand All @@ -108,7 +106,6 @@ static void EmitARMTargetDef(RecordKeeper &RK, raw_ostream &OS) {
OS << ", \"-" << Rec->getValueAsString("Name") << "\""; // negfeature
OS << "},\n";
};
OS << " {\"none\", {}, AArch64::AEK_NONE, {}, {}, {}, {} },\n";
OS << "};\n"
<< "#undef EMIT_EXTENSIONS\n"
<< "#endif // EMIT_EXTENSIONS\n"
Expand Down

0 comments on commit 81660bb

Please sign in to comment.