[clang] [llvm] Adding splitdouble HLSL function (PR #109331)
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 9 19:21:12 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(
----------------
bogner wrote:
We could potentially do this in a semi-generic way by having a `replaceFunctionWithNamedStructOp(F, OpCode, NewRetTy)`. Conceptually, we could even do that automatically within `replaceFunctionWithOp` with a little bit more tablegen. For these layout-compatible-but-named-struct operations I would expect them to all be the same.
https://github.com/llvm/llvm-project/pull/109331
More information about the cfe-commits
mailing list