From d8765e3455ff3f99cc733f01f8d10d4b0939bbd5 Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Wed, 19 Oct 2016 13:39:13 -0400 Subject: Define SK_CPU_SSE_LEVEL on Windows builds. We check this define to know which intrinsics we can call safely. The -msse flags set it for us on non-MSVC, but MSVC has no such switch. We do this in GYP (and Chrome's GN) too. No need for any defines on :avx or :hsw targets... the /arch:AVX and /arch:AVX2 do set SK_CPU_SSE_LEVEL for us. Most directly, this means things like Sk4f::thenElse() will now use blendps when compiled into SkOpts_sse41.cpp. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3666 Change-Id: Ie80a8b8e5544250b45cfe51c40604fade06b3ef9 Reviewed-on: https://skia-review.googlesource.com/3666 Commit-Queue: Mike Klein Reviewed-by: Matt Sarett --- BUILD.gn | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 25985e1019..3b9a83a688 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -195,7 +195,9 @@ opts("crc32") { opts("sse2") { enabled = is_x86 sources = skia_opts.sse2_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE2" ] + } else { cflags = [ "-msse2" ] } } @@ -203,7 +205,9 @@ opts("sse2") { opts("ssse3") { enabled = is_x86 sources = skia_opts.ssse3_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSSE3" ] + } else { cflags = [ "-mssse3" ] } } @@ -211,7 +215,9 @@ opts("ssse3") { opts("sse41") { enabled = is_x86 sources = skia_opts.sse41_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE41" ] + } else { cflags = [ "-msse4.1" ] } } @@ -219,7 +225,9 @@ opts("sse41") { opts("sse42") { enabled = is_x86 sources = skia_opts.sse42_sources - if (!is_win) { + if (is_win) { + defines = [ "SK_CPU_SSE_LEVEL=SK_CPU_SSE_LEVEL_SSE42" ] + } else { cflags = [ "-msse4.2" ] } } -- cgit v1.2.3