File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,37 @@ For example:
128128
129129- F-extension v2.2 will define `+__riscv_f+` as `2002000`.
130130
131+ === Architecture Profile Test Macros
132+
133+ Architecture profile test macros allow checking whether a specific RISC-V profile
134+ is in effect at compile-time. These macros enable developers to conditionally compile code
135+ based on the target profile.
136+
137+ The naming rule for profile test macros is `+__riscv_<profile_name>+`,
138+ where `<profile_name>` is the lowercase profile identifier.
139+
140+ Examples:
141+
142+ - The test macro for the RVA23U64 profile is `+__riscv_rva23u64+`.
143+ - The test macro for the RVI20U32 profile is `+__riscv_rvi20u32+`.
144+
145+ The profile macro is defined (with value 1) when the compiler detects that the enabled extensions match a specific RISC-V profile.
146+
147+ Example usage:
148+
149+ [source, C]
150+ ----
151+ #ifdef __riscv_rva23u64
152+ // Code specific to the RVA23U64 profile
153+ #endif
154+
155+ #ifdef __riscv_rvi20u32
156+ // Code specific to the RVI20U32 profile
157+ #endif
158+ ----
159+
160+ NOTE: The compiler selects the best matching profile based on the maximum number of matching extensions when multiple profiles could apply.
161+
131162=== ABI Related Preprocessor Definitions
132163
133164.ABI Related Preprocessor Definitions
You can’t perform that action at this time.
0 commit comments