Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/relationals_float.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 float and float2
12 ; types:
13 ; isfinite, isinf, isnan, isnormal, signbit, isequal, isnotequal, isgreater
14 ; isgreaterequal, isless, islessequal, islessgreater, isordered, isunordered
15
16 ; CHECK-SPIRV: 2 TypeBool [[BoolTypeID:[0-9]+]]
17 ; CHECK-SPIRV: 4 TypeVector [[BoolVectorTypeID:[0-9]+]] [[BoolTypeID]] 2
18
19 ; CHECK-SPIRV: 4 IsFinite [[BoolTypeID]]
20 ; CHECK-SPIRV: 4 IsInf [[BoolTypeID]]
21 ; CHECK-SPIRV: 4 IsNan [[BoolTypeID]]
22 ; CHECK-SPIRV: 4 IsNormal [[BoolTypeID]]
23 ; CHECK-SPIRV: 4 SignBitSet [[BoolTypeID]]
24 ; CHECK-SPIRV: 5 FOrdEqual [[BoolTypeID]]
25 ; CHECK-SPIRV: 5 FUnordNotEqual [[BoolTypeID]]
26 ; CHECK-SPIRV: 5 FOrdGreaterThan [[BoolTypeID]]
27 ; CHECK-SPIRV: 5 FOrdGreaterThanEqual [[BoolTypeID]]
28 ; CHECK-SPIRV: 5 FOrdLessThan [[BoolTypeID]]
29 ; CHECK-SPIRV: 5 FOrdLessThanEqual [[BoolTypeID]]
30 ; CHECK-SPIRV: 5 FOrdNotEqual [[BoolTypeID]]
31 ; CHECK-SPIRV: 5 Ordered [[BoolTypeID]]
32 ; CHECK-SPIRV: 5 Unordered [[BoolTypeID]]
33
34 ; CHECK-SPIRV: 4 IsFinite [[BoolVectorTypeID]]
35 ; CHECK-SPIRV: 4 IsInf [[BoolVectorTypeID]]
36 ; CHECK-SPIRV: 4 IsNan [[BoolVectorTypeID]]
37 ; CHECK-SPIRV: 4 IsNormal [[BoolVectorTypeID]]
38 ; CHECK-SPIRV: 4 SignBitSet [[BoolVectorTypeID]]
39 ; CHECK-SPIRV: 5 FOrdEqual [[BoolVectorTypeID]]
40 ; CHECK-SPIRV: 5 FUnordNotEqual [[BoolVectorTypeID]]
41 ; CHECK-SPIRV: 5 FOrdGreaterThan [[BoolVectorTypeID]]
42 ; CHECK-SPIRV: 5 FOrdGreaterThanEqual [[BoolVectorTypeID]]
43 ; CHECK-SPIRV: 5 FOrdLessThan [[BoolVectorTypeID]]
44 ; CHECK-SPIRV: 5 FOrdLessThanEqual [[BoolVectorTypeID]]
45 ; CHECK-SPIRV: 5 FOrdNotEqual [[BoolVectorTypeID]]
46 ; CHECK-SPIRV: 5 Ordered [[BoolVectorTypeID]]
47 ; CHECK-SPIRV: 5 Unordered [[BoolVectorTypeID]]
48
49 ; CHECK-SPV-IR: call spir_func i1 @_Z16__spirv_IsFinitef(float
50 ; CHECK-SPV-IR: call spir_func i1 @_Z13__spirv_IsInff(float
51 ; CHECK-SPV-IR: call spir_func i1 @_Z13__spirv_IsNanf(float
52 ; CHECK-SPV-IR: call spir_func i1 @_Z16__spirv_IsNormalf(float
53 ; CHECK-SPV-IR: call spir_func i1 @_Z18__spirv_SignBitSetf(float
54 ; CHECK-SPV-IR: fcmp oeq float
55 ; CHECK-SPV-IR: fcmp une float
56 ; CHECK-SPV-IR: fcmp ogt float
57 ; CHECK-SPV-IR: fcmp oge float
58 ; CHECK-SPV-IR: fcmp olt float
59 ; CHECK-SPV-IR: fcmp ole float
60 ; CHECK-SPV-IR: fcmp one float
61 ; CHECK-SPV-IR: fcmp ord float
62 ; CHECK-SPV-IR: fcmp uno float
63
64 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z16__spirv_IsFiniteDv2_f(<2 x float>
65 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z13__spirv_IsInfDv2_f(<2 x float>
66 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z13__spirv_IsNanDv2_f(<2 x float>
67 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z16__spirv_IsNormalDv2_f(<2 x float>
68 ; CHECK-SPV-IR: call spir_func <2 x i8> @_Z18__spirv_SignBitSetDv2_f(<2 x float>
69 ; CHECK-SPV-IR: fcmp oeq <2 x float>
70 ; CHECK-SPV-IR: fcmp une <2 x float>
71 ; CHECK-SPV-IR: fcmp ogt <2 x float>
72 ; CHECK-SPV-IR: fcmp oge <2 x float>
73 ; CHECK-SPV-IR: fcmp olt <2 x float>
74 ; CHECK-SPV-IR: fcmp ole <2 x float>
75 ; CHECK-SPV-IR: fcmp one <2 x float>
76 ; CHECK-SPV-IR: fcmp ord <2 x float>
77 ; CHECK-SPV-IR: fcmp uno <2 x float>
78
79 ; CHECK-LLVM: call spir_func i32 @_Z8isfinitef(float
80 ; CHECK-LLVM: call spir_func i32 @_Z5isinff(float
81 ; CHECK-LLVM: call spir_func i32 @_Z5isnanf(float
82 ; CHECK-LLVM: call spir_func i32 @_Z8isnormalf(float
83 ; CHECK-LLVM: call spir_func i32 @_Z7signbitf(float
84 ; CHECK-LLVM: fcmp oeq float
85 ; CHECK-LLVM: fcmp une float
86 ; CHECK-LLVM: fcmp ogt float
87 ; CHECK-LLVM: fcmp oge float
88 ; CHECK-LLVM: fcmp olt float
89 ; CHECK-LLVM: fcmp ole float
90 ; CHECK-LLVM: fcmp one float
91 ; CHECK-LLVM: fcmp ord float
92 ; CHECK-LLVM: fcmp uno float
93
94 ; CHECK-LLVM: call spir_func <2 x i32> @_Z8isfiniteDv2_f(<2 x float>
95 ; CHECK-LLVM: call spir_func <2 x i32> @_Z5isinfDv2_f(<2 x float>
96 ; CHECK-LLVM: call spir_func <2 x i32> @_Z5isnanDv2_f(<2 x float>
97 ; CHECK-LLVM: call spir_func <2 x i32> @_Z8isnormalDv2_f(<2 x float>
98 ; CHECK-LLVM: call spir_func <2 x i32> @_Z7signbitDv2_f(<2 x float>
99 ; CHECK-LLVM: fcmp oeq <2 x float>
100 ; CHECK-LLVM: fcmp une <2 x float>
101 ; CHECK-LLVM: fcmp ogt <2 x float>
102 ; CHECK-LLVM: fcmp oge <2 x float>
103 ; CHECK-LLVM: fcmp olt <2 x float>
104 ; CHECK-LLVM: fcmp ole <2 x float>
105 ; CHECK-LLVM: fcmp one <2 x float>
106 ; CHECK-LLVM: fcmp ord <2 x float>
107 ; CHECK-LLVM: fcmp uno <2 x float>
108
109 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"
110 target triple = "spir"
111
112 ; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn writeonly
113 define dso_local spir_func void @test_scalar(i32 addrspace(4)* nocapture writeonly %out, float %f) local_unnamed_addr #0 {
114 entry:
115 %call = tail call spir_func i32 @_Z8isfinitef(float %f) #3
116 %call1 = tail call spir_func i32 @_Z5isinff(float %f) #3
117 %add = add nsw i32 %call1, %call
118 %call2 = tail call spir_func i32 @_Z5isnanf(float %f) #3
119 %add3 = add nsw i32 %add, %call2
120 %call4 = tail call spir_func i32 @_Z8isnormalf(float %f) #3
121 %add5 = add nsw i32 %add3, %call4
122 %call6 = tail call spir_func i32 @_Z7signbitf(float %f) #3
123 %add7 = add nsw i32 %add5, %call6
124 %call8 = tail call spir_func i32 @_Z7isequalff(float %f, float %f) #3
125 %add9 = add nsw i32 %add7, %call8
126 %call10 = tail call spir_func i32 @_Z10isnotequalff(float %f, float %f) #3
127 %add11 = add nsw i32 %add9, %call10
128 %call12 = tail call spir_func i32 @_Z9isgreaterff(float %f, float %f) #3
129 %add13 = add nsw i32 %add11, %call12
130 %call14 = tail call spir_func i32 @_Z14isgreaterequalff(float %f, float %f) #3
131 %add15 = add nsw i32 %add13, %call14
132 %call16 = tail call spir_func i32 @_Z6islessff(float %f, float %f) #3
133 %add17 = add nsw i32 %add15, %call16
134 %call18 = tail call spir_func i32 @_Z11islessequalff(float %f, float %f) #3
135 %add19 = add nsw i32 %add17, %call18
136 %call20 = tail call spir_func i32 @_Z13islessgreaterff(float %f, float %f) #3
137 %add21 = add nsw i32 %add19, %call20
138 %call22 = tail call spir_func i32 @_Z9isorderedff(float %f, float %f) #3
139 %add23 = add nsw i32 %add21, %call22
140 %call24 = tail call spir_func i32 @_Z11isunorderedff(float %f, float %f) #3
141 %add25 = add nsw i32 %add23, %call24
142 store i32 %add25, i32 addrspace(4)* %out, align 4, !tbaa !3
143 ret void
144 }
145
146 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
147 declare spir_func i32 @_Z8isfinitef(float) local_unnamed_addr #1
148
149 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
150 declare spir_func i32 @_Z5isinff(float) local_unnamed_addr #1
151
152 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
153 declare spir_func i32 @_Z5isnanf(float) local_unnamed_addr #1
154
155 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
156 declare spir_func i32 @_Z8isnormalf(float) local_unnamed_addr #1
157
158 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
159 declare spir_func i32 @_Z7signbitf(float) local_unnamed_addr #1
160
161 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
162 declare spir_func i32 @_Z7isequalff(float, float) local_unnamed_addr #1
163
164 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
165 declare spir_func i32 @_Z10isnotequalff(float, float) local_unnamed_addr #1
166
167 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
168 declare spir_func i32 @_Z9isgreaterff(float, float) local_unnamed_addr #1
169
170 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
171 declare spir_func i32 @_Z14isgreaterequalff(float, float) local_unnamed_addr #1
172
173 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
174 declare spir_func i32 @_Z6islessff(float, float) local_unnamed_addr #1
175
176 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
177 declare spir_func i32 @_Z11islessequalff(float, float) local_unnamed_addr #1
178
179 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
180 declare spir_func i32 @_Z13islessgreaterff(float, float) local_unnamed_addr #1
181
182 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
183 declare spir_func i32 @_Z9isorderedff(float, float) local_unnamed_addr #1
184
185 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
186 declare spir_func i32 @_Z11isunorderedff(float, float) local_unnamed_addr #1
187
188 ; Function Attrs: convergent mustprogress nofree norecurse nounwind willreturn writeonly
189 define dso_local spir_func void @test_vector(<2 x i32> addrspace(4)* nocapture writeonly %out, <2 x float> %f) local_unnamed_addr #2 {
190 entry:
191 %call = tail call spir_func <2 x i32> @_Z8isfiniteDv2_f(<2 x float> %f) #3
192 %call1 = tail call spir_func <2 x i32> @_Z5isinfDv2_f(<2 x float> %f) #3
193 %add = add <2 x i32> %call1, %call
194 %call2 = tail call spir_func <2 x i32> @_Z5isnanDv2_f(<2 x float> %f) #3
195 %add3 = add <2 x i32> %add, %call2
196 %call4 = tail call spir_func <2 x i32> @_Z8isnormalDv2_f(<2 x float> %f) #3
197 %add5 = add <2 x i32> %add3, %call4
198 %call6 = tail call spir_func <2 x i32> @_Z7signbitDv2_f(<2 x float> %f) #3
199 %add7 = add <2 x i32> %add5, %call6
200 %call8 = tail call spir_func <2 x i32> @_Z7isequalDv2_fS_(<2 x float> %f, <2 x float> %f) #3
201 %add9 = add <2 x i32> %add7, %call8
202 %call10 = tail call spir_func <2 x i32> @_Z10isnotequalDv2_fS_(<2 x float> %f, <2 x float> %f) #3
203 %add11 = add <2 x i32> %add9, %call10
204 %call12 = tail call spir_func <2 x i32> @_Z9isgreaterDv2_fS_(<2 x float> %f, <2 x float> %f) #3
205 %add13 = add <2 x i32> %add11, %call12
206 %call14 = tail call spir_func <2 x i32> @_Z14isgreaterequalDv2_fS_(<2 x float> %f, <2 x float> %f) #3
207 %add15 = add <2 x i32> %add13, %call14
208 %call16 = tail call spir_func <2 x i32> @_Z6islessDv2_fS_(<2 x float> %f, <2 x float> %f) #3
209 %add17 = add <2 x i32> %add15, %call16
210 %call18 = tail call spir_func <2 x i32> @_Z11islessequalDv2_fS_(<2 x float> %f, <2 x float> %f) #3
211 %add19 = add <2 x i32> %add17, %call18
212 %call20 = tail call spir_func <2 x i32> @_Z13islessgreaterDv2_fS_(<2 x float> %f, <2 x float> %f) #3
213 %add21 = add <2 x i32> %add19, %call20
214 %call22 = tail call spir_func <2 x i32> @_Z9isorderedDv2_fS_(<2 x float> %f, <2 x float> %f) #3
215 %add23 = add <2 x i32> %add21, %call22
216 %call24 = tail call spir_func <2 x i32> @_Z11isunorderedDv2_fS_(<2 x float> %f, <2 x float> %f) #3
217 %add25 = add <2 x i32> %add23, %call24
218 store <2 x i32> %add25, <2 x i32> addrspace(4)* %out, align 8, !tbaa !7
219 ret void
220 }
221
222 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
223 declare spir_func <2 x i32> @_Z8isfiniteDv2_f(<2 x float>) local_unnamed_addr #1
224
225 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
226 declare spir_func <2 x i32> @_Z5isinfDv2_f(<2 x float>) local_unnamed_addr #1
227
228 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
229 declare spir_func <2 x i32> @_Z5isnanDv2_f(<2 x float>) local_unnamed_addr #1
230
231 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
232 declare spir_func <2 x i32> @_Z8isnormalDv2_f(<2 x float>) local_unnamed_addr #1
233
234 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
235 declare spir_func <2 x i32> @_Z7signbitDv2_f(<2 x float>) local_unnamed_addr #1
236
237 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
238 declare spir_func <2 x i32> @_Z7isequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
239
240 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
241 declare spir_func <2 x i32> @_Z10isnotequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
242
243 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
244 declare spir_func <2 x i32> @_Z9isgreaterDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
245
246 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
247 declare spir_func <2 x i32> @_Z14isgreaterequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
248
249 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
250 declare spir_func <2 x i32> @_Z6islessDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
251
252 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
253 declare spir_func <2 x i32> @_Z11islessequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
254
255 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
256 declare spir_func <2 x i32> @_Z13islessgreaterDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
257
258 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
259 declare spir_func <2 x i32> @_Z9isorderedDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
260
261 ; Function Attrs: convergent mustprogress nofree nounwind readnone willreturn
262 declare spir_func <2 x i32> @_Z11isunorderedDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr #1
263
264 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" }
265 attributes #1 = { convergent mustprogress nofree nounwind readnone willreturn "frame-pointer"="none" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
266 attributes #2 = { convergent mustprogress nofree norecurse nounwind willreturn writeonly "frame-pointer"="none" "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
267 attributes #3 = { convergent nounwind readnone willreturn }
268
269 !llvm.module.flags = !{!0}
270 !opencl.ocl.version = !{!1}
271 !opencl.spir.version = !{!1}
272 !llvm.ident = !{!2}
273
274 !0 = !{i32 1, !"wchar_size", i32 4}
275 !1 = !{i32 2, i32 0}
276 !2 = !{!"clang version 14.0.0"}
277 !3 = !{!4, !4, i64 0}
278 !4 = !{!"int", !5, i64 0}
279 !5 = !{!"omnipotent char", !6, i64 0}
280 !6 = !{!"Simple C/C++ TBAA"}
281 !7 = !{!5, !5, i64 0}