[all-commits] [llvm/llvm-project] 45ea3b: [HLSL] Add float overload for `InterlockedExchange...

Joshua Batista via All-commits all-commits at lists.llvm.org
Thu Sep 24 15:13:15 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45ea3b957284d8940b109b6b6706f451e9719ef9
      https://github.com/llvm/llvm-project/commit/45ea3b957284d8940b109b6b6706f451e9719ef9
  Author: Joshua Batista <jbatista at microsoft.com>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M clang/include/clang/Basic/Builtins.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/CodeGen/CGHLSLBuiltins.cpp
    M clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
    M clang/lib/Sema/HLSLExternalSemaSource.cpp
    M clang/lib/Sema/SemaHLSL.cpp
    M clang/test/CodeGenHLSL/builtins/InterlockedExchange.hlsl
    M clang/test/CodeGenHLSL/builtins/RWByteAddressBuffer-InterlockedExchange.hlsl
    M clang/test/CodeGenHLSL/builtins/RWTexture-Interlocked.hlsl
    A clang/test/SemaHLSL/BuiltIns/ByteAddressBuffer-InterlockedExchangeFloat-sm60.hlsl
    M clang/test/SemaHLSL/BuiltIns/InterlockedExchange-errors.hlsl
    M llvm/lib/Target/DirectX/DXILLegalizePass.cpp
    M llvm/lib/Target/DirectX/DXILResourceAccess.cpp
    A llvm/test/CodeGen/DirectX/LegalizeAtomicExchangeFloat-unsupported-width.ll
    A llvm/test/CodeGen/DirectX/LegalizeAtomicExchangeFloat.ll
    M llvm/test/CodeGen/DirectX/ResourceAtomicBinOp-texture-nonscalar.ll
    A llvm/test/CodeGen/DirectX/ResourceAtomicExchangeFloat.ll

  Log Message:
  -----------
  [HLSL] Add float overload for `InterlockedExchange` (#222163)

This PR adds the float overload of `InterlockedExchange`, and the
`InterlockedExchangeFloat` method on `RWByteAddressBuffer` and
`RasterizerOrderedByteAddressBuffer`. 

The HLSL interlocked builtins are declared with a variadic type in
`Builtins.td`, so Clang applies the default argument promotions to their
arguments. That promotion turns a `float` argument into a `double`
before Sema
sees it. The Sema check then rejects the call and names the type as
`'double'`
in the diagnostic, which does not match what the user wrote.

`CustomTypeChecking` suppresses that promotion, so the argument keeps
its
`float` type and the diagnostic names it correctly.

Only the builtins that can see a float argument need the attribute. This
PR
sets it on `__builtin_hlsl_interlocked_exchange` alone. The later float
builtins in this stack set it as they are added. The integer-only
builtins do
not set it, because they never see a float and the promotion cannot
affect
them.

Fixes: https://github.com/llvm/llvm-project/issues/99129
Assisted by: Github Copilot



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