[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/ilinpv closed https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/jroelofs approved this pull request. https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
ilinpv wrote: Thanks @MaskRay for valuable comments, all addressed. https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/ilinpv updated https://github.com/llvm/llvm-project/pull/84098 >From 528af71d043d306a4aeb5c448a0780fa42644c15 Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Wed, 6 Mar 2024 00:23:36 + Subject: [PATCH 1/3] [NFC][Docs] Documenting __builtin_cpu_supports. --- clang/docs/LanguageExtensions.rst | 28 1 file changed, 28 insertions(+) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index bcd69198eafdbe..f939d1c765e91a 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a +warning and replace builtin by constant 0. + +Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. + ``__builtin_dump_struct`` - >From 165d1f0a360f47c2419eef1c4ab1c54d826b609a Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Wed, 6 Mar 2024 11:19:20 + Subject: [PATCH 2/3] Update clang/docs/LanguageExtensions.rst Co-authored-by: Jon Roelofs --- clang/docs/LanguageExtensions.rst | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index f939d1c765e91a..96b76273c71166 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2817,13 +2817,13 @@ Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``. **Description**: -The ``__builtin_cpu_supports`` function detects at runtime if target CPU -supports features specified in string argument. It returns positive integer -if all features are supported and 0 otherwise. Names of features and format is +The ``__builtin_cpu_supports`` function detects at runtime if the target CPU +supports features specified in string argument. It returns a positive integer +if all features are supported and 0 otherwise. Names of features and format are target specific. For example on AArch64 features are combined using ``+`` like this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. -If feature name is not supported or format is wrong, compiler will issue a -warning and replace builtin by constant 0. +If a feature name is not supported or the format is wrong, the compiler will issue a +warning and replace builtin by the constant 0. Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. >From 280583a3f8fabb544b549feffbd4e7bb27808bc3 Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Wed, 6 Mar 2024 15:48:58 + Subject: [PATCH 3/3] Addressing comments to __builtin_cpu_supports description. --- clang/docs/LanguageExtensions.rst | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 96b76273c71166..2b54dffd058a35 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2817,13 +2817,13 @@ Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``. **Description**: -The ``__builtin_cpu_supports`` function detects at runtime if the target CPU -supports features specified in string argument. It returns a positive integer -if all features are supported and 0 otherwise. Names of features and format are -target specific. For example on AArch64 features are combined using ``+`` like -this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. -If a feature name is not supported or the format is wrong, the compiler will issue a -warning and replace builtin by the constant 0. +The ``__builtin_cpu_supports`` function detects if the run-time CPU supports +features specified in string argument. It returns a positive integer if all +features are supported and 0 otherwise. Feature names are target specific. On +AArch64 features are combined using ``+`` like this +``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If a feature name is not supported, Clang will issue a warning and replace +builtin by the constant 0. Query for this feature with
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/ilinpv updated https://github.com/llvm/llvm-project/pull/84098 >From 528af71d043d306a4aeb5c448a0780fa42644c15 Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Wed, 6 Mar 2024 00:23:36 + Subject: [PATCH 1/2] [NFC][Docs] Documenting __builtin_cpu_supports. --- clang/docs/LanguageExtensions.rst | 28 1 file changed, 28 insertions(+) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index bcd69198eafdbe..f939d1c765e91a 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a +warning and replace builtin by constant 0. + +Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. + ``__builtin_dump_struct`` - >From 165d1f0a360f47c2419eef1c4ab1c54d826b609a Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Wed, 6 Mar 2024 11:19:20 + Subject: [PATCH 2/2] Update clang/docs/LanguageExtensions.rst Co-authored-by: Jon Roelofs --- clang/docs/LanguageExtensions.rst | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index f939d1c765e91a..96b76273c71166 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -2817,13 +2817,13 @@ Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``. **Description**: -The ``__builtin_cpu_supports`` function detects at runtime if target CPU -supports features specified in string argument. It returns positive integer -if all features are supported and 0 otherwise. Names of features and format is +The ``__builtin_cpu_supports`` function detects at runtime if the target CPU +supports features specified in string argument. It returns a positive integer +if all features are supported and 0 otherwise. Names of features and format are target specific. For example on AArch64 features are combined using ``+`` like this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. -If feature name is not supported or format is wrong, compiler will issue a -warning and replace builtin by constant 0. +If a feature name is not supported or the format is wrong, the compiler will issue a +warning and replace builtin by the constant 0. Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a +warning and replace builtin by constant 0. + +Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. ilinpv wrote: ah, articles 臘 Thanks for grammar fix https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a MaskRay wrote: If a feature is not supported, Clang will ... https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 +supports features specified in string argument. It returns positive integer MaskRay wrote: a positive integer https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like MaskRay wrote: Remove: "For example". I believe other targets don't support `+`. https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is MaskRay wrote: Feature names are target-specific. "format" seems not useful in this context? https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/MaskRay approved this pull request. https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
@@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a +warning and replace builtin by constant 0. + +Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. jroelofs wrote: ```suggestion The ``__builtin_cpu_supports`` function detects at runtime if the target CPU supports features specified in string argument. It returns a positive integer if all features are supported and 0 otherwise. Names of features and format are target specific. For example on AArch64 features are combined using ``+`` like this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. If a feature name is not supported or the format is wrong, the compiler will issue a warning and replace builtin by the constant 0. Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. ``` https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/jroelofs approved this pull request. Some small nits, but LGTM. https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/jroelofs edited https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
llvmbot wrote: @llvm/pr-subscribers-clang Author: Pavel Iliin (ilinpv) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/84098.diff 1 Files Affected: - (modified) clang/docs/LanguageExtensions.rst (+28) ``diff diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index bcd69198eafdbe..f939d1c765e91a 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a +warning and replace builtin by constant 0. + +Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. + ``__builtin_dump_struct`` - `` https://github.com/llvm/llvm-project/pull/84098 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [NFC][Docs] Documenting __builtin_cpu_supports. (PR #84098)
https://github.com/ilinpv created https://github.com/llvm/llvm-project/pull/84098 None >From 528af71d043d306a4aeb5c448a0780fa42644c15 Mon Sep 17 00:00:00 2001 From: Pavel Iliin Date: Wed, 6 Mar 2024 00:23:36 + Subject: [PATCH] [NFC][Docs] Documenting __builtin_cpu_supports. --- clang/docs/LanguageExtensions.rst | 28 1 file changed, 28 insertions(+) diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index bcd69198eafdbe..f939d1c765e91a 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -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 +supports features specified in string argument. It returns positive integer +if all features are supported and 0 otherwise. Names of features and format is +target specific. For example on AArch64 features are combined using ``+`` like +this ``__builtin_cpu_supports("flagm+sha3+lse+rcpc2+fcma+memtag+bti+sme2")``. +If feature name is not supported or format is wrong, compiler will issue a +warning and replace builtin by constant 0. + +Query for this feature with ``__has_builtin(__builtin_cpu_supports)``. + ``__builtin_dump_struct`` - ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits