1; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s --check-prefix=ELF64
2; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64le-unknown-linux-gnu -mattr=+vsx | FileCheck %s --check-prefix=VSX
3; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc-unknown-linux-gnu -mcpu=e500 -mattr=spe | FileCheck %s --check-prefix=SPE
4
5declare void @foo()
6
7define void @t1a(float %a) nounwind {
8entry:
9; ELF64-LABEL: @t1a
10; SPE-LABEL: @t1a
11; VSX-LABEL: @t1a
12  %cmp = fcmp oeq float %a, 0.000000e+00
13; ELF64: addis
14; ELF64: lfs
15; ELF64: fcmpu
16; VSX: addis
17; VSX: lfs
18; VSX: fcmpu
19; SPE: efscmpeq
20  br i1 %cmp, label %if.then, label %if.end
21
22if.then:                                          ; preds = %entry
23  call void @foo()
24  br label %if.end
25
26if.end:                                           ; preds = %if.then, %entry
27  ret void
28}
29
30define void @t1b(float %a) nounwind {
31entry:
32; ELF64-LABEL: @t1b
33; SPE-LABEL: @t1b
34; VSX-LABEL: @t1b
35  %cmp = fcmp oeq float %a, -0.000000e+00
36; ELF64: addis
37; ELF64: lfs
38; ELF64: fcmpu
39; VSX: addis
40; VSX: lfs
41; VSX: fcmpu
42; SPE: efscmpeq
43  br i1 %cmp, label %if.then, label %if.end
44
45if.then:                                          ; preds = %entry
46  call void @foo()
47  br label %if.end
48
49if.end:                                           ; preds = %if.then, %entry
50  ret void
51}
52
53define void @t1c(float %a) nounwind {
54entry:
55; ELF64-LABEL: @t1c
56; SPE-LABEL: @t1c
57; VSX-LABEL: @t1c
58  %cmp = fcmp oeq float -0.000000e+00, %a
59; ELF64: addis
60; ELF64: lfs
61; ELF64: fcmpu
62; VSX: addis
63; VSX: lfs
64; VSX: fcmpu
65; SPE: efscmpeq
66  br i1 %cmp, label %if.then, label %if.end
67
68if.then:                                          ; preds = %entry
69  call void @foo()
70  br label %if.end
71
72if.end:                                           ; preds = %if.then, %entry
73  ret void
74}
75
76define void @t2a(double %a) nounwind {
77entry:
78; ELF64-LABEL: @t2a
79; SPE-LABEL: @t2a
80; VSX-LABEL: @t2a
81  %cmp = fcmp oeq double %a, 0.000000e+00
82; ELF64: addis
83; ELF64: lfd
84; ELF64: fcmpu
85; VSX: addis
86; VSX: lfd
87; VSX: xscmpudp
88; SPE: efdcmpeq
89  br i1 %cmp, label %if.then, label %if.end
90
91if.then:                                          ; preds = %entry
92  call void @foo()
93  br label %if.end
94
95if.end:                                           ; preds = %if.then, %entry
96  ret void
97}
98
99define void @t2b(double %a) nounwind {
100entry:
101; ELF64-LABEL: @t2b
102; SPE-LABEL: @t2b
103; VSX-LABEL: @t2b
104  %cmp = fcmp oeq double %a, -0.000000e+00
105; ELF64: addis
106; ELF64: lfd
107; ELF64: fcmpu
108; VSX: addis
109; VSX: lfd
110; VSX: xscmpudp
111; SPE: efdcmpeq
112  br i1 %cmp, label %if.then, label %if.end
113
114if.then:                                          ; preds = %entry
115  call void @foo()
116  br label %if.end
117
118if.end:                                           ; preds = %if.then, %entry
119  ret void
120}
121
122define void @t2c(double %a) nounwind {
123entry:
124; ELF64-LABEL: @t2c
125; SPE-LABEL: @t2c
126; VSX-LABEL: @t2c
127  %cmp = fcmp oeq double -0.000000e+00, %a
128; ELF64: addis
129; ELF64: lfd
130; ELF64: fcmpu
131; VSX: addis
132; VSX: lfd
133; VSX: xscmpudp
134; SPE: efdcmpeq
135  br i1 %cmp, label %if.then, label %if.end
136
137if.then:                                          ; preds = %entry
138  call void @foo()
139  br label %if.end
140
141if.end:                                           ; preds = %if.then, %entry
142  ret void
143}
144
145define void @t4(i8 signext %a) nounwind {
146entry:
147; ELF64-LABEL: @t4
148  %cmp = icmp eq i8 %a, -1
149; ELF64: extsb
150; ELF64: cmpwi
151  br i1 %cmp, label %if.then, label %if.end
152
153if.then:                                          ; preds = %entry
154  call void @foo()
155  br label %if.end
156
157if.end:                                           ; preds = %if.then, %entry
158  ret void
159}
160
161define void @t5(i8 zeroext %a) nounwind {
162entry:
163; ELF64-LABEL: @t5
164  %cmp = icmp eq i8 %a, 1
165; ELF64: extsb
166; ELF64: cmpwi
167  br i1 %cmp, label %if.then, label %if.end
168
169if.then:                                          ; preds = %entry
170  call void @foo()
171  br label %if.end
172
173if.end:                                           ; preds = %if.then, %entry
174  ret void
175}
176
177define void @t5a(i8 zeroext %a) nounwind {
178entry:
179; ELF64-LABEL: @t5a
180  %cmp = icmp eq i8 1, %a
181; ELF64: extsb
182; ELF64: cmpw
183  br i1 %cmp, label %if.then, label %if.end
184
185if.then:                                          ; preds = %entry
186  call void @foo()
187  br label %if.end
188
189if.end:                                           ; preds = %if.then, %entry
190  ret void
191}
192
193define void @t6(i16 signext %a) nounwind {
194entry:
195; ELF64-LABEL: @t6
196  %cmp = icmp eq i16 %a, -1
197; ELF64: extsh
198; ELF64: cmpwi
199  br i1 %cmp, label %if.then, label %if.end
200
201if.then:                                          ; preds = %entry
202  call void @foo()
203  br label %if.end
204
205if.end:                                           ; preds = %if.then, %entry
206  ret void
207}
208
209define void @t7(i16 zeroext %a) nounwind {
210entry:
211; ELF64-LABEL: @t7
212  %cmp = icmp eq i16 %a, 1
213; ELF64: extsh
214; ELF64: cmpwi
215  br i1 %cmp, label %if.then, label %if.end
216
217if.then:                                          ; preds = %entry
218  call void @foo()
219  br label %if.end
220
221if.end:                                           ; preds = %if.then, %entry
222  ret void
223}
224
225define void @t7a(i16 zeroext %a) nounwind {
226entry:
227; ELF64-LABEL: @t7a
228  %cmp = icmp eq i16 1, %a
229; ELF64: extsh
230; ELF64: cmpw
231  br i1 %cmp, label %if.then, label %if.end
232
233if.then:                                          ; preds = %entry
234  call void @foo()
235  br label %if.end
236
237if.end:                                           ; preds = %if.then, %entry
238  ret void
239}
240
241define void @t8(i32 %a) nounwind {
242entry:
243; ELF64-LABEL: @t8
244  %cmp = icmp eq i32 %a, -1
245; ELF64: cmpwi
246  br i1 %cmp, label %if.then, label %if.end
247
248if.then:                                          ; preds = %entry
249  call void @foo()
250  br label %if.end
251
252if.end:                                           ; preds = %if.then, %entry
253  ret void
254}
255
256define void @t9(i32 %a) nounwind {
257entry:
258; ELF64-LABEL: @t9
259  %cmp = icmp eq i32 %a, 1
260; ELF64: cmpwi
261  br i1 %cmp, label %if.then, label %if.end
262
263if.then:                                          ; preds = %entry
264  call void @foo()
265  br label %if.end
266
267if.end:                                           ; preds = %if.then, %entry
268  ret void
269}
270
271define void @t10(i32 %a) nounwind {
272entry:
273; ELF64-LABEL: @t10
274  %cmp = icmp eq i32 %a, 384
275; ELF64: cmpwi
276  br i1 %cmp, label %if.then, label %if.end
277
278if.then:                                          ; preds = %entry
279  call void @foo()
280  br label %if.end
281
282if.end:                                           ; preds = %if.then, %entry
283  ret void
284}
285
286define void @t11(i32 %a) nounwind {
287entry:
288; ELF64-LABEL: @t11
289  %cmp = icmp eq i32 %a, 4096
290; ELF64: cmpwi
291  br i1 %cmp, label %if.then, label %if.end
292
293if.then:                                          ; preds = %entry
294  call void @foo()
295  br label %if.end
296
297if.end:                                           ; preds = %if.then, %entry
298  ret void
299}
300
301define void @t11a(i32 %a) nounwind {
302entry:
303; ELF64-LABEL: @t11a
304  %cmp = icmp eq i32 4096, %a
305; ELF64: cmpw
306  br i1 %cmp, label %if.then, label %if.end
307
308if.then:                                          ; preds = %entry
309  call void @foo()
310  br label %if.end
311
312if.end:                                           ; preds = %if.then, %entry
313  ret void
314}
315
316define void @t12(i8 %a) nounwind {
317entry:
318; ELF64-LABEL: @t12
319  %cmp = icmp ugt i8 %a, -113
320; ELF64: clrlwi
321; ELF64: cmplwi
322  br i1 %cmp, label %if.then, label %if.end
323
324if.then:                                          ; preds = %entry
325  call void @foo()
326  br label %if.end
327
328if.end:                                           ; preds = %if.then, %entry
329  ret void
330}
331
332define void @t13() nounwind ssp {
333entry:
334; ELF64-LABEL: @t13
335  %cmp = icmp slt i32 -123, -2147483648
336; ELF64: li
337; ELF64: lis
338; ELF64: cmpw
339  br i1 %cmp, label %if.then, label %if.end
340
341if.then:                                          ; preds = %entry
342  ret void
343
344if.end:                                           ; preds = %entry
345  ret void
346}
347
348define void @t14(i64 %a) nounwind {
349entry:
350; ELF64-LABEL: @t14
351  %cmp = icmp eq i64 %a, -1
352; ELF64: cmpdi
353  br i1 %cmp, label %if.then, label %if.end
354
355if.then:                                          ; preds = %entry
356  call void @foo()
357  br label %if.end
358
359if.end:                                           ; preds = %if.then, %entry
360  ret void
361}
362
363define void @t15(i64 %a) nounwind {
364entry:
365; ELF64-LABEL: @t15
366  %cmp = icmp eq i64 %a, 1
367; ELF64: cmpdi
368  br i1 %cmp, label %if.then, label %if.end
369
370if.then:                                          ; preds = %entry
371  call void @foo()
372  br label %if.end
373
374if.end:                                           ; preds = %if.then, %entry
375  ret void
376}
377
378define void @t16(i64 %a) nounwind {
379entry:
380; ELF64-LABEL: @t16
381  %cmp = icmp eq i64 %a, 384
382; ELF64: cmpdi
383  br i1 %cmp, label %if.then, label %if.end
384
385if.then:                                          ; preds = %entry
386  call void @foo()
387  br label %if.end
388
389if.end:                                           ; preds = %if.then, %entry
390  ret void
391}
392
393define void @t17(i64 %a) nounwind {
394entry:
395; ELF64-LABEL: @t17
396  %cmp = icmp eq i64 %a, 32768
397; Extra operand so we don't match on cmpdi.
398; ELF64: cmpd {{[0-9]+}}
399  br i1 %cmp, label %if.then, label %if.end
400
401if.then:                                          ; preds = %entry
402  call void @foo()
403  br label %if.end
404
405if.end:                                           ; preds = %if.then, %entry
406  ret void
407}
408
409define void @t17a(i64 %a) nounwind {
410entry:
411; ELF64-LABEL: @t17a
412  %cmp = icmp eq i64 32768, %a
413; Extra operand so we don't match on cmpdi.
414; ELF64: cmpd {{[0-9]+}}
415  br i1 %cmp, label %if.then, label %if.end
416
417if.then:                                          ; preds = %entry
418  call void @foo()
419  br label %if.end
420
421if.end:                                           ; preds = %if.then, %entry
422  ret void
423}
424
425