From 1afdfb3da85a391b7d54f2ca867c7d52fbf3f1ac Mon Sep 17 00:00:00 2001 From: "zhongwei.yao@arm.com" Date: Wed, 13 Aug 2014 03:45:11 +0000 Subject: [PATCH] arm64 neon optimization building is enabled git-svn-id: http://libyuv.googlecode.com/svn/trunk@1042 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- include/libyuv/row.h | 2 +- libyuv.gyp | 17 +++++++++++++++-- source/cpu_id.cc | 7 ++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/libyuv/row.h b/include/libyuv/row.h index fdfe1ae35..9a79fda20 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -465,7 +465,7 @@ typedef uint8 uvec8[16]; #opcode " " #offset "(%" #base ",%" #index "," #scale "),%" #arg "\n" #endif // defined(__native_client__) && defined(__x86_64__) -#if defined(__arm__) +#if defined(__arm__) || defined(__aarch64__) #undef MEMACCESS #if defined(__native_client__) #define MEMACCESS(base) ".p2align 3\nbic %" #base ", #0xc0000000\n" diff --git a/libyuv.gyp b/libyuv.gyp index b18601040..63b6d0d57 100644 --- a/libyuv.gyp +++ b/libyuv.gyp @@ -15,7 +15,10 @@ 'libyuv_disable_jpeg%': 0, 'build_neon': 0, 'conditions': [ - [ '(target_arch == "armv7" or target_arch == "armv7s" or (target_arch == "arm" and arm_version >= 7)) and target_subarch != 64 and (arm_neon == 1 or arm_neon_optional == 1)', { + [ '(target_arch == "armv7" or target_arch == "armv7s" or \ + (target_arch == "arm" and arm_version >= 7) or target_arch == "arm64")\ + and target_subarch != 64 and (arm_neon == 1 or arm_neon_optional == 1)', + { 'build_neon': 1, }], ], @@ -35,8 +38,12 @@ '-mfpu=vfpv3', '-mfpu=vfpv3-d16', ], - 'cflags': [ + 'conditions': [ + ['target_arch != "arm64"', { + 'cflags': [ '-mfpu=neon', + ], + }], ], 'include_dirs': [ 'include', @@ -101,9 +108,15 @@ 'dependencies': [ 'libyuv_neon', ], + 'conditions': [ + #TODO LIBYUV_NEON is temporary disabled. When all arm64 port has + # been done, enable it. + ['target_arch !="arm64"', { 'defines': [ 'LIBYUV_NEON', ] + }], + ], }], # MemorySanitizer does not support assembly code yet. # http://crbug.com/344505 diff --git a/source/cpu_id.cc b/source/cpu_id.cc index 2e0d61d20..c88a251e6 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -256,12 +256,17 @@ int InitCpuFlags(void) { if (getenv("LIBYUV_DISABLE_MIPS_DSPR2")) { cpu_info_ &= ~kCpuHasMIPS_DSPR2; } -#elif defined(__arm__) +#elif defined(__arm__) || defined(__aarch64__) // gcc -mfpu=neon defines __ARM_NEON__ // __ARM_NEON__ generates code that requires Neon. NaCL also requires Neon. // For Linux, /proc/cpuinfo can be tested but without that assume Neon. #if defined(__ARM_NEON__) || defined(__native_client__) || !defined(__linux__) cpu_info_ = kCpuHasNEON; +// For aarch64(arm64), /proc/cpuinfo's feature is not complete, e.g. no neon +// flag in it. +// So for aarch64, neon enabling is hard coded here. +#elif defined(__aarch64__) + cpu_info_ = kCpuHasNEON; #else // Linux arm parse text file for neon detect. cpu_info_ = ArmCpuCaps("/proc/cpuinfo");