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

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 9 15:31:01 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(
----------------
joaosaffran wrote:

`DXIL.td`, is defining the OpCode call signature, like it's arguments, return type, shader stages where it is available, etc.
First, the `OpCode` is generated from `DXIL.td`, so the Op codes defined in there will be made available through the `OpCode` class. Finally, when we call `tryCreateOp` it will check the values specified within `DXIL.td` in order to make sure the call is valid. 

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


More information about the cfe-commits mailing list