forked from GPUOpen-Drivers/llpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathScalarizeInputWithDynamicIndexUser.lgc
102 lines (92 loc) · 6.2 KB
/
ScalarizeInputWithDynamicIndexUser.lgc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
; Check that if the generic input has an extract instruction user whose index is dynamic, the input should be scalarized for each component.
; RUN: lgc -mcpu=gfx900 --print-after=lgc-patch-resource-collect %s -emit-llvm -o=- 2>&1 | FileCheck %s
; ModuleID = 'lgcPipeline'
source_filename = "lgcPipeline"
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7"
target triple = "amdgcn--amdpal"
; CHECK: IR Dump After Patch LLVM for resource collecting
; CHECK: define dllexport spir_func void @lgc.shader.VS.main()
; CHECK: call void @lgc.output.export.generic.i32.i32.v4f32(i32 2, i32 0, <4 x float> %[[#]])
; CHECK: define dllexport spir_func void @lgc.shader.FS.main()
; CHECK: [[IMPORT0:%[0-9]+]] = call float @lgc.input.import.generic.f32.i32.i32.i32.i32(i32 2, i32 0, i32 0, i32 1)
; CHECK-NEXT: [[INSERTELEMENT0:%[0-9]+]] = insertelement <4 x float> undef, float [[IMPORT0]], i64 0
; CHECK-NEXT: [[IMPORT1:%[0-9]+]] = call float @lgc.input.import.generic.f32.i32.i32.i32.i32(i32 2, i32 1, i32 0, i32 1)
; CHECK-NEXT: [[INSERTELEMENT1:%[0-9]+]] = insertelement <4 x float> [[INSERTELEMENT0]], float [[IMPORT1]], i64 1
; CHECK-NEXT: [[IMPORT2:%[0-9]+]] = call float @lgc.input.import.generic.f32.i32.i32.i32.i32(i32 2, i32 2, i32 0, i32 1)
; CHECK-NEXT: [[INSERTELEMENT2:%[0-9]+]] = insertelement <4 x float> [[INSERTELEMENT1]], float [[IMPORT2]], i64 2
; CHECK-NEXT: [[IMPORT3:%[0-9]+]] = call float @lgc.input.import.generic.f32.i32.i32.i32.i32(i32 2, i32 3, i32 0, i32 1)
; CHECK-NEXT: [[INSERTELEMENT3:%[0-9]+]] = insertelement <4 x float> [[INSERTELEMENT2]], float [[IMPORT3]], i64 3
; CHECK-NEXT: [[UBFE:%[0-9]+]] = call i32 @llvm.amdgcn.ubfe.i32(i32 12816, i32 0, i32 4)
; CHECK-NEXT: [[SELECT:%[0-9]+]] = select i1 false, i32 12816, i32 [[UBFE]]
; CHECK-NEXT: [[SELECT1:%[0-9]+]] = select i1 false, i32 0, i32 [[SELECT]]
; CHECK-NEXT: [[EXTRACTELEMENT:%[0-9]+]] = extractelement <4 x float> [[INSERTELEMENT3]], i32 [[SELECT1]]
; Function Attrs: nounwind
define dllexport spir_func void @lgc.shader.VS.main() local_unnamed_addr #0 !lgc.shaderstage !15 {
.entry:
%0 = call <4 x float> (...) @lgc.create.read.generic.input.v4f32(i32 2, i32 0, i32 0, i32 0, i32 0, i32 undef)
%1 = call <4 x float> (...) @lgc.create.read.generic.input.v4f32(i32 1, i32 0, i32 0, i32 0, i32 0, i32 undef)
%2 = call <4 x float> (...) @lgc.create.read.generic.input.v4f32(i32 0, i32 0, i32 0, i32 0, i32 0, i32 undef)
call void (...) @lgc.create.write.generic.output(<4 x float> %2, i32 0, i32 0, i32 0, i32 0, i32 0, i32 undef)
call void (...) @lgc.create.write.generic.output(<4 x float> %1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 undef)
call void (...) @lgc.create.write.generic.output(<4 x float> %0, i32 2, i32 0, i32 0, i32 0, i32 0, i32 undef)
ret void
}
; Function Attrs: nounwind readonly willreturn
declare <4 x float> @lgc.create.read.generic.input.v4f32(...) local_unnamed_addr #1
; Function Attrs: nounwind
declare void @lgc.create.write.generic.output(...) local_unnamed_addr #0
; Function Attrs: nounwind
define dllexport spir_func void @lgc.shader.FS.main() local_unnamed_addr #0 !lgc.shaderstage !16 {
.entry:
%0 = call <4 x float> (...) @lgc.create.read.generic.input.v4f32(i32 2, i32 0, i32 0, i32 0, i32 16, i32 undef)
%1 = call i32 (...) @lgc.create.extract.bit.field.i32(i32 12816, i32 0, i32 4, i1 false)
%2 = extractelement <4 x float> %0, i32 %1
%3 = call i32 (...) @lgc.create.extract.bit.field.i32(i32 12816, i32 4, i32 4, i1 false)
%4 = extractelement <4 x float> %0, i32 %3
%5 = call i32 (...) @lgc.create.extract.bit.field.i32(i32 12816, i32 8, i32 4, i1 false)
%6 = extractelement <4 x float> %0, i32 %5
%7 = call i32 (...) @lgc.create.extract.bit.field.i32(i32 12816, i32 12, i32 4, i1 false)
%8 = extractelement <4 x float> %0, i32 %7
%9 = insertelement <4 x float> undef, float %2, i32 0
%10 = insertelement <4 x float> %9, float %4, i32 1
%11 = insertelement <4 x float> %10, float %6, i32 2
%12 = insertelement <4 x float> %11, float %8, i32 3
call void (...) @lgc.create.write.generic.output(<4 x float> %12, i32 0, i32 0, i32 0, i32 0, i32 0, i32 undef)
ret void
}
; Function Attrs: nounwind readnone
declare i32 @lgc.create.extract.bit.field.i32(...) local_unnamed_addr #3
attributes #0 = { nounwind }
attributes #1 = { nounwind readonly willreturn }
attributes #2 = { argmemonly nofree nosync nounwind willreturn }
attributes #3 = { nounwind readnone }
attributes #4 = { nofree nosync nounwind readnone speculatable willreturn }
!llpc.shader.mode.VS = !{!0}
!llpc.shader.mode.FS = !{!0}
!lgc.client = !{!1}
!lgc.options = !{!2}
!lgc.options.VS = !{!3}
!lgc.options.FS = !{!4}
!lgc.user.data.nodes = !{!5, !6, !7}
!lgc.vertex.inputs = !{!8, !9, !10}
!lgc.color.export.formats = !{!11}
!lgc.input.assembly.state = !{!12}
!lgc.rasterizer.state = !{!13}
!amdgpu.pal.metadata.msgpack = !{!14}
!0 = !{i32 0, i32 0, i32 0, i32 1}
!1 = !{!"Vulkan"}
!2 = !{i32 -1861977700, i32 -726079217, i32 -248869534, i32 2063972137, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, i32 1}
!3 = !{i32 1581426283, i32 -161330761, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 20, i32 1800}
!4 = !{i32 -1618560552, i32 -939433038, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 64, i32 0, i32 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 20, i32 1800}
!5 = !{!"StreamOutTableVaPtr", i32 0, i32 1, i32 0}
!6 = !{!"DescriptorBuffer", i32 1, i32 4, i32 0, i32 0, i32 4}
!7 = !{!"IndirectUserDataVaPtr", i32 5, i32 1, i32 12}
!8 = !{i32 0, i32 0, i32 0, i32 12, i32 11, i32 7, i32 -1}
!9 = !{i32 1, i32 1, i32 0, i32 12, i32 10, i32 0, i32 -1}
!10 = !{i32 2, i32 2, i32 0, i32 4, i32 4, i32 7, i32 -1}
!11 = !{i32 10, i32 0, i32 1, i32 1}
!12 = !{i32 2, i32 3}
!13 = !{i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 1}
!14 = !{!"\82\B0amdpal.pipelines\91\84\AA.registers\80\B0.spill_threshold\CE\FF\FF\FF\FF\B0.user_data_limit\00\AF.xgl_cache_info\82\B3.128_bit_cache_hash\92\CF\D2=9\F1\99\1BM\8E\CF\A8y\98tI\99\D7'\AD.llpc_version\A446.1\AEamdpal.version\92\02\03"}
!15 = !{i32 1}
!16 = !{i32 6}