llvm.org GIT mirror llvm / e6979f2
[PowerPC] add more tests for FMF propagation; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332295 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 1 year, 5 months ago
1 changed file(s) with 84 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
11 ; REQUIRES: asserts
22 ; RUN: llc < %s -mtriple=powerpc64le -debug-only=isel -o /dev/null 2>&1 | FileCheck %s --check-prefix=FMFDEBUG
33 ; RUN: llc < %s -mtriple=powerpc64le | FileCheck %s --check-prefix=FMF
4 ; RUN: llc < %s -mtriple=powerpc64le -debug-only=isel -o /dev/null 2>&1 -enable-unsafe-fp-math | FileCheck %s --check-prefix=GLOBALDEBUG
5 ; RUN: llc < %s -mtriple=powerpc64le -enable-unsafe-fp-math | FileCheck %s --check-prefix=GLOBAL
4 ; RUN: llc < %s -mtriple=powerpc64le -debug-only=isel -o /dev/null 2>&1 -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=GLOBALDEBUG
5 ; RUN: llc < %s -mtriple=powerpc64le -enable-unsafe-fp-math -enable-no-nans-fp-math | FileCheck %s --check-prefix=GLOBAL
66
77 ; Test FP transforms using instruction/node-level fast-math-flags.
88 ; We're also checking debug output to verify that FMF is propagated to the newly created nodes.
376376 ret float %rt
377377 }
378378
379 ; fcmp can have fast-math-flags.
380
381 ; FMFDEBUG-LABEL: Optimized lowered selection DAG: %bb.0 'fcmp_nnan:'
382 ; FMFDEBUG: select_cc {{t[0-9]+}}
383 ; FMFDEBUG: Type-legalized selection DAG: %bb.0 'fcmp_nnan:'
384
385 ; GLOBALDEBUG-LABEL: Optimized lowered selection DAG: %bb.0 'fcmp_nnan:'
386 ; GLOBALDEBUG: select_cc {{t[0-9]+}}
387 ; GLOBALDEBUG: Type-legalized selection DAG: %bb.0 'fcmp_nnan:'
388
389 define double @fcmp_nnan(double %a, double %y, double %z) {
390 ; FMF-LABEL: fcmp_nnan:
391 ; FMF: # %bb.0:
392 ; FMF-NEXT: xxlxor 0, 0, 0
393 ; FMF-NEXT: fcmpu 0, 1, 1
394 ; FMF-NEXT: fcmpu 1, 1, 0
395 ; FMF-NEXT: cror 20, 4, 3
396 ; FMF-NEXT: bc 12, 20, .LBB12_2
397 ; FMF-NEXT: # %bb.1:
398 ; FMF-NEXT: fmr 3, 2
399 ; FMF-NEXT: .LBB12_2:
400 ; FMF-NEXT: fmr 1, 3
401 ; FMF-NEXT: blr
402 ;
403 ; GLOBAL-LABEL: fcmp_nnan:
404 ; GLOBAL: # %bb.0:
405 ; GLOBAL-NEXT: xxlxor 0, 0, 0
406 ; GLOBAL-NEXT: xscmpudp 0, 1, 0
407 ; GLOBAL-NEXT: blt 0, .LBB12_2
408 ; GLOBAL-NEXT: # %bb.1:
409 ; GLOBAL-NEXT: fmr 3, 2
410 ; GLOBAL-NEXT: .LBB12_2:
411 ; GLOBAL-NEXT: fmr 1, 3
412 ; GLOBAL-NEXT: blr
413 %cmp = fcmp nnan ult double %a, 0.0
414 %z.y = select i1 %cmp, double %z, double %y
415 ret double %z.y
416 }
417
418 ; FP library calls can have fast-math-flags.
419
420 ; FMFDEBUG-LABEL: Optimized lowered selection DAG: %bb.0 'log2_approx:'
421 ; FMFDEBUG: ch,glue = PPCISD::CALL_NOP t11, TargetGlobalAddress:i64
422 ; FMFDEBUG: ch,glue = callseq_end t15, TargetConstant:i64<32>, TargetConstant:i64<0>, t15:1
423 ; FMFDEBUG: f64,ch,glue = CopyFromReg t16, Register:f64 $f1, t16:1
424 ; FMFDEBUG: Type-legalized selection DAG: %bb.0 'log2_approx:'
425
426 ; GLOBALDEBUG-LABEL: Optimized lowered selection DAG: %bb.0 'log2_approx:'
427 ; GLOBALDEBUG: ch,glue = PPCISD::CALL_NOP t11, TargetGlobalAddress:i64
428 ; GLOBALDEBUG: ch,glue = callseq_end t15, TargetConstant:i64<32>, TargetConstant:i64<0>, t15:1
429 ; GLOBALDEBUG: f64,ch,glue = CopyFromReg t16, Register:f64 $f1, t16:1
430 ; GLOBALDEBUG: Type-legalized selection DAG: %bb.0 'log2_approx:'
431
432 declare double @log2(double)
433 define double @log2_approx(double %x) nounwind {
434 ; FMF-LABEL: log2_approx:
435 ; FMF: # %bb.0:
436 ; FMF-NEXT: mflr 0
437 ; FMF-NEXT: std 0, 16(1)
438 ; FMF-NEXT: stdu 1, -32(1)
439 ; FMF-NEXT: bl log2
440 ; FMF-NEXT: nop
441 ; FMF-NEXT: addi 1, 1, 32
442 ; FMF-NEXT: ld 0, 16(1)
443 ; FMF-NEXT: mtlr 0
444 ; FMF-NEXT: blr
445 ;
446 ; GLOBAL-LABEL: log2_approx:
447 ; GLOBAL: # %bb.0:
448 ; GLOBAL-NEXT: mflr 0
449 ; GLOBAL-NEXT: std 0, 16(1)
450 ; GLOBAL-NEXT: stdu 1, -32(1)
451 ; GLOBAL-NEXT: bl log2
452 ; GLOBAL-NEXT: nop
453 ; GLOBAL-NEXT: addi 1, 1, 32
454 ; GLOBAL-NEXT: ld 0, 16(1)
455 ; GLOBAL-NEXT: mtlr 0
456 ; GLOBAL-NEXT: blr
457 %r = call afn double @log2(double %x)
458 ret double %r
459 }
460