diff options
author | mtklein <mtklein@google.com> | 2015-09-21 11:02:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-21 11:02:39 -0700 |
commit | b758bbd84e6d4556376850186252777a1a239f4a (patch) | |
tree | 9501dd8d1ec32b1b312e6bfbbbc67dbfb3adc903 /include | |
parent | 46243a7c02a1d5116e55a27ff59218f9c320df97 (diff) |
Revert of Combined approach. (patchset #2 id:20001 of https://codereview.chromium.org/1356133002/ )
Reason for revert:
whee
Original issue's description:
> Combined approach.
>
> This combines some ideas from these two CLs:
> - try stosd/w
> - update memset16/32 inlining heuristics
>
>
> BUG=skia:4316
>
> Blinking in and out for perf.skia.org.
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/46243a7c02a1d5116e55a27ff59218f9c320df97
TBR=reed@google.com,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:4316
Review URL: https://codereview.chromium.org/1353703006
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkUtils.h | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/include/core/SkUtils.h b/include/core/SkUtils.h index 652cdae36e..4e24bd0883 100644 --- a/include/core/SkUtils.h +++ b/include/core/SkUtils.h @@ -9,27 +9,6 @@ #define SkUtils_DEFINED #include "SkTypes.h" -#if defined(SK_BUILD_FOR_WIN) - #include <intrin.h> -#endif - -#if defined(SK_CPU_X86) - static inline void rep_stosw(uint16_t buffer[], uint16_t value, int count) { - #if defined(SK_BUILD_FOR_WIN) - __stosw(buffer, value, count); - #else - __asm__ __volatile__ ( "rep stosw" : "+D"(buffer), "+c"(count) : "a"(value) ); - #endif - } - - static inline void rep_stosd(uint32_t buffer[], uint32_t value, int count) { - #if defined(SK_BUILD_FOR_WIN) - __stosd((PDWORD)buffer, value, count); - #else - __asm__ __volatile__ ( "rep stosl" : "+D"(buffer), "+c"(count) : "a"(value) ); - #endif - } -#endif namespace SkOpts { extern void (*memset16)(uint16_t[], uint16_t, int); @@ -38,8 +17,13 @@ namespace SkOpts { /////////////////////////////////////////////////////////////////////////////// -// The stosw/d and inlining heuristics below were determined using -// bench/MemsetBench.cpp and perf.skia.org. +// The inlining heuristics below were determined using bench/MemsetBench.cpp +// on a x86 desktop, a Nexus 7 with and without NEON, and a Nexus 9: +// - on x86, inlining was never faster, +// - on ARMv7, inlining was faster for N<=10. Putting this check inside the NEON +// code was not helpful; it's got to be here outside. +// - NEON code generation for ARMv8 with GCC 4.9 is terrible, +// making the NEON code ~8x slower that just a serial loop. /** Similar to memset(), but it assigns a 16bit value into the buffer. @param buffer The memory to have value copied into it @@ -47,10 +31,10 @@ namespace SkOpts { @param count The number of times value should be copied into the buffer. */ static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) { -#if defined(SK_CPU_X86) - if (count > 30) { rep_stosw(buffer, value, count); return; } -#elif defined(SK_ARM_HAS_NEON) +#if defined(SK_CPU_ARM64) while (count --> 0) { *buffer++ = value; } return; +#elif defined(SK_CPU_ARM32) + if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; } #endif SkOpts::memset16(buffer, value, count); } @@ -61,10 +45,10 @@ static inline void sk_memset16(uint16_t buffer[], uint16_t value, int count) { @param count The number of times value should be copied into the buffer. */ static inline void sk_memset32(uint32_t buffer[], uint32_t value, int count) { -#if defined(SK_CPU_X86) - if (count > 30) { rep_stosd(buffer, value, count); return; } -#elif defined(SK_ARM_HAS_NEON) +#if defined(SK_CPU_ARM64) while (count --> 0) { *buffer++ = value; } return; +#elif defined(SK_CPU_ARM32) + if (count <= 10) { while (count --> 0) { *buffer++ = value; } return; } #endif SkOpts::memset32(buffer, value, count); } |