================
@@ -5888,12 +5888,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(const 
GlobalDecl GD, unsigned BuiltinID,
   case Builtin::BI__builtin_printf:
   case Builtin::BIprintf:
     if (getTarget().getTriple().isNVPTX() ||
-        getTarget().getTriple().isAMDGCN()) {
+        getTarget().getTriple().isAMDGCN() ||
+        (getTarget().getTriple().isSPIRV() &&
+         getTarget().getTriple().getVendor() == Triple::VendorType::AMD)) {
       if (getLangOpts().OpenMPIsTargetDevice)
         return EmitOpenMPDevicePrintfCallExpr(E);
       if (getTarget().getTriple().isNVPTX())
         return EmitNVPTXDevicePrintfCallExpr(E);
-      if (getTarget().getTriple().isAMDGCN() && getLangOpts().HIP)
+      if ((getTarget().getTriple().isAMDGCN() ||
+           getTarget().getTriple().isSPIRV()) &&
+          getLangOpts().HIP)
----------------
AlexVlx wrote:

OMP seems to have no triple logic, and just unconditionally forwards to their 
`printf` impl if on the device path, so I'm not entirely sure on what the 
question is probing. If you're asking why we're not unconditionally forwarding 
in HIP, if compiling for device, I don't quite know, I'm merely re-using what 
was there. If you're asking why I'm not checking again for the vendor type, and 
merely checking for SPIR-V, it's because it'd be spurious due to the outer 
check. If it's none of those, could you please clarify what you mean?

https://github.com/llvm/llvm-project/pull/97132
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to