Conservatively disable use of integer division on Android ARM64 devices.

R=jsimmons@google.com

Review-Url: https://codereview.chromium.org/2800883002 .
This commit is contained in:
Ryan Macnak
2017-04-05 12:44:51 -07:00
parent 247fc68d21
commit 683077944b
+14 -4
View File
@@ -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_ =