Debian Codegraph @

llvm/test/CodeGen/SPIRV/transcoding/RelationalOperators.ll

raw
1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2
3 ; CHECK-SPIRV: %[[#bool:]] = OpTypeBool
4 ; CHECK-SPIRV: %[[#bool2:]] = OpTypeVector %[[#bool]] 2
5
6 ; CHECK-SPIRV: OpFunction
7 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
8 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
9 ; CHECK-SPIRV: %[[#]] = OpUGreaterThan %[[#bool2]] %[[#A]] %[[#B]]
10 ; CHECK-SPIRV: OpFunctionEnd
11
12 ;; kernel void testUGreaterThan(uint2 a, uint2 b, global int2 *res) {
13 ;; res[0] = a > b;
14 ;; }
15
16 define dso_local spir_kernel void @testUGreaterThan(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
17 entry:
18 %cmp = icmp ugt <2 x i32> %a, %b
19 %sext = sext <2 x i1> %cmp to <2 x i32>
20 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
21 ret void
22 }
23
24 ; CHECK-SPIRV: OpFunction
25 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
26 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
27 ; CHECK-SPIRV: %[[#]] = OpSGreaterThan %[[#bool2]] %[[#A]] %[[#B]]
28 ; CHECK-SPIRV: OpFunctionEnd
29
30 ;; kernel void testSGreaterThan(int2 a, int2 b, global int2 *res) {
31 ;; res[0] = a > b;
32 ;; }
33
34 define dso_local spir_kernel void @testSGreaterThan(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
35 entry:
36 %cmp = icmp sgt <2 x i32> %a, %b
37 %sext = sext <2 x i1> %cmp to <2 x i32>
38 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
39 ret void
40 }
41
42 ; CHECK-SPIRV: OpFunction
43 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
44 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
45 ; CHECK-SPIRV: %[[#]] = OpUGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]
46 ; CHECK-SPIRV: OpFunctionEnd
47
48 ;; kernel void testUGreaterThanEqual(uint2 a, uint2 b, global int2 *res) {
49 ;; res[0] = a >= b;
50 ;; }
51
52 define dso_local spir_kernel void @testUGreaterThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
53 entry:
54 %cmp = icmp uge <2 x i32> %a, %b
55 %sext = sext <2 x i1> %cmp to <2 x i32>
56 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
57 ret void
58 }
59
60 ; CHECK-SPIRV: OpFunction
61 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
62 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
63 ; CHECK-SPIRV: %[[#]] = OpSGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]
64 ; CHECK-SPIRV: OpFunctionEnd
65
66 ;; kernel void testSGreaterThanEqual(int2 a, int2 b, global int2 *res) {
67 ;; res[0] = a >= b;
68 ;; }
69
70 define dso_local spir_kernel void @testSGreaterThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
71 entry:
72 %cmp = icmp sge <2 x i32> %a, %b
73 %sext = sext <2 x i1> %cmp to <2 x i32>
74 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
75 ret void
76 }
77
78 ; CHECK-SPIRV: OpFunction
79 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
80 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
81 ; CHECK-SPIRV: %[[#]] = OpULessThan %[[#bool2]] %[[#A]] %[[#B]]
82 ; CHECK-SPIRV: OpFunctionEnd
83
84 ;; kernel void testULessThan(uint2 a, uint2 b, global int2 *res) {
85 ;; res[0] = a < b;
86 ;; }
87
88 define dso_local spir_kernel void @testULessThan(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
89 entry:
90 %cmp = icmp ult <2 x i32> %a, %b
91 %sext = sext <2 x i1> %cmp to <2 x i32>
92 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
93 ret void
94 }
95
96 ; CHECK-SPIRV: OpFunction
97 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
98 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
99 ; CHECK-SPIRV: %[[#]] = OpSLessThan %[[#bool2]] %[[#A]] %[[#B]]
100 ; CHECK-SPIRV: OpFunctionEnd
101
102 ;; kernel void testSLessThan(int2 a, int2 b, global int2 *res) {
103 ;; res[0] = a < b;
104 ;; }
105
106 define dso_local spir_kernel void @testSLessThan(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
107 entry:
108 %cmp = icmp slt <2 x i32> %a, %b
109 %sext = sext <2 x i1> %cmp to <2 x i32>
110 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
111 ret void
112 }
113
114 ; CHECK-SPIRV: OpFunction
115 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
116 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
117 ; CHECK-SPIRV: %[[#]] = OpULessThanEqual %[[#bool2]] %[[#A]] %[[#B]]
118 ; CHECK-SPIRV: OpFunctionEnd
119
120 ;; kernel void testULessThanEqual(uint2 a, uint2 b, global int2 *res) {
121 ;; res[0] = a <= b;
122 ;; }
123
124 define dso_local spir_kernel void @testULessThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
125 entry:
126 %cmp = icmp ule <2 x i32> %a, %b
127 %sext = sext <2 x i1> %cmp to <2 x i32>
128 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
129 ret void
130 }
131
132 ; CHECK-SPIRV: OpFunction
133 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
134 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
135 ; CHECK-SPIRV: %[[#]] = OpSLessThanEqual %[[#bool2]] %[[#A]] %[[#B]]
136 ; CHECK-SPIRV: OpFunctionEnd
137
138 ;; kernel void testSLessThanEqual(int2 a, int2 b, global int2 *res) {
139 ;; res[0] = a <= b;
140 ;; }
141
142 define dso_local spir_kernel void @testSLessThanEqual(<2 x i32> noundef %a, <2 x i32> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
143 entry:
144 %cmp = icmp sle <2 x i32> %a, %b
145 %sext = sext <2 x i1> %cmp to <2 x i32>
146 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
147 ret void
148 }
149
150 ; CHECK-SPIRV: OpFunction
151 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
152 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
153 ; CHECK-SPIRV: %[[#]] = OpFOrdEqual %[[#bool2]] %[[#A]] %[[#B]]
154 ; CHECK-SPIRV: OpFunctionEnd
155
156 ;; kernel void testFOrdEqual(float2 a, float2 b, global int2 *res) {
157 ;; res[0] = a == b;
158 ;; }
159
160 define dso_local spir_kernel void @testFOrdEqual(<2 x float> noundef %a, <2 x float> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
161 entry:
162 %cmp = fcmp oeq <2 x float> %a, %b
163 %sext = sext <2 x i1> %cmp to <2 x i32>
164 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
165 ret void
166 }
167
168 ; CHECK-SPIRV: OpFunction
169 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
170 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
171 ; CHECK-SPIRV: %[[#]] = OpFUnordNotEqual %[[#bool2]] %[[#A]] %[[#B]]
172 ; CHECK-SPIRV: OpFunctionEnd
173
174 ;; kernel void testFUnordNotEqual(float2 a, float2 b, global int2 *res) {
175 ;; res[0] = a != b;
176 ;; }
177
178 define dso_local spir_kernel void @testFUnordNotEqual(<2 x float> noundef %a, <2 x float> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
179 entry:
180 %cmp = fcmp une <2 x float> %a, %b
181 %sext = sext <2 x i1> %cmp to <2 x i32>
182 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
183 ret void
184 }
185
186 ; CHECK-SPIRV: OpFunction
187 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
188 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
189 ; CHECK-SPIRV: %[[#]] = OpFOrdGreaterThan %[[#bool2]] %[[#A]] %[[#B]]
190 ; CHECK-SPIRV: OpFunctionEnd
191
192 ;; kernel void testFOrdGreaterThan(float2 a, float2 b, global int2 *res) {
193 ;; res[0] = a > b;
194 ;; }
195
196 define dso_local spir_kernel void @testFOrdGreaterThan(<2 x float> noundef %a, <2 x float> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
197 entry:
198 %cmp = fcmp ogt <2 x float> %a, %b
199 %sext = sext <2 x i1> %cmp to <2 x i32>
200 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
201 ret void
202 }
203
204 ; CHECK-SPIRV: OpFunction
205 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
206 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
207 ; CHECK-SPIRV: %[[#]] = OpFOrdGreaterThanEqual %[[#bool2]] %[[#A]] %[[#B]]
208 ; CHECK-SPIRV: OpFunctionEnd
209
210 ;; kernel void testFOrdGreaterThanEqual(float2 a, float2 b, global int2 *res) {
211 ;; res[0] = a >= b;
212 ;; }
213
214 define dso_local spir_kernel void @testFOrdGreaterThanEqual(<2 x float> noundef %a, <2 x float> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
215 entry:
216 %cmp = fcmp oge <2 x float> %a, %b
217 %sext = sext <2 x i1> %cmp to <2 x i32>
218 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
219 ret void
220 }
221
222 ; CHECK-SPIRV: OpFunction
223 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
224 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
225 ; CHECK-SPIRV: %[[#]] = OpFOrdLessThan %[[#bool2]] %[[#A]] %[[#B]]
226 ; CHECK-SPIRV: OpFunctionEnd
227
228 ;; kernel void testFOrdLessThan(float2 a, float2 b, global int2 *res) {
229 ;; res[0] = a < b;
230 ;; }
231
232 define dso_local spir_kernel void @testFOrdLessThan(<2 x float> noundef %a, <2 x float> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
233 entry:
234 %cmp = fcmp olt <2 x float> %a, %b
235 %sext = sext <2 x i1> %cmp to <2 x i32>
236 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
237 ret void
238 }
239
240 ; CHECK-SPIRV: OpFunction
241 ; CHECK-SPIRV-NEXT: %[[#A:]] = OpFunctionParameter %[[#]]
242 ; CHECK-SPIRV-NEXT: %[[#B:]] = OpFunctionParameter %[[#]]
243 ; CHECK-SPIRV: %[[#]] = OpFOrdLessThanEqual %[[#bool2]] %[[#A]] %[[#B]]
244 ; CHECK-SPIRV: OpFunctionEnd
245
246 ;; kernel void testFOrdLessThanEqual(float2 a, float2 b, global int2 *res) {
247 ;; res[0] = a <= b;
248 ;; }
249
250 define dso_local spir_kernel void @testFOrdLessThanEqual(<2 x float> noundef %a, <2 x float> noundef %b, ptr addrspace(1) nocapture noundef writeonly %res) local_unnamed_addr {
251 entry:
252 %cmp = fcmp ole <2 x float> %a, %b
253 %sext = sext <2 x i1> %cmp to <2 x i32>
254 store <2 x i32> %sext, ptr addrspace(1) %res, align 8
255 ret void
256 }