summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authormtklein <mtklein@chromium.org>2015-11-11 09:37:20 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-11 17:38:18 +0000
commit6c88d596d0ab59817b358250d6bf51a2264b6461 (patch)
tree6a605197f1a2e15e07f22d1b4c959e6a5b1a662a /skia
parentfa43aae032ceb89b79b67e333d5ad12d10a9b19b (diff)
downloadchromium_src-6c88d596d0ab59817b358250d6bf51a2264b6461.zip
chromium_src-6c88d596d0ab59817b358250d6bf51a2264b6461.tar.gz
chromium_src-6c88d596d0ab59817b358250d6bf51a2264b6461.tar.bz2
GYP+GN plumbing for SSE4.2, AVX, and AVX2 in Skia.
This doesn't change any code yet: each of the sse42, avx, and avx2_sources is a list with a single empty .cpp file. Remember https://codereview.chromium.org/1290423007 ? This is part 2, and parts 1 and 3 have already landed. GYP config in Skia: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/skia/gyp/opts.gyp&l=140 GYP config for libvpx: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/libvpx_new/libvpx_srcs_x86_64_intrinsics.gypi&l=97 GN config for libvpx: https://code.google.com/p/chromium/codesearch#chromium/src/third_party/libvpx_new/BUILD.gn&l=159 BUG=skia:4117 Review URL: https://codereview.chromium.org/1431143002 Cr-Commit-Position: refs/heads/master@{#359108}
Diffstat (limited to 'skia')
-rw-r--r--skia/BUILD.gn55
-rw-r--r--skia/skia_library_opts.gyp108
2 files changed, 157 insertions, 6 deletions
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index f3fd404..e6fc643 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -520,7 +520,7 @@ if (current_cpu == "x86" || current_cpu == "x64") {
"//build/config/compiler:no_chromium_code",
]
}
- source_set("skia_opts_sse4") {
+ source_set("skia_opts_sse41") {
sources = gypi_skia_opts.sse41_sources
if (!is_win || is_clang) {
cflags = [ "-msse4.1" ]
@@ -536,6 +536,54 @@ if (current_cpu == "x86" || current_cpu == "x64") {
"//build/config/compiler:no_chromium_code",
]
}
+ source_set("skia_opts_sse42") {
+ sources = gypi_skia_opts.sse42_sources
+ if (!is_win || is_clang) {
+ cflags = [ "-msse4.2" ]
+ }
+ if (is_win) {
+ defines = [ "SK_CPU_SSE_LEVEL=42" ]
+ }
+ visibility = [ ":skia_opts" ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":skia_config",
+ ":skia_library_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ }
+ source_set("skia_opts_avx") {
+ sources = gypi_skia_opts.avx_sources
+ if (!is_win || is_clang) {
+ cflags = [ "-mavx" ]
+ }
+ if (is_win) {
+ cflags = [ "/arch:AVX" ]
+ }
+ visibility = [ ":skia_opts" ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":skia_config",
+ ":skia_library_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ }
+ source_set("skia_opts_avx2") {
+ sources = gypi_skia_opts.avx2_sources
+ if (!is_win || is_clang) {
+ cflags = [ "-mavx2" ]
+ }
+ if (is_win) {
+ cflags = [ "/arch:AVX2" ]
+ }
+ visibility = [ ":skia_opts" ]
+ configs -= [ "//build/config/compiler:chromium_code" ]
+ configs += [
+ ":skia_config",
+ ":skia_library_config",
+ "//build/config/compiler:no_chromium_code",
+ ]
+ }
}
source_set("skia_opts") {
cflags = []
@@ -549,7 +597,10 @@ source_set("skia_opts") {
sources = gypi_skia_opts.sse2_sources
deps += [
":skia_opts_sse3",
- ":skia_opts_sse4",
+ ":skia_opts_sse41",
+ ":skia_opts_sse42",
+ ":skia_opts_avx",
+ ":skia_opts_avx2",
]
} else if (current_cpu == "arm") {
# The assembly uses the frame pointer register (r7 in Thumb/r11 in
diff --git a/skia/skia_library_opts.gyp b/skia/skia_library_opts.gyp
index 85fdcb3..e1627e0 100644
--- a/skia/skia_library_opts.gyp
+++ b/skia/skia_library_opts.gyp
@@ -29,7 +29,7 @@
'target_name': 'skia_opts',
'type': 'static_library',
# The optimize: 'max' scattered throughout are particularly
- # important when compiled by MSVC 2013, which seems
+ # important when compiled by MSVC 2013, which seems
# to mis-link-time-compile code that's built with
# different optimization levels. http://crbug.com/543583
'variables': {
@@ -55,6 +55,9 @@
'dependencies': [
'skia_opts_ssse3',
'skia_opts_sse41',
+ 'skia_opts_sse42',
+ 'skia_opts_avx',
+ 'skia_opts_avx2',
],
}],
[ 'target_arch == "arm"', {
@@ -110,7 +113,7 @@
'target_name': 'skia_opts_ssse3',
'type': 'static_library',
# The optimize: 'max' scattered throughout are particularly
- # important when compiled by MSVC 2013, which seems
+ # important when compiled by MSVC 2013, which seems
# to mis-link-time-compile code that's built with
# different optimization levels. http://crbug.com/543583
'variables': {
@@ -154,7 +157,7 @@
'target_name': 'skia_opts_sse41',
'type': 'static_library',
# The optimize: 'max' scattered throughout are particularly
- # important when compiled by MSVC 2013, which seems
+ # important when compiled by MSVC 2013, which seems
# to mis-link-time-compile code that's built with
# different optimization levels. http://crbug.com/543583
'variables': {
@@ -188,10 +191,107 @@
],
},
{
+ 'target_name': 'skia_opts_sse42',
+ 'type': 'static_library',
+ # The optimize: 'max' scattered throughout are particularly
+ # important when compiled by MSVC 2013, which seems
+ # to mis-link-time-compile code that's built with
+ # different optimization levels. http://crbug.com/543583
+ 'variables': {
+ 'optimize': 'max',
+ },
+ 'includes': [
+ 'skia_common.gypi',
+ '../build/android/increase_size_for_speed.gypi',
+ ],
+ 'include_dirs': [ '<@(include_dirs)' ],
+ 'sources': [ '<@(sse42_sources)' ],
+ 'conditions': [
+ [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
+ 'cflags': [ '-msse4.2' ],
+ }],
+ [ 'OS == "mac"', {
+ 'xcode_settings': {
+ 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES',
+ },
+ }],
+ [ 'OS == "win" and clang == 1', {
+ # cl.exe's /arch flag doesn't have a setting for SSE4.2, and cl.exe
+ # doesn't need it for intrinsics. clang-cl does need it, though.
+ 'msvs_settings': {
+ 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.2' ] },
+ },
+ }],
+ [ 'OS == "win"', {
+ 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'skia_opts_avx',
+ 'type': 'static_library',
+ # The optimize: 'max' scattered throughout are particularly
+ # important when compiled by MSVC 2013, which seems
+ # to mis-link-time-compile code that's built with
+ # different optimization levels. http://crbug.com/543583
+ 'variables': {
+ 'optimize': 'max',
+ },
+ 'includes': [
+ 'skia_common.gypi',
+ '../build/android/increase_size_for_speed.gypi',
+ ],
+ 'include_dirs': [ '<@(include_dirs)' ],
+ 'sources': [ '<@(avx_sources)' ],
+ 'conditions': [
+ [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
+ 'cflags': [ '-mavx' ],
+ }],
+ [ 'OS == "mac"', {
+ 'xcode_settings': {
+ 'OTHER_CFLAGS': [ '-mavx' ],
+ },
+ }],
+ [ 'OS == "win"', {
+ 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '3' } },
+ }],
+ ],
+ },
+ {
+ 'target_name': 'skia_opts_avx2',
+ 'type': 'static_library',
+ # The optimize: 'max' scattered throughout are particularly
+ # important when compiled by MSVC 2013, which seems
+ # to mis-link-time-compile code that's built with
+ # different optimization levels. http://crbug.com/543583
+ 'variables': {
+ 'optimize': 'max',
+ },
+ 'includes': [
+ 'skia_common.gypi',
+ '../build/android/increase_size_for_speed.gypi',
+ ],
+ 'include_dirs': [ '<@(include_dirs)' ],
+ 'sources': [ '<@(avx2_sources)' ],
+ 'conditions': [
+ [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
+ 'cflags': [ '-mavx2' ],
+ }],
+ [ 'OS == "mac"', {
+ 'xcode_settings': {
+ 'OTHER_CFLAGS': [ '-mavx2' ],
+ },
+ }],
+ [ 'OS == "win"', {
+ 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet': '5' } },
+ }],
+ ],
+ },
+ {
'target_name': 'skia_opts_none',
'type': 'static_library',
# The optimize: 'max' scattered throughout are particularly
- # important when compiled by MSVC 2013, which seems
+ # important when compiled by MSVC 2013, which seems
# to mis-link-time-compile code that's built with
# different optimization levels. http://crbug.com/543583
'variables': {