diff --git a/clang/lib/CodeGen/CGHLSLRuntime.cpp b/clang/lib/CodeGen/CGHLSLRuntime.cpp index b695d016c0524..d15e348a5d1c6 100644 --- a/clang/lib/CodeGen/CGHLSLRuntime.cpp +++ b/clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -116,12 +116,12 @@ static const ValueDecl *getArrayDecl(const ArraySubscriptExpr *ASE) { return getArrayDecl(E); } -// Get the total size of the array, or -1 if the array is unbounded. +// Get the total size of the array, or 0 if the array is unbounded. static int getTotalArraySize(ASTContext &AST, const clang::Type *Ty) { Ty = Ty->getUnqualifiedDesugaredType(); assert(Ty->isArrayType() && "expected array type"); if (Ty->isIncompleteArrayType()) - return -1; + return 0; return AST.getConstantArrayElementCount(cast(Ty)); } diff --git a/clang/test/CodeGenHLSL/resources/res-array-global-unbounded.hlsl b/clang/test/CodeGenHLSL/resources/res-array-global-unbounded.hlsl index 6756a26bfc124..66bf71b3b0a35 100644 --- a/clang/test/CodeGenHLSL/resources/res-array-global-unbounded.hlsl +++ b/clang/test/CodeGenHLSL/resources/res-array-global-unbounded.hlsl @@ -30,14 +30,14 @@ void main(uint GI : SV_GroupIndex) { // and explicit binding (u10, space1) // CHECK: @hlsl::RWBuffer::__createFromBinding(unsigned int, unsigned int, int, unsigned int, char const*) // CHECK-SAME: (ptr {{.*}} sret(%"class.hlsl::RWBuffer.0") align {{(4|8)}} %[[Tmp0]], - // CHECK-SAME: i32 noundef 10, i32 noundef 1, i32 noundef -1, i32 noundef 100, ptr noundef @A.str) + // CHECK-SAME: i32 noundef 10, i32 noundef 1, i32 noundef 0, i32 noundef 100, ptr noundef @A.str) // CHECK-NEXT: %[[BufPtr:.*]] = call {{.*}} ptr{{.*}} @hlsl::RWBuffer::operator[](unsigned int)(ptr {{.*}} %[[Tmp0]], i32 noundef 0) // CHECK-NEXT: %[[Value1:.*]] = load float, ptr{{.*}} %[[BufPtr]], align 4 // CHECK-NEXT: store float %[[Value1]], ptr %a, align 4 float a = A[100][0]; // Make sure B[2][3] is translated to a local RWBuffer[4] array where each array element - // is initialized by a constructor call with range -1 and index 52-55 and implicit binding + // is initialized by a constructor call with range 0 and index 52-55 and implicit binding // (space 0, order_id 0) // The first index is calculated from the array dimensions (unbounded x 5 x 4) and indices (2, 3) // as 2 * 5 * 4 + 3 * 4 = 52 and the following indices are sequential. @@ -45,22 +45,22 @@ void main(uint GI : SV_GroupIndex) { // CHECK-NEXT: %[[Ptr_Tmp2_0:.*]] = getelementptr [4 x %"class.hlsl::RWBuffer"], ptr %[[Tmp2]], i32 0, i32 0 // CHECK-NEXT: call void @hlsl::RWBuffer::__createFromImplicitBinding(unsigned int, unsigned int, int, unsigned int, char const*) // CHECK-SAME: (ptr {{.*}} sret(%"class.hlsl::RWBuffer") align {{(4|8)}} %[[Ptr_Tmp2_0]], - // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef -1, i32 noundef 52, ptr noundef @[[BufB]]) + // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 52, ptr noundef @[[BufB]]) // CHECK-NEXT: %[[Ptr_Tmp2_1:.*]] = getelementptr [4 x %"class.hlsl::RWBuffer"], ptr %[[Tmp2]], i32 0, i32 1 // CHECK-NEXT: call void @hlsl::RWBuffer::__createFromImplicitBinding(unsigned int, unsigned int, int, unsigned int, char const*) // CHECK-SAME: (ptr {{.*}} sret(%"class.hlsl::RWBuffer") align {{(4|8)}} %[[Ptr_Tmp2_1]], - // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef -1, i32 noundef 53, ptr noundef @[[BufB]]) + // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 53, ptr noundef @[[BufB]]) // CHECK-NEXT: %[[Ptr_Tmp2_2:.*]] = getelementptr [4 x %"class.hlsl::RWBuffer"], ptr %[[Tmp2]], i32 0, i32 2 // CHECK-NEXT: call void @hlsl::RWBuffer::__createFromImplicitBinding(unsigned int, unsigned int, int, unsigned int, char const*) // CHECK-SAME: (ptr {{.*}} sret(%"class.hlsl::RWBuffer") align {{(4|8)}} %[[Ptr_Tmp2_2]], - // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef -1, i32 noundef 54, ptr noundef @[[BufB]]) + // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 54, ptr noundef @[[BufB]]) // CHECK-NEXT: %[[Ptr_Tmp2_3:.*]] = getelementptr [4 x %"class.hlsl::RWBuffer"], ptr %[[Tmp2]], i32 0, i32 3 // CHECK-NEXT: call void @hlsl::RWBuffer::__createFromImplicitBinding(unsigned int, unsigned int, int, unsigned int, char const*) // CHECK-SAME: (ptr {{.*}} sret(%"class.hlsl::RWBuffer") align {{(4|8)}} %[[Ptr_Tmp2_3]], - // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef -1, i32 noundef 55, ptr noundef @[[BufB]]) + // CHECK-SAME: i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 55, ptr noundef @[[BufB]]) // DXIL-NEXT: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %[[Tmp1]], ptr align 4 %[[Tmp2]], i32 16, i1 false) // SPV-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 8 %[[Tmp1]], ptr align 8 %[[Tmp2]], i64 32, i1 false) diff --git a/llvm/docs/DirectX/DXILResources.rst b/llvm/docs/DirectX/DXILResources.rst index d1841dfe0afcb..4471a248108cf 100644 --- a/llvm/docs/DirectX/DXILResources.rst +++ b/llvm/docs/DirectX/DXILResources.rst @@ -191,7 +191,7 @@ arguments. * - ``%range_size`` - 3 - ``i32`` - - Range size of the binding, where ``UINT32_MAX (~0U)`` denotes an unbounded range. + - Range size of the binding, where ``0`` denotes an unbounded range. * - ``%index`` - 4 - ``i32`` diff --git a/llvm/include/llvm/Analysis/DXILResource.h b/llvm/include/llvm/Analysis/DXILResource.h index f38de81d76a2c..dc54dfa64b539 100644 --- a/llvm/include/llvm/Analysis/DXILResource.h +++ b/llvm/include/llvm/Analysis/DXILResource.h @@ -384,13 +384,18 @@ class ResourceInfo { return !(*this == RHS); } bool operator<(const ResourceBinding &RHS) const { - return std::tie(RecordID, Space, LowerBound, Size) < - std::tie(RHS.RecordID, RHS.Space, RHS.LowerBound, RHS.Size); + // a size of 0 indicates unbounded. Accounting for when the size is 0 + // guarantees a well ordered results. + const bool LHSIsUnbounded = Size == 0; + const bool RHSIsUnbounded = RHS.Size == 0; + return std::tie(RecordID, Space, LowerBound, LHSIsUnbounded, Size) < + std::tie(RHS.RecordID, RHS.Space, RHS.LowerBound, RHSIsUnbounded, + RHS.Size); } bool overlapsWith(const ResourceBinding &RHS) const { if (Space != RHS.Space) return false; - if (Size == UINT32_MAX) + if (Size == 0) return LowerBound < RHS.LowerBound; return LowerBound + Size - 1 >= RHS.LowerBound; } diff --git a/llvm/lib/Analysis/DXILResource.cpp b/llvm/lib/Analysis/DXILResource.cpp index f01a6f80161a5..a427a261d82d3 100644 --- a/llvm/lib/Analysis/DXILResource.cpp +++ b/llvm/lib/Analysis/DXILResource.cpp @@ -692,7 +692,7 @@ MDTuple *ResourceInfo::getAsMetadata(Module &M, MDVals.push_back(MDString::get(Ctx, Name)); MDVals.push_back(getIntMD(Binding.Space)); MDVals.push_back(getIntMD(Binding.LowerBound)); - MDVals.push_back(getIntMD(Binding.Size)); + MDVals.push_back(getIntMD(Binding.Size == 0 ? ~0u : Binding.Size)); if (RTI.isCBuffer()) { MDVals.push_back(getIntMD(RTI.getCBufferSize(DL))); @@ -1071,14 +1071,12 @@ void DXILResourceBindingInfo::populate(Module &M, DXILResourceTypeMap &DRTM) { cast(CI->getArgOperand(2))->getZExtValue(); Value *Name = CI->getArgOperand(4); - // UINT32_MAX (~0U) size means unbounded resource array; + // 0 size means unbounded resource array; // upper bound register overflow should be detected in Sema - assert((Size == UINT32_MAX || - (uint64_t)LowerBound + (uint64_t)Size - 1ULL <= - (uint64_t)UINT32_MAX) && + assert((Size == 0 || (uint64_t)LowerBound + (uint64_t)Size - 1ULL <= + (uint64_t)UINT32_MAX) && "upper bound register overflow"); - uint32_t UpperBound = - Size == UINT32_MAX ? UINT32_MAX : LowerBound + Size - 1; + uint32_t UpperBound = Size == 0 ? UINT32_MAX : LowerBound + Size - 1; Builder.trackBinding(RTI.getResourceClass(), Space, LowerBound, UpperBound, Name); } diff --git a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp index 95577dd668e1e..5fdc498db57e1 100644 --- a/llvm/lib/Target/DirectX/DXContainerGlobals.cpp +++ b/llvm/lib/Target/DirectX/DXContainerGlobals.cpp @@ -194,10 +194,10 @@ void DXContainerGlobals::addResourcesForPSV(Module &M, PSVRuntimeInfo &PSV) { BindInfo.Type = Type; BindInfo.LowerBound = Binding.LowerBound; assert( - (Binding.Size == UINT32_MAX || + (Binding.Size == 0 || (uint64_t)Binding.LowerBound + Binding.Size - 1 <= UINT32_MAX) && "Resource range is too large"); - BindInfo.UpperBound = (Binding.Size == UINT32_MAX) + BindInfo.UpperBound = (Binding.Size == 0) ? UINT32_MAX : Binding.LowerBound + Binding.Size - 1; BindInfo.Space = Binding.Space; diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp index 0c0830cc92aa7..794bae8fd3a34 100644 --- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp +++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp @@ -354,9 +354,8 @@ class OpLowerer { // For `CreateHandleFromBinding` we need the upper bound rather than the // size, so we need to be careful about the difference for "unbounded". - uint32_t Unbounded = std::numeric_limits::max(); - uint32_t UpperBound = Binding.Size == Unbounded - ? Unbounded + uint32_t UpperBound = Binding.Size == 0 + ? std::numeric_limits::max() : Binding.LowerBound + Binding.Size - 1; Constant *ResBind = OpBuilder.getResBind(Binding.LowerBound, UpperBound, Binding.Space, RC); diff --git a/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp b/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp index 9da3bdb8d59b2..12e54ad2cc73e 100644 --- a/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp +++ b/llvm/lib/Target/DirectX/DXILPrettyPrinter.cpp @@ -214,7 +214,7 @@ struct FormatBindingSize void format(llvm::raw_ostream &OS, StringRef Style) override { uint32_t Size = Item.getBinding().Size; - if (Size == std::numeric_limits::max()) + if (Size == 0) OS << "unbounded"; else OS << Size; diff --git a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp index 3e50e4a0e8c80..5e966df6372db 100644 --- a/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp @@ -6012,6 +6012,10 @@ bool SPIRVInstructionSelector::loadHandleBeforePosition( SC = GR.getPointerStorageClass(ResType); } + if (ResType->getOpcode() == SPIRV::OpTypeImage && ArraySize == 0) + MIRBuilder.buildInstr(SPIRV::OpCapability) + .addImm(SPIRV::Capability::RuntimeDescriptorArrayEXT); + Register VarReg = buildPointerToResource(SPIRVTypeInst(VarType), SC, Set, Binding, ArraySize, IndexReg, Name, MIRBuilder); diff --git a/llvm/test/CodeGen/DirectX/Binding/binding-overlap-6.ll b/llvm/test/CodeGen/DirectX/Binding/binding-overlap-6.ll index a58e85b4159f1..dcca4feb31dae 100644 --- a/llvm/test/CodeGen/DirectX/Binding/binding-overlap-6.ll +++ b/llvm/test/CodeGen/DirectX/Binding/binding-overlap-6.ll @@ -18,7 +18,7 @@ target triple = "dxil-pc-shadermodel6.3-library" define void @test_overlapping() { entry: %h1 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 3, i32 0, ptr @A.str) - %h2 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 4, i32 -1, i32 0, ptr @B.str) + %h2 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 4, i32 0, i32 0, ptr @B.str) %h3 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 17, i32 1, i32 0, ptr @C.str) ret void } diff --git a/llvm/test/CodeGen/DirectX/Binding/binding-overlap-7.ll b/llvm/test/CodeGen/DirectX/Binding/binding-overlap-7.ll index 9c52d6ed3486a..151c770489826 100644 --- a/llvm/test/CodeGen/DirectX/Binding/binding-overlap-7.ll +++ b/llvm/test/CodeGen/DirectX/Binding/binding-overlap-7.ll @@ -29,7 +29,7 @@ entry: ; Buffer C[] : register(t2, space4); %h2 = call target("dx.TypedBuffer", double, 0, 0, 0) - @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 -1, i32 10, ptr @C.str) + @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 0, i32 10, ptr @C.str) ret void } diff --git a/llvm/test/CodeGen/DirectX/ContainerData/PSVResources.ll b/llvm/test/CodeGen/DirectX/ContainerData/PSVResources.ll index d792078b8cbb7..ea3a02245c1cc 100644 --- a/llvm/test/CodeGen/DirectX/ContainerData/PSVResources.ll +++ b/llvm/test/CodeGen/DirectX/ContainerData/PSVResources.ll @@ -105,7 +105,7 @@ define void @main() #0 { ; CHECK: UsedByAtomic64: false ; RWBuffer Buf = BufferArray[100]; %uav3 = call target("dx.TypedBuffer", <4 x float>, 1, 0, 0) - @llvm.dx.resource.handlefrombinding(i32 5, i32 10, i32 -1, i32 100, ptr null) + @llvm.dx.resource.handlefrombinding(i32 5, i32 10, i32 0, i32 100, ptr null) ret void } diff --git a/llvm/test/CodeGen/DirectX/CreateHandle.ll b/llvm/test/CodeGen/DirectX/CreateHandle.ll index 6cca501bb2568..d92f4d369ad94 100644 --- a/llvm/test/CodeGen/DirectX/CreateHandle.ll +++ b/llvm/test/CodeGen/DirectX/CreateHandle.ll @@ -61,7 +61,7 @@ define void @test_buffers() { %typed3_ix = call i32 @some_val() %typed3 = call target("dx.TypedBuffer", <4 x float>, 0, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f32_0_0_0t( - i32 0, i32 7, i32 -1, i32 %typed3_ix, ptr null) + i32 0, i32 7, i32 0, i32 %typed3_ix, ptr null) ; CHECK: %[[IX:.*]] = add i32 %typed3_ix, 7 ; CHECK: call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 %[[IX]], i1 false) #[[#ATTR]] diff --git a/llvm/test/CodeGen/DirectX/CreateHandleFromBinding.ll b/llvm/test/CodeGen/DirectX/CreateHandleFromBinding.ll index 671fcef281314..561193508297b 100644 --- a/llvm/test/CodeGen/DirectX/CreateHandleFromBinding.ll +++ b/llvm/test/CodeGen/DirectX/CreateHandleFromBinding.ll @@ -66,7 +66,7 @@ define void @test_bindings() { %typed3_ix = call i32 @some_val() %typed3 = call target("dx.TypedBuffer", <4 x float>, 0, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_v4f32_0_0_0t( - i32 0, i32 7, i32 -1, i32 %typed3_ix, ptr null) + i32 0, i32 7, i32 0, i32 %typed3_ix, ptr null) ; CHECK: %[[IX:.*]] = add i32 %typed3_ix, 7 ; CHECK: [[BUF5:%.*]] = call %dx.types.Handle @dx.op.createHandleFromBinding(i32 217, %dx.types.ResBind { i32 7, i32 -1, i32 0, i8 0 }, i32 %[[IX]], i1 false) #[[#ATTR]] ; CHECK: call %dx.types.Handle @dx.op.annotateHandle(i32 216, %dx.types.Handle [[BUF5]], %dx.types.ResourceProperties { i32 10, i32 1033 }) #[[#ATTR]] diff --git a/llvm/test/CodeGen/DirectX/Metadata/srv_metadata.ll b/llvm/test/CodeGen/DirectX/Metadata/srv_metadata.ll index 0062f90326490..ea8f418d4dada 100644 --- a/llvm/test/CodeGen/DirectX/Metadata/srv_metadata.ll +++ b/llvm/test/CodeGen/DirectX/Metadata/srv_metadata.ll @@ -80,9 +80,9 @@ define void @test() #0 { ; Buffer C1 = Array[10]; ; Buffer C2 = Array[20]; %Array2_10_h = call target("dx.TypedBuffer", double, 0, 0, 0) - @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 -1, i32 10, ptr @Array2.str) + @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 0, i32 10, ptr @Array2.str) %Array2_20_h = call target("dx.TypedBuffer", double, 0, 0, 0) - @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 -1, i32 20, ptr @Array2.str) + @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 0, i32 20, ptr @Array2.str) ret void } diff --git a/llvm/test/CodeGen/DirectX/Metadata/uav_metadata.ll b/llvm/test/CodeGen/DirectX/Metadata/uav_metadata.ll index d377a528abca1..0f7d56fb1261e 100644 --- a/llvm/test/CodeGen/DirectX/Metadata/uav_metadata.ll +++ b/llvm/test/CodeGen/DirectX/Metadata/uav_metadata.ll @@ -92,9 +92,9 @@ define void @test() #0 { ; RWBuffer C1 = Array[10]; ; RWBuffer C2 = Array[20]; %Array2_10_h = call target("dx.TypedBuffer", double, 1, 0, 0) - @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 -1, i32 10, ptr @Array2.str) + @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 0, i32 10, ptr @Array2.str) %Array2_20_h = call target("dx.TypedBuffer", double, 1, 0, 0) - @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 -1, i32 20, ptr @Array2.str) + @llvm.dx.resource.handlefrombinding(i32 4, i32 2, i32 0, i32 20, ptr @Array2.str) ; Same buffer type as Nine - should have the same type in metadata ; RWBuffer Ten : register(u2); diff --git a/llvm/test/CodeGen/SPIRV/hlsl-resources/unbounded-arr.ll b/llvm/test/CodeGen/SPIRV/hlsl-resources/unbounded-arr.ll new file mode 100644 index 0000000000000..2b0394c356aa3 --- /dev/null +++ b/llvm/test/CodeGen/SPIRV/hlsl-resources/unbounded-arr.ll @@ -0,0 +1,29 @@ +; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv1.6-vulkan1.3-library %s -o - | FileCheck %s +; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv1.6-vulkan1.3-library %s -o - -filetype=obj | spirv-val %} + +; CHECK-DAG: OpCapability RuntimeDescriptorArrayEXT +; CHECK-DAG: %[[int32:[0-9]+]] = OpTypeInt 32 0 +; CHECK-DAG: %[[rwbuffer:[0-9]+]] = OpTypeImage %[[int32]] Buffer 2 0 0 2 R32i +; CHECK-DAG: OpTypeRuntimeArray %[[rwbuffer]] + +; This IR was emmited from the following HLSL code: +; [[vk::binding(0)]] +; RWBuffer Buf[] : register(u0); +; +; [numthreads(4,2,1)] +; void main(uint GI : SV_GroupIndex) { +; Buf[0][0] = 0; +; } + +@Buf.str = private unnamed_addr constant [4 x i8] c"Buf\00", align 1 + +; Function Attrs: convergent noinline norecurse +define void @main() #0 { +entry: + %binding = call target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 24) @llvm.spv.resource.handlefrombinding(i32 0, i32 0, i32 0, i32 0, ptr @Buf.str) + %pointer = call noundef align 4 dereferenceable(4) ptr addrspace(11) @llvm.spv.resource.getpointer(target("spirv.SignedImage", i32, 5, 2, 0, 0, 2, 24) %binding, i32 0) + store i32 0, ptr addrspace(11) %pointer, align 4 + ret void +} + +attributes #0 = { convergent noinline norecurse "hlsl.numthreads"="4,2,1" "hlsl.shader"="compute" } diff --git a/llvm/unittests/Target/DirectX/ResourceBindingAnalysisTests.cpp b/llvm/unittests/Target/DirectX/ResourceBindingAnalysisTests.cpp index 3211c2c702aab..65e1beadf3e38 100644 --- a/llvm/unittests/Target/DirectX/ResourceBindingAnalysisTests.cpp +++ b/llvm/unittests/Target/DirectX/ResourceBindingAnalysisTests.cpp @@ -71,7 +71,7 @@ TEST_F(ResourceBindingAnalysisTest, TestOverlap) { StringRef Assembly = R"( define void @main() { entry: - %handleA = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 2, i32 0, i32 -1, i32 100, ptr null) + %handleA = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 2, i32 0, i32 0, i32 100, ptr null) %handleB = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 2, i32 4, i32 1, i32 0, ptr null) ret void }