summaryrefslogtreecommitdiff
path: root/runtime/arch/instruction_set_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2017-11-01 14:35:42 +0000
committer Vladimir Marko <vmarko@google.com> 2017-11-02 10:11:02 +0000
commit33bff25bcd7a02d35c54f63740eadb1a4833fc92 (patch)
tree553db4f60878acf2a0fa7036a739d406df9a29b7 /runtime/arch/instruction_set_test.cc
parent321b3ca9a36d769283c64d4bdee0798db80af524 (diff)
ART: Make InstructionSet an enum class and add kLast.
Adding InstructionSet::kLast shall make it easier to encode the InstructionSet in fewer bits using BitField<>. However, introducing `kLast` into the `art` namespace is not a good idea, so we change the InstructionSet to an enum class. This also uncovered a case of InstructionSet::kNone being erroneously used instead of vixl32::Condition::None(), so it's good to remove `kNone` from the `art` namespace. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Change-Id: I6fa6168dfba4ed6da86d021a69c80224f09997a6
Diffstat (limited to 'runtime/arch/instruction_set_test.cc')
-rw-r--r--runtime/arch/instruction_set_test.cc50
1 files changed, 28 insertions, 22 deletions
diff --git a/runtime/arch/instruction_set_test.cc b/runtime/arch/instruction_set_test.cc
index b251b57c99..12a117d7a1 100644
--- a/runtime/arch/instruction_set_test.cc
+++ b/runtime/arch/instruction_set_test.cc
@@ -23,34 +23,40 @@
namespace art {
TEST(InstructionSetTest, GetInstructionSetFromString) {
- EXPECT_EQ(kArm, GetInstructionSetFromString("arm"));
- EXPECT_EQ(kArm64, GetInstructionSetFromString("arm64"));
- EXPECT_EQ(kX86, GetInstructionSetFromString("x86"));
- EXPECT_EQ(kX86_64, GetInstructionSetFromString("x86_64"));
- EXPECT_EQ(kMips, GetInstructionSetFromString("mips"));
- EXPECT_EQ(kMips64, GetInstructionSetFromString("mips64"));
- EXPECT_EQ(kNone, GetInstructionSetFromString("none"));
- EXPECT_EQ(kNone, GetInstructionSetFromString("random-string"));
+ EXPECT_EQ(InstructionSet::kArm, GetInstructionSetFromString("arm"));
+ EXPECT_EQ(InstructionSet::kArm64, GetInstructionSetFromString("arm64"));
+ EXPECT_EQ(InstructionSet::kX86, GetInstructionSetFromString("x86"));
+ EXPECT_EQ(InstructionSet::kX86_64, GetInstructionSetFromString("x86_64"));
+ EXPECT_EQ(InstructionSet::kMips, GetInstructionSetFromString("mips"));
+ EXPECT_EQ(InstructionSet::kMips64, GetInstructionSetFromString("mips64"));
+ EXPECT_EQ(InstructionSet::kNone, GetInstructionSetFromString("none"));
+ EXPECT_EQ(InstructionSet::kNone, GetInstructionSetFromString("random-string"));
}
TEST(InstructionSetTest, GetInstructionSetString) {
- EXPECT_STREQ("arm", GetInstructionSetString(kArm));
- EXPECT_STREQ("arm", GetInstructionSetString(kThumb2));
- EXPECT_STREQ("arm64", GetInstructionSetString(kArm64));
- EXPECT_STREQ("x86", GetInstructionSetString(kX86));
- EXPECT_STREQ("x86_64", GetInstructionSetString(kX86_64));
- EXPECT_STREQ("mips", GetInstructionSetString(kMips));
- EXPECT_STREQ("mips64", GetInstructionSetString(kMips64));
- EXPECT_STREQ("none", GetInstructionSetString(kNone));
+ EXPECT_STREQ("arm", GetInstructionSetString(InstructionSet::kArm));
+ EXPECT_STREQ("arm", GetInstructionSetString(InstructionSet::kThumb2));
+ EXPECT_STREQ("arm64", GetInstructionSetString(InstructionSet::kArm64));
+ EXPECT_STREQ("x86", GetInstructionSetString(InstructionSet::kX86));
+ EXPECT_STREQ("x86_64", GetInstructionSetString(InstructionSet::kX86_64));
+ EXPECT_STREQ("mips", GetInstructionSetString(InstructionSet::kMips));
+ EXPECT_STREQ("mips64", GetInstructionSetString(InstructionSet::kMips64));
+ EXPECT_STREQ("none", GetInstructionSetString(InstructionSet::kNone));
}
TEST(InstructionSetTest, GetInstructionSetInstructionAlignment) {
- EXPECT_EQ(GetInstructionSetInstructionAlignment(kThumb2), kThumb2InstructionAlignment);
- EXPECT_EQ(GetInstructionSetInstructionAlignment(kArm64), kArm64InstructionAlignment);
- EXPECT_EQ(GetInstructionSetInstructionAlignment(kX86), kX86InstructionAlignment);
- EXPECT_EQ(GetInstructionSetInstructionAlignment(kX86_64), kX86_64InstructionAlignment);
- EXPECT_EQ(GetInstructionSetInstructionAlignment(kMips), kMipsInstructionAlignment);
- EXPECT_EQ(GetInstructionSetInstructionAlignment(kMips64), kMips64InstructionAlignment);
+ EXPECT_EQ(GetInstructionSetInstructionAlignment(InstructionSet::kThumb2),
+ kThumb2InstructionAlignment);
+ EXPECT_EQ(GetInstructionSetInstructionAlignment(InstructionSet::kArm64),
+ kArm64InstructionAlignment);
+ EXPECT_EQ(GetInstructionSetInstructionAlignment(InstructionSet::kX86),
+ kX86InstructionAlignment);
+ EXPECT_EQ(GetInstructionSetInstructionAlignment(InstructionSet::kX86_64),
+ kX86_64InstructionAlignment);
+ EXPECT_EQ(GetInstructionSetInstructionAlignment(InstructionSet::kMips),
+ kMipsInstructionAlignment);
+ EXPECT_EQ(GetInstructionSetInstructionAlignment(InstructionSet::kMips64),
+ kMips64InstructionAlignment);
}
TEST(InstructionSetTest, TestRoundTrip) {