I'm on Windows 10, with Clang version 5 (recently installed). When I compile the following
#define __AVX__
#define __AVX2__
#include <immintrin.h>
int main(void) {
__m256i a, b, result;
result = _mm256_add_epi64(a, b);
return 0;
}
I get the following error:
error: always_inline function '_mm256_add_epi64' requires target
feature 'avx2', but would be inlined into function 'main' that is
compiled without support for 'avx2'
result = _mm256_add_epi64(a, b);
^
MSVC compiles it just fine. What compiler option do I need to use in order to get Clang to compile this? Or is there something else going on?
If you are native compiling (host and target being the same machine so, not cross-compilation), then consider passing -march=native to clang
See also the user manual of the Clang compiler.
Notice that the Clang compiler is open source. You are allowed to download its source code and improve it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With