-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove request for preprocessor guards from header files. #321
Changes from all commits
fc50eb1
994aec6
1270932
6e3991a
9079875
ae42458
92e5b8c
fb4b4f8
15bd063
4fafea9
50f5670
9d357be
cd750bf
7b3ee34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -925,8 +925,8 @@ and: | |||||||||
to the more specific header files below. These intrinsics are in the | ||||||||||
C implementation namespace and begin with double underscores. It is | ||||||||||
unspecified whether they are available without the header being | ||||||||||
included. The `__ARM_ACLE` macro should be tested before including the | ||||||||||
header: | ||||||||||
included. When `__ARM_ACLE` is defined to `1`, the header file is | ||||||||||
guaranteed to be available. | ||||||||||
|
||||||||||
``` c | ||||||||||
#ifdef __ARM_ACLE | ||||||||||
|
@@ -939,8 +939,9 @@ header: | |||||||||
`<arm_fp16.h>` is provided to define the scalar 16-bit floating point | ||||||||||
arithmetic intrinsics. As these intrinsics are in the user namespace, | ||||||||||
an implementation would not normally define them until the header is | ||||||||||
included. The `__ARM_FEATURE_FP16_SCALAR_ARITHMETIC` feature macro | ||||||||||
should be tested before including the header: | ||||||||||
included. When `__ARM_FEATURE_FP16_SCALAR_ARITHMETIC` is defined to `1`, | ||||||||||
the header file is available regardless of the context in which the macro | ||||||||||
is evaluated. | ||||||||||
|
||||||||||
``` c | ||||||||||
#ifdef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC | ||||||||||
|
@@ -953,8 +954,9 @@ should be tested before including the header: | |||||||||
`<arm_bf16.h>` is provided to define the 16-bit brain floating point | ||||||||||
arithmetic intrinsics. As these intrinsics are in the user namespace, | ||||||||||
an implementation would not normally define them until the header is | ||||||||||
included. The `__ARM_FEATURE_BF16` feature macro | ||||||||||
should be tested before including the header: | ||||||||||
included. When `__ARM_FEATURE_BF16` is defined to `1`, the header file is | ||||||||||
guaranteed to be available regardless of the context in which the macro | ||||||||||
is evaluated. | ||||||||||
|
||||||||||
``` c | ||||||||||
#ifdef __ARM_FEATURE_BF16 | ||||||||||
|
@@ -975,8 +977,10 @@ instructions available are conversion intrinsics between `bfloat16_t` and | |||||||||
intrinsics](#advanced-simd-neon-intrinsics) and associated | ||||||||||
[data types](#vector-data-types). As these intrinsics and data types are | ||||||||||
in the user namespace, an implementation would not normally define them | ||||||||||
until the header is included. The `__ARM_NEON` macro should be tested | ||||||||||
before including the header: | ||||||||||
until the header is included. When `__ARM_NEON` is defined to `1`, | ||||||||||
the header file is available regardless of the context in which the macro is | ||||||||||
evaluated. | ||||||||||
|
||||||||||
|
||||||||||
``` c | ||||||||||
#ifdef __ARM_NEON | ||||||||||
|
@@ -999,8 +1003,8 @@ following it. --><span id="arm_sve.h"></span> | |||||||||
`<arm_sve.h>` defines data types and intrinsics for SVE and its | ||||||||||
extensions; see [SVE language extensions and | ||||||||||
intrinsics](#sve-language-extensions-and-intrinsics) for details. | ||||||||||
You should test the `__ARM_FEATURE_SVE` macro before including the | ||||||||||
header: | ||||||||||
When `__ARM_FEATURE_SVE` is defined to `1`, the header file is available | ||||||||||
regardless of the context in which the macro is evaluated. | ||||||||||
|
||||||||||
``` c | ||||||||||
#ifdef __ARM_FEATURE_SVE | ||||||||||
|
@@ -1019,7 +1023,7 @@ Including `<arm_sve.h>` also includes the following header files: | |||||||||
|
||||||||||
`<arm_neon_sve_bridge.h>` defines intrinsics for moving data between | ||||||||||
Neon and SVE vector types; see [NEON-SVE Bridge](#neon-sve-bridge) | ||||||||||
for details. The `__ARM_NEON_SVE_BRIDGE` macro should be tested | ||||||||||
for details. The `__ARM_NEON_SVE_BRIDGE` macro should be tested | ||||||||||
before including the header: | ||||||||||
|
||||||||||
``` c | ||||||||||
|
@@ -1061,8 +1065,8 @@ change or be extended in the future. | |||||||||
|
||||||||||
`<arm_sme.h>` declares functions and defines intrinsics for SME | ||||||||||
and its extensions; see [SME language extensions and intrinsics](#sme-language-extensions-and-intrinsics) | ||||||||||
for details. The `__ARM_FEATURE_SME` macro should be tested before | ||||||||||
including the header: | ||||||||||
for details. When `__ARM_FEATURE_SME` is defined to `1`, the header file is | ||||||||||
available regardless of the context in which the macro is evaluated. | ||||||||||
|
||||||||||
``` c | ||||||||||
#ifdef __ARM_FEATURE_SME | ||||||||||
|
@@ -1072,6 +1076,39 @@ including the header: | |||||||||
|
||||||||||
Including `<arm_sme.h>` also includes [`<arm_sve.h>`](#arm_sve.h). | ||||||||||
|
||||||||||
### Predefined feature macros and header files | ||||||||||
|
||||||||||
CarolineConcatto marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
Evaluating a feature macro returns the availability of intrinsics and inline | ||||||||||
assembly for that feature, but no assumptions should be made on the order or | ||||||||||
context in which the preprocessor macros are evaluated. For example: | ||||||||||
|
||||||||||
``` c | ||||||||||
__attribute__((target("+sve"))) | ||||||||||
void foo() { | ||||||||||
#ifdef __ARM_FEATURE_SVE | ||||||||||
// The user should make no assumptions that the target attribute | ||||||||||
// has enabled the __ARM_FEATURE_SVE macro. | ||||||||||
Comment on lines
+1089
to
+1090
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: whitespace
Suggested change
|
||||||||||
#endif | ||||||||||
} | ||||||||||
``` | ||||||||||
|
||||||||||
CarolineConcatto marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
The compiler may add additional restrictions to the intrinsics beyond what is | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
captured by the ACLE macros depending on the context in which the intrinsics | ||||||||||
are used. For example: | ||||||||||
Comment on lines
+1095
to
+1097
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still not convinced this is worth pointing out, because the compiler may also enforce requirements on the range of immediate arguments, and we never bothered to document that either. That said though, I don't see any harm in adding this either. |
||||||||||
|
||||||||||
``` c | ||||||||||
#include <arm_sme.h> | ||||||||||
void foo(svbool_t pg, void *ptr, uint32_t slice_base) { | ||||||||||
#ifdef __ARM_FEATURE_SME | ||||||||||
svst1_hor_za8(0, slice_base, pg, ptr); | ||||||||||
CarolineConcatto marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||
#endif | ||||||||||
} | ||||||||||
``` | ||||||||||
|
||||||||||
If `__ARM_FEATURE_SME` evaluates to `true` the SME intrinsic `svst1_hor_za8` | ||||||||||
is available, but `foo` may still fail to compile because the call does not | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||
occur in a [streaming statement](#streaming-statement). | ||||||||||
|
||||||||||
## Attributes | ||||||||||
|
||||||||||
GCC-style attributes are provided to annotate types, objects and | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unnecessary change.