923923to the more specific header files below. These intrinsics are in the
924924C implementation namespace and begin with double underscores. It is
925925unspecified whether they are available without the header being
926- included. The `__ARM_ACLE` macro should be tested before including the
927- header:
926+ included. When `__ARM_ACLE` is defined to `1`, the header file is
927+ guaranteed to be available.
928928
929929``` c
930930 #ifdef __ARM_ACLE
@@ -937,8 +937,9 @@ header:
937937`<arm_fp16.h>` is provided to define the scalar 16-bit floating point
938938arithmetic intrinsics. As these intrinsics are in the user namespace,
939939an implementation would not normally define them until the header is
940- included. The `__ARM_FEATURE_FP16_SCALAR_ARITHMETIC` feature macro
941- should be tested before including the header:
940+ included. When `__ARM_FEATURE_FP16_SCALAR_ARITHMETIC` is defined to `1`,
941+ the header file is available regardless of the context in which the macro
942+ is evaluated.
942943
943944``` c
944945 #ifdef __ARM_FEATURE_FP16_SCALAR_ARITHMETIC
@@ -951,8 +952,9 @@ should be tested before including the header:
951952`<arm_bf16.h>` is provided to define the 16-bit brain floating point
952953arithmetic intrinsics. As these intrinsics are in the user namespace,
953954an implementation would not normally define them until the header is
954- included. The `__ARM_FEATURE_BF16` feature macro
955- should be tested before including the header:
955+ included. When `__ARM_FEATURE_BF16` is defined to `1`, the header file is
956+ guaranteed to be available regardless of the context in which the macro
957+ is evaluated.
956958
957959``` c
958960 #ifdef __ARM_FEATURE_BF16
@@ -973,8 +975,10 @@ instructions available are conversion intrinsics between `bfloat16_t` and
973975intrinsics](#advanced-simd-neon-intrinsics) and associated
974976[data types](#vector-data-types). As these intrinsics and data types are
975977in the user namespace, an implementation would not normally define them
976- until the header is included. The `__ARM_NEON` macro should be tested
977- before including the header:
978+ until the header is included. When `__ARM_NEON` is defined to `1`,
979+ the header file is available regardless of the context in which the macro is
980+ evaluated.
981+
978982
979983``` c
980984 #ifdef __ARM_NEON
@@ -995,8 +999,8 @@ to be included, if the header files are available:
995999`<arm_sve.h>` defines data types and intrinsics for SVE and its
9961000extensions; see [SVE language extensions and
9971001intrinsics](#sve-language-extensions-and-intrinsics) for details.
998- You should test the `__ARM_FEATURE_SVE` macro before including the
999- header:
1002+ When `__ARM_FEATURE_SVE` is defined to `1`, the header file is available
1003+ regardless of the context in which the macro is evaluated.
10001004
10011005``` c
10021006 #ifdef __ARM_FEATURE_SVE
@@ -1015,7 +1019,7 @@ Including `<arm_sve.h>` also includes the following header files:
10151019
10161020`<arm_neon_sve_bridge.h>` defines intrinsics for moving data between
10171021Neon and SVE vector types; see [NEON-SVE Bridge](#neon-sve-bridge)
1018- for details. The `__ARM_NEON_SVE_BRIDGE` macro should be tested
1022+ for details. The `__ARM_NEON_SVE_BRIDGE` macro should be tested
10191023before including the header:
10201024
10211025``` c
@@ -1057,8 +1061,8 @@ change or be extended in the future.
10571061
10581062`<arm_sme.h>` declares functions and defines intrinsics for SME
10591063and its extensions; see [SME language extensions and intrinsics](#sme-language-extensions-and-intrinsics)
1060- for details. The `__ARM_FEATURE_SME` macro should be tested before
1061- including the header:
1064+ for details. When `__ARM_FEATURE_SME` is defined to `1`, the header file is
1065+ available regardless of the context in which the macro is evaluated.
10621066
10631067``` c
10641068 #ifdef __ARM_FEATURE_SME
@@ -1068,6 +1072,39 @@ including the header:
10681072
10691073Including `<arm_sme.h>` also includes [`<arm_sve.h>`](#arm_sve.h).
10701074
1075+ ### Predefined feature macros and header files
1076+
1077+ Evaluating a feature macro returns the availability of intrinsics and inline
1078+ assembly for that feature, but no assumptions should be made on the order or
1079+ context in which the preprocessor macros are evaluated. For example:
1080+
1081+ ``` c
1082+ __attribute__((target("+sve")))
1083+ void foo() {
1084+ #ifdef __ARM_FEATURE_SVE
1085+ // The user should make no assumptions that the target attribute
1086+ // has enabled the __ARM_FEATURE_SVE macro.
1087+ #endif
1088+ }
1089+ ```
1090+
1091+ The compiler may add additional restrictions to the intrinsics beyond what is
1092+ captured by the ACLE macros depending on the context in which the intrinsics
1093+ are used. For example:
1094+
1095+ ``` c
1096+ #include <arm_sme.h>
1097+ void foo(svbool_t pg, void *ptr, uint32_t slice_base) {
1098+ #ifdef __ARM_FEATURE_SME
1099+ svst1_hor_za8(0, slice_base, pg, ptr);
1100+ #endif
1101+ }
1102+ ```
1103+
1104+ If `__ARM_FEATURE_SME` evaluates to `true` the SME intrinsic `svst1_hor_za8`
1105+ is available, but `foo` may still fail to compile because the call does not
1106+ occur in a [streaming statement](#streaming-statement).
1107+
10711108## Attributes
10721109
10731110GCC-style attributes are provided to annotate types, objects and
0 commit comments