[PATCH] D125555: [clang] Add __has_target_feature

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 09:54:00 PDT 2022


tra added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:275
+  // On amdgcn target
+  #if __has_target_feature("s-memtime-inst")
+    x = __builtin_amdgcn_s_memtime();
----------------
Do you have a better example? This particular case could've been handled by existing `__has_builtin()`.

While I could see usefulness of checking features (e.g. for CUDA/NVPTX it could be used to chose inline assembly supported only by newer PTX versions, but even then that choice could be made using existing methods, even if they are not always direct (e.g. by using CUDA_VERSION as a proxy for "new enough PTX version").



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125555/new/

https://reviews.llvm.org/D125555



More information about the cfe-commits mailing list