================ @@ -96,6 +100,47 @@ the ``<cmath>`` header file to conditionally make a function constexpr whenever the constant evaluation of the corresponding builtin (for example, ``std::fmax`` calls ``__builtin_fmax``) is supported in Clang. +``__has_target_builtin`` +------------------------ + +This function-like macro takes a single identifier argument that is the name of +a builtin function, a builtin pseudo-function (taking one or more type +arguments), or a builtin template. +It evaluates to 1 if the builtin is supported on the current target or 0 if not. + +``__has_builtin`` and ``__has_target_builtin`` behave identically for normal C++ compilations. ---------------- AaronBallman wrote:
> if the user's goal is to check that the builtin can be codegen'd on the > current target being compiled, then yes they should use __has_target_builtin. > if they want to confirm it can be parsed but not necessarily codegen'd, then > they should use __has_builtin. if that's unclear let me know and i can try to > improve the doc Users don't typically think in terms of "parsed" and "codegenned", but more "works" and "doesn't work", which I think means "codegenned" in general. The line we're drawing here is pretty subtle, so perhaps more real world examples would help; it's hard to understand why a builtin can be parsed but cannot be used. https://github.com/llvm/llvm-project/pull/126324 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits