|
| 1 | +; RUN: %dxopt %s -hlsl-passes-resume -dxilgen -S | FileCheck %s |
| 2 | +; REQUIRES: dxil-1-9 |
| 3 | + |
| 4 | +; |
| 5 | +; Buffer Definitions: |
| 6 | +; |
| 7 | +; |
| 8 | +; Resource Bindings: |
| 9 | +; |
| 10 | +; Name Type Format Dim ID HLSL Bind Count |
| 11 | +; ------------------------------ ---------- ------- ----------- ------- -------------- ------ |
| 12 | +; outbuf UAV byte r/w U0u4294967295,space4294967295 1 |
| 13 | +; |
| 14 | +target datalayout = "e-m:e-p:32:32-i1:32-i8:32-i16:32-i32:32-i64:64-f16:32-f32:32-f64:64-n8:16:32:64" |
| 15 | +target triple = "dxil-ms-dx" |
| 16 | + |
| 17 | +%struct.RWByteAddressBuffer = type { i32 } |
| 18 | +%dx.types.HitObject = type { i8* } |
| 19 | +%struct.CustomAttrs = type { <4 x float>, i32 } |
| 20 | +%dx.types.Handle = type { i8* } |
| 21 | +%dx.types.ResourceProperties = type { i32, i32 } |
| 22 | +%"class.dx::HitObject" = type { i32 } |
| 23 | + |
| 24 | +@"\01?outbuf@@3URWByteAddressBuffer@@A" = external global %struct.RWByteAddressBuffer, align 4 |
| 25 | + |
| 26 | +; CHECK: %[[ATTRA:[^ ]+]] = alloca %struct.CustomAttrs, align 4 |
| 27 | +; CHECK: call void @dx.op.hitObject_Attributes.struct.CustomAttrs(i32 289, %dx.types.HitObject %{{[^ ]+}}, %struct.CustomAttrs* %[[ATTRA]]) |
| 28 | + |
| 29 | +; Function Attrs: nounwind |
| 30 | +define void @"\01?main@@YAXXZ"() #0 { |
| 31 | +entry: |
| 32 | + %hit = alloca %dx.types.HitObject, align 4 |
| 33 | + %0 = bitcast %dx.types.HitObject* %hit to i8*, !dbg !21 ; line:22 col:3 |
| 34 | + call void @llvm.lifetime.start(i64 4, i8* %0) #0, !dbg !21 ; line:22 col:3 |
| 35 | + %1 = call %dx.types.HitObject* @"dx.hl.op..%dx.types.HitObject* (i32, %dx.types.HitObject*)"(i32 358, %dx.types.HitObject* %hit), !dbg !25 ; line:22 col:17 |
| 36 | + %2 = call %struct.CustomAttrs* @"dx.hl.op..%struct.CustomAttrs* (i32, %dx.types.HitObject*)"(i32 364, %dx.types.HitObject* %hit), !dbg !26 ; line:23 col:23 |
| 37 | + %3 = getelementptr inbounds %struct.CustomAttrs, %struct.CustomAttrs* %2, i32 0, i32 0, !dbg !26 ; line:23 col:23 |
| 38 | + %4 = load <4 x float>, <4 x float>* %3, !dbg !26 ; line:23 col:23 |
| 39 | + %5 = getelementptr inbounds %struct.CustomAttrs, %struct.CustomAttrs* %2, i32 0, i32 1, !dbg !26 ; line:23 col:23 |
| 40 | + %6 = load i32, i32* %5, !dbg !26 ; line:23 col:23 |
| 41 | + %7 = extractelement <4 x float> %4, i32 0, !dbg !27 ; line:24 col:15 |
| 42 | + %8 = extractelement <4 x float> %4, i32 1, !dbg !28 ; line:24 col:27 |
| 43 | + %add = fadd float %7, %8, !dbg !29 ; line:24 col:25 |
| 44 | + %9 = extractelement <4 x float> %4, i32 2, !dbg !30 ; line:24 col:39 |
| 45 | + %add4 = fadd float %add, %9, !dbg !31 ; line:24 col:37 |
| 46 | + %10 = extractelement <4 x float> %4, i32 3, !dbg !32 ; line:24 col:51 |
| 47 | + %add6 = fadd float %add4, %10, !dbg !33 ; line:24 col:49 |
| 48 | + %conv = sitofp i32 %6 to float, !dbg !34 ; line:24 col:63 |
| 49 | + %add7 = fadd float %add6, %conv, !dbg !35 ; line:24 col:61 |
| 50 | + %11 = load %struct.RWByteAddressBuffer, %struct.RWByteAddressBuffer* @"\01?outbuf@@3URWByteAddressBuffer@@A", !dbg !36 ; line:25 col:3 |
| 51 | + %12 = call %dx.types.Handle @"dx.hl.createhandle..%dx.types.Handle (i32, %struct.RWByteAddressBuffer)"(i32 0, %struct.RWByteAddressBuffer %11), !dbg !36 ; line:25 col:3 |
| 52 | + %13 = call %dx.types.Handle @"dx.hl.annotatehandle..%dx.types.Handle (i32, %dx.types.Handle, %dx.types.ResourceProperties, %struct.RWByteAddressBuffer)"(i32 14, %dx.types.Handle %12, %dx.types.ResourceProperties { i32 4107, i32 0 }, %struct.RWByteAddressBuffer zeroinitializer), !dbg !36 ; line:25 col:3 |
| 53 | + call void @"dx.hl.op..void (i32, %dx.types.Handle, i32, float)"(i32 277, %dx.types.Handle %13, i32 0, float %add7), !dbg !36 ; line:25 col:3 |
| 54 | + %14 = bitcast %dx.types.HitObject* %hit to i8*, !dbg !37 ; line:26 col:1 |
| 55 | + call void @llvm.lifetime.end(i64 4, i8* %14) #0, !dbg !37 ; line:26 col:1 |
| 56 | + ret void, !dbg !37 ; line:26 col:1 |
| 57 | +} |
| 58 | + |
| 59 | +; Function Attrs: nounwind |
| 60 | +declare void @llvm.lifetime.start(i64, i8* nocapture) #0 |
| 61 | + |
| 62 | +; Function Attrs: nounwind |
| 63 | +declare void @llvm.lifetime.end(i64, i8* nocapture) #0 |
| 64 | + |
| 65 | +; Function Attrs: nounwind |
| 66 | +declare %dx.types.HitObject* @"dx.hl.op..%dx.types.HitObject* (i32, %dx.types.HitObject*)"(i32, %dx.types.HitObject*) #0 |
| 67 | + |
| 68 | +; Function Attrs: nounwind |
| 69 | +declare %struct.CustomAttrs* @"dx.hl.op..%struct.CustomAttrs* (i32, %dx.types.HitObject*)"(i32, %dx.types.HitObject*) #0 |
| 70 | + |
| 71 | +; Function Attrs: nounwind |
| 72 | +declare void @"dx.hl.op..void (i32, %dx.types.Handle, i32, float)"(i32, %dx.types.Handle, i32, float) #0 |
| 73 | + |
| 74 | +; Function Attrs: nounwind readnone |
| 75 | +declare %dx.types.Handle @"dx.hl.createhandle..%dx.types.Handle (i32, %struct.RWByteAddressBuffer)"(i32, %struct.RWByteAddressBuffer) #1 |
| 76 | + |
| 77 | +; Function Attrs: nounwind readnone |
| 78 | +declare %dx.types.Handle @"dx.hl.annotatehandle..%dx.types.Handle (i32, %dx.types.Handle, %dx.types.ResourceProperties, %struct.RWByteAddressBuffer)"(i32, %dx.types.Handle, %dx.types.ResourceProperties, %struct.RWByteAddressBuffer) #1 |
| 79 | + |
| 80 | +attributes #0 = { nounwind } |
| 81 | +attributes #1 = { nounwind readnone } |
| 82 | + |
| 83 | +!llvm.module.flags = !{!0} |
| 84 | +!pauseresume = !{!1} |
| 85 | +!dx.version = !{!2} |
| 86 | +!dx.valver = !{!2} |
| 87 | +!dx.shaderModel = !{!3} |
| 88 | +!dx.typeAnnotations = !{!4, !10} |
| 89 | +!dx.entryPoints = !{!14} |
| 90 | +!dx.fnprops = !{!18} |
| 91 | +!dx.options = !{!19, !20} |
| 92 | + |
| 93 | +!0 = !{i32 2, !"Debug Info Version", i32 3} |
| 94 | +!1 = !{!"hlsl-hlemit", !"hlsl-hlensure"} |
| 95 | +!2 = !{i32 1, i32 9} |
| 96 | +!3 = !{!"lib", i32 6, i32 9} |
| 97 | +!4 = !{i32 0, %"class.dx::HitObject" undef, !5, %struct.CustomAttrs undef, !7} |
| 98 | +!5 = !{i32 4, !6} |
| 99 | +!6 = !{i32 6, !"h", i32 3, i32 0, i32 7, i32 4} |
| 100 | +!7 = !{i32 20, !8, !9} |
| 101 | +!8 = !{i32 6, !"v", i32 3, i32 0, i32 7, i32 9, i32 13, i32 4} |
| 102 | +!9 = !{i32 6, !"y", i32 3, i32 16, i32 7, i32 4} |
| 103 | +!10 = !{i32 1, void ()* @"\01?main@@YAXXZ", !11} |
| 104 | +!11 = !{!12} |
| 105 | +!12 = !{i32 1, !13, !13} |
| 106 | +!13 = !{} |
| 107 | +!14 = !{null, !"", null, !15, null} |
| 108 | +!15 = !{null, !16, null, null} |
| 109 | +!16 = !{!17} |
| 110 | +!17 = !{i32 0, %struct.RWByteAddressBuffer* @"\01?outbuf@@3URWByteAddressBuffer@@A", !"outbuf", i32 -1, i32 -1, i32 1, i32 11, i1 false, i1 false, i1 false, null} |
| 111 | +!18 = !{void ()* @"\01?main@@YAXXZ", i32 7} |
| 112 | +!19 = !{i32 -2147483584} |
| 113 | +!20 = !{i32 -1} |
| 114 | +!21 = !DILocation(line: 22, column: 3, scope: !22) |
| 115 | +!22 = !DISubprogram(name: "main", scope: !23, file: !23, line: 21, type: !24, isLocal: false, isDefinition: true, scopeLine: 21, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @"\01?main@@YAXXZ") |
| 116 | +!23 = !DIFile(filename: "tools/clang/test/CodeGenDXIL/hlsl/objects/HitObject/hitobject_attributes.hlsl", directory: "") |
| 117 | +!24 = !DISubroutineType(types: !13) |
| 118 | +!25 = !DILocation(line: 22, column: 17, scope: !22) |
| 119 | +!26 = !DILocation(line: 23, column: 23, scope: !22) |
| 120 | +!27 = !DILocation(line: 24, column: 15, scope: !22) |
| 121 | +!28 = !DILocation(line: 24, column: 27, scope: !22) |
| 122 | +!29 = !DILocation(line: 24, column: 25, scope: !22) |
| 123 | +!30 = !DILocation(line: 24, column: 39, scope: !22) |
| 124 | +!31 = !DILocation(line: 24, column: 37, scope: !22) |
| 125 | +!32 = !DILocation(line: 24, column: 51, scope: !22) |
| 126 | +!33 = !DILocation(line: 24, column: 49, scope: !22) |
| 127 | +!34 = !DILocation(line: 24, column: 63, scope: !22) |
| 128 | +!35 = !DILocation(line: 24, column: 61, scope: !22) |
| 129 | +!36 = !DILocation(line: 25, column: 3, scope: !22) |
| 130 | +!37 = !DILocation(line: 26, column: 1, scope: !22) |
0 commit comments