Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Conditional compilation based on /arch: switch

mtlroom
Beginner
288 Views
I tried to search docs and online but I don't see:
1) how to do conditional compilation based on the targeted cpu/arch
2) how to emit all defined preprocessor maro.

MS compiler has these predifined macro:
http://msdn.microsoft.com/en-us/library/b0084kay%28v=VS.80%29.aspx

_M_IX86_FP

Expands to a value indicating which /arch compiler option was used:



Seems that Intel compiler does not implement that and doesn't have any other way to detect what /arch was used.
I tried to build a project that tested _M_IX86_FP and obviously results produced by intel ocmpiler sucked big time because it didn't properly mimic ms compiler. Among popular open source project that also test this macro is speex codec.
0 Kudos
2 Replies
Brandon_H_Intel
Employee
288 Views
Hi mtlroom,

First, if you want to print out the list of defined macros, compile a source file with "/QdM /E" to get a list of them.

Currently there isn't a predefined macro from the Intel compiler that will tell you what the /arch setting used to compile a source file is. I see potentially two feature requests here.

1. I think it makes the most sense for the Intel compiler to have its own macro for this due to the significantly different option settings the Intel compiler offers in this space (i.e. supporting SSSE3 and above options and also supporting this option on Intel 64 architectures).
2. If we do have an Intel-compiler-specific macro, then we could still support the _M_IX86_FP macro in compatibility situations where it makes sense (i.e. set it to 2 by default, or to 0 if /arch:IA32 or /arch:SSE is used and only define this on 32-bit compilations).

Does this make sense? Are you only interested in the second request or would you be interested in both?
0 Kudos
iccuser
Beginner
288 Views
Sorry for bumping an old thread, but I still see that Intel composer 12 update 5 doesn't support those 2 macros. Can you at least support those macros for now?
0 Kudos
Reply