Does /arch:AVX enable AVX2?

2019-03-28 07:14发布

问题:

I can't find an answer to this simple question, does the /arch:AVX enable AVX2 with its fancy 256 bit registers on the Visual Studio 2012 Update 4?

Line of thought:

Yes, it enables AVX because VS doesn't mention AVX2. But I think VS can do AVX2 because my intrinsic work.

No, it doesn't because SSE and SSE2 are separate

回答1:

It refers to AVX not AVX2. According to Microsoft this applies (mostly) to floating point operations. VS2012 supports AVX2 intrinsic functions regardless of this flag. AVX is available on i3, i5 and i7 variants of SandyBridge and IvyBridge. AVX2 started with Haswell.



回答2:

The using of "/arch:AVX" compiler options allows to use AVX2 integer instructions more efficiently. If this options is disabled then code with AVX2 instructions may be slower then with SSE2 (because there are many switchings between SSE2 and AVX2).



回答3:

I have already confirmed that Visual Studio 2013 Update 5, when /arch:AVX is enabled, still compiles certain part of the code into AVX2, currently there is no option to say AVX only, which I hope Microsoft would fix.