47 lines · plain
1; Use llc for this test so that we don't abort after the first error.2; RUN: not llc %s -o /dev/null 2>&1 | FileCheck %s3 4; Check multiple overlap errors.5; Also check different resource class with same binding values is ok (no error expected).6 7; C overlaps with A8; C overlaps with B9; StructuredBuffer<float> A : register(t5);10; StructuredBuffer<float> B : register(t9);11; StructuredBuffer<float> C[10] : register(t0);12; RWBuffer<float> S[10] : register(u0);13 14; CHECK: error: resource C at register 0 overlaps with resource A at register 5 in space 015; CHECK: error: resource C at register 0 overlaps with resource B at register 9 in space 016 17target triple = "dxil-pc-shadermodel6.3-library"18 19@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 120@B.str = private unnamed_addr constant [2 x i8] c"B\00", align 121@C.str = private unnamed_addr constant [2 x i8] c"C\00", align 122@S.str = private unnamed_addr constant [2 x i8] c"S\00", align 123 24; Fake globals to store handles in; this is to make sure the handlefrombinding calls25; are not optimized away by llc.26@One = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 427@Two = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 428@Three = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 429@Four = internal global { target("dx.TypedBuffer", float, 1, 0, 0) } poison, align 430 31define void @test_overlapping() "hlsl.export" {32entry:33 %h1 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 5, i32 1, i32 0, ptr @A.str)34 store target("dx.RawBuffer", float, 0, 0) %h1, ptr @One, align 435 36 %h2 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 9, i32 1, i32 0, ptr @B.str)37 store target("dx.RawBuffer", float, 0, 0) %h2, ptr @Two, align 438 39 %h3 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 10, i32 4, ptr @C.str)40 store target("dx.RawBuffer", float, 0, 0) %h3, ptr @Three, align 441 42 %h4 = call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr @S.str)43 store target("dx.TypedBuffer", float, 1, 0, 0) %h4, ptr @Four, align 444 45 ret void46}47