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 <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2018-03-26 11:25:07 -04:00 committed by Skia Commit-Bot
parent 809183efca
commit b468ddcc74
2 changed files with 5 additions and 2 deletions

View File

@ -78,11 +78,13 @@
#include <sys/auxv.h>
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;
}

View File

@ -44,6 +44,7 @@ struct SkCpu {
NEON_FMA = 1 << 1,
VFP_FP16 = 1 << 2,
CRC32 = 1 << 3,
ASIMDHP = 1 << 4,
};
static void CacheRuntimeFeatures();