List of CPU architecture-specific macros?

Jeffrey Walton noloader@gmail.com
Mon Feb 13 02:36:00 GMT 2017


On Sun, Feb 12, 2017 at 9:13 PM, Liu Hao <lh_mouse@126.com> wrote:
> On 2017/2/13 9:59, Jeffrey Walton wrote:
>>
>> For x86 machines, you often want to use 'gcc -march=native -dM -E
>> </dev/null | sort' (or similar). The '-march=native' is important to
>> get most of the defines for the native machine.
>
> I know a few of them and am wondering whether they are subject to change in
> future releases.

I've never seen them change from GCC release to GCC release. Once they
are added, they appear to be written in stone. Changing them would
probably be a bad idea.

The defines will change as you move from one processor to another.
Xeon's seem to cause a lot of confusion. Folks will compile on one
Xeon model, and then experience a SIGILL on another one. The
difference between Xeon E5-2699v4 and Xeon E5-2699v3 is not very
obvious until you realize its Broadwell (E5-2699v4) vs Haswell (
E5-2699v3).

There are a few odd ones, like -mrdrnd and __RDRND__ for the rdrand
instruction. In contrast, rdseed uses all the vowels: -mrdseed and
__RDSEED__.

Jeff



More information about the Gcc-help mailing list