Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt < %s -instcombine -S | FileCheck %s
      2 
      3 define double @mylog(double %x, double %y) #0 {
      4 entry:
      5   %pow = call double @llvm.pow.f64(double %x, double %y)
      6   %call = call double @log(double %pow) #0
      7   ret double %call
      8 }
      9 
     10 ; CHECK-LABEL: define double @mylog(
     11 ; CHECK:   %log = call fast double @log(double %x) #0
     12 ; CHECK:   %mul = fmul fast double %log, %y
     13 ; CHECK:   ret double %mul
     14 ; CHECK: }
     15 
     16 define double @test2(double ()* %fptr, double %p1) #0 {
     17   %call1 = call double %fptr()
     18   %pow = call double @log(double %call1)
     19   ret double %pow
     20 }
     21 
     22 ; CHECK-LABEL: @test2
     23 ; CHECK: log
     24 
     25 define double @test3(double %x) #0 {
     26   %call2 = call double @exp2(double %x) #0
     27   %call3 = call double @log(double %call2) #0
     28   ret double %call3
     29 }
     30 
     31 ; CHECK-LABEL: @test3
     32 ; CHECK:  %call2 = call double @exp2(double %x) #0
     33 ; CHECK:  %logmul = fmul fast double %x, 0x3FE62E42FEFA39EF
     34 ; CHECK:  ret double %logmul
     35 ; CHECK: }
     36 
     37 declare double @log(double) #0
     38 declare double @exp2(double) #0
     39 declare double @llvm.pow.f64(double, double)
     40 
     41 attributes #0 = { "unsafe-fp-math"="true" }
     42