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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 15:12:09 PDT 2024


================
@@ -264,6 +265,31 @@ class OpLowerer {
     return lowerToBindAndAnnotateHandle(F);
   }
 
+  Error replaceSplitDoubleCallUsages(CallInst *Intrin, CallInst *Op) {
+    IRBuilder<> &IRB = OpBuilder.getIRB();
+
+    for (Use &U : make_early_inc_range(Intrin->uses())) {
+      if (auto *EVI = dyn_cast<ExtractValueInst>(U.getUser())) {
+
+        assert(EVI->getNumIndices() == 1 &&
+               "splitdouble result should be indexed individually.");
+        if (EVI->getNumIndices() != 1)
+          return make_error<StringError>(
+              "splitdouble result should be indexed individually.",
+              inconvertibleErrorCode());
+
+        unsigned int IndexVal = EVI->getIndices()[0];
+
+        auto *OpEVI = IRB.CreateExtractValue(Op, IndexVal);
----------------
joaosaffran wrote:

Sure, done that

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


More information about the llvm-commits mailing list