Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: skia/skia_library_opts.gyp

Issue 1431143002: GYP+GN plumbing for SSE4.2, AVX, and AVX2 in Skia. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « skia/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # This gyp file contains the platform-specific optimizations for Skia 5 # This gyp file contains the platform-specific optimizations for Skia
6 { 6 {
7 'variables': { 7 'variables': {
8 'skia_src_path': '../third_party/skia/src', 8 'skia_src_path': '../third_party/skia/src',
9 'includes': [ '../third_party/skia/gyp/opts.gypi' ], 9 'includes': [ '../third_party/skia/gyp/opts.gypi' ],
10 'include_dirs': [ 10 'include_dirs': [
(...skipping 11 matching lines...) Expand all
22 # SSE files have to be built in a separate target, because gcc needs 22 # SSE files have to be built in a separate target, because gcc needs
23 # different -msse flags for different SSE levels which enable use of SSE 23 # different -msse flags for different SSE levels which enable use of SSE
24 # intrinsics but also allow emission of SSE2 instructions for scalar code. 24 # intrinsics but also allow emission of SSE2 instructions for scalar code.
25 # gyp does not allow per-file compiler flags. 25 # gyp does not allow per-file compiler flags.
26 # For about the same reason, we need to compile the ARM opts files 26 # For about the same reason, we need to compile the ARM opts files
27 # separately as well. 27 # separately as well.
28 { 28 {
29 'target_name': 'skia_opts', 29 'target_name': 'skia_opts',
30 'type': 'static_library', 30 'type': 'static_library',
31 # The optimize: 'max' scattered throughout are particularly 31 # The optimize: 'max' scattered throughout are particularly
32 # important when compiled by MSVC 2013, which seems 32 # important when compiled by MSVC 2013, which seems
33 # to mis-link-time-compile code that's built with 33 # to mis-link-time-compile code that's built with
34 # different optimization levels. http://crbug.com/543583 34 # different optimization levels. http://crbug.com/543583
35 'variables': { 35 'variables': {
36 'optimize': 'max', 36 'optimize': 'max',
37 }, 37 },
38 'includes': [ 38 'includes': [
39 'skia_common.gypi', 39 'skia_common.gypi',
40 '../build/android/increase_size_for_speed.gypi', 40 '../build/android/increase_size_for_speed.gypi',
41 # Disable LTO due to compiler error 41 # Disable LTO due to compiler error
42 # in mems_in_disjoint_alias_sets_p, at alias.c:393 42 # in mems_in_disjoint_alias_sets_p, at alias.c:393
43 # crbug.com/422255 43 # crbug.com/422255
44 '../build/android/disable_gcc_lto.gypi', 44 '../build/android/disable_gcc_lto.gypi',
45 ], 45 ],
46 'include_dirs': [ '<@(include_dirs)' ], 46 'include_dirs': [ '<@(include_dirs)' ],
47 'conditions': [ 47 'conditions': [
48 [ 'target_arch != "arm" and target_arch != "mipsel" and \ 48 [ 'target_arch != "arm" and target_arch != "mipsel" and \
49 target_arch != "arm64" and target_arch != "mips64el"', { 49 target_arch != "arm64" and target_arch != "mips64el"', {
50 # Chrome builds with -msse2 locally, so sse2_sources could in theory 50 # Chrome builds with -msse2 locally, so sse2_sources could in theory
51 # be in the regular skia target. But we need skia_opts for arm 51 # be in the regular skia target. But we need skia_opts for arm
52 # anyway, so putting sse2_sources here is simpler than making this 52 # anyway, so putting sse2_sources here is simpler than making this
53 # conditionally a type none target on x86. 53 # conditionally a type none target on x86.
54 'sources': [ '<@(sse2_sources)' ], 54 'sources': [ '<@(sse2_sources)' ],
55 'dependencies': [ 55 'dependencies': [
56 'skia_opts_ssse3', 56 'skia_opts_ssse3',
57 'skia_opts_sse41', 57 'skia_opts_sse41',
58 'skia_opts_sse42',
59 'skia_opts_avx',
60 'skia_opts_avx2',
58 ], 61 ],
59 }], 62 }],
60 [ 'target_arch == "arm"', { 63 [ 'target_arch == "arm"', {
61 'conditions': [ 64 'conditions': [
62 [ 'arm_version >= 7', { 65 [ 'arm_version >= 7', {
63 'sources': [ '<@(armv7_sources)' ], 66 'sources': [ '<@(armv7_sources)' ],
64 }, { # arm_version < 7 67 }, { # arm_version < 7
65 'sources': [ '<@(none_sources)' ], 68 'sources': [ '<@(none_sources)' ],
66 }], 69 }],
67 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', { 70 [ 'arm_version >= 7 and (arm_neon == 1 or arm_neon_optional == 1)', {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 ], 106 ],
104 }, 107 },
105 # For the same lame reasons as what is done for skia_opts, we have to 108 # For the same lame reasons as what is done for skia_opts, we have to
106 # create another target specifically for SSSE3 code as we would not want 109 # create another target specifically for SSSE3 code as we would not want
107 # to compile the SSE2 code with -mssse3 which would potentially allow 110 # to compile the SSE2 code with -mssse3 which would potentially allow
108 # gcc to generate SSSE3 code. 111 # gcc to generate SSSE3 code.
109 { 112 {
110 'target_name': 'skia_opts_ssse3', 113 'target_name': 'skia_opts_ssse3',
111 'type': 'static_library', 114 'type': 'static_library',
112 # The optimize: 'max' scattered throughout are particularly 115 # The optimize: 'max' scattered throughout are particularly
113 # important when compiled by MSVC 2013, which seems 116 # important when compiled by MSVC 2013, which seems
114 # to mis-link-time-compile code that's built with 117 # to mis-link-time-compile code that's built with
115 # different optimization levels. http://crbug.com/543583 118 # different optimization levels. http://crbug.com/543583
116 'variables': { 119 'variables': {
117 'optimize': 'max', 120 'optimize': 'max',
118 }, 121 },
119 'includes': [ 122 'includes': [
120 'skia_common.gypi', 123 'skia_common.gypi',
121 '../build/android/increase_size_for_speed.gypi', 124 '../build/android/increase_size_for_speed.gypi',
122 ], 125 ],
123 'include_dirs': [ '<@(include_dirs)' ], 126 'include_dirs': [ '<@(include_dirs)' ],
(...skipping 23 matching lines...) Expand all
147 ], 150 ],
148 }, 151 },
149 # For the same lame reasons as what is done for skia_opts, we also have to 152 # For the same lame reasons as what is done for skia_opts, we also have to
150 # create another target specifically for SSE4.1 code as we would not want 153 # create another target specifically for SSE4.1 code as we would not want
151 # to compile the SSE2 code with -msse4.1 which would potentially allow 154 # to compile the SSE2 code with -msse4.1 which would potentially allow
152 # gcc to generate SSE4.1 code. 155 # gcc to generate SSE4.1 code.
153 { 156 {
154 'target_name': 'skia_opts_sse41', 157 'target_name': 'skia_opts_sse41',
155 'type': 'static_library', 158 'type': 'static_library',
156 # The optimize: 'max' scattered throughout are particularly 159 # The optimize: 'max' scattered throughout are particularly
157 # important when compiled by MSVC 2013, which seems 160 # important when compiled by MSVC 2013, which seems
158 # to mis-link-time-compile code that's built with 161 # to mis-link-time-compile code that's built with
159 # different optimization levels. http://crbug.com/543583 162 # different optimization levels. http://crbug.com/543583
160 'variables': { 163 'variables': {
161 'optimize': 'max', 164 'optimize': 'max',
162 }, 165 },
163 'includes': [ 166 'includes': [
164 'skia_common.gypi', 167 'skia_common.gypi',
165 '../build/android/increase_size_for_speed.gypi', 168 '../build/android/increase_size_for_speed.gypi',
166 ], 169 ],
167 'include_dirs': [ '<@(include_dirs)' ], 170 'include_dirs': [ '<@(include_dirs)' ],
(...skipping 13 matching lines...) Expand all
181 'msvs_settings': { 184 'msvs_settings': {
182 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] }, 185 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
183 }, 186 },
184 }], 187 }],
185 [ 'OS == "win"', { 188 [ 'OS == "win"', {
186 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ], 189 'defines' : [ 'SK_CPU_SSE_LEVEL=41' ],
187 }], 190 }],
188 ], 191 ],
189 }, 192 },
190 { 193 {
194 'target_name': 'skia_opts_sse42',
195 'type': 'static_library',
196 # The optimize: 'max' scattered throughout are particularly
197 # important when compiled by MSVC 2013, which seems
198 # to mis-link-time-compile code that's built with
199 # different optimization levels. http://crbug.com/543583
200 'variables': {
201 'optimize': 'max',
202 },
203 'includes': [
204 'skia_common.gypi',
205 '../build/android/increase_size_for_speed.gypi',
206 ],
207 'include_dirs': [ '<@(include_dirs)' ],
208 'sources': [ '<@(sse42_sources)' ],
209 'conditions': [
210 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
211 'cflags': [ '-msse4.2' ],
212 }],
213 [ 'OS == "mac"', {
214 'xcode_settings': {
215 'GCC_ENABLE_SSE42_EXTENSIONS': 'YES',
216 },
217 }],
218 [ 'OS == "win" and clang == 1', {
219 # cl.exe's /arch flag doesn't have a setting for SSE4.2, and cl.exe
220 # doesn't need it for intrinsics. clang-cl does need it, though.
221 'msvs_settings': {
222 'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.2' ] },
223 },
224 }],
225 [ 'OS == "win"', {
226 'defines' : [ 'SK_CPU_SSE_LEVEL=42' ],
227 }],
228 ],
229 },
230 {
231 'target_name': 'skia_opts_avx',
232 'type': 'static_library',
233 # The optimize: 'max' scattered throughout are particularly
234 # important when compiled by MSVC 2013, which seems
235 # to mis-link-time-compile code that's built with
236 # different optimization levels. http://crbug.com/543583
237 'variables': {
238 'optimize': 'max',
239 },
240 'includes': [
241 'skia_common.gypi',
242 '../build/android/increase_size_for_speed.gypi',
243 ],
244 'include_dirs': [ '<@(include_dirs)' ],
245 'sources': [ '<@(avx_sources)' ],
246 'conditions': [
247 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
248 'cflags': [ '-mavx' ],
249 }],
250 [ 'OS == "mac"', {
251 'xcode_settings': {
252 'OTHER_CFLAGS': [ '-mavx' ],
253 },
254 }],
255 [ 'OS == "win"', {
256 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet ': '3' } },
257 }],
258 ],
259 },
260 {
261 'target_name': 'skia_opts_avx2',
262 'type': 'static_library',
263 # The optimize: 'max' scattered throughout are particularly
264 # important when compiled by MSVC 2013, which seems
265 # to mis-link-time-compile code that's built with
266 # different optimization levels. http://crbug.com/543583
267 'variables': {
268 'optimize': 'max',
269 },
270 'includes': [
271 'skia_common.gypi',
272 '../build/android/increase_size_for_speed.gypi',
273 ],
274 'include_dirs': [ '<@(include_dirs)' ],
275 'sources': [ '<@(avx2_sources)' ],
276 'conditions': [
277 [ 'OS in ["linux", "freebsd", "openbsd", "solaris", "android"]', {
278 'cflags': [ '-mavx2' ],
279 }],
280 [ 'OS == "mac"', {
281 'xcode_settings': {
282 'OTHER_CFLAGS': [ '-mavx2' ],
283 },
284 }],
285 [ 'OS == "win"', {
286 'msvs_settings': { 'VCCLCompilerTool': { 'EnableEnhancedInstructionSet ': '5' } },
287 }],
288 ],
289 },
290 {
191 'target_name': 'skia_opts_none', 291 'target_name': 'skia_opts_none',
192 'type': 'static_library', 292 'type': 'static_library',
193 # The optimize: 'max' scattered throughout are particularly 293 # The optimize: 'max' scattered throughout are particularly
194 # important when compiled by MSVC 2013, which seems 294 # important when compiled by MSVC 2013, which seems
195 # to mis-link-time-compile code that's built with 295 # to mis-link-time-compile code that's built with
196 # different optimization levels. http://crbug.com/543583 296 # different optimization levels. http://crbug.com/543583
197 'variables': { 297 'variables': {
198 'optimize': 'max', 298 'optimize': 'max',
199 }, 299 },
200 'includes': [ 300 'includes': [
201 'skia_common.gypi', 301 'skia_common.gypi',
202 '../build/android/increase_size_for_speed.gypi', 302 '../build/android/increase_size_for_speed.gypi',
203 ], 303 ],
204 'include_dirs': [ '<@(include_dirs)' ], 304 'include_dirs': [ '<@(include_dirs)' ],
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 'ldflags': [ 336 'ldflags': [
237 '-march=armv7-a', 337 '-march=armv7-a',
238 '-Wl,--fix-cortex-a8', 338 '-Wl,--fix-cortex-a8',
239 ], 339 ],
240 'sources': [ '<@(neon_sources)' ], 340 'sources': [ '<@(neon_sources)' ],
241 }, 341 },
242 ], 342 ],
243 }], 343 }],
244 ], 344 ],
245 } 345 }
OLDNEW
« no previous file with comments | « skia/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698