1 ; FIXME: FastISel currently returns false if it hits code that uses VSX
2 ; registers and with -fast-isel-abort=1 turned on the test case will then fail.
3 ; When fastisel better supports VSX fix up this test case.
5 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck %s
6 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr8 -mattr=-vsx | FileCheck %s
7 ; RUN: llc < %s -O0 -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -mcpu=970 -mattr=-vsx | FileCheck %s --check-prefix=PPC970
8 ; RUN: llc < %s -O0 -verify-machineinstrs -mtriple=powerpc-unknown-linux-gnu -mcpu=e500 -mattr=spe | FileCheck %s --check-prefix=SPE
10 ;; Tests for 970 don't use -fast-isel-abort=1 because we intentionally punt
11 ;; to SelectionDAG in some cases.
15 define void @sitofp_single_i64(i64 %a, float %b) nounwind {
17 ; CHECK: sitofp_single_i64
18 ; PPC970: sitofp_single_i64
19 %b.addr = alloca float, align 4
20 %conv = sitofp i64 %a to float
28 store float %conv, ptr %b.addr, align 4
32 define void @sitofp_single_i32(i32 %a, float %b) nounwind {
34 ; CHECK: sitofp_single_i32
35 ; PPC970: sitofp_single_i32
36 %b.addr = alloca float, align 4
37 %conv = sitofp i32 %a to float
47 store float %conv, ptr %b.addr, align 4
51 define void @sitofp_single_i16(i16 %a, float %b) nounwind {
53 ; CHECK: sitofp_single_i16
54 ; PPC970: sitofp_single_i16
55 %b.addr = alloca float, align 4
56 %conv = sitofp i16 %a to float
68 store float %conv, ptr %b.addr, align 4
72 define void @sitofp_single_i8(i8 %a) nounwind {
74 ; CHECK: sitofp_single_i8
75 ; PPC970: sitofp_single_i8
76 %b.addr = alloca float, align 4
77 %conv = sitofp i8 %a to float
89 store float %conv, ptr %b.addr, align 4
93 define void @sitofp_double_i32(i32 %a, double %b) nounwind {
95 ; CHECK: sitofp_double_i32
96 ; PPC970: sitofp_double_i32
97 %b.addr = alloca double, align 8
98 %conv = sitofp i32 %a to double
109 store double %conv, ptr %b.addr, align 8
113 define void @sitofp_double_i64(i64 %a, double %b) nounwind {
115 ; CHECK: sitofp_double_i64
116 ; PPC970: sitofp_double_i64
117 %b.addr = alloca double, align 8
118 %conv = sitofp i64 %a to double
125 store double %conv, ptr %b.addr, align 8
129 define void @sitofp_double_i16(i16 %a, double %b) nounwind {
131 ; CHECK: sitofp_double_i16
132 ; PPC970: sitofp_double_i16
133 %b.addr = alloca double, align 8
134 %conv = sitofp i16 %a to double
145 store double %conv, ptr %b.addr, align 8
149 define void @sitofp_double_i8(i8 %a, double %b) nounwind {
151 ; CHECK: sitofp_double_i8
152 ; PPC970: sitofp_double_i8
153 %b.addr = alloca double, align 8
154 %conv = sitofp i8 %a to double
165 store double %conv, ptr %b.addr, align 8
171 define void @uitofp_single_i64(i64 %a, float %b) nounwind {
173 ; CHECK: uitofp_single_i64
174 ; PPC970: uitofp_single_i64
175 %b.addr = alloca float, align 4
176 %conv = uitofp i64 %a to float
180 ; PPC970-NOT: fcfidus
181 store float %conv, ptr %b.addr, align 4
185 define void @uitofp_single_i32(i32 %a, float %b) nounwind {
187 ; CHECK: uitofp_single_i32
188 ; PPC970: uitofp_single_i32
189 %b.addr = alloca float, align 4
190 %conv = uitofp i32 %a to float
198 ; PPC970-NOT: fcfidus
200 store float %conv, ptr %b.addr, align 4
204 define void @uitofp_single_i16(i16 %a, float %b) nounwind {
206 ; CHECK: uitofp_single_i16
207 ; PPC970: uitofp_single_i16
208 %b.addr = alloca float, align 4
209 %conv = uitofp i16 %a to float
210 ; CHECK: clrldi {{[0-9]+}}, {{[0-9]+}}, 48
214 ; PPC970: clrlwi {{[0-9]+}}, {{[0-9]+}}, 16
219 ; SPE: clrlwi {{[0-9]+}}, {{[0-9]+}}, 16
221 store float %conv, ptr %b.addr, align 4
225 define void @uitofp_single_i8(i8 %a) nounwind {
227 ; CHECK: uitofp_single_i8
228 ; PPC970: uitofp_single_i8
229 %b.addr = alloca float, align 4
230 %conv = uitofp i8 %a to float
231 ; CHECK: clrldi {{[0-9]+}}, {{[0-9]+}}, 56
235 ; PPC970: clrlwi {{[0-9]+}}, {{[0-9]+}}, 24
240 ; SPE: clrlwi {{[0-9]+}}, {{[0-9]+}}, 24
242 store float %conv, ptr %b.addr, align 4
246 define void @uitofp_double_i64(i64 %a, double %b) nounwind {
248 ; CHECK: uitofp_double_i64
249 ; PPC970: uitofp_double_i64
250 %b.addr = alloca double, align 8
251 %conv = uitofp i64 %a to double
256 store double %conv, ptr %b.addr, align 8
260 define void @uitofp_double_i32(i32 %a, double %b) nounwind {
262 ; CHECK: uitofp_double_i32
263 ; PPC970: uitofp_double_i32
264 %b.addr = alloca double, align 8
265 %conv = uitofp i32 %a to double
273 store double %conv, ptr %b.addr, align 8
277 define void @uitofp_double_i16(i16 %a, double %b) nounwind {
279 ; CHECK: uitofp_double_i16
280 ; PPC970: uitofp_double_i16
281 %b.addr = alloca double, align 8
282 %conv = uitofp i16 %a to double
283 ; CHECK: clrldi {{[0-9]+}}, {{[0-9]+}}, 48
287 ; PPC970: clrlwi {{[0-9]+}}, {{[0-9]+}}, 16
291 ; SPE: clrlwi {{[0-9]+}}, {{[0-9]+}}, 16
293 store double %conv, ptr %b.addr, align 8
297 define void @uitofp_double_i8(i8 %a, double %b) nounwind {
299 ; CHECK: uitofp_double_i8
300 ; PPC970: uitofp_double_i8
301 %b.addr = alloca double, align 8
302 %conv = uitofp i8 %a to double
303 ; CHECK: clrldi {{[0-9]+}}, {{[0-9]+}}, 56
307 ; PPC970: clrlwi {{[0-9]+}}, {{[0-9]+}}, 24
311 ; SPE: clrlwi {{[0-9]+}}, {{[0-9]+}}, 24
313 store double %conv, ptr %b.addr, align 8
319 define void @fptosi_float_i32(float %a) nounwind {
321 ; CHECK: fptosi_float_i32
322 ; PPC970: fptosi_float_i32
323 %b.addr = alloca i32, align 4
324 %conv = fptosi float %a to i32
332 store i32 %conv, ptr %b.addr, align 4
336 define void @fptosi_float_i64(float %a) nounwind {
338 ; CHECK: fptosi_float_i64
339 ; PPC970: fptosi_float_i64
340 %b.addr = alloca i64, align 4
341 %conv = fptosi float %a to i64
348 store i64 %conv, ptr %b.addr, align 4
352 define void @fptosi_double_i32(double %a) nounwind {
354 ; CHECK: fptosi_double_i32
355 ; PPC970: fptosi_double_i32
356 %b.addr = alloca i32, align 8
357 %conv = fptosi double %a to i32
365 store i32 %conv, ptr %b.addr, align 8
369 define void @fptosi_double_i64(double %a) nounwind {
371 ; CHECK: fptosi_double_i64
372 ; PPC970: fptosi_double_i64
373 %b.addr = alloca i64, align 8
374 %conv = fptosi double %a to i64
381 store i64 %conv, ptr %b.addr, align 8
387 define void @fptoui_float_i32(float %a) nounwind {
389 ; CHECK: fptoui_float_i32
390 ; PPC970: fptoui_float_i32
391 %b.addr = alloca i32, align 4
392 %conv = fptoui float %a to i32
400 store i32 %conv, ptr %b.addr, align 4
404 define void @fptoui_float_i64(float %a) nounwind {
406 ; CHECK: fptoui_float_i64
407 ; PPC970: fptoui_float_i64
408 %b.addr = alloca i64, align 4
409 %conv = fptoui float %a to i64
413 ; PPC970-NOT: fctiduz
414 store i64 %conv, ptr %b.addr, align 4
418 define void @fptoui_double_i32(double %a) nounwind {
420 ; CHECK: fptoui_double_i32
421 ; PPC970: fptoui_double_i32
422 %b.addr = alloca i32, align 8
423 %conv = fptoui double %a to i32
431 store i32 %conv, ptr %b.addr, align 8
435 define void @fptoui_double_i64(double %a) nounwind {
437 ; CHECK: fptoui_double_i64
438 ; PPC970: fptoui_double_i64
439 %b.addr = alloca i64, align 8
440 %conv = fptoui double %a to i64
444 ; PPC970-NOT: fctiduz
445 store i64 %conv, ptr %b.addr, align 8