|
| 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 %s |
| 3 | + |
| 4 | +; Check multiple overlap errors. |
| 5 | + |
| 6 | +; A overlaps with B |
| 7 | +; B overlaps with C |
| 8 | +; StructuredBuffer<float> A[5] : register(t1, space11); // 1-5 |
| 9 | +; StructuredBuffer<float> B[6] : register(t2, space11); // 2-7 |
| 10 | +; StructuredBuffer<float> C[3] : register(t6, space11); // 6-8 |
| 11 | + |
| 12 | +; CHECK: error: resource A at register 1 overlaps with resource B at register 2 in space 11 |
| 13 | +; CHECK: error: resource B at register 2 overlaps with resource C at register 6 in space 11 |
| 14 | + |
| 15 | +target triple = "dxil-pc-shadermodel6.3-library" |
| 16 | + |
| 17 | +@A.str = private unnamed_addr constant [2 x i8] c"A\00", align 1 |
| 18 | +@B.str = private unnamed_addr constant [2 x i8] c"B\00", align 1 |
| 19 | +@C.str = private unnamed_addr constant [2 x i8] c"C\00", align 1 |
| 20 | + |
| 21 | +; Fake globals to store handles in; this is to make sure the handlefrombinding calls |
| 22 | +; are not optimized away by llc. |
| 23 | +@One = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 4 |
| 24 | +@Two = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 4 |
| 25 | +@Three = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 4 |
| 26 | + |
| 27 | +define void @test_overlapping() "hlsl.export" { |
| 28 | +entry: |
| 29 | + %h1 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 11, i32 1, i32 5, i32 0, i1 false, ptr @A.str) |
| 30 | + store target("dx.RawBuffer", float, 0, 0) %h1, ptr @One, align 4 |
| 31 | + |
| 32 | + %h2 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 11, i32 2, i32 6, i32 0, i1 false, ptr @B.str) |
| 33 | + store target("dx.RawBuffer", float, 0, 0) %h2, ptr @Two, align 4 |
| 34 | + |
| 35 | + %h3 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 11, i32 6, i32 3, i32 4, i1 false, ptr @C.str) |
| 36 | + store target("dx.RawBuffer", float, 0, 0) %h3, ptr @Three, align 4 |
| 37 | + |
| 38 | + ret void |
| 39 | +} |
0 commit comments