avoid immintrin.h in SkNx_sse.h

Including <immintrin.h> is an easy way to get all the supported
Intel intrinsics for the current build flags, and for intrinsics
since AVX, the only supported way.

But, including immintrin.h can pull in more headers than needed,
and for pieces of code like SkNx.h, that extra include cost is
measurable.  Here we'll include only the intrisnics we'll use.

    $ gn clean out && time ninja -C out

    Before:  131.57 real      4207.95 user       249.18 sys
    After:   125.60 real      3988.18 user       241.64 sys

Seems like a win.

Change-Id: I81543202d889be403ff0aa393c13c19ed89c5373
Reviewed-on: https://skia-review.googlesource.com/134325
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2018-06-12 12:11:28 -04:00 committed by Skia Commit-Bot
parent 2107bd8ee0
commit 8ea971bfef

View File

@ -8,7 +8,15 @@
#ifndef SkNx_sse_DEFINED
#define SkNx_sse_DEFINED
#include <immintrin.h>
#include "SkTypes.h"
#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41
#include <smmintrin.h>
#elif SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSSE3
#include <tmmintrin.h>
#else
#include <emmintrin.h>
#endif
// This file may assume <= SSE2, but must check SK_CPU_SSE_LEVEL for anything more recent.
// If you do, make sure this is in a static inline function... anywhere else risks violating ODR.