[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 22:06:46 PST 2024


================
@@ -2799,6 +2799,34 @@ counter's true frequency will need to be provided by the user.
 
 Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``.
 
+``__builtin_cpu_supports``
+--------------------------
+
+**Syntax**:
+
+.. code-block:: c++
+
+  int __builtin_cpu_supports(const char *features);
+
+**Example of Use:**:
+
+.. code-block:: c++
+
+  if (__builtin_cpu_supports("sve"))
+    sve_code();
+
+**Description**:
+
+The ``__builtin_cpu_supports`` function detects at runtime if target CPU
----------------
MaskRay wrote:

"target CPU" can cause confusion: is this the CPU specified at compile time?

run-time CPU is clearer.

https://github.com/llvm/llvm-project/pull/84098


More information about the cfe-commits mailing list