RISC-V: Add intrinsic detection macros

RISC-V C API pull request #183 specifies macros that let users
detect compiler support for intrinsic APIs independent of -march:
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/183

Define __riscv_intrinsic_<extension> macros in the corresponding
RISC-V intrinsic headers.  The macros describe compiler support for
an intrinsic API and do not depend on whether the related ISA
extension is enabled by -march.

Derive scalar composite macros from their component macros so they
are only defined when all component intrinsic headers have been
included.

gcc/
	* config/riscv/andes_vector.h: Define intrinsic detection macros.
	* config/riscv/riscv_bitmanip.h: Likewise.
	* config/riscv/riscv_crypto.h: Likewise.
	* config/riscv/riscv_vector.h: Likewise.
	* config/riscv/sifive_vector.h: Likewise.
	* doc/extend.texi: Document RISC-V intrinsic detection macros.

gcc/testsuite/
	* gcc.target/riscv/intrinsic-detection-bitmanip.c: New test.
	* gcc.target/riscv/intrinsic-detection-crypto.c: New test.
	* gcc.target/riscv/intrinsic-detection-scalar-reverse.c: New test.
	* gcc.target/riscv/intrinsic-detection-scalar.c: New test.
	* gcc.target/riscv/rvv/base/intrinsic-detection.c: New test.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
11 files changed