[clang] [llvm] Adding splitdouble HLSL function (PR #109331)

Farzon Lotfi via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 15:39:13 PDT 2024


================
@@ -461,6 +479,27 @@ class OpLowerer {
     });
   }
 
+  [[nodiscard]] bool lowerSplitDouble(Function &F) {
+    IRBuilder<> &IRB = OpBuilder.getIRB();
+    return replaceFunction(F, [&](CallInst *CI) -> Error {
+      IRB.SetInsertPoint(CI);
+
+      Value *Arg0 = CI->getArgOperand(0);
+
+      Type *NewRetTy = OpBuilder.getResSplitDoubleType(M.getContext());
+
+      std::array<Value *, 1> Args{Arg0};
+      Expected<CallInst *> OpCall = OpBuilder.tryCreateOp(
----------------
farzonl wrote:

so what im wondering is it possible to just something that looks like:
```
case Intrinsic::dx_splitdouble:
replaceSplitDoubleCallUsages(...);
replaceFunctionWithOp(F, OpCode); 
```
instead of writing our own intrinsic to op code lowering as a one off.

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


More information about the cfe-commits mailing list