aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/opts
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-06-12 12:11:28 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-12 18:24:33 +0000
commit8ea971bfefb687a813f5b7cb62137b5d7b742dee (patch)
tree8dae6feec1bbf6116fb9a79de24001662a4f363d /src/opts
parent2107bd8ee0f17bfff35eb9d91b63f501cb57a50e (diff)
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>
Diffstat (limited to 'src/opts')
-rw-r--r--src/opts/SkNx_sse.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/opts/SkNx_sse.h b/src/opts/SkNx_sse.h
index 1720f14fb8..335b70c1e9 100644
--- a/src/opts/SkNx_sse.h
+++ b/src/opts/SkNx_sse.h
@@ -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.