Home | History | Annotate | Download | only in PowerPC
      1 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck %s
      2 ; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -enable-unsafe-fp-math | FileCheck -check-prefix=CHECK-FM %s
      3 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
      4 target triple = "powerpc64-unknown-linux-gnu"
      5 
      6 define float @test1(float %x) nounwind  {
      7   %call = tail call float @floorf(float %x) nounwind readnone
      8   ret float %call
      9 
     10 ; CHECK-LABEL: test1:
     11 ; CHECK: frim 1, 1
     12 
     13 ; CHECK-FM-LABEL: test1:
     14 ; CHECK-FM: frim 1, 1
     15 }
     16 
     17 declare float @floorf(float) nounwind readnone
     18 
     19 define double @test2(double %x) nounwind  {
     20   %call = tail call double @floor(double %x) nounwind readnone
     21   ret double %call
     22 
     23 ; CHECK-LABEL: test2:
     24 ; CHECK: frim 1, 1
     25 
     26 ; CHECK-FM-LABEL: test2:
     27 ; CHECK-FM: frim 1, 1
     28 }
     29 
     30 declare double @floor(double) nounwind readnone
     31 
     32 define float @test3(float %x) nounwind  {
     33   %call = tail call float @nearbyintf(float %x) nounwind readnone
     34   ret float %call
     35 
     36 ; CHECK-LABEL: test3:
     37 ; CHECK-NOT: frin
     38 
     39 ; CHECK-FM-LABEL: test3:
     40 ; CHECK-FM: frin 1, 1
     41 }
     42 
     43 declare float @nearbyintf(float) nounwind readnone
     44 
     45 define double @test4(double %x) nounwind  {
     46   %call = tail call double @nearbyint(double %x) nounwind readnone
     47   ret double %call
     48 
     49 ; CHECK-LABEL: test4:
     50 ; CHECK-NOT: frin
     51 
     52 ; CHECK-FM-LABEL: test4:
     53 ; CHECK-FM: frin 1, 1
     54 }
     55 
     56 declare double @nearbyint(double) nounwind readnone
     57 
     58 define float @test5(float %x) nounwind  {
     59   %call = tail call float @ceilf(float %x) nounwind readnone
     60   ret float %call
     61 
     62 ; CHECK-LABEL: test5:
     63 ; CHECK: frip 1, 1
     64 
     65 ; CHECK-FM-LABEL: test5:
     66 ; CHECK-FM: frip 1, 1
     67 }
     68 
     69 declare float @ceilf(float) nounwind readnone
     70 
     71 define double @test6(double %x) nounwind  {
     72   %call = tail call double @ceil(double %x) nounwind readnone
     73   ret double %call
     74 
     75 ; CHECK-LABEL: test6:
     76 ; CHECK: frip 1, 1
     77 
     78 ; CHECK-FM-LABEL: test6:
     79 ; CHECK-FM: frip 1, 1
     80 }
     81 
     82 declare double @ceil(double) nounwind readnone
     83 
     84 define float @test9(float %x) nounwind  {
     85   %call = tail call float @truncf(float %x) nounwind readnone
     86   ret float %call
     87 
     88 ; CHECK-LABEL: test9:
     89 ; CHECK: friz 1, 1
     90 
     91 ; CHECK-FM-LABEL: test9:
     92 ; CHECK-FM: friz 1, 1
     93 }
     94 
     95 declare float @truncf(float) nounwind readnone
     96 
     97 define double @test10(double %x) nounwind  {
     98   %call = tail call double @trunc(double %x) nounwind readnone
     99   ret double %call
    100 
    101 ; CHECK-LABEL: test10:
    102 ; CHECK: friz 1, 1
    103 
    104 ; CHECK-FM-LABEL: test10:
    105 ; CHECK-FM: friz 1, 1
    106 }
    107 
    108 declare double @trunc(double) nounwind readnone
    109 
    110 define void @test11(float %x, float* %y) nounwind  {
    111   %call = tail call float @rintf(float %x) nounwind readnone
    112   store float %call, float* %y
    113   ret void
    114 
    115 ; CHECK-LABEL: test11:
    116 ; CHECK-NOT: frin
    117 
    118 ; CHECK-FM-LABEL: test11:
    119 ; CHECK-FM: frin [[R2:[0-9]+]], [[R1:[0-9]+]]
    120 ; CHECK-FM: fcmpu [[CR:[0-9]+]], [[R2]], [[R1]]
    121 ; CHECK-FM: beq [[CR]], .LBB[[BB:[0-9]+]]_2
    122 ; CHECK-FM: mtfsb1 6
    123 ; CHECK-FM: .LBB[[BB]]_2:
    124 ; CHECK-FM: blr
    125 }
    126 
    127 declare float @rintf(float) nounwind readnone
    128 
    129 define void @test12(double %x, double* %y) nounwind  {
    130   %call = tail call double @rint(double %x) nounwind readnone
    131   store double %call, double* %y
    132   ret void
    133 
    134 ; CHECK-LABEL: test12:
    135 ; CHECK-NOT: frin
    136 
    137 ; CHECK-FM-LABEL: test12:
    138 ; CHECK-FM: frin [[R2:[0-9]+]], [[R1:[0-9]+]]
    139 ; CHECK-FM: fcmpu [[CR:[0-9]+]], [[R2]], [[R1]]
    140 ; CHECK-FM: beq [[CR]], .LBB[[BB:[0-9]+]]_2
    141 ; CHECK-FM: mtfsb1 6
    142 ; CHECK-FM: .LBB[[BB]]_2:
    143 ; CHECK-FM: blr
    144 }
    145 
    146 declare double @rint(double) nounwind readnone
    147 
    148