From 683077944b67ccd21dd656cf8fb573a45eaeb340 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 5 Apr 2017 12:44:51 -0700 Subject: [PATCH] Conservatively disable use of integer division on Android ARM64 devices. R=jsimmons@google.com Review-Url: https://codereview.chromium.org/2800883002 . --- runtime/vm/cpu_arm.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/runtime/vm/cpu_arm.cc b/runtime/vm/cpu_arm.cc index d0ecc0dbe23..9ab9adf272b 100644 --- a/runtime/vm/cpu_arm.cc +++ b/runtime/vm/cpu_arm.cc @@ -207,15 +207,25 @@ void HostCPUFeatures::InitOnce() { // - Qualcomm Krait CPUs (QCT APQ8064) in Nexus 4 and 7 incorrectly report // that they lack integer division. // - Marvell Armada 370/XP incorrectly reports that it has integer division. - // - Qualcomm Snapdragon 820/821 CPUs (MSM 8996 and MSM8996pro) in Xiaomi MI5 - // and Pixel lack integer division even though ARMv8 requires it in A32. bool is_krait = CpuInfo::FieldContains(kCpuInfoHardware, "QCT APQ8064"); bool is_armada_370xp = CpuInfo::FieldContains(kCpuInfoHardware, "Marvell Armada 370/XP"); - bool is_snapdragon = CpuInfo::FieldContains(kCpuInfoHardware, "MSM8996"); +#if defined(HOST_OS_ANDROID) + bool is_android = true; +#else + bool is_android = false; +#endif if (is_krait) { integer_division_supported_ = FLAG_use_integer_division; - } else if (is_armada_370xp || is_snapdragon) { + } else if (is_android && is_arm64) { + // Various Android ARM64 devices, including the Qualcomm Snapdragon 820/821 + // CPUs (MSM 8996 and MSM8996pro) in Xiaomi MI5 and Pixel lack integer + // division even though ARMv8 requires it in A32. Instead of attempting to + // track all of these devices, we conservatively disable use of integer + // division on Android ARM64 devices. + // TODO(29270): /proc/self/auxv might be more reliable here. + integer_division_supported_ = false; + } else if (is_armada_370xp) { integer_division_supported_ = false; } else { integer_division_supported_ =