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

AMD64 compiler defines... not defined

mattst88
Beginner
790 Views
An easy way to improve gcc compatibility is to define the "__amd64__", "__amd64", or "amd64" symbols. gcc defines the first two, along with "__x86_64__". icc only defines "__x86_64__". Interesting. Politics, anyone?

Much free software checks for __amd64__ and not __x86_64__ which is why this is an issue.

For instance

#ifdef __amd64__
do64bitStuff();
#endif


This code works as expected when compiled with gcc, but has to be modified to be
#if defined __amd64__ || defined __x86_64__
do64bitStuff();
#endif

to be compiled by icc correctly.
0 Kudos
2 Replies
JenniferJ
Moderator
790 Views

We understand that __amd64__ is used because AMD came out with the 64-bit extensions before Intel did and thus older code still uses the former #define.

However, we think x86_64 makes more sense since it is a standard across all architectures, not limited to AMD, thus it does not makes sense to continue to propagate the former.

0 Kudos
Dale_S_Intel
Employee
790 Views
If you really need them, you could add -D__amd64__ and -D__amd64 to icc.cfg. This file should live in the same directory where the Intel64 icc binary lives, typically /opt/intel/cce//bin on Linux and Mac.

Dale
0 Kudos
Reply