Skip to content

Show all predefined macros for your compiler

magnumripper edited this page Dec 18, 2014 · 3 revisions

This works for many other than gcc too, eg. clang and icc: gcc -dM -E -x c /dev/null. You can add switches and see how output differs:

$ alias gccmacros='gcc -dM -E -x c /dev/null'

$ gccmacros -m32 | grep -E "(MMX|SSE|AVX|XOP)"
#define __MMX__ 1
#define __SSE2__ 1
#define __SSE__ 1
#define __SSE3__ 1

$ gccmacros -march=native | grep -E "(MMX|SSE|AVX|XOP)"
#define __SSE4_1__ 1
#define __MMX__ 1
#define __SSE4_2__ 1
#define __SSE2_MATH__ 1
#define __AVX__ 1
#define __SSE_MATH__ 1
#define __SSE2__ 1
#define __SSSE3__ 1
#define __SSE__ 1
#define __SSE3__ 1