RISC-V: Add intrinsic detection macros for compiler support.
Adds macros to detect compiler support for RISC-V intrinsic APIs, independent of the target architecture.
This patch introduces macros that allow users to detect compiler support for RISC-V intrinsic APIs. These macros, defined in the corresponding intrinsic headers, indicate compiler support independently of the -march setting. Scalar composite macros are derived from their component macros, ensuring they are defined only when all component intrinsic headers are included, improving the accuracy of feature detection.
In Details
The RISC-V C API defines macros for detecting compiler support for intrinsic APIs, independent of -march. This patch adds these macros to the relevant headers (e.g., riscv_vector.h, riscv_bitmanip.h). The macros enable users to determine if the compiler supports a specific intrinsic API without needing to check the enabled ISA extensions, simplifying the process of utilizing intrinsic functions.
For Context
RISC-V is a modular instruction set architecture (ISA), and extensions add optional features. Intrinsics offer a way to use specific hardware features directly from C code. This patch defines preprocessor macros that C code can use to detect whether the compiler supports a given intrinsic, independently of which extensions are enabled via command-line flags. This allows developers to write code that adapts to the available hardware features at compile time.