[all-commits] [llvm/llvm-project] b4eceb: [HLSL] [DXIL] Implement the AddUint64 HLSL functio...

Deric C. via All-commits all-commits at lists.llvm.org
Wed Mar 5 17:04:31 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b4ecebe745ddebf30449435203deeb6463ecf9f0
      https://github.com/llvm/llvm-project/commit/b4ecebe745ddebf30449435203deeb6463ecf9f0
  Author: Deric C. <cheung.deric at gmail.com>
  Date:   2025-03-05 (Wed, 05 Mar 2025)

  Changed paths:
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Headers/hlsl/hlsl_alias_intrinsics.h
    M clang/lib/Sema/SemaHLSL.cpp
    A clang/test/CodeGenHLSL/builtins/AddUint64.hlsl
    A clang/test/SemaHLSL/BuiltIns/AddUint64-errors.hlsl
    M llvm/lib/Target/DirectX/DXIL.td
    M llvm/lib/Target/DirectX/DXILOpBuilder.cpp
    A llvm/test/CodeGen/DirectX/UAddc.ll
    A llvm/test/CodeGen/DirectX/UAddc_errors.ll
    A llvm/test/CodeGen/SPIRV/hlsl-intrinsics/AddUint64.ll

  Log Message:
  -----------
  [HLSL] [DXIL] Implement the AddUint64 HLSL function and the UAddc DXIL op (#127137)

Fixes #99205.

- Implements the HLSL intrinsic `AddUint64` used to perform unsigned
64-bit integer addition by using pairs of unsigned 32-bit integers
instead of native 64-bit types
- The LLVM intrinsic `uadd_with_overflow` is used in the implementation
of `AddUint64` in `CGBuiltin.cpp`
- The DXIL op `UAddc` was defined in `DXIL.td`, and a lowering of the
LLVM intrinsic `uadd_with_overflow` to the `UAddc` DXIL op was
implemented in `DXILOpLowering.cpp`

Notes:
- `__builtin_addc` was not able to be used to implement `AddUint64` in
`hlsl_intrinsics.h` because its `CarryOut` argument is a pointer, and
pointers are not supported in HLSL
- A lowering of the LLVM intrinsic `uadd_with_overflow` to SPIR-V
[already
exists](https://github.com/llvm/llvm-project/blob/main/llvm/test/CodeGen/SPIRV/llvm-intrinsics/uadd.with.overflow.ll)
- When lowering the LLVM intrinsic `uadd_with_overflow` to the `UAddc`
DXIL op, the anonymous struct type `{ i32, i1 }` is replaced with a
named struct type `%dx.types.i32c`. This aspect of the implementation
may be changed when issue #113192 gets addressed
- Fixes issues mentioned in the comments on the original PR #125319

---------

Co-authored-by: Finn Plummer <50529406+inbelic at users.noreply.github.com>
Co-authored-by: Farzon Lotfi <farzonlotfi at microsoft.com>
Co-authored-by: Chris B <beanz at abolishcrlf.org>
Co-authored-by: Justin Bogner <mail at justinbogner.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list