blob: 5881dc3798aecad10a8e588b5a8f411a4848f69a [file] [log] [blame]
Bill Schmidt87982a12014-10-19 20:48:47 +00001; FIXME: FastISel currently returns false if it hits code that uses VSX
Mehdi Amini945a6602015-02-27 18:32:11 +00002; registers and with -fast-isel-abort=1 turned on the test case will then fail.
Bill Schmidt87982a12014-10-19 20:48:47 +00003; When fastisel better supports VSX fix up this test case.
4;
Mehdi Amini945a6602015-02-27 18:32:11 +00005; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s --check-prefix=ELF64
Eric Christopher1fb23392015-07-24 01:07:50 +00006define void @t1a(float %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +00007entry:
8; ELF64: t1a
9 %cmp = fcmp oeq float %a, 0.000000e+00
10; ELF64: addis
11; ELF64: lfs
12; ELF64: fcmpu
13 br i1 %cmp, label %if.then, label %if.end
14
15if.then: ; preds = %entry
16 call void @foo()
17 br label %if.end
18
19if.end: ; preds = %if.then, %entry
20 ret void
21}
22
23declare void @foo()
24
Eric Christopher1fb23392015-07-24 01:07:50 +000025define void @t1b(float %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +000026entry:
27; ELF64: t1b
28 %cmp = fcmp oeq float %a, -0.000000e+00
29; ELF64: addis
30; ELF64: lfs
31; ELF64: fcmpu
32 br i1 %cmp, label %if.then, label %if.end
33
34if.then: ; preds = %entry
35 call void @foo()
36 br label %if.end
37
38if.end: ; preds = %if.then, %entry
39 ret void
40}
41
Eric Christopher1fb23392015-07-24 01:07:50 +000042define void @t2a(double %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +000043entry:
44; ELF64: t2a
45 %cmp = fcmp oeq double %a, 0.000000e+00
46; ELF64: addis
47; ELF64: lfd
48; ELF64: fcmpu
49 br i1 %cmp, label %if.then, label %if.end
50
51if.then: ; preds = %entry
52 call void @foo()
53 br label %if.end
54
55if.end: ; preds = %if.then, %entry
56 ret void
57}
58
Eric Christopher1fb23392015-07-24 01:07:50 +000059define void @t2b(double %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +000060entry:
61; ELF64: t2b
62 %cmp = fcmp oeq double %a, -0.000000e+00
63; ELF64: addis
64; ELF64: lfd
65; ELF64: fcmpu
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
Eric Christopher1fb23392015-07-24 01:07:50 +000076define void @t4(i8 signext %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +000077entry:
78; ELF64: t4
79 %cmp = icmp eq i8 %a, -1
80; ELF64: extsb
81; ELF64: cmpwi
82 br i1 %cmp, label %if.then, label %if.end
83
84if.then: ; preds = %entry
85 call void @foo()
86 br label %if.end
87
88if.end: ; preds = %if.then, %entry
89 ret void
90}
91
Eric Christopher1fb23392015-07-24 01:07:50 +000092define void @t5(i8 zeroext %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +000093entry:
94; ELF64: t5
95 %cmp = icmp eq i8 %a, 1
96; ELF64: extsb
97; ELF64: cmpwi
98 br i1 %cmp, label %if.then, label %if.end
99
100if.then: ; preds = %entry
101 call void @foo()
102 br label %if.end
103
104if.end: ; preds = %if.then, %entry
105 ret void
106}
107
Eric Christopher1fb23392015-07-24 01:07:50 +0000108define void @t6(i16 signext %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000109entry:
110; ELF64: t6
111 %cmp = icmp eq i16 %a, -1
112; ELF64: extsh
113; ELF64: cmpwi
114 br i1 %cmp, label %if.then, label %if.end
115
116if.then: ; preds = %entry
117 call void @foo()
118 br label %if.end
119
120if.end: ; preds = %if.then, %entry
121 ret void
122}
123
Eric Christopher1fb23392015-07-24 01:07:50 +0000124define void @t7(i16 zeroext %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000125entry:
126; ELF64: t7
127 %cmp = icmp eq i16 %a, 1
128; ELF64: extsh
129; ELF64: cmpwi
130 br i1 %cmp, label %if.then, label %if.end
131
132if.then: ; preds = %entry
133 call void @foo()
134 br label %if.end
135
136if.end: ; preds = %if.then, %entry
137 ret void
138}
139
Eric Christopher1fb23392015-07-24 01:07:50 +0000140define void @t8(i32 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000141entry:
142; ELF64: t8
143 %cmp = icmp eq i32 %a, -1
144; ELF64: cmpwi
145 br i1 %cmp, label %if.then, label %if.end
146
147if.then: ; preds = %entry
148 call void @foo()
149 br label %if.end
150
151if.end: ; preds = %if.then, %entry
152 ret void
153}
154
Eric Christopher1fb23392015-07-24 01:07:50 +0000155define void @t9(i32 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000156entry:
157; ELF64: t9
158 %cmp = icmp eq i32 %a, 1
159; ELF64: cmpwi
160 br i1 %cmp, label %if.then, label %if.end
161
162if.then: ; preds = %entry
163 call void @foo()
164 br label %if.end
165
166if.end: ; preds = %if.then, %entry
167 ret void
168}
169
Eric Christopher1fb23392015-07-24 01:07:50 +0000170define void @t10(i32 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000171entry:
172; ELF64: t10
173 %cmp = icmp eq i32 %a, 384
174; ELF64: cmpwi
175 br i1 %cmp, label %if.then, label %if.end
176
177if.then: ; preds = %entry
178 call void @foo()
179 br label %if.end
180
181if.end: ; preds = %if.then, %entry
182 ret void
183}
184
Eric Christopher1fb23392015-07-24 01:07:50 +0000185define void @t11(i32 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000186entry:
187; ELF64: t11
188 %cmp = icmp eq i32 %a, 4096
189; ELF64: cmpwi
190 br i1 %cmp, label %if.then, label %if.end
191
192if.then: ; preds = %entry
193 call void @foo()
194 br label %if.end
195
196if.end: ; preds = %if.then, %entry
197 ret void
198}
199
Eric Christopher1fb23392015-07-24 01:07:50 +0000200define void @t12(i8 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000201entry:
202; ELF64: t12
203 %cmp = icmp ugt i8 %a, -113
Hal Finkel7c5cb062015-04-23 18:30:38 +0000204; ELF64: clrlwi
Bill Schmidt057b04f2013-08-30 03:16:48 +0000205; ELF64: cmplwi
206 br i1 %cmp, label %if.then, label %if.end
207
208if.then: ; preds = %entry
209 call void @foo()
210 br label %if.end
211
212if.end: ; preds = %if.then, %entry
213 ret void
214}
215
216define void @t13() nounwind ssp {
217entry:
218; ELF64: t13
219 %cmp = icmp slt i32 -123, -2147483648
220; ELF64: li
221; ELF64: lis
222; ELF64: cmpw
223 br i1 %cmp, label %if.then, label %if.end
224
225if.then: ; preds = %entry
226 ret void
227
228if.end: ; preds = %entry
229 ret void
230}
231
Eric Christopher1fb23392015-07-24 01:07:50 +0000232define void @t14(i64 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000233entry:
234; ELF64: t14
235 %cmp = icmp eq i64 %a, -1
236; ELF64: cmpdi
237 br i1 %cmp, label %if.then, label %if.end
238
239if.then: ; preds = %entry
240 call void @foo()
241 br label %if.end
242
243if.end: ; preds = %if.then, %entry
244 ret void
245}
246
Eric Christopher1fb23392015-07-24 01:07:50 +0000247define void @t15(i64 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000248entry:
249; ELF64: t15
250 %cmp = icmp eq i64 %a, 1
251; ELF64: cmpdi
252 br i1 %cmp, label %if.then, label %if.end
253
254if.then: ; preds = %entry
255 call void @foo()
256 br label %if.end
257
258if.end: ; preds = %if.then, %entry
259 ret void
260}
261
Eric Christopher1fb23392015-07-24 01:07:50 +0000262define void @t16(i64 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000263entry:
264; ELF64: t16
265 %cmp = icmp eq i64 %a, 384
266; ELF64: cmpdi
267 br i1 %cmp, label %if.then, label %if.end
268
269if.then: ; preds = %entry
270 call void @foo()
271 br label %if.end
272
273if.end: ; preds = %if.then, %entry
274 ret void
275}
276
Eric Christopher1fb23392015-07-24 01:07:50 +0000277define void @t17(i64 %a) nounwind {
Bill Schmidt057b04f2013-08-30 03:16:48 +0000278entry:
279; ELF64: t17
280 %cmp = icmp eq i64 %a, 32768
281; Extra operand so we don't match on cmpdi.
282; ELF64: cmpd {{[0-9]+}}
283 br i1 %cmp, label %if.then, label %if.end
284
285if.then: ; preds = %entry
286 call void @foo()
287 br label %if.end
288
289if.end: ; preds = %if.then, %entry
290 ret void
291}
292