Making a guess to fix the test case with r204056 to get the build bot working.
[oota-llvm.git] / test / CodeGen / R600 / setcc.ll
1 ;RUN: llc < %s -march=r600 -mcpu=redwood | FileCheck --check-prefix=R600 --check-prefix=FUNC %s
2 ;RUN: llc < %s -march=r600 -mcpu=SI | FileCheck --check-prefix=SI --check-prefix=FUNC %s
3
4 ; FUNC-LABEL: @setcc_v2i32
5 ; R600-DAG: SETE_INT * T{{[0-9]+\.[XYZW]}}, KC0[3].X, KC0[3].Z
6 ; R600-DAG: SETE_INT * T{{[0-9]+\.[XYZW]}}, KC0[2].W, KC0[3].Y
7
8 define void @setcc_v2i32(<2 x i32> addrspace(1)* %out, <2 x i32> %a, <2 x i32> %b) {
9   %result = icmp eq <2 x i32> %a, %b
10   %sext = sext <2 x i1> %result to <2 x i32>
11   store <2 x i32> %sext, <2 x i32> addrspace(1)* %out
12   ret void
13 }
14
15 ; FUNC-LABEL: @setcc_v4i32
16 ; R600-DAG: SETE_INT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
17 ; R600-DAG: SETE_INT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
18 ; R600-DAG: SETE_INT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
19 ; R600-DAG: SETE_INT * T{{[0-9]+\.[XYZW], T[0-9]+\.[XYZW], T[0-9]+\.[XYZW]}}
20
21 define void @setcc_v4i32(<4 x i32> addrspace(1)* %out, <4 x i32> addrspace(1)* %in) {
22   %b_ptr = getelementptr <4 x i32> addrspace(1)* %in, i32 1
23   %a = load <4 x i32> addrspace(1) * %in
24   %b = load <4 x i32> addrspace(1) * %b_ptr
25   %result = icmp eq <4 x i32> %a, %b
26   %sext = sext <4 x i1> %result to <4 x i32>
27   store <4 x i32> %sext, <4 x i32> addrspace(1)* %out
28   ret void
29 }
30
31 ;;;==========================================================================;;;
32 ;; Float comparisons
33 ;;;==========================================================================;;;
34
35 ; FUNC-LABEL: @f32_oeq
36 ; R600: SETE_DX10
37 ; SI: V_CMP_EQ_F32
38 define void @f32_oeq(i32 addrspace(1)* %out, float %a, float %b) {
39 entry:
40   %0 = fcmp oeq float %a, %b
41   %1 = sext i1 %0 to i32
42   store i32 %1, i32 addrspace(1)* %out
43   ret void
44 }
45
46 ; FUNC-LABEL: @f32_ogt
47 ; R600: SETGT_DX10
48 ; SI: V_CMP_GT_F32
49 define void @f32_ogt(i32 addrspace(1)* %out, float %a, float %b) {
50 entry:
51   %0 = fcmp ogt float %a, %b
52   %1 = sext i1 %0 to i32
53   store i32 %1, i32 addrspace(1)* %out
54   ret void
55 }
56
57 ; FUNC-LABEL: @f32_oge
58 ; R600: SETGE_DX10
59 ; SI: V_CMP_GE_F32
60 define void @f32_oge(i32 addrspace(1)* %out, float %a, float %b) {
61 entry:
62   %0 = fcmp oge float %a, %b
63   %1 = sext i1 %0 to i32
64   store i32 %1, i32 addrspace(1)* %out
65   ret void
66 }
67
68 ; FUNC-LABEL: @f32_olt
69 ; R600: SETGT_DX10
70 ; SI: V_CMP_LT_F32
71 define void @f32_olt(i32 addrspace(1)* %out, float %a, float %b) {
72 entry:
73   %0 = fcmp olt float %a, %b
74   %1 = sext i1 %0 to i32
75   store i32 %1, i32 addrspace(1)* %out
76   ret void
77 }
78
79 ; FUNC-LABEL: @f32_ole
80 ; R600: SETGE_DX10
81 ; SI: V_CMP_LE_F32
82 define void @f32_ole(i32 addrspace(1)* %out, float %a, float %b) {
83 entry:
84   %0 = fcmp ole float %a, %b
85   %1 = sext i1 %0 to i32
86   store i32 %1, i32 addrspace(1)* %out
87   ret void
88 }
89
90 ; FUNC-LABEL: @f32_one
91 ; R600-DAG: SETE_DX10
92 ; R600-DAG: SETE_DX10
93 ; R600-DAG: AND_INT
94 ; R600-DAG: SETNE_DX10
95 ; R600-DAG: AND_INT
96 ; R600-DAG: SETNE_INT
97 ; SI: V_CMP_O_F32
98 ; SI: V_CMP_NEQ_F32
99 ; SI: S_AND_B64
100 define void @f32_one(i32 addrspace(1)* %out, float %a, float %b) {
101 entry:
102   %0 = fcmp one float %a, %b
103   %1 = sext i1 %0 to i32
104   store i32 %1, i32 addrspace(1)* %out
105   ret void
106 }
107
108 ; FUNC-LABEL: @f32_ord
109 ; R600-DAG: SETE_DX10
110 ; R600-DAG: SETE_DX10
111 ; R600-DAG: AND_INT
112 ; R600-DAG: SETNE_INT
113 ; SI: V_CMP_O_F32
114 define void @f32_ord(i32 addrspace(1)* %out, float %a, float %b) {
115 entry:
116   %0 = fcmp ord float %a, %b
117   %1 = sext i1 %0 to i32
118   store i32 %1, i32 addrspace(1)* %out
119   ret void
120 }
121
122 ; FUNC-LABEL: @f32_ueq
123 ; R600-DAG: SETNE_DX10
124 ; R600-DAG: SETNE_DX10
125 ; R600-DAG: OR_INT
126 ; R600-DAG: SETE_DX10
127 ; R600-DAG: OR_INT
128 ; R600-DAG: SETNE_INT
129 ; SI: V_CMP_U_F32
130 ; SI: V_CMP_EQ_F32
131 ; SI: S_OR_B64
132 define void @f32_ueq(i32 addrspace(1)* %out, float %a, float %b) {
133 entry:
134   %0 = fcmp ueq float %a, %b
135   %1 = sext i1 %0 to i32
136   store i32 %1, i32 addrspace(1)* %out
137   ret void
138 }
139
140 ; FUNC-LABEL: @f32_ugt
141 ; R600: SETGE
142 ; R600: SETE_DX10
143 ; SI: V_CMP_U_F32
144 ; SI: V_CMP_GT_F32
145 ; SI: S_OR_B64
146 define void @f32_ugt(i32 addrspace(1)* %out, float %a, float %b) {
147 entry:
148   %0 = fcmp ugt float %a, %b
149   %1 = sext i1 %0 to i32
150   store i32 %1, i32 addrspace(1)* %out
151   ret void
152 }
153
154 ; FUNC-LABEL: @f32_uge
155 ; R600: SETGT
156 ; R600: SETE_DX10
157 ; SI: V_CMP_U_F32
158 ; SI: V_CMP_GE_F32
159 ; SI: S_OR_B64
160 define void @f32_uge(i32 addrspace(1)* %out, float %a, float %b) {
161 entry:
162   %0 = fcmp uge float %a, %b
163   %1 = sext i1 %0 to i32
164   store i32 %1, i32 addrspace(1)* %out
165   ret void
166 }
167
168 ; FUNC-LABEL: @f32_ult
169 ; R600: SETGE
170 ; R600: SETE_DX10
171 ; SI: V_CMP_U_F32
172 ; SI: V_CMP_LT_F32
173 ; SI: S_OR_B64
174 define void @f32_ult(i32 addrspace(1)* %out, float %a, float %b) {
175 entry:
176   %0 = fcmp ult float %a, %b
177   %1 = sext i1 %0 to i32
178   store i32 %1, i32 addrspace(1)* %out
179   ret void
180 }
181
182 ; FUNC-LABEL: @f32_ule
183 ; R600: SETGT
184 ; R600: SETE_DX10
185 ; SI: V_CMP_U_F32
186 ; SI: V_CMP_LE_F32
187 ; SI: S_OR_B64
188 define void @f32_ule(i32 addrspace(1)* %out, float %a, float %b) {
189 entry:
190   %0 = fcmp ule float %a, %b
191   %1 = sext i1 %0 to i32
192   store i32 %1, i32 addrspace(1)* %out
193   ret void
194 }
195
196 ; FUNC-LABEL: @f32_une
197 ; R600: SETNE_DX10
198 ; SI: V_CMP_NEQ_F32
199 define void @f32_une(i32 addrspace(1)* %out, float %a, float %b) {
200 entry:
201   %0 = fcmp une float %a, %b
202   %1 = sext i1 %0 to i32
203   store i32 %1, i32 addrspace(1)* %out
204   ret void
205 }
206
207 ; FUNC-LABEL: @f32_uno
208 ; R600: SETNE_DX10
209 ; R600: SETNE_DX10
210 ; R600: OR_INT
211 ; R600: SETNE_INT
212 ; SI: V_CMP_U_F32
213 define void @f32_uno(i32 addrspace(1)* %out, float %a, float %b) {
214 entry:
215   %0 = fcmp uno float %a, %b
216   %1 = sext i1 %0 to i32
217   store i32 %1, i32 addrspace(1)* %out
218   ret void
219 }
220
221 ;;;==========================================================================;;;
222 ;; 32-bit integer comparisons
223 ;;;==========================================================================;;;
224
225 ; FUNC-LABEL: @i32_eq
226 ; R600: SETE_INT
227 ; SI: V_CMP_EQ_I32
228 define void @i32_eq(i32 addrspace(1)* %out, i32 %a, i32 %b) {
229 entry:
230   %0 = icmp eq i32 %a, %b
231   %1 = sext i1 %0 to i32
232   store i32 %1, i32 addrspace(1)* %out
233   ret void
234 }
235
236 ; FUNC-LABEL: @i32_ne
237 ; R600: SETNE_INT
238 ; SI: V_CMP_NE_I32
239 define void @i32_ne(i32 addrspace(1)* %out, i32 %a, i32 %b) {
240 entry:
241   %0 = icmp ne i32 %a, %b
242   %1 = sext i1 %0 to i32
243   store i32 %1, i32 addrspace(1)* %out
244   ret void
245 }
246
247 ; FUNC-LABEL: @i32_ugt
248 ; R600: SETGT_UINT
249 ; SI: V_CMP_GT_U32
250 define void @i32_ugt(i32 addrspace(1)* %out, i32 %a, i32 %b) {
251 entry:
252   %0 = icmp ugt i32 %a, %b
253   %1 = sext i1 %0 to i32
254   store i32 %1, i32 addrspace(1)* %out
255   ret void
256 }
257
258 ; FUNC-LABEL: @i32_uge
259 ; R600: SETGE_UINT
260 ; SI: V_CMP_GE_U32
261 define void @i32_uge(i32 addrspace(1)* %out, i32 %a, i32 %b) {
262 entry:
263   %0 = icmp uge i32 %a, %b
264   %1 = sext i1 %0 to i32
265   store i32 %1, i32 addrspace(1)* %out
266   ret void
267 }
268
269 ; FUNC-LABEL: @i32_ult
270 ; R600: SETGT_UINT
271 ; SI: V_CMP_LT_U32
272 define void @i32_ult(i32 addrspace(1)* %out, i32 %a, i32 %b) {
273 entry:
274   %0 = icmp ult i32 %a, %b
275   %1 = sext i1 %0 to i32
276   store i32 %1, i32 addrspace(1)* %out
277   ret void
278 }
279
280 ; FUNC-LABEL: @i32_ule
281 ; R600: SETGE_UINT
282 ; SI: V_CMP_LE_U32
283 define void @i32_ule(i32 addrspace(1)* %out, i32 %a, i32 %b) {
284 entry:
285   %0 = icmp ule i32 %a, %b
286   %1 = sext i1 %0 to i32
287   store i32 %1, i32 addrspace(1)* %out
288   ret void
289 }
290
291 ; FUNC-LABEL: @i32_sgt
292 ; R600: SETGT_INT
293 ; SI: V_CMP_GT_I32
294 define void @i32_sgt(i32 addrspace(1)* %out, i32 %a, i32 %b) {
295 entry:
296   %0 = icmp sgt i32 %a, %b
297   %1 = sext i1 %0 to i32
298   store i32 %1, i32 addrspace(1)* %out
299   ret void
300 }
301
302 ; FUNC-LABEL: @i32_sge
303 ; R600: SETGE_INT
304 ; SI: V_CMP_GE_I32
305 define void @i32_sge(i32 addrspace(1)* %out, i32 %a, i32 %b) {
306 entry:
307   %0 = icmp sge i32 %a, %b
308   %1 = sext i1 %0 to i32
309   store i32 %1, i32 addrspace(1)* %out
310   ret void
311 }
312
313 ; FUNC-LABEL: @i32_slt
314 ; R600: SETGT_INT
315 ; SI: V_CMP_LT_I32
316 define void @i32_slt(i32 addrspace(1)* %out, i32 %a, i32 %b) {
317 entry:
318   %0 = icmp slt i32 %a, %b
319   %1 = sext i1 %0 to i32
320   store i32 %1, i32 addrspace(1)* %out
321   ret void
322 }
323
324 ; FUNC-LABEL: @i32_sle
325 ; R600: SETGE_INT
326 ; SI: V_CMP_LE_I32
327 define void @i32_sle(i32 addrspace(1)* %out, i32 %a, i32 %b) {
328 entry:
329   %0 = icmp sle i32 %a, %b
330   %1 = sext i1 %0 to i32
331   store i32 %1, i32 addrspace(1)* %out
332   ret void
333 }