[PATCH] D22956: Ajust two tests implementation of TargetParserTest

jojo.ma via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 00:41:36 PDT 2016


jojo created this revision.
jojo added reviewers: djasper, rengolin.
jojo added a subscriber: llvm-commits.

The loop from 0 ~ AEK_XSCALE(0x80000000) in these tests will over the entire int range. 
Actually,the ArchExtKind from AEK_OS(0x8000000) to AEK_XSCALE(0x80000000) are unsupported extensions for now.
So do not care about these extensions in the tests of TargetParserTest.
If these extensions will be supported in the future,they would be given a reasonable value absolutely.

https://reviews.llvm.org/D22956

Files:
  unittests/Support/TargetParserTest.cpp

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<ARM::ArchExtKind>(0);
+       AEK <= ARM::ArchExtKind::AEK_RAS;
+       AEK = static_cast<ARM::ArchExtKind>(static_cast<unsigned>(AEK) + 1))
+    EXPECT_TRUE(contains(kARMArchExtKinds, static_cast<unsigned>(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<ARM::ArchExtKind>(0);
+       AEK <= ARM::ArchExtKind::AEK_RAS;
+       AEK = static_cast<ARM::ArchExtKind>(static_cast<unsigned>(AEK) + 1))
+    EXPECT_TRUE(contains(kHWDivKinds, static_cast<unsigned>(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());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22956.66090.patch
Type: text/x-patch
Size: 2067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160729/993a332a/attachment.bin>


More information about the llvm-commits mailing list