Files
clang-p2996/llvm/test/CodeGen/DirectX/ImplicitBinding/simple.ll
Helena Kotas 03934d0a21 [DirectX] Implement DXILResourceImplicitBinding pass (#138043)
The `DXILResourceImplicitBinding` pass uses the results of
`DXILResourceBindingAnalysis` to assigns register slots to resources
that do not have explicit binding. It replaces all
`llvm.dx.resource.handlefromimplicitbinding` calls with
`llvm.dx.resource.handlefrombinding` using the newly assigned binding.

If a binding cannot be found for a resource, the pass will raise a
diagnostic error. Currently this diagnostic message does not include the
resource name, which will be addressed in a separate task (#137868).

Part 2/2 of #136786
Closes #136786
2025-05-12 23:00:00 -07:00

31 lines
1.3 KiB
LLVM

; RUN: opt -S -dxil-resource-implicit-binding %s | FileCheck %s
target triple = "dxil-pc-shadermodel6.6-compute"
define void @test_simple_binding() {
; StructuredBuffer<float> A : register(t1);
%bufA = call target("dx.RawBuffer", float, 0, 0)
@llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 1, i32 0, i1 false)
; no change to llvm.dx.resource.handlefrombinding
; CHECK: %bufA = call target("dx.RawBuffer", float, 0, 0)
; CHECK-SAME: @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_0_0t(i32 0, i32 1, i32 1, i32 0, i1 false)
; StructuredBuffer<float> B; // gets register(t0, space0)
%bufB = call target("dx.RawBuffer", float, 0, 0)
@llvm.dx.resource.handlefromimplicitbinding(i32 5, i32 0, i32 1, i32 0, i1 false)
; CHECK: %{{.*}} = call target("dx.RawBuffer", float, 0, 0)
; CHECK-SAME: @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false)
; StructuredBuffer<float> C; // gets register(t2, space0)
%bufC = call target("dx.RawBuffer", float, 0, 0)
@llvm.dx.resource.handlefromimplicitbinding(i32 6, i32 0, i32 1, i32 0, i1 false)
; CHECK: %{{.*}} = call target("dx.RawBuffer", float, 0, 0)
; CHECK-SAME: @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_f32_0_0t(i32 0, i32 2, i32 1, i32 0, i1 false)
; CHECK-NOT: @llvm.dx.resource.handlefromimplicitbinding
ret void
}