Skip to content

Commit aea75da

Browse files
author
joaosaffran
committed
fix test
1 parent 403b546 commit aea75da

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1
2+
; CHECK: error: register srv (space=0, register=0) is bound to a texture or typed buffer.
3+
4+
;
5+
; Resource Bindings:
6+
;
7+
; Name Type Format Dim ID HLSL Bind Count
8+
; ------------------------------ ---------- ------- ----------- ------- -------------- ---------
9+
; B texture f32 buf T0 t0 1
10+
; Out UAV struct r/w U0 u0 1
11+
;
12+
; ModuleID = '../clang/test/SemaHLSL/RootSignature-Validation-Textures.hlsl'
13+
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
14+
target triple = "dxilv1.5-unknown-shadermodel6.5-compute"
15+
16+
%"Buffer<float>" = type { float }
17+
%"RWStructuredBuffer<int32_t>" = type { i32 }
18+
19+
@.str = private unnamed_addr constant [4 x i8] c"Out\00", align 1
20+
@.str.2 = private unnamed_addr constant [2 x i8] c"B\00", align 1
21+
@B = external constant %"Buffer<float>"
22+
@Out = external constant %"RWStructuredBuffer<int32_t>"
23+
24+
; Function Attrs: mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none)
25+
define void @CSMain() local_unnamed_addr #0 {
26+
entry:
27+
%0 = tail call target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_1_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @.str)
28+
%1 = tail call target("dx.TypedBuffer", float, 0, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_0_0_0t(i32 0, i32 0, i32 1, i32 0, i1 false, ptr nonnull @.str.2)
29+
%2 = call { float, i1 } @llvm.dx.resource.load.typedbuffer.f32.tdx.TypedBuffer_f32_0_0_0t(target("dx.TypedBuffer", float, 0, 0, 0) %1, i32 0)
30+
%3 = extractvalue { float, i1 } %2, 0
31+
%conv.i = fptosi float %3 to i32
32+
call void @llvm.dx.resource.store.rawbuffer.tdx.RawBuffer_i32_1_0t.i32(target("dx.RawBuffer", i32, 1, 0) %0, i32 0, i32 0, i32 %conv.i)
33+
ret void
34+
}
35+
36+
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)
37+
declare target("dx.RawBuffer", i32, 1, 0) @llvm.dx.resource.handlefrombinding.tdx.RawBuffer_i32_1_0t(i32, i32, i32, i32, i1, ptr) #1
38+
39+
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)
40+
declare target("dx.TypedBuffer", float, 0, 0, 0) @llvm.dx.resource.handlefrombinding.tdx.TypedBuffer_f32_0_0_0t(i32, i32, i32, i32, i1, ptr) #1
41+
42+
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)
43+
declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_i32_1_0t(target("dx.RawBuffer", i32, 1, 0), i32) #1
44+
45+
; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(none)
46+
declare ptr @llvm.dx.resource.getpointer.p0.tdx.TypedBuffer_f32_0_0_0t(target("dx.TypedBuffer", float, 0, 0, 0), i32) #1
47+
48+
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(read)
49+
declare { float, i1 } @llvm.dx.resource.load.typedbuffer.f32.tdx.TypedBuffer_f32_0_0_0t(target("dx.TypedBuffer", float, 0, 0, 0), i32) #2
50+
51+
; Function Attrs: nocallback nofree nosync nounwind willreturn memory(write)
52+
declare void @llvm.dx.resource.store.rawbuffer.tdx.RawBuffer_i32_1_0t.i32(target("dx.RawBuffer", i32, 1, 0), i32, i32, i32) #3
53+
54+
attributes #0 = { mustprogress nofree noinline norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) "approx-func-fp-math"="true" "frame-pointer"="all" "hlsl.numthreads"="8,8,1" "hlsl.shader"="compute" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
55+
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(none) }
56+
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(read) }
57+
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(write) }
58+
59+
!dx.rootsignatures = !{!0}
60+
!llvm.module.flags = !{!4, !5}
61+
!dx.valver = !{!6}
62+
!llvm.ident = !{!7}
63+
!dx.shaderModel = !{!8}
64+
!dx.version = !{!9}
65+
!dx.resources = !{!10}
66+
!dx.entryPoints = !{!17}
67+
68+
!0 = !{ptr @CSMain, !1, i32 2}
69+
!1 = !{!2, !3}
70+
!2 = !{!"RootSRV", i32 0, i32 0, i32 0, i32 4}
71+
!3 = !{!"RootUAV", i32 0, i32 0, i32 0, i32 2}
72+
!4 = !{i32 1, !"wchar_size", i32 4}
73+
!5 = !{i32 7, !"frame-pointer", i32 2}
74+
!6 = !{i32 1, i32 8}
75+
!7 = !{!"clang version 21.0.0git (https://github.com/joaosaffran/llvm-project.git c16f15b4cd469a3f6efc2e4b0e098190d7fd0787)"}
76+
!8 = !{!"cs", i32 6, i32 5}
77+
!9 = !{i32 1, i32 5}
78+
!10 = !{!11, !14, null, null}
79+
!11 = !{!12}
80+
!12 = !{i32 0, ptr @B, !"B", i32 0, i32 0, i32 1, i32 10, i32 0, !13}
81+
!13 = !{i32 0, i32 9}
82+
!14 = !{!15}
83+
!15 = !{i32 0, ptr @Out, !"Out", i32 0, i32 0, i32 1, i32 12, i1 false, i1 false, i1 false, !16}
84+
!16 = !{i32 1, i32 4}
85+
!17 = !{ptr @CSMain, !"CSMain", null, !10, !18}
86+
!18 = !{i32 0, i64 16, i32 4, !19}
87+
!19 = !{i32 8, i32 8, i32 1}

0 commit comments

Comments
 (0)