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 <mtklein@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
This commit is contained in:
Mike Klein 2016-10-19 13:39:13 -04:00
parent 4bc6d8fd3d
commit d8765e3455

View File

@ -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" ]
}
}