问题
I read on a few sites that MSVC can actually emit say AVX instructions, when SSE2 architecture is used and detect the AVX support runtime. Is it true?
I tested various loops that would definitely benefit from AVX/AVX2 support, but when run in debugger I couldn't really find any AVX instructions.
When /arch:AVX is used, then it emits AVX instructions, but it of course crashes on CPUs that doesn't support it (tested), so no runtime detection either. I could use AVX intrinsics though and it would successfully create AVX instructions from them. Any ideas?
回答1:
I've contacted the VC++ team, and the answer is "no". The bug reports linked in the comments under the question show only normal bugs, rather than bugs in the auto-dispatch code generator.
So if /arch:SSE2 is specified (by default), VC++ can only auto-dispatch to SSE4. This is the only form of auto-dispatching that is currently supported. In other words, VC++ cannot auto-dispatch to AVX/AVX2.
来源:https://stackoverflow.com/questions/49846979/does-msvc-2017-support-automatic-cpu-dispatch