[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
Wed Feb 26 14:23:17 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:

Whatever does the lowering for `int_uadd_with_overflow` generically would still need to know that the 32-bit `int_uadd_with_overflow` maps directly to the `UAddc` DXIL op in order to codegen optimally, as opposed to creating some expansion that does the same thing using more instructions.

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


More information about the llvm-commits mailing list