[clang] [llvm] [HLSL] [DXIL] Implement the `AddUint64` HLSL function and the `UAddc` DXIL op (PR #125319)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 14:54:51 PST 2025


================
@@ -359,18 +359,21 @@ class OpLowerer {
     return lowerToBindAndAnnotateHandle(F);
   }
 
-  Error replaceSplitDoubleCallUsages(CallInst *Intrin, CallInst *Op) {
+  Error replaceExtractElementTypeOfCallUsages(CallInst *Intrin, CallInst *Op) {
     for (Use &U : make_early_inc_range(Intrin->uses())) {
       if (auto *EVI = dyn_cast<ExtractValueInst>(U.getUser())) {
 
         if (EVI->getNumIndices() != 1)
-          return createStringError(std::errc::invalid_argument,
-                                   "Splitdouble has only 2 elements");
+          return createStringError(
----------------
joaosaffran wrote:

I think it is alright to reuse `splitdouble` logic for this intrinsic. We have issue https://github.com/llvm/llvm-project/issues/113192 that keeps track of doing this struct lowering more generic. There is a list of intrinsic there that requires similar lowering. At the time issue https://github.com/llvm/llvm-project/issues/113192 was created, we discussed that some intrinsic lowering will have specificities. So I would suggest commenting the implementation of `replaceFunctionWithNamedStructOp` into issue https://github.com/llvm/llvm-project/issues/113192, but I would wait for more intrinsic that require lowering to be added, so we can have more information to create the generic lowering function. 

About the error being handled in `if (EVI->getNumIndices() != 1)`, if it's being caught somewhere else, feel free to remove it. This was originally added due to the wonky lowering process of splitdouble.

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


More information about the llvm-commits mailing list