[clang] [llvm] [clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (PR #89796)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 11:22:01 PDT 2024


================
@@ -6088,6 +6088,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
   StringRef Prefix =
       llvm::Triple::getArchTypePrefix(getTarget().getTriple().getArch());
   if (!Prefix.empty()) {
+    if (Prefix == "spv" &&
+        getTarget().getTriple().getOS() == llvm::Triple::OSType::AMDHSA)
+      Prefix = "amdgcn";
----------------
efriedma-quic wrote:

If we want to allow this choice to be target-specific, we can just make the "IntrinsicPrefix" a property of the TargetInfo, instead of trying to derive it directly from the target triple.  The default constructor would derive it from the triple, but specific targets could override the field.

I'm more concerned this is going to prevent us from using builtins which shoud be usable; do we need to getIntrinsicForClangBuiltin() for both "spv" and "amdgcn"?

https://github.com/llvm/llvm-project/pull/89796


More information about the llvm-commits mailing list