Remove SkOpts_sse2.cpp.

It's sort of pointless: all our clients that will have SSE2 at runtime have it
unconditionally at compile time, so the functions in namespace portable will
pick up the SSE2 code.  The procs in SkOpts_sse2.o were just duplicate code.

A couple of the procs we had in _sse2.cpp can benefit slightly when compiled
with SSSE3.  I've moved those to _ssse3.cpp.  This should lead to small speedups
on platforms like Linux and Windows that have a baseline of SSE2.

Similarly, I've removed the call to Init_neon() when NEON is available globally... it's a no-op.

Renaming namespace portable to something clearer is TBD.

BUG=skia:4117

Review URL: https://codereview.chromium.org/1294213002
This commit is contained in:
mtklein 2015-08-18 05:18:52 -07:00 committed by Commit bot
parent 95dd17737d
commit 9483763793
5 changed files with 7 additions and 42 deletions

View File

@ -43,7 +43,6 @@
'<(skia_src_path)/opts/SkBitmapProcState_opts_SSE2.cpp',
'<(skia_src_path)/opts/SkBlitRow_opts_SSE2.cpp',
'<(skia_src_path)/opts/opts_check_x86.cpp',
'<(skia_src_path)/opts/SkOpts_sse2.cpp',
],
'ssse3_sources': [
'<(skia_src_path)/opts/SkBitmapProcState_opts_SSSE3.cpp',

View File

@ -54,7 +54,6 @@ namespace SkOpts {
decltype(blit_mask_d32_a8) blit_mask_d32_a8 = portable::blit_mask_d32_a8;
// Each Init_foo() is defined in src/opts/SkOpts_foo.cpp.
void Init_sse2();
void Init_ssse3();
void Init_sse41();
void Init_neon();
@ -65,12 +64,9 @@ namespace SkOpts {
#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
uint32_t abcd[] = {0,0,0,0};
cpuid(abcd);
if (abcd[3] & (1<<26)) { Init_sse2(); }
if (abcd[2] & (1<< 9)) { Init_ssse3(); }
if (abcd[2] & (1<<19)) { Init_sse41(); }
#elif defined(SK_ARM_HAS_NEON)
Init_neon();
#elif defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR_ANDROID)
#elif !defined(SK_ARM_HAS_NEON) && defined(SK_CPU_ARM32) && defined(SK_BUILD_FOR_ANDROID)
if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) { Init_neon(); }
#endif
}

View File

@ -1,34 +0,0 @@
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkOpts.h"
#define SK_OPTS_NS sse2
#include "SkBlitMask_opts.h"
#include "SkBlurImageFilter_opts.h"
#include "SkMorphologyImageFilter_opts.h"
#include "SkUtils_opts.h"
#include "SkXfermode_opts.h"
namespace SkOpts {
void Init_sse2() {
memset16 = sse2::memset16;
memset32 = sse2::memset32;
create_xfermode = SkCreate4pxXfermode;
box_blur_xx = sse2::box_blur_xx;
box_blur_xy = sse2::box_blur_xy;
box_blur_yx = sse2::box_blur_yx;
dilate_x = sse2::dilate_x;
dilate_y = sse2::dilate_y;
erode_x = sse2::erode_x;
erode_y = sse2::erode_y;
blit_mask_d32_a8 = sse2::blit_mask_d32_a8;
}
}

View File

@ -6,9 +6,13 @@
*/
#include "SkOpts.h"
#define SK_OPTS_NS ssse3
#include "SkBlitMask_opts.h"
#include "SkXfermode_opts.h"
namespace SkOpts {
void Init_ssse3() {
create_xfermode = SkCreate4pxXfermode;
blit_mask_d32_a8 = ssse3::blit_mask_d32_a8;
}
}

View File

@ -10,7 +10,7 @@ namespace { // See SkPMFloat.h
inline SkPMFloat::SkPMFloat(SkPMColor c) {
SkPMColorAssert(c);
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3
const int _ = 255; // Zero these bytes.
const char _ = ~0; // Zero these bytes.
__m128i fix8 = _mm_cvtsi32_si128((int)c),
fix8_32 = _mm_shuffle_epi8(fix8, _mm_setr_epi8(0,_,_,_, 1,_,_,_, 2,_,_,_, 3,_,_,_));
#else