Re: Check for command line option in my header file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 17 July 2016 at 23:27, greg7mdp wrote:
> I want to use the gcc builtin __builtin_popcount() inside my program if, and
> only if, the program is compiled with the option -mpopcnt.
>
> This is because I see that calling __builtin_popcount() when the program is
> not compiled with option -mpopcnt is actually slower than doing the popcnt()
> computation myself.
>
> So I was hoping that there is a way to test whether a compilation option is
> present in the preprocessor. Anyone know the answer?

You can't test whether the option was given on the command-line, but
that's not the right thing to test anyway. What you can test is
whether use of the instruction is enabled, by checking for the
__POPCNT__ macro being defined.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux