Check for command line option in my header file

Jeffrey Walton noloader@gmail.com
Mon Jul 18 02:46:00 GMT 2016


On Sun, Jul 17, 2016 at 10:09 PM, greg7mdp <greg7mdp@gmail.com> wrote:
> Thanks. However that's exactly what it appears to do, i.e. when I compile
> with the option -mpopcnt, the macro __POPCNT__ is defined, but is not
> defined when the option is not given.
> That's exactly what I was looking for! Thanks again.

-march=native can be used to enable it *if* its a native CPU feature.
It does not depend on the user adding (or not adding) -mpopcnt.

You can see all (most?) of the defines for a particular CPU feature with:

   gcc -march=native -dM -E - </dev/null

Jeff



More information about the Gcc-help mailing list