/arch:AVX should define a predefined macro in x64, and set a unique value for _M_IX86_FP in Win32 - by DaveB

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 605858 Comments
Status Closed Workarounds
Type Suggestion Repros 0
Opened 9/27/2010 6:35:39 PM
Access Restriction Public

Description

The predefined macro _M_IX86_FP is defined when compiling for 32-bit.  The value of the macro is determined by the /arch switch:
/arch not used -> _M_IX86_FP == 0
/arch:SSE -> _M_IX86_FP == 1
/arch:SSE2 -> _M_IX86_FP == 2

VC2010 now supports /arch:AVX.  However, _M_IX86_FP gets set to '2' which is the same value as /arch:SSE2.  I don't know if this is a bug or by design.  It would be nice if _M_IX86_FP had a new unique value when using /arch:AVX (=3 perhaps?).

_M_IX86_FP (or an equivilent x64 macro) is not defined when compiling for x64.  I assume this decision was by design as SSE2 is the default architecture for SIMD code generation for x64 targets.  However, with the advent of the /arch:AVX option, it follows that there should be a macro that can be queried by projects when enabling /arch:AVX for x64 builds.
Sign in to post a comment.
Posted by Chuck Walbourn - MSFT on 1/22/2014 at 12:03 PM
Note that VS 2012 and VS 2013 define an "__AVX__" control define when building with /arch:AVX
Posted by Microsoft on 11/8/2010 at 2:08 PM
RitualDave,

Thank you for reporting this feedback.

After discussing this, we have decided that this is by design. Because the AVX instructions do not just include floating point, we do not believe that we should extend this preprocessor macro to indicate AVX. We will be taking a look at creating an appropriate mechanism for identifying AVX compilations for both x86 and x64 for future product releases.

Currently there is no built in preprocessor macro that you can use to determine whether you are compiling for AVX enabled machines. You will have to build your own define into your build system.

Thanks
~Pete Steijn
Windows C++ SDET
Posted by Microsoft on 9/28/2010 at 3:47 AM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)