Index: unittests/Support/TargetParserTest.cpp =================================================================== --- unittests/Support/TargetParserTest.cpp +++ unittests/Support/TargetParserTest.cpp @@ -16,6 +16,18 @@ using namespace llvm; namespace { +static const unsigned kHWDivKinds[] = { +#define ARM_HW_DIV_NAME(NAME, ID) ID, +#include "llvm/Support/ARMTargetParser.def" +#undef ARM_HW_DIV_NAME +}; + +static const unsigned kARMArchExtKinds[] = { +#define ARM_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) ID, +#include "llvm/Support/ARMTargetParser.def" +#undef ARM_ARCH_EXT_NAME +}; + static const unsigned kAArch64ArchExtKinds[] = { #define AARCH64_ARCH_EXT_NAME(NAME, ID, FEATURE, NEGFEATURE) ID, #include "llvm/Support/AArch64TargetParser.def" @@ -201,6 +213,15 @@ : (kARMARCHNames[AK].ArchAttr == ARM::getArchAttr(AK))); } +TEST(TargetParserTest, ARMArchExtName) { + for (ARM::ArchExtKind AEK = static_cast(0); + AEK <= ARM::ArchExtKind::AEK_RAS; + AEK = static_cast(static_cast(AEK) + 1)) + EXPECT_TRUE(contains(kARMArchExtKinds, static_cast(AEK)) + ? !ARM::getArchExtName(AEK).empty() + : ARM::getArchExtName(AEK).empty()); +} + TEST(TargetParserTest, ARMArchExtFeature) { const char *ArchExt[][4] = {{"crc", "nocrc", "+crc", "-crc"}, {"crypto", "nocrypto", "+crypto", "-crypto"}, @@ -225,6 +246,15 @@ } } +TEST(TargetParserTest, ARMHWDivName) { + for (ARM::ArchExtKind AEK = static_cast(0); + AEK <= ARM::ArchExtKind::AEK_RAS; + AEK = static_cast(static_cast(AEK) + 1)) + EXPECT_TRUE(contains(kHWDivKinds, static_cast(AEK)) + ? !ARM::getHWDivName(AEK).empty() + : ARM::getHWDivName(AEK).empty()); +} + TEST(TargetParserTest, ARMDefaultCPU) { for (unsigned i = 0; i < array_lengthof(ARMArch); i++) EXPECT_FALSE(ARM::getDefaultCPU(ARMArch[i]).empty());