[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
Fri Jan 31 16:11:37 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 95d993a838863269dc1b90de3808c1e40ac6d5f2 2bc239b3e7fce57899c2b54089005a73e8aff1c5 --extensions h,cpp -- clang/lib/CodeGen/CGBuiltin.cpp clang/lib/Headers/hlsl/hlsl_intrinsics.h clang/lib/Sema/SemaHLSL.cpp llvm/lib/Target/DirectX/DXILOpBuilder.cpp llvm/lib/Target/DirectX/DXILOpBuilder.h llvm/lib/Target/DirectX/DXILOpLowering.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
index af309663c6..f0f1bbabb6 100644
--- a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
@@ -234,7 +234,7 @@ static StructType *getBinaryWithCarryType(LLVMContext &Context) {
   if (auto *ST = StructType::getTypeByName(Context, "dx.types.i32c"))
     return ST;
   Type *Int32Ty = Type::getInt32Ty(Context);
-  Type *Int1Ty= Type::getInt1Ty(Context);
+  Type *Int1Ty = Type::getInt1Ty(Context);
   return StructType::create({Int32Ty, Int1Ty}, "dx.types.i32c");
 }
 
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index d639430ba5..9fa4836181 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -364,12 +364,16 @@ public:
       if (auto *EVI = dyn_cast<ExtractValueInst>(U.getUser())) {
 
         if (EVI->getNumIndices() != 1)
-          return createStringError(std::errc::invalid_argument, (std::string(Intrin->getOpcodeName()) + " has only 2 elements").c_str());
+          return createStringError(
+              std::errc::invalid_argument,
+              (std::string(Intrin->getOpcodeName()) + " has only 2 elements")
+                  .c_str());
         EVI->setOperand(0, Op);
       } else {
-        return make_error<StringError>(
-            (std::string(Intrin->getOpcodeName()) + " use is not ExtractValueInst").c_str(),
-            inconvertibleErrorCode());
+        return make_error<StringError>((std::string(Intrin->getOpcodeName()) +
+                                        " use is not ExtractValueInst")
+                                           .c_str(),
+                                       inconvertibleErrorCode());
       }
     }
 
@@ -827,8 +831,7 @@ public:
       // https://github.com/llvm/llvm-project/issues/113192 is fixed
       case Intrinsic::uadd_with_overflow:
         HasErrors |= replaceFunctionWithNamedStructOp(
-            F, OpCode::UAddc,
-            OpBuilder.getBinaryWithCarryType(M.getContext()),
+            F, OpCode::UAddc, OpBuilder.getBinaryWithCarryType(M.getContext()),
             [&](CallInst *CI, CallInst *Op) {
               return replaceExtractElementTypeOfCallUsages(CI, Op);
             });

``````````

</details>


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


More information about the llvm-commits mailing list