Search code examples
cgccintrinsics

Testing for builtins/intrinsics


I have some code that uses gcc intrinsics. I would like to include code in case the intrinsic is missing. How can I do this?

#ifdef __builtin_ctzll

does not work.


Solution

  • GCC now (for the last few years) supports __has_builtin: It was introduced in GCC 10.1, May 7 2020. See the new features for that version here.

    Also, thanks to @Charles comment, find the bug report here