From b468ddcc743289e18186b6ec45c22a241a627888 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Mon, 26 Mar 2018 11:25:07 -0400 Subject: [PATCH] detect ASIMDHP on ARM64 (ASIMDHP == "advanced SIMD half-precision" == NEON half-float compute.) Testing: printed features after detection Pixel 1: 0x08 Galaxy S9: 0x18 (All as expected.) Change-Id: I3c6987d9ad50b0eb244c2be4354c1c13fdd24815 Reviewed-on: https://skia-review.googlesource.com/116480 Reviewed-by: Herb Derby Commit-Queue: Mike Klein --- src/core/SkCpu.cpp | 6 ++++-- src/core/SkCpu.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/SkCpu.cpp b/src/core/SkCpu.cpp index e9777c0b3b..b4b2d6802b 100644 --- a/src/core/SkCpu.cpp +++ b/src/core/SkCpu.cpp @@ -78,11 +78,13 @@ #include static uint32_t read_cpu_features() { - const uint32_t kHWCAP_CRC32 = (1<<7); + const uint32_t kHWCAP_CRC32 = (1<< 7), + kHWCAP_ASIMDHP = (1<<10); uint32_t features = 0; uint32_t hwcaps = getauxval(AT_HWCAP); - if (hwcaps & kHWCAP_CRC32) { features |= SkCpu::CRC32; } + if (hwcaps & kHWCAP_CRC32 ) { features |= SkCpu::CRC32; } + if (hwcaps & kHWCAP_ASIMDHP) { features |= SkCpu::ASIMDHP; } return features; } diff --git a/src/core/SkCpu.h b/src/core/SkCpu.h index 34af7fd497..8d2e4fb030 100644 --- a/src/core/SkCpu.h +++ b/src/core/SkCpu.h @@ -44,6 +44,7 @@ struct SkCpu { NEON_FMA = 1 << 1, VFP_FP16 = 1 << 2, CRC32 = 1 << 3, + ASIMDHP = 1 << 4, }; static void CacheRuntimeFeatures();