1 ; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu \
2 ; RUN: -mattr=+spe | FileCheck %s
4 declare float @llvm.fabs.float(float)
5 define float @test_float_abs(float %a) #0 {
7 %0 = tail call float @llvm.fabs.float(float %a)
9 ; CHECK-LABEL: test_float_abs
14 define float @test_fnabs(float %a) #0 {
16 %0 = tail call float @llvm.fabs.float(float %a)
17 %sub = fsub float -0.000000e+00, %0
19 ; CHECK-LABEL: @test_fnabs
24 define float @test_fdiv(float %a, float %b) {
26 %v = fdiv float %a, %b
29 ; CHECK-LABEL: test_fdiv
34 define float @test_fmul(float %a, float %b) {
36 %v = fmul float %a, %b
38 ; CHECK-LABEL @test_fmul
43 define float @test_fadd(float %a, float %b) {
45 %v = fadd float %a, %b
47 ; CHECK-LABEL @test_fadd
52 define float @test_fsub(float %a, float %b) {
54 %v = fsub float %a, %b
56 ; CHECK-LABEL @test_fsub
61 define float @test_fneg(float %a) {
63 %v = fsub float -0.0, %a
66 ; CHECK-LABEL @test_fneg
71 define float @test_dtos(double %a) {
73 %v = fptrunc double %a to float
75 ; CHECK-LABEL: test_dtos
80 define i1 @test_fcmpgt(float %a, float %b) {
82 %r = fcmp ogt float %a, %b
84 ; CHECK-LABEL: test_fcmpgt
89 define i1 @test_fcmpugt(float %a, float %b) {
91 %r = fcmp ugt float %a, %b
93 ; CHECK-LABEL: test_fcmpugt
98 define i1 @test_fcmple(float %a, float %b) {
100 %r = fcmp ole float %a, %b
102 ; CHECK-LABEL: test_fcmple
107 define i1 @test_fcmpule(float %a, float %b) {
109 %r = fcmp ule float %a, %b
111 ; CHECK-LABEL: test_fcmpule
116 define i1 @test_fcmpeq(float %a, float %b) {
118 %r = fcmp oeq float %a, %b
120 ; CHECK-LABEL: test_fcmpeq
125 ; (un)ordered tests are expanded to une and oeq so verify
126 define i1 @test_fcmpuno(float %a, float %b) {
128 %r = fcmp uno float %a, %b
130 ; CHECK-LABEL: test_fcmpuno
137 define i1 @test_fcmpord(float %a, float %b) {
139 %r = fcmp ord float %a, %b
141 ; CHECK-LABEL: test_fcmpord
148 define i1 @test_fcmpueq(float %a, float %b) {
150 %r = fcmp ueq float %a, %b
152 ; CHECK-LABEL: test_fcmpueq
157 define i1 @test_fcmpne(float %a, float %b) {
159 %r = fcmp one float %a, %b
161 ; CHECK-LABEL: test_fcmpne
166 define i1 @test_fcmpune(float %a, float %b) {
168 %r = fcmp une float %a, %b
170 ; CHECK-LABEL: test_fcmpune
175 define i1 @test_fcmplt(float %a, float %b) {
177 %r = fcmp olt float %a, %b
179 ; CHECK-LABEL: test_fcmplt
184 define i1 @test_fcmpult(float %a, float %b) {
186 %r = fcmp ult float %a, %b
188 ; CHECK-LABEL: test_fcmpult
193 define i1 @test_fcmpge(float %a, float %b) {
195 %r = fcmp oge float %a, %b
197 ; CHECK-LABEL: test_fcmpge
202 define i1 @test_fcmpuge(float %a, float %b) {
204 %r = fcmp uge float %a, %b
206 ; CHECK-LABEL: test_fcmpuge
211 define i32 @test_ftoui(float %a) {
212 %v = fptoui float %a to i32
214 ; CHECK-LABEL: test_ftoui
218 define i32 @test_ftosi(float %a) {
219 %v = fptosi float %a to i32
221 ; CHECK-LABEL: test_ftosi
225 define float @test_ffromui(i32 %a) {
226 %v = uitofp i32 %a to float
228 ; CHECK-LABEL: test_ffromui
232 define float @test_ffromsi(i32 %a) {
233 %v = sitofp i32 %a to float
235 ; CHECK-LABEL: test_ffromsi
239 define i32 @test_fasmconst(float %x) {
241 %x.addr = alloca float, align 8
242 store float %x, float* %x.addr, align 8
243 %0 = load float, float* %x.addr, align 8
244 %1 = call i32 asm sideeffect "efsctsi $0, $1", "=f,f"(float %0)
246 ; CHECK-LABEL: test_fasmconst
247 ; Check that it's not loading a double
256 define void @test_double_abs(double * %aa) #0 {
258 %0 = load double, double * %aa
259 %1 = tail call double @llvm.fabs.f64(double %0) #2
260 store double %1, double * %aa
262 ; CHECK-LABEL: test_double_abs
267 ; Function Attrs: nounwind readnone
268 declare double @llvm.fabs.f64(double) #1
270 define void @test_dnabs(double * %aa) #0 {
272 %0 = load double, double * %aa
273 %1 = tail call double @llvm.fabs.f64(double %0) #2
274 %sub = fsub double -0.000000e+00, %1
275 store double %sub, double * %aa
278 ; CHECK-LABEL: @test_dnabs
282 define double @test_ddiv(double %a, double %b) {
284 %v = fdiv double %a, %b
287 ; CHECK-LABEL: test_ddiv
292 define double @test_dmul(double %a, double %b) {
294 %v = fmul double %a, %b
296 ; CHECK-LABEL @test_dmul
301 define double @test_dadd(double %a, double %b) {
303 %v = fadd double %a, %b
305 ; CHECK-LABEL @test_dadd
310 define double @test_dsub(double %a, double %b) {
312 %v = fsub double %a, %b
314 ; CHECK-LABEL @test_dsub
319 define double @test_dneg(double %a) {
321 %v = fsub double -0.0, %a
324 ; CHECK-LABEL @test_dneg
328 define double @test_stod(float %a) {
330 %v = fpext float %a to double
332 ; CHECK-LABEL: test_stod
337 ; (un)ordered tests are expanded to une and oeq so verify
338 define i1 @test_dcmpuno(double %a, double %b) {
340 %r = fcmp uno double %a, %b
342 ; CHECK-LABEL: test_dcmpuno
349 define i1 @test_dcmpord(double %a, double %b) {
351 %r = fcmp ord double %a, %b
353 ; CHECK-LABEL: test_dcmpord
360 define i1 @test_dcmpgt(double %a, double %b) {
362 %r = fcmp ogt double %a, %b
364 ; CHECK-LABEL: test_dcmpgt
369 define i1 @test_dcmpugt(double %a, double %b) {
371 %r = fcmp ugt double %a, %b
373 ; CHECK-LABEL: test_dcmpugt
378 define i1 @test_dcmple(double %a, double %b) {
380 %r = fcmp ole double %a, %b
382 ; CHECK-LABEL: test_dcmple
387 define i1 @test_dcmpule(double %a, double %b) {
389 %r = fcmp ule double %a, %b
391 ; CHECK-LABEL: test_dcmpule
396 define i1 @test_dcmpeq(double %a, double %b) {
398 %r = fcmp oeq double %a, %b
400 ; CHECK-LABEL: test_dcmpeq
405 define i1 @test_dcmpueq(double %a, double %b) {
407 %r = fcmp ueq double %a, %b
409 ; CHECK-LABEL: test_dcmpueq
414 define i1 @test_dcmpne(double %a, double %b) {
416 %r = fcmp one double %a, %b
418 ; CHECK-LABEL: test_dcmpne
423 define i1 @test_dcmpune(double %a, double %b) {
425 %r = fcmp une double %a, %b
427 ; CHECK-LABEL: test_dcmpune
432 define i1 @test_dcmplt(double %a, double %b) {
434 %r = fcmp olt double %a, %b
436 ; CHECK-LABEL: test_dcmplt
441 define i1 @test_dcmpult(double %a, double %b) {
443 %r = fcmp ult double %a, %b
445 ; CHECK-LABEL: test_dcmpult
450 define i1 @test_dcmpge(double %a, double %b) {
452 %r = fcmp oge double %a, %b
454 ; CHECK-LABEL: test_dcmpge
459 define i1 @test_dcmpuge(double %a, double %b) {
461 %r = fcmp uge double %a, %b
463 ; CHECK-LABEL: test_dcmpuge
468 define double @test_dselect(double %a, double %b, i1 %c) {
470 %r = select i1 %c, double %a, double %b
472 ; CHECK-LABEL: test_dselect
480 define i32 @test_dtoui(double %a) {
482 %v = fptoui double %a to i32
484 ; CHECK-LABEL: test_dtoui
488 define i32 @test_dtosi(double %a) {
490 %v = fptosi double %a to i32
492 ; CHECK-LABEL: test_dtosi
496 define double @test_dfromui(i32 %a) {
498 %v = uitofp i32 %a to double
500 ; CHECK-LABEL: test_dfromui
504 define double @test_dfromsi(i32 %a) {
506 %v = sitofp i32 %a to double
508 ; CHECK-LABEL: test_dfromsi
512 define i32 @test_dasmconst(double %x) {
514 %x.addr = alloca double, align 8
515 store double %x, double* %x.addr, align 8
516 %0 = load double, double* %x.addr, align 8
517 %1 = call i32 asm sideeffect "efdctsi $0, $1", "=d,d"(double %0)
519 ; CHECK-LABEL: test_dasmconst
526 declare double @test_spill_spe_regs(double, double);
527 define dso_local void @test_func2() #0 {
532 declare void @test_memset(i8* nocapture writeonly, i8, i32, i1)
533 @global_var1 = global i32 0, align 4
534 define double @test_spill(double %a, i32 %a1, i64 %a2, i8 * %a3, i32 *%a4, i32* %a5) nounwind {
536 %v1 = alloca [13 x i32], align 4
537 %v2 = alloca [11 x i32], align 4
538 %0 = fadd double %a, %a
539 call void asm sideeffect "","~{s0},~{s3},~{s4},~{s5},~{s6},~{s7},~{s8},~{s9},~{s10},~{s11},~{s12},~{s13},~{s14},~{s15},~{s16},~{s17},~{s18},~{s19},~{s20},~{s21},~{s22},~{s23},~{s24},~{s25},~{s26},~{s27},~{s28},~{s29},~{s30},~{s31}"() nounwind
540 %1 = fadd double %0, 3.14159
541 %2 = bitcast [13 x i32]* %v1 to i8*
542 call void @test_memset(i8* align 4 %2, i8 0, i32 24, i1 true)
543 store i32 0, i32* %a5, align 4
544 call void @test_func2()
545 %3 = bitcast [11 x i32]* %v2 to i8*
546 call void @test_memset(i8* align 4 %3, i8 0, i32 20, i1 true)
552 ; CHECK-LABEL: test_spill
553 ; CHECK: li [[VREG:[0-9]+]], 256
554 ; CHECK: evstddx {{[0-9]+}}, {{[0-9]+}}, [[VREG]]
555 ; CHECK-NOT: evstdd {{[0-9]+}}, 256({{[0-9]+}}