From a44e6c6b5310be3b4724746b4fdca54c5233f41b Mon Sep 17 00:00:00 2001 From: "djsollen@google.com" Date: Mon, 9 Jan 2012 14:38:25 +0000 Subject: [PATCH] Add ARM optimizations to the build. Also had to fix a problem in the ARM memset code that was causing some tests and bench to fail. Review URL: http://codereview.appspot.com/5522052 git-svn-id: http://skia.googlecode.com/svn/trunk@2989 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gyp/core.gyp | 5 ----- gyp/opts.gyp | 7 ++++++- include/core/SkUtils.h | 7 ------- src/core/SkUtils.cpp | 3 --- src/opts/memset.arm.S | 8 ++++---- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/gyp/core.gyp b/gyp/core.gyp index 9e5c53635..f83f482bb 100644 --- a/gyp/core.gyp +++ b/gyp/core.gyp @@ -148,8 +148,6 @@ '../src/core/SkWriter32.cpp', '../src/core/SkXfermode.cpp', - '../src/opts/opts_check_SSE2.cpp', - '../include/core/Sk64.h', '../include/core/SkAdvancedTypefaceMetrics.h', '../include/core/SkAutoKern.h', @@ -302,9 +300,6 @@ ], }], [ 'skia_os == "android"', { - 'sources!': [ - '../src/opts/opts_check_SSE2.cpp', - ], 'dependencies': [ 'android_system.gyp:ft2', ], diff --git a/gyp/opts.gyp b/gyp/opts.gyp index ae364816d..1f67e006d 100644 --- a/gyp/opts.gyp +++ b/gyp/opts.gyp @@ -28,6 +28,7 @@ '../include/config', '../include/core', '../src/core', + '../src/opts', ], 'conditions': [ [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', { @@ -37,6 +38,7 @@ }], [ 'skia_target_arch != "arm"', { 'sources': [ + '../src/opts/opts_check_SSE2.cpp', '../src/opts/SkBitmapProcState_opts_SSE2.cpp', '../src/opts/SkBlitRow_opts_SSE2.cpp', '../src/opts/SkUtils_opts_SSE2.cpp', @@ -52,9 +54,12 @@ '-fomit-frame-pointer', ], 'sources': [ + '../src/opts/opts_check_arm.cpp', + '../src/opts/memset.arm.S', + '../src/opts/memset16_neon.S', + '../src/opts/memset32_neon.S', '../src/opts/SkBitmapProcState_opts_arm.cpp', '../src/opts/SkBlitRow_opts_arm.cpp', - '../src/opts/SkUtils_opts_none.cpp', ], }], [ 'skia_target_arch == "arm" and armv7 != 1', { diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h index 37dd755b7..b700b9627 100644 --- a/include/core/SkUtils.h +++ b/include/core/SkUtils.h @@ -32,13 +32,6 @@ void sk_memset32_portable(uint32_t dst[], uint32_t value, int count); typedef void (*SkMemset32Proc)(uint32_t dst[], uint32_t value, int count); SkMemset32Proc SkMemset32GetPlatformProc(); -#if defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_ANDROID_NDK) - #include "cutils/memory.h" - - #define sk_memset16(dst, value, count) android_memset16(dst, value, (count) << 1) - #define sk_memset32(dst, value, count) android_memset32(dst, value, (count) << 2) -#endif - #ifndef sk_memset16 extern SkMemset16Proc sk_memset16; #endif diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp index 9161609de..3f1c65e77 100644 --- a/src/core/SkUtils.cpp +++ b/src/core/SkUtils.cpp @@ -108,7 +108,6 @@ void sk_memset32_portable(uint32_t dst[], uint32_t value, int count) { } } -#if !defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_ANDROID_NDK) static void sk_memset16_stub(uint16_t dst[], uint16_t value, int count) { SkMemset16Proc proc = SkMemset16GetPlatformProc(); sk_memset16 = proc ? proc : sk_memset16_portable; @@ -125,8 +124,6 @@ static void sk_memset32_stub(uint32_t dst[], uint32_t value, int count) { SkMemset32Proc sk_memset32 = sk_memset32_stub; -#endif - /////////////////////////////////////////////////////////////////////////////// /* 0xxxxxxx 1 total diff --git a/src/opts/memset.arm.S b/src/opts/memset.arm.S index 773217488..bc0c060ac 100644 --- a/src/opts/memset.arm.S +++ b/src/opts/memset.arm.S @@ -32,6 +32,10 @@ arm_memset16: .fnstart push {lr} + /* Multiply count by 2 - go from the number of 16-bit shorts + * to the number of bytes desired. */ + mov r2, r2, lsl #1 + /* expand the data to 32 bits */ orr r1, r1, lsl #16 @@ -40,10 +44,6 @@ arm_memset16: strneh r1, [r0], #2 subne r2, r2, #2 - /* Multiply count by 2 - go from the number of 16-bit shorts - * to the number of bytes desired. */ - mov r2, r2, lsl #1 - /* Now jump into the main loop below. */ b .Lwork_32 .fnend