Debian Codegraph @

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

raw
1 ; RUN: llvm-as %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -spirv-text -o %t.txt
3 ; RUN: FileCheck < %t.txt %s --check-prefix=CHECK-SPIRV
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: spirv-val %t.spv
6 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.spv.bc --spirv-target-env=SPV-IR
7 ; RUN: llvm-dis < %t.rev.spv.bc | FileCheck %s --check-prefix=CHECK-SPV-IR
8 ; RUN: llvm-spirv -r -emit-opaque-pointers %t.spv -o %t.rev.bc
9 ; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
10
11 ; This test checks following SYCL relational builtins with half and half2 types:
12 ; isfinite, isinf, isnan, isnormal, signbit, isequal, isnotequal, isgreater
13 ; isgreaterequal, isless, islessequal, islessgreater, isordered, isunordered
14
15 ; CHECK-SPIRV: 2 TypeBool [[BoolTypeID:[0-9]+]]
16 ; CHECK-SPIRV: 4 TypeVector [[BoolVectorTypeID:[0-9]+]] [[BoolTypeID]] 2
17
18 ; CHECK-SPIRV: 4 IsFinite [[BoolTypeID]]
19 ; CHECK-SPIRV: 4 IsInf [[BoolTypeID]]
20 ; CHECK-SPIRV: 4 IsNan [[BoolTypeID]]
21 ; CHECK-SPIRV: 4 IsNormal [[BoolTypeID]]
22 ; CHECK-SPIRV: 4 SignBitSet [[BoolTypeID]]
23 ; CHECK-SPIRV: 5 FOrdEqual [[BoolTypeID]]
24 ; CHECK-SPIRV: 5 FUnordNotEqual [[BoolTypeID]]
25 ; CHECK-SPIRV: 5 FOrdGreaterThan [[BoolTypeID]]
26 ; CHECK-SPIRV: 5 FOrdGreaterThanEqual [[BoolTypeID]]
27 ; CHECK-SPIRV: 5 FOrdLessThan [[BoolTypeID]]
28 ; CHECK-SPIRV: 5 FOrdLessThanEqual [[BoolTypeID]]
29 ; CHECK-SPIRV: 5 FOrdNotEqual [[BoolTypeID]]
30 ; CHECK-SPIRV: 5 Ordered [[BoolTypeID]]
31 ; CHECK-SPIRV: 5 Unordered [[BoolTypeID]]
32
33 ; CHECK-SPIRV: 4 IsFinite [[BoolVectorTypeID]]
34 ; CHECK-SPIRV: 4 IsInf [[BoolVectorTypeID]]
35 ; CHECK-SPIRV: 4 IsNan [[BoolVectorTypeID]]
36 ; CHECK-SPIRV: 4 IsNormal [[BoolVectorTypeID]]
37 ; CHECK-SPIRV: 4 SignBitSet [[BoolVectorTypeID]]
38 ; CHECK-SPIRV: 5 FOrdEqual [[BoolVectorTypeID]]
39 ; CHECK-SPIRV: 5 FUnordNotEqual [[BoolVectorTypeID]]
40 ; CHECK-SPIRV: 5 FOrdGreaterThan [[BoolVectorTypeID]]
41 ; CHECK-SPIRV: 5 FOrdGreaterThanEqual [[BoolVectorTypeID]]
42 ; CHECK-SPIRV: 5 FOrdLessThan [[BoolVectorTypeID]]
43 ; CHECK-SPIRV: 5 FOrdLessThanEqual [[BoolVectorTypeID]]
44 ; CHECK-SPIRV: 5 FOrdNotEqual [[BoolVectorTypeID]]
45 ; CHECK-SPIRV: 5 Ordered [[BoolVectorTypeID]]
46 ; CHECK-SPIRV: 5 Unordered [[BoolVectorTypeID]]
47
48 ; CHECK-SPV-IR: call spir_func i1 @_Z16__spirv_IsFiniteDh(half
49 ; CHECK-SPV-IR: call spir_func i1 @_Z13__spirv_IsInfDh(half
50 ; CHECK-SPV-IR: call spir_func i1 @_Z13__spirv_IsNanDh(half
51 ; CHECK-SPV-IR: call spir_func i1 @_Z16__spirv_IsNormalDh(half
52 ; CHECK-SPV-IR: call spir_func i1 @_Z18__spirv_SignBitSetDh(half
53 ; CHECK-SPV-IR: fcmp oeq half
54 ; CHECK-SPV-IR: fcmp une half
55 ; CHECK-SPV-IR: fcmp ogt half
56 ; CHECK-SPV-IR: fcmp oge half
57 ; CHECK-SPV-IR: fcmp olt half
58 ; CHECK-SPV-IR: fcmp ole half
59 ; CHECK-SPV-IR: fcmp one half
60 ; CHECK-SPV-IR: fcmp ord half
61 ; CHECK-SPV-IR: fcmp uno half
62
63 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z16__spirv_IsFiniteDv2_Dh(<2 x half>
64 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z13__spirv_IsInfDv2_Dh(<2 x half>
65 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z13__spirv_IsNanDv2_Dh(<2 x half>
66 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z16__spirv_IsNormalDv2_Dh(<2 x half>
67 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z18__spirv_SignBitSetDv2_Dh(<2 x half>
68 ; CHECK-SPV-IR: fcmp oeq <2 x half>
69 ; CHECK-SPV-IR: fcmp une <2 x half>
70 ; CHECK-SPV-IR: fcmp ogt <2 x half>
71 ; CHECK-SPV-IR: fcmp oge <2 x half>
72 ; CHECK-SPV-IR: fcmp olt <2 x half>
73 ; CHECK-SPV-IR: fcmp ole <2 x half>
74 ; CHECK-SPV-IR: fcmp one <2 x half>
75 ; CHECK-SPV-IR: fcmp ord <2 x half>
76 ; CHECK-SPV-IR: fcmp uno <2 x half>
77
78 ; CHECK-LLVM: call spir_func i32 @_Z8isfiniteDh(half
79 ; CHECK-LLVM: call spir_func i32 @_Z5isinfDh(half
80 ; CHECK-LLVM: call spir_func i32 @_Z5isnanDh(half
81 ; CHECK-LLVM: call spir_func i32 @_Z8isnormalDh(half
82 ; CHECK-LLVM: call spir_func i32 @_Z7signbitDh(half
83 ; CHECK-LLVM: fcmp oeq half
84 ; CHECK-LLVM: fcmp une half
85 ; CHECK-LLVM: fcmp ogt half
86 ; CHECK-LLVM: fcmp oge half
87 ; CHECK-LLVM: fcmp olt half
88 ; CHECK-LLVM: fcmp ole half
89 ; CHECK-LLVM: fcmp one half
90 ; CHECK-LLVM: fcmp ord half
91 ; CHECK-LLVM: fcmp uno half
92
93 ; CHECK-LLVM: call spir_func <2 x i16> @_Z8isfiniteDv2_Dh(<2 x half>
94 ; CHECK-LLVM: call spir_func <2 x i16> @_Z5isinfDv2_Dh(<2 x half>
95 ; CHECK-LLVM: call spir_func <2 x i16> @_Z5isnanDv2_Dh(<2 x half>
96 ; CHECK-LLVM: call spir_func <2 x i16> @_Z8isnormalDv2_Dh(<2 x half>
97 ; CHECK-LLVM: call spir_func <2 x i16> @_Z7signbitDv2_Dh(<2 x half>
98 ; CHECK-LLVM: fcmp oeq <2 x half>
99 ; CHECK-LLVM: fcmp une <2 x half>
100 ; CHECK-LLVM: fcmp ogt <2 x half>
101 ; CHECK-LLVM: fcmp oge <2 x half>
102 ; CHECK-LLVM: fcmp olt <2 x half>
103 ; CHECK-LLVM: fcmp ole <2 x half>
104 ; CHECK-LLVM: fcmp one <2 x half>
105 ; CHECK-LLVM: fcmp ord <2 x half>
106 ; CHECK-LLVM: fcmp uno <2 x half>
107
108 target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
109 target triple = "spir"
110
111 ; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn writeonly
112 define dso_local spir_func void @test_scalar(i32 addrspace(4)* nocapture writeonly %out, half %h) local_unnamed_addr #0 {
113 entry:
114 %call = tail call spir_func i32 @_Z8isfiniteDh(half %h) #3
115 %call1 = tail call spir_func i32 @_Z5isinfDh(half %h) #3
116 %add = add nsw i32 %call1, %call
117 %call2 = tail call spir_func i32 @_Z5isnanDh(half %h) #3
118 %add3 = add nsw i32 %add, %call2
119 %call4 = tail call spir_func i32 @_Z8isnormalDh(half %h) #3
120 %add5 = add nsw i32 %add3, %call4
121 %call6 = tail call spir_func i32 @_Z7signbitDh(half %h) #3
122 %add7 = add nsw i32 %add5, %call6
123 %call8 = tail call spir_func i32 @_Z7isequalDhDh(half %h, half %h) #3
124 %add9 = add nsw i32 %add7, %call8
125 %call10 = tail call spir_func i32 @_Z10isnotequalDhDh(half %h, half %h) #3
126 %add11 = add nsw i32 %add9, %call10
127 %call12 = tail call spir_func i32 @_Z9isgreaterDhDh(half %h, half %h) #3
128 %add13 = add nsw i32 %add11, %call12
129 %call14 = tail call spir_func i32 @_Z14isgreaterequalDhDh(half %h, half %h) #3
130 %add15 = add nsw i32 %add13, %call14
131 %call16 = tail call spir_func i32 @_Z6islessDhDh(half %h, half %h) #3
132 %add17 = add nsw i32 %add15, %call16
133 %call18 = tail call spir_func i32 @_Z11islessequalDhDh(half %h, half %h) #3
134 %add19 = add nsw i32 %add17, %call18
135 %call20 = tail call spir_func i32 @_Z13islessgreaterDhDh(half %h, half %h) #3
136 %add21 = add nsw i32 %add19, %call20
137 %call22 = tail call spir_func i32 @_Z9isorderedDhDh(half %h, half %h) #3
138 %add23 = add nsw i32 %add21, %call22
139 %call24 = tail call spir_func i32 @_Z11isunorderedDhDh(half %h, half %h) #3
140 %add25 = add nsw i32 %add23, %call24
141 store i32 %add25, i32 addrspace(4)* %out, align 4, !tbaa !3
142 ret void
143 }
144
145 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
146 declare spir_func i32 @_Z8isfiniteDh(half) local_unnamed_addr #1
147
148 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
149 declare spir_func i32 @_Z5isinfDh(half) local_unnamed_addr #1
150
151 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
152 declare spir_func i32 @_Z5isnanDh(half) local_unnamed_addr #1
153
154 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
155 declare spir_func i32 @_Z8isnormalDh(half) local_unnamed_addr #1
156
157 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
158 declare spir_func i32 @_Z7signbitDh(half) local_unnamed_addr #1
159
160 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
161 declare spir_func i32 @_Z7isequalDhDh(half, half) local_unnamed_addr #1
162
163 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
164 declare spir_func i32 @_Z10isnotequalDhDh(half, half) local_unnamed_addr #1
165
166 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
167 declare spir_func i32 @_Z9isgreaterDhDh(half, half) local_unnamed_addr #1
168
169 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
170 declare spir_func i32 @_Z14isgreaterequalDhDh(half, half) local_unnamed_addr #1
171
172 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
173 declare spir_func i32 @_Z6islessDhDh(half, half) local_unnamed_addr #1
174
175 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
176 declare spir_func i32 @_Z11islessequalDhDh(half, half) local_unnamed_addr #1
177
178 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
179 declare spir_func i32 @_Z13islessgreaterDhDh(half, half) local_unnamed_addr #1
180
181 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
182 declare spir_func i32 @_Z9isorderedDhDh(half, half) local_unnamed_addr #1
183
184 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
185 declare spir_func i32 @_Z11isunorderedDhDh(half, half) local_unnamed_addr #1
186
187 ; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn writeonly
188 define dso_local spir_func void @test_vector(<2 x i16> addrspace(4)* nocapture writeonly %out, <2 x half> %h) local_unnamed_addr #2 {
189 entry:
190 %call = tail call spir_func <2 x i16> @_Z8isfiniteDv2_Dh(<2 x half> %h) #3
191 %call1 = tail call spir_func <2 x i16> @_Z5isinfDv2_Dh(<2 x half> %h) #3
192 %add = add <2 x i16> %call1, %call
193 %call2 = tail call spir_func <2 x i16> @_Z5isnanDv2_Dh(<2 x half> %h) #3
194 %add3 = add <2 x i16> %add, %call2
195 %call4 = tail call spir_func <2 x i16> @_Z8isnormalDv2_Dh(<2 x half> %h) #3
196 %add5 = add <2 x i16> %add3, %call4
197 %call6 = tail call spir_func <2 x i16> @_Z7signbitDv2_Dh(<2 x half> %h) #3
198 %add7 = add <2 x i16> %add5, %call6
199 %call8 = tail call spir_func <2 x i16> @_Z7isequalDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
200 %add9 = add <2 x i16> %add7, %call8
201 %call10 = tail call spir_func <2 x i16> @_Z10isnotequalDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
202 %add11 = add <2 x i16> %add9, %call10
203 %call12 = tail call spir_func <2 x i16> @_Z9isgreaterDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
204 %add13 = add <2 x i16> %add11, %call12
205 %call14 = tail call spir_func <2 x i16> @_Z14isgreaterequalDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
206 %add15 = add <2 x i16> %add13, %call14
207 %call16 = tail call spir_func <2 x i16> @_Z6islessDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
208 %add17 = add <2 x i16> %add15, %call16
209 %call18 = tail call spir_func <2 x i16> @_Z11islessequalDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
210 %add19 = add <2 x i16> %add17, %call18
211 %call20 = tail call spir_func <2 x i16> @_Z13islessgreaterDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
212 %add21 = add <2 x i16> %add19, %call20
213 %call22 = tail call spir_func <2 x i16> @_Z9isorderedDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
214 %add23 = add <2 x i16> %add21, %call22
215 %call24 = tail call spir_func <2 x i16> @_Z11isunorderedDv2_DhS_(<2 x half> %h, <2 x half> %h) #3
216 %add25 = add <2 x i16> %add23, %call24
217 store <2 x i16> %add25, <2 x i16> addrspace(4)* %out, align 4, !tbaa !7
218 ret void
219 }
220
221 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
222 declare spir_func <2 x i16> @_Z8isfiniteDv2_Dh(<2 x half>) local_unnamed_addr #1
223
224 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
225 declare spir_func <2 x i16> @_Z5isinfDv2_Dh(<2 x half>) local_unnamed_addr #1
226
227 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
228 declare spir_func <2 x i16> @_Z5isnanDv2_Dh(<2 x half>) local_unnamed_addr #1
229
230 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
231 declare spir_func <2 x i16> @_Z8isnormalDv2_Dh(<2 x half>) local_unnamed_addr #1
232
233 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
234 declare spir_func <2 x i16> @_Z7signbitDv2_Dh(<2 x half>) local_unnamed_addr #1
235
236 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
237 declare spir_func <2 x i16> @_Z7isequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
238
239 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
240 declare spir_func <2 x i16> @_Z10isnotequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
241
242 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
243 declare spir_func <2 x i16> @_Z9isgreaterDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
244
245 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
246 declare spir_func <2 x i16> @_Z14isgreaterequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
247
248 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
249 declare spir_func <2 x i16> @_Z6islessDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
250
251 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
252 declare spir_func <2 x i16> @_Z11islessequalDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
253
254 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
255 declare spir_func <2 x i16> @_Z13islessgreaterDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
256
257 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
258 declare spir_func <2 x i16> @_Z9isorderedDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
259
260 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
261 declare spir_func <2 x i16> @_Z11isunorderedDv2_DhS_(<2 x half>, <2 x half>) local_unnamed_addr #1
262
263 attributes #0 = { convergent mustprogress nofree norecurse nounwind willreturn writeonly "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
264 attributes #1 = { convergent mustprogress nofree nounwind readnone willreturn "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
265 attributes #2 = { convergent mustprogress nofree norecurse nounwind willreturn writeonly "frame-pointer"="none" "min-legal-vector-width"="32" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
266 attributes #3 = { convergent nounwind readnone willreturn }
267
268 !llvm.module.flags = !{!0}
269 !opencl.ocl.version = !{!1}
270 !opencl.spir.version = !{!1}
271 !llvm.ident = !{!2}
272
273 !0 = !{i32 1, !"wchar_size", i32 4}
274 !1 = !{i32 2, i32 0}
275 !2 = !{!"clang version 14.0.0"}
276 !3 = !{!4, !4, i64 0}
277 !4 = !{!"int", !5, i64 0}
278 !5 = !{!"omnipotent char", !6, i64 0}
279 !6 = !{!"Simple C/C++ TBAA"}
280 !7 = !{!5, !5, i64 0}