kimwalisch / primesieve

🚀 Fast prime number generator
BSD 2-Clause "Simplified" License
956 stars 123 forks source link

MSVC AVX512 status #149

Open kimwalisch opened 7 months ago

kimwalisch commented 7 months ago

The __AVX512F__, __AVX512CD__, __AVX512BW__, __AVX512DQ__ and __AVX512VL__ preprocessor symbols are defined when the /arch:AVX512 compiler option is specified.

According to the Microsoft MSVC website https://learn.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-170 the support of AVX512 macros is not good. When using the /arch:AVX512 option MSVC seems to support all of AVX512 however it only defines a small selection of the AVX512 macros. Because of this it is currently not possible to detect using the preprocessor if MSVC properly supports AVX512.

If MSVC would also define the __AVX512VBMI__ and __AVX512VBMI2__ macros (which might happen in the next major MSVC release) then AVX512 for MSVC would be supported by primesieve without any code changes required.