brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · bd8dda7 Raw
42 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 6; A overlaps with B7; A overlaps with C8; B overlaps with C9; StructuredBuffer<float> A[5] : register(t1); // 1-510; StructuredBuffer<float> B[2] : register(t2); // 2-311; StructuredBuffer<float> C[3] : register(t3); // 3-5 12 13; CHECK: error: resource A at register 1 overlaps with resource B at register 2 in space 014; CHECK: error: resource A at register 1 overlaps with resource C at register 3 in space 015; CHECK: error: resource B at register 2 overlaps with resource C at register 3 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 23; Fake globals to store handles in; this is to make sure the handlefrombinding calls24; are not optimized away by llc.25@One = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 426@Two = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 427@Three = internal global { target("dx.RawBuffer", float, 0, 0) } poison, align 428 29define void @test_overlapping() "hlsl.export" {30entry:31  %h1 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 1, i32 5, i32 0, ptr @A.str)32  store target("dx.RawBuffer", float, 0, 0) %h1, ptr @One, align 433  34  %h2 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 2, i32 2, i32 0, ptr @B.str)35  store target("dx.RawBuffer", float, 0, 0) %h2, ptr @Two, align 436 37  %h3 = call target("dx.RawBuffer", float, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 3, i32 3, i32 4, ptr @C.str)38  store target("dx.RawBuffer", float, 0, 0) %h3, ptr @Three, align 439 40  ret void41}42