Skip to content

Commit

Permalink
Attempt to let skia's SSE files build with clang-cl.
Browse files Browse the repository at this point in the history
cl.exe can use intrinsics (like e.g. _mm_cvtsi128_si32()) even if arch
targetted by the compiler doesn't support the SSE level needed by the intrinsic.

clang (and gcc) can't do this, because it converts intrinsics into general
LLVM operations, and the LLVM bitcode is then translated back into assembly
later on, based on the target arch.

So explicitly enable SSSE3 and SSE4 when using clang-cl, so that the intrinsics
compile.

(It's unfortunate that clang-cl deviates fairly heavily from cl in this regard.
But this is very difficult to change, and it's the only larger deviation so
far.)

BUG=82385
R=rnk@chromium.org

Review URL: https://codereview.chromium.org/475273002

Cr-Commit-Position: refs/heads/master@{#289735}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289735 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thakis@chromium.org committed Aug 15, 2014
1 parent 72412cf commit a8b437d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions skia/skia_library_opts.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@
'GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONS': 'YES',
},
}],
[ 'OS == "win" and clang == 1', {
# cl.exe's /arch flag doesn't have a setting for SSSE3, and cl.exe
# doesn't need it for intrinsics. clang-cl does need it, though.
'msvs_settings': {
'VCCLCompilerTool': { 'AdditionalOptions': [ '-mssse3' ] },
},
}],
[ 'OS == "win"', {
'include_dirs': [
'config/win',
Expand Down Expand Up @@ -226,6 +233,13 @@
'GCC_ENABLE_SSE41_EXTENSIONS': 'YES',
},
}],
[ 'OS == "win" and clang == 1', {
# cl.exe's /arch flag doesn't have a setting for SSE4.1, and cl.exe
# doesn't need it for intrinsics. clang-cl does need it, though.
'msvs_settings': {
'VCCLCompilerTool': { 'AdditionalOptions': [ '-msse4.1' ] },
},
}],
[ 'OS == "win"', {
'defines' : [
'SK_CPU_SSE_LEVEL=41'
Expand Down

0 comments on commit a8b437d

Please sign in to comment.