List of CPU architecture-specific macros?

Jeffrey Walton noloader@gmail.com
Mon Feb 13 01:59:00 GMT 2017


On Sun, Feb 12, 2017 at 7:24 AM, Liu Hao <lh_mouse@126.com> wrote:
> Hello,
> Do we have a complete list of CPU architecture-specific macros (e.g.
> __SSE__, __FMA__ on x86)? The doc
> (https://gcc.gnu.org/onlinedocs/cpp/System-specific-Predefined-Macros.html)
> doesn't seem to mention it. Thanks.

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 can only say "most of the defines" because I know some of them are
omitted, like __MOVBE__, even when the processor supports it. To see
__MOVBE__ in the list, yo have to check /proc/cpuinfo and then add
-mmovbe if the cpu feature flag is set.

Jeff



More information about the Gcc-help mailing list