Invoking -mbmi

This commit is contained in:
Daniel Lemire 2019-01-16 13:26:24 -05:00
parent b5a2c41049
commit 90c881a3de
2 changed files with 7 additions and 2 deletions

View File

@ -54,7 +54,12 @@ static inline bool mul_overflow(uint64_t value1, uint64_t value2, uint64_t *re
/* result might be undefined when input_num is zero */
static inline int trailingzeroes(uint64_t input_num) {
return _tzcnt_u64(input_num); // for some reason, the Intel intrinsic _tzcnt_u64 may be missing
#ifdef __BMI__
return _tzcnt_u64(input_num);
#else
#warning "BMI is missing?"
return __builtin_ctzll(input_num);
#endif
}
/* result might be undefined when input_num is zero */

View File

@ -16,7 +16,7 @@ endif()
# some compilers like clang do not automagically define __AVX2__ and __BMI2__ even when the hardware supports it
if(NOT MSVC)
set (OPT_FLAGS "${OPT_FLAGS} -mavx2 -mbmi2 -mpclmul")
set (OPT_FLAGS "${OPT_FLAGS} -mavx2 -mbmi -mbmi2 -mpclmul")
else()
set (OPT_FLAGS "${OPT_FLAGS} /arch:AVX2 /std:c++latest")
endif()