Skip to content

use -mavx clang style options to enable SIMD for clang-cl#257

Closed
wangyoucao577 wants to merge 4 commits intoxiph:masterfrom
wangyoucao577:bugfix/avx-clangcl
Closed

use -mavx clang style options to enable SIMD for clang-cl#257
wangyoucao577 wants to merge 4 commits intoxiph:masterfrom
wangyoucao577:bugfix/avx-clangcl

Conversation

@wangyoucao577
Copy link
Copy Markdown

@wangyoucao577 wangyoucao577 commented Jul 23, 2022

  • Only use /arch:AVX MSVC style options to enable SIMD when strictly MSVC cl;
  • Use -mavx gcc/clang style options to enable SIMD when possible, for example clang-cl installed in MSVC;
  • Enable C11 for clang-cl;
  • Enable cpuinfo for clang-cl;

Closes #256

Signed-off-by: Jay Zhang <wangyoucao577@gmail.com>
Signed-off-by: Jay Zhang <wangyoucao577@gmail.com>
Comment thread CMakeLists.txt Outdated
add_sources_group(opus celt ${celt_sources_sse})
target_compile_definitions(opus PRIVATE OPUS_X86_MAY_HAVE_SSE)
if(NOT MSVC)
if(NOT (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "MSVC"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe easier to make a variable for the case when using MSVC compiler frontend and not.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Updated.

@xnorpx
Copy link
Copy Markdown
Contributor

xnorpx commented Jul 23, 2022

@wangyoucao577 can you add the same check for all other compiler flags regarding clang-cl frontend. (fast-math etc)

@wangyoucao577
Copy link
Copy Markdown
Author

@wangyoucao577 can you add the same check for all other compiler flags regarding clang-cl frontend. (fast-math etc)

I checked all MSVC related options in current cmake, unfortunately -ffast-math can't work on clang-cl, it must be /fp:fast. Supported options(c11, cpuinfo) has been updated.

@jmvalin
Copy link
Copy Markdown
Member

jmvalin commented Dec 4, 2023

What's the status of this PR?

@abique
Copy link
Copy Markdown

abique commented Feb 13, 2024

Is it the correct fix to enable avx everywhere?
If you do that then it'll allow the compiler to use avx regardless of the intrinsic right?

@jmvalin jmvalin deleted the branch xiph:master March 19, 2024 02:11
@jmvalin jmvalin closed this Mar 19, 2024
@xnorpx
Copy link
Copy Markdown
Contributor

xnorpx commented Mar 19, 2024

Master branch is deleted and all pr's against master is closed. If this change is still relevant please reopen and repoint your PR to main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build failed when disable AVX on Windows with MSVC clang-cl compiler

4 participants