1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3 ;; This test checks following SYCL relational builtins with float and float2
5 ;; isfinite, isinf, isnan, isnormal, signbit, isequal, isnotequal, isgreater
6 ;; isgreaterequal, isless, islessequal, islessgreater, isordered, isunordered
8 ; CHECK-SPIRV: %[[#BoolTypeID:]] = OpTypeBool
9 ; CHECK-SPIRV: %[[#BoolVectorTypeID:]] = OpTypeVector %[[#BoolTypeID]] 2
11 ; CHECK-SPIRV: OpIsFinite %[[#BoolTypeID]]
12 ; CHECK-SPIRV: OpIsInf %[[#BoolTypeID]]
13 ; CHECK-SPIRV: OpIsNan %[[#BoolTypeID]]
14 ; CHECK-SPIRV: OpIsNormal %[[#BoolTypeID]]
15 ; CHECK-SPIRV: OpSignBitSet %[[#BoolTypeID]]
16 ; CHECK-SPIRV: OpFOrdEqual %[[#BoolTypeID]]
17 ; CHECK-SPIRV: OpFUnordNotEqual %[[#BoolTypeID]]
18 ; CHECK-SPIRV: OpFOrdGreaterThan %[[#BoolTypeID]]
19 ; CHECK-SPIRV: OpFOrdGreaterThanEqual %[[#BoolTypeID]]
20 ; CHECK-SPIRV: OpFOrdLessThan %[[#BoolTypeID]]
21 ; CHECK-SPIRV: OpFOrdLessThanEqual %[[#BoolTypeID]]
22 ; CHECK-SPIRV: OpFOrdNotEqual %[[#BoolTypeID]]
23 ; CHECK-SPIRV: OpOrdered %[[#BoolTypeID]]
24 ; CHECK-SPIRV: OpUnordered %[[#BoolTypeID]]
26 ; CHECK-SPIRV: OpIsFinite %[[#BoolVectorTypeID]]
27 ; CHECK-SPIRV: OpIsInf %[[#BoolVectorTypeID]]
28 ; CHECK-SPIRV: OpIsNan %[[#BoolVectorTypeID]]
29 ; CHECK-SPIRV: OpIsNormal %[[#BoolVectorTypeID]]
30 ; CHECK-SPIRV: OpSignBitSet %[[#BoolVectorTypeID]]
31 ; CHECK-SPIRV: OpFOrdEqual %[[#BoolVectorTypeID]]
32 ; CHECK-SPIRV: OpFUnordNotEqual %[[#BoolVectorTypeID]]
33 ; CHECK-SPIRV: OpFOrdGreaterThan %[[#BoolVectorTypeID]]
34 ; CHECK-SPIRV: OpFOrdGreaterThanEqual %[[#BoolVectorTypeID]]
35 ; CHECK-SPIRV: OpFOrdLessThan %[[#BoolVectorTypeID]]
36 ; CHECK-SPIRV: OpFOrdLessThanEqual %[[#BoolVectorTypeID]]
37 ; CHECK-SPIRV: OpFOrdNotEqual %[[#BoolVectorTypeID]]
38 ; CHECK-SPIRV: OpOrdered %[[#BoolVectorTypeID]]
39 ; CHECK-SPIRV: OpUnordered %[[#BoolVectorTypeID]]
41 define dso_local spir_func void @test_scalar(i32 addrspace(4)* nocapture writeonly %out, float %f) local_unnamed_addr {
43 %call = tail call spir_func i32 @_Z8isfinitef(float %f)
44 %call1 = tail call spir_func i32 @_Z5isinff(float %f)
45 %add = add nsw i32 %call1, %call
46 %call2 = tail call spir_func i32 @_Z5isnanf(float %f)
47 %add3 = add nsw i32 %add, %call2
48 %call4 = tail call spir_func i32 @_Z8isnormalf(float %f)
49 %add5 = add nsw i32 %add3, %call4
50 %call6 = tail call spir_func i32 @_Z7signbitf(float %f)
51 %add7 = add nsw i32 %add5, %call6
52 %call8 = tail call spir_func i32 @_Z7isequalff(float %f, float %f)
53 %add9 = add nsw i32 %add7, %call8
54 %call10 = tail call spir_func i32 @_Z10isnotequalff(float %f, float %f)
55 %add11 = add nsw i32 %add9, %call10
56 %call12 = tail call spir_func i32 @_Z9isgreaterff(float %f, float %f)
57 %add13 = add nsw i32 %add11, %call12
58 %call14 = tail call spir_func i32 @_Z14isgreaterequalff(float %f, float %f)
59 %add15 = add nsw i32 %add13, %call14
60 %call16 = tail call spir_func i32 @_Z6islessff(float %f, float %f)
61 %add17 = add nsw i32 %add15, %call16
62 %call18 = tail call spir_func i32 @_Z11islessequalff(float %f, float %f)
63 %add19 = add nsw i32 %add17, %call18
64 %call20 = tail call spir_func i32 @_Z13islessgreaterff(float %f, float %f)
65 %add21 = add nsw i32 %add19, %call20
66 %call22 = tail call spir_func i32 @_Z9isorderedff(float %f, float %f)
67 %add23 = add nsw i32 %add21, %call22
68 %call24 = tail call spir_func i32 @_Z11isunorderedff(float %f, float %f)
69 %add25 = add nsw i32 %add23, %call24
70 store i32 %add25, i32 addrspace(4)* %out, align 4
74 declare spir_func i32 @_Z8isfinitef(float) local_unnamed_addr
76 declare spir_func i32 @_Z5isinff(float) local_unnamed_addr
78 declare spir_func i32 @_Z5isnanf(float) local_unnamed_addr
80 declare spir_func i32 @_Z8isnormalf(float) local_unnamed_addr
82 declare spir_func i32 @_Z7signbitf(float) local_unnamed_addr
84 declare spir_func i32 @_Z7isequalff(float, float) local_unnamed_addr
86 declare spir_func i32 @_Z10isnotequalff(float, float) local_unnamed_addr
88 declare spir_func i32 @_Z9isgreaterff(float, float) local_unnamed_addr
90 declare spir_func i32 @_Z14isgreaterequalff(float, float) local_unnamed_addr
92 declare spir_func i32 @_Z6islessff(float, float) local_unnamed_addr
94 declare spir_func i32 @_Z11islessequalff(float, float) local_unnamed_addr
96 declare spir_func i32 @_Z13islessgreaterff(float, float) local_unnamed_addr
98 declare spir_func i32 @_Z9isorderedff(float, float) local_unnamed_addr
100 declare spir_func i32 @_Z11isunorderedff(float, float) local_unnamed_addr
102 define dso_local spir_func void @test_vector(<2 x i32> addrspace(4)* nocapture writeonly %out, <2 x float> %f) local_unnamed_addr {
104 %call = tail call spir_func <2 x i32> @_Z8isfiniteDv2_f(<2 x float> %f)
105 %call1 = tail call spir_func <2 x i32> @_Z5isinfDv2_f(<2 x float> %f)
106 %add = add <2 x i32> %call1, %call
107 %call2 = tail call spir_func <2 x i32> @_Z5isnanDv2_f(<2 x float> %f)
108 %add3 = add <2 x i32> %add, %call2
109 %call4 = tail call spir_func <2 x i32> @_Z8isnormalDv2_f(<2 x float> %f)
110 %add5 = add <2 x i32> %add3, %call4
111 %call6 = tail call spir_func <2 x i32> @_Z7signbitDv2_f(<2 x float> %f)
112 %add7 = add <2 x i32> %add5, %call6
113 %call8 = tail call spir_func <2 x i32> @_Z7isequalDv2_fS_(<2 x float> %f, <2 x float> %f)
114 %add9 = add <2 x i32> %add7, %call8
115 %call10 = tail call spir_func <2 x i32> @_Z10isnotequalDv2_fS_(<2 x float> %f, <2 x float> %f)
116 %add11 = add <2 x i32> %add9, %call10
117 %call12 = tail call spir_func <2 x i32> @_Z9isgreaterDv2_fS_(<2 x float> %f, <2 x float> %f)
118 %add13 = add <2 x i32> %add11, %call12
119 %call14 = tail call spir_func <2 x i32> @_Z14isgreaterequalDv2_fS_(<2 x float> %f, <2 x float> %f)
120 %add15 = add <2 x i32> %add13, %call14
121 %call16 = tail call spir_func <2 x i32> @_Z6islessDv2_fS_(<2 x float> %f, <2 x float> %f)
122 %add17 = add <2 x i32> %add15, %call16
123 %call18 = tail call spir_func <2 x i32> @_Z11islessequalDv2_fS_(<2 x float> %f, <2 x float> %f)
124 %add19 = add <2 x i32> %add17, %call18
125 %call20 = tail call spir_func <2 x i32> @_Z13islessgreaterDv2_fS_(<2 x float> %f, <2 x float> %f)
126 %add21 = add <2 x i32> %add19, %call20
127 %call22 = tail call spir_func <2 x i32> @_Z9isorderedDv2_fS_(<2 x float> %f, <2 x float> %f)
128 %add23 = add <2 x i32> %add21, %call22
129 %call24 = tail call spir_func <2 x i32> @_Z11isunorderedDv2_fS_(<2 x float> %f, <2 x float> %f)
130 %add25 = add <2 x i32> %add23, %call24
131 store <2 x i32> %add25, <2 x i32> addrspace(4)* %out, align 8
135 declare spir_func <2 x i32> @_Z8isfiniteDv2_f(<2 x float>) local_unnamed_addr
137 declare spir_func <2 x i32> @_Z5isinfDv2_f(<2 x float>) local_unnamed_addr
139 declare spir_func <2 x i32> @_Z5isnanDv2_f(<2 x float>) local_unnamed_addr
141 declare spir_func <2 x i32> @_Z8isnormalDv2_f(<2 x float>) local_unnamed_addr
143 declare spir_func <2 x i32> @_Z7signbitDv2_f(<2 x float>) local_unnamed_addr
145 declare spir_func <2 x i32> @_Z7isequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
147 declare spir_func <2 x i32> @_Z10isnotequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
149 declare spir_func <2 x i32> @_Z9isgreaterDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
151 declare spir_func <2 x i32> @_Z14isgreaterequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
153 declare spir_func <2 x i32> @_Z6islessDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
155 declare spir_func <2 x i32> @_Z11islessequalDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
157 declare spir_func <2 x i32> @_Z13islessgreaterDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
159 declare spir_func <2 x i32> @_Z9isorderedDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr
161 declare spir_func <2 x i32> @_Z11isunorderedDv2_fS_(<2 x float>, <2 x float>) local_unnamed_addr