Merge "ARM64: Clean-up and extend the supported cpu_variant list."
diff --git a/runtime/arch/arm64/instruction_set_features_arm64.cc b/runtime/arch/arm64/instruction_set_features_arm64.cc
index c598743..01bd177 100644
--- a/runtime/arch/arm64/instruction_set_features_arm64.cc
+++ b/runtime/arch/arm64/instruction_set_features_arm64.cc
@@ -33,7 +33,16 @@
const std::string& variant, std::string* error_msg) {
// Look for variants that need a fix for a53 erratum 835769.
static const char* arm64_variants_with_a53_835769_bug[] = {
- "default", "generic", "cortex-a53" // Pessimistically assume all generic ARM64s are A53s.
+ // Pessimistically assume all generic CPUs are cortex-a53.
+ "default",
+ "generic",
+ "cortex-a53",
+ "cortex-a53.a57",
+ "cortex-a53.a72",
+ // Pessimistically assume all "big" cortex CPUs are paired with a cortex-a53.
+ "cortex-a57",
+ "cortex-a72",
+ "cortex-a73",
};
bool needs_a53_835769_fix = FindVariantInArray(arm64_variants_with_a53_835769_bug,
arraysize(arm64_variants_with_a53_835769_bug),
@@ -42,7 +51,10 @@
if (!needs_a53_835769_fix) {
// Check to see if this is an expected variant.
static const char* arm64_known_variants[] = {
- "denver64", "kryo", "exynos-m1"
+ "cortex-a35",
+ "exynos-m1",
+ "denver64",
+ "kryo"
};
if (!FindVariantInArray(arm64_known_variants, arraysize(arm64_known_variants), variant)) {
std::ostringstream os;
diff --git a/runtime/arch/arm64/instruction_set_features_arm64_test.cc b/runtime/arch/arm64/instruction_set_features_arm64_test.cc
index cefa499..91cb58f 100644
--- a/runtime/arch/arm64/instruction_set_features_arm64_test.cc
+++ b/runtime/arch/arm64/instruction_set_features_arm64_test.cc
@@ -30,6 +30,40 @@
EXPECT_TRUE(arm64_features->Equals(arm64_features.get()));
EXPECT_STREQ("a53", arm64_features->GetFeatureString().c_str());
EXPECT_EQ(arm64_features->AsBitmap(), 1U);
+
+ std::unique_ptr<const InstructionSetFeatures> cortex_a57_features(
+ InstructionSetFeatures::FromVariant(kArm64, "cortex-a57", &error_msg));
+ ASSERT_TRUE(cortex_a57_features.get() != nullptr) << error_msg;
+ EXPECT_EQ(cortex_a57_features->GetInstructionSet(), kArm64);
+ EXPECT_TRUE(cortex_a57_features->Equals(cortex_a57_features.get()));
+ EXPECT_STREQ("a53", cortex_a57_features->GetFeatureString().c_str());
+ EXPECT_EQ(cortex_a57_features->AsBitmap(), 1U);
+
+ std::unique_ptr<const InstructionSetFeatures> cortex_a73_features(
+ InstructionSetFeatures::FromVariant(kArm64, "cortex-a73", &error_msg));
+ ASSERT_TRUE(cortex_a73_features.get() != nullptr) << error_msg;
+ EXPECT_EQ(cortex_a73_features->GetInstructionSet(), kArm64);
+ EXPECT_TRUE(cortex_a73_features->Equals(cortex_a73_features.get()));
+ EXPECT_STREQ("a53", cortex_a73_features->GetFeatureString().c_str());
+ EXPECT_EQ(cortex_a73_features->AsBitmap(), 1U);
+
+ std::unique_ptr<const InstructionSetFeatures> cortex_a35_features(
+ InstructionSetFeatures::FromVariant(kArm64, "cortex-a35", &error_msg));
+ ASSERT_TRUE(cortex_a35_features.get() != nullptr) << error_msg;
+ EXPECT_EQ(cortex_a35_features->GetInstructionSet(), kArm64);
+ EXPECT_TRUE(cortex_a35_features->Equals(cortex_a35_features.get()));
+ EXPECT_STREQ("-a53", cortex_a35_features->GetFeatureString().c_str());
+ EXPECT_EQ(cortex_a35_features->AsBitmap(), 0U);
+
+ std::unique_ptr<const InstructionSetFeatures> kryo_features(
+ InstructionSetFeatures::FromVariant(kArm64, "kryo", &error_msg));
+ ASSERT_TRUE(kryo_features.get() != nullptr) << error_msg;
+ EXPECT_EQ(kryo_features->GetInstructionSet(), kArm64);
+ EXPECT_TRUE(kryo_features->Equals(kryo_features.get()));
+ EXPECT_TRUE(kryo_features->Equals(cortex_a35_features.get()));
+ EXPECT_FALSE(kryo_features->Equals(cortex_a57_features.get()));
+ EXPECT_STREQ("-a53", kryo_features->GetFeatureString().c_str());
+ EXPECT_EQ(kryo_features->AsBitmap(), 0U);
}
} // namespace art