================
@@ -225,6 +235,42 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions
&Opts,
// Currently we support the v1.0 RISC-V V intrinsics.
Builder.defineMacro("__riscv_v_intrinsic", Twine(getVersionValue(1, 0)));
+ // These macros indicate which extensions have intrinsics supported by the
+ // toolchain, regardless of whether they are currently enabled.
+ for (llvm::StringRef Ext : UniqueExtensions) {
+ if (Ext == "64bit")
+ continue;
+ Builder.defineMacro("__riscv_v_intrinsic_" + Twine(Ext));
+ }
+
+ // Define macros for intrinsics that are not explicitly listed in
+ // RequiredFeatures in td files.
+ const char *ImplicitList[] = {"v", "zve32x", "zve32f",
+ "zve64x", "zve64f", "zve64d"};
+ for (const auto *Ext : ImplicitList)
+ Builder.defineMacro(Twine("__riscv_v_intrinsic_") + Ext);
+
+ // Define macros for shorthand extensions when all of intrinsics of its
+ // extensions are presented.
+ auto DefineSuperExt = [&](const char *Name, ArrayRef<const char *> Required)
{
+ assert(Required.size() > 0);
----------------
topperc wrote:
!Required.empty()
https://github.com/llvm/llvm-project/pull/187197
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits