[clang] [llvm] [HLSL] Implement ddx/ddy_coarse intrinsics (PR #164831)
    Farzon Lotfi via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Oct 23 08:38:06 PDT 2025
    
    
  
================
@@ -151,6 +151,18 @@ Value *CodeGenFunction::EmitSPIRVBuiltinExpr(unsigned BuiltinID,
         Intrinsic::spv_global_offset,
         ArrayRef<Value *>{EmitScalarExpr(E->getArg(0))}, nullptr,
         "spv.global.offset");
+  case SPIRV::BI__builtin_spirv_ddx_coarse:
+    return Builder.CreateIntrinsic(
+        /*ReturnType=*/getTypes().ConvertType(E->getType()),
+        Intrinsic::spv_ddx_coarse,
+        ArrayRef<Value *>{EmitScalarExpr(E->getArg(0))}, nullptr,
+        "spv.ddx.coarse");
+  case SPIRV::BI__builtin_spirv_ddy_coarse:
+    return Builder.CreateIntrinsic(
+        /*ReturnType=*/getTypes().ConvertType(E->getType()),
+        Intrinsic::spv_ddy_coarse,
+        ArrayRef<Value *>{EmitScalarExpr(E->getArg(0))}, nullptr,
+        "spv.ddy.coarse");
----------------
farzonl wrote:
This isn't wrong, but is out of scope for how we are doing HLSL intrinsics. we don't just want to add target builtins because we can.  If there is a different project that wants to expand these to make c\c++ a proper frontend for spirv that project can feel free to make this change, but for us this would be equivalent to adding an untested entry point to the spv intrinsics. please revert for this change.
https://github.com/llvm/llvm-project/pull/164831
    
    
More information about the llvm-commits
mailing list