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

Deric Cheung via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 25 09:34:19 PST 2025


================
@@ -738,6 +739,16 @@ def UMin : DXILOp<40, binary> {
   let attributes = [Attributes<DXIL1_0, [ReadNone]>];
 }
 
+def UAddc : DXILOp<44, binaryWithCarryOrBorrow > {
+  let Doc = "Unsigned 32-bit integer arithmetic add with carry. uaddc(a,b) = (a+b, a+b overflowed ? 1 : 0)";
+  let intrinsics = [IntrinSelect<int_uadd_with_overflow>];
----------------
Icohedron wrote:

It is the `AddUint64` HLSL function that only accepts `uint32_t2` and `uint32_t4` to perform a 64-bit add operation. `AddUint64` lowers into several instructions, one (or two) of which is the `int_uadd_with_overflow` intrinsic used to compute an i32 add with carry, which is the same exact operation performed by `UAddc`.

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


More information about the llvm-commits mailing list