Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/SpecConstantComposite.ll

raw
1 ; RUN: llvm-as < %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.spt
3 ; RUN: FileCheck < %t.spt %s --check-prefix=CHECK-SPIRV
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: spirv-val %t.spv
6 ; RUN: llvm-spirv %t.spv -r -emit-opaque-pointers -o - | llvm-dis -o %t.ll
7 ; RUN: FileCheck < %t.ll %s --check-prefix=CHECK-LLVM
8
9 ; CHECK-SPIRV-DAG: Decorate [[#SC3:]] SpecId 3
10 ; CHECK-SPIRV-DAG: Decorate [[#SC4:]] SpecId 4
11 ; CHECK-SPIRV-DAG: Decorate [[#SC6:]] SpecId 6
12 ; CHECK-SPIRV-DAG: Decorate [[#SC7:]] SpecId 7
13 ; CHECK-SPIRV-DAG: Decorate [[#SC10:]] SpecId 10
14 ; CHECK-SPIRV-DAG: Decorate [[#SC11:]] SpecId 11
15
16 ; CHECK-SPIRV-DAG: TypeInt [[#Int:]] 32
17 ; CHECK-SPIRV-DAG: TypeFloat [[#Float:]] 32
18 ; CHECK-SPIRV-DAG: TypeStruct [[#StructA:]] [[#Int]] [[#Float]]
19 ; CHECK-SPIRV-DAG: TypeArray [[#Array:]] [[#StructA]] [[#]]
20 ; CHECK-SPIRV-DAG: TypeVector [[#Vector:]] [[#Int]] 2
21 ; CHECK-SPIRV-DAG: TypeStruct [[#Struct:]] [[#Vector]]
22 ; CHECK-SPIRV-DAG: TypeStruct [[#POD_TYPE:]] [[#Array]] [[#Struct]]
23
24 source_filename = "./SpecConstantComposite.ll"
25 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
26 target triple = "spir64-unknown-unknown"
27
28 %struct._ZTS3POD.POD = type { [2 x %struct._ZTS1A.A], %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" }
29 %struct._ZTS1A.A = type { i32, float }
30 %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" = type { <2 x i32> }
31 %"class._ZTSN2cl4sycl5rangeILi1EEE.cl::sycl::range" = type { %"class._ZTSN2cl4sycl6detail5arrayILi1EEE.cl::sycl::detail::array" }
32 %"class._ZTSN2cl4sycl6detail5arrayILi1EEE.cl::sycl::detail::array" = type { [1 x i64] }
33 %"class._ZTSN2cl4sycl2idILi1EEE.cl::sycl::id" = type { %"class._ZTSN2cl4sycl6detail5arrayILi1EEE.cl::sycl::detail::array" }
34
35 $_ZTS4Test = comdat any
36
37 ; Function Attrs: convergent norecurse uwtable
38 define weak_odr dso_local spir_kernel void @_ZTS4Test(%struct._ZTS3POD.POD addrspace(1)* %_arg_, %"class._ZTSN2cl4sycl5rangeILi1EEE.cl::sycl::range"* byval(%"class._ZTSN2cl4sycl5rangeILi1EEE.cl::sycl::range") align 8 %_arg_1, %"class._ZTSN2cl4sycl5rangeILi1EEE.cl::sycl::range"* byval(%"class._ZTSN2cl4sycl5rangeILi1EEE.cl::sycl::range") align 8 %_arg_2, %"class._ZTSN2cl4sycl2idILi1EEE.cl::sycl::id"* byval(%"class._ZTSN2cl4sycl2idILi1EEE.cl::sycl::id") align 8 %_arg_3) local_unnamed_addr #0 comdat !kernel_arg_buffer_location !4 {
39 entry:
40 %ref.tmp.i = alloca %struct._ZTS3POD.POD, align 8
41 %0 = getelementptr inbounds %"class._ZTSN2cl4sycl2idILi1EEE.cl::sycl::id", %"class._ZTSN2cl4sycl2idILi1EEE.cl::sycl::id"* %_arg_3, i64 0, i32 0, i32 0, i64 0
42 %1 = load i64, i64* %0, align 8
43 %add.ptr.i = getelementptr inbounds %struct._ZTS3POD.POD, %struct._ZTS3POD.POD addrspace(1)* %_arg_, i64 %1
44 %2 = bitcast %struct._ZTS3POD.POD* %ref.tmp.i to i8*
45 call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull %2) #2
46 %3 = addrspacecast %struct._ZTS3POD.POD* %ref.tmp.i to %struct._ZTS3POD.POD addrspace(4)*
47
48 %4 = call i32 @_Z20__spirv_SpecConstantii(i32 3, i32 1)
49 ; CHECK-SPIRV-DAG: SpecConstant [[#Int]] [[#SC3]] 1
50
51 %5 = call float @_Z20__spirv_SpecConstantif(i32 4, float 0.000000e+00)
52 ; CHECK-SPIRV-DAG: SpecConstant [[#Float]] [[#SC4]] 0
53
54 %6 = call %struct._ZTS1A.A @_Z29__spirv_SpecConstantCompositeif(i32 %4, float %5)
55 ; CHECK-SPIRV-DAG: SpecConstantComposite [[#StructA]] [[#SC_StructA0:]] [[#SC3]] [[#SC4]]
56
57 %7 = call i32 @_Z20__spirv_SpecConstantii(i32 6, i32 35)
58 ; CHECK-SPIRV-DAG: SpecConstant [[#Int]] [[#SC6]] 35
59
60 %8 = call float @_Z20__spirv_SpecConstantif(i32 7, float 0.000000e+00)
61 ; CHECK-SPIRV-DAG: SpecConstant [[#Float]] [[#SC7]] 0
62
63 %9 = call %struct._ZTS1A.A @_Z29__spirv_SpecConstantCompositeif(i32 %7, float %8)
64 ; CHECK-SPIRV-DAG: SpecConstantComposite [[#StructA]] [[#SC_StructA1:]] [[#SC6]] [[#SC7]]
65
66 %10 = call [2 x %struct._ZTS1A.A] @_Z29__spirv_SpecConstantCompositestruct._ZTS1A.Astruct._ZTS1A.A(%struct._ZTS1A.A %6, %struct._ZTS1A.A %9)
67 ; CHECK-SPIRV-DAG: SpecConstantComposite [[#Array]] [[#SC_Array:]] [[#SC_StructA0]] [[#SC_StructA1]]
68
69 %11 = call i32 @_Z20__spirv_SpecConstantii(i32 10, i32 45)
70 ; CHECK-SPIRV-DAG: SpecConstant [[#Int]] [[#SC10]] 45
71
72 %12 = call i32 @_Z20__spirv_SpecConstantii(i32 11, i32 55)
73 ; CHECK-SPIRV-DAG: SpecConstant [[#Int]] [[#SC11]] 55
74
75 %13 = call <2 x i32> @_Z29__spirv_SpecConstantCompositeii(i32 %11, i32 %12)
76 ; CHECK-SPIRV-DAG: SpecConstantComposite [[#Vector]] [[#SC_Vector:]] [[#SC10]] [[#SC11]]
77
78 %14 = call %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" @_Z29__spirv_SpecConstantCompositeDv2_i(<2 x i32> %13)
79 ; CHECK-SPIRV-DAG: SpecConstantComposite [[#Struct]] [[#SC_Struct:]] [[#SC_Vector]]
80
81 %15 = call %struct._ZTS3POD.POD @"_Z29__spirv_SpecConstantCompositeAstruct._ZTS1A.Aclass._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec"([2 x %struct._ZTS1A.A] %10, %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" %14), !SYCL_SPEC_CONST_SYM_ID !5
82 ; CHECK-SPIRV-DAG: SpecConstantComposite [[#POD_TYPE]] [[#SC_POD:]] [[#SC_Array]] [[#SC_Struct]]
83
84 store %struct._ZTS3POD.POD %15, %struct._ZTS3POD.POD addrspace(4)* %3, align 8
85 ; CHECK-SPIRV-DAG: Store [[#]] [[#SC_POD]]
86 ; CHECK-LLVM: store %struct._ZTS3POD.POD { [2 x %struct._ZTS1A.A] [%struct._ZTS1A.A { i32 1, float 0.000000e+00 }, %struct._ZTS1A.A { i32 35, float 0.000000e+00 }], %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" { <2 x i32> <i32 45, i32 55> } }
87
88 %16 = bitcast %struct._ZTS3POD.POD addrspace(1)* %add.ptr.i to i8 addrspace(1)*
89 %17 = addrspacecast i8 addrspace(1)* %16 to i8 addrspace(4)*
90 call void @llvm.memcpy.p4i8.p0i8.i64(i8 addrspace(4)* align 8 dereferenceable(24) %17, i8* nonnull align 8 dereferenceable(24) %2, i64 24, i1 false), !tbaa.struct !6
91 call void @llvm.lifetime.end.p0i8(i64 24, i8* nonnull %2) #2
92 ret void
93 }
94
95 ; Function Attrs: argmemonly nounwind willreturn
96 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #1
97
98 ; Function Attrs: argmemonly nounwind willreturn
99 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture) #1
100
101 ; Function Attrs: argmemonly nounwind willreturn
102 declare void @llvm.memcpy.p4i8.p0i8.i64(i8 addrspace(4)* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #1
103
104 declare i32 @_Z20__spirv_SpecConstantii(i32, i32)
105
106 declare float @_Z20__spirv_SpecConstantif(i32, float)
107
108 declare %struct._ZTS1A.A @_Z29__spirv_SpecConstantCompositeif(i32, float)
109
110 declare [2 x %struct._ZTS1A.A] @_Z29__spirv_SpecConstantCompositestruct._ZTS1A.Astruct._ZTS1A.A(%struct._ZTS1A.A, %struct._ZTS1A.A)
111
112 declare <2 x i32> @_Z29__spirv_SpecConstantCompositeii(i32, i32)
113
114 declare %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec" @_Z29__spirv_SpecConstantCompositeDv2_i(<2 x i32>)
115
116 declare %struct._ZTS3POD.POD @"_Z29__spirv_SpecConstantCompositeAstruct._ZTS1A.Aclass._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec"([2 x %struct._ZTS1A.A], %"class._ZTSN2cl4sycl3vecIiLi2EEE.cl::sycl::vec")
117
118 attributes #0 = { convergent norecurse uwtable "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="../sycl/test/spec_const/composite.cpp" "tune-cpu"="generic" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" }
119 attributes #1 = { argmemonly nounwind willreturn }
120 attributes #2 = { nounwind }
121
122 !llvm.module.flags = !{!0}
123 !opencl.spir.version = !{!1}
124 !spirv.Source = !{!2}
125 !llvm.ident = !{!3}
126
127 !0 = !{i32 1, !"wchar_size", i32 4}
128 !1 = !{i32 1, i32 2}
129 !2 = !{i32 4, i32 100000}
130 !3 = !{!"clang version 12.0.0 (/data/github.com/intel/llvm/clang 56ee5b054b5a1f2f703722fc414fcb05af18b40a)"}
131 !4 = !{i32 -1, i32 -1, i32 -1, i32 -1}
132 !5 = !{!"_ZTS3POD", i32 3, i32 4, i32 6, i32 7, i32 10, i32 11}
133 !6 = !{i64 0, i64 16, !7, i64 16, i64 8, !7}
134 !7 = !{!8, !8, i64 0}
135 !8 = !{!"omnipotent char", !9, i64 0}
136 !9 = !{!"Simple C++ TBAA"}