[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:29:29 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:
I'm not sure I understand the concern. `UAddc` and `int_uadd_with_overflow` are equivalent operations on inputs of `uint32_t` type. Vectors of `uint32_t` must be scalarized to be lowered to `UAddc`.
Other types accepted by `int_uadd_with_overflow` (`uint16_t` and `uint64_t` scalars or vectors) are not currently able to be lowered to DXIL. Attempting to lower to DXIL results in an error like the following: `error: <unknown>:0:0: in function uaddci16 i16 (i16, i16): Cannot create UAddc operation: Invalid overload type`. But they could be supported
https://github.com/llvm/llvm-project/pull/127137
More information about the llvm-commits
mailing list