google / google/leveldb

CMake config sets HAVE_BMI2 on MSVC even when SNAPPY_REQUIRE_AVX is 0

Open
#781 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39.4k
Forks
8.2k
PR merge metrics
No merged PRs in 30d

Description

Experiment: https://godbolt.org/z/H7jymg

clang and gcc do not compile `_bzhi_u32` without `-mbmi2`. So, on these compilers, setting `SNAPPY_REQUIRE_AVX2=0` should result in `HAVE_BMI2` being set to 0, as the compilation test should fail.

MSVC does compile `_bzhi_u32` without `/arch:AVX2`. [The docs](https://docs.microsoft.com/en-us/cpp/build/reference/arch-x64?view=vs-2019) state that the default for 64-bit compilers is SSE2. It seems like the docs are referring to the compiler's instruction selection and that, as you mentioned, MSVC will happily assemble anything you ask it to.

This issue is open while we figure out how to handle the MSVC situation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.