1 ; RUN: opt < %s -instcombine -S | FileCheck %s 2 3 define double @pow_exp(double %x, double %y) { 4 %call = call fast double @exp(double %x) nounwind readnone 5 %pow = call fast double @llvm.pow.f64(double %call, double %y) 6 ret double %pow 7 } 8 9 ; CHECK-LABEL: define double @pow_exp( 10 ; CHECK-NEXT: %mul = fmul fast double %x, %y 11 ; CHECK-NEXT: %exp = call fast double @exp(double %mul) 12 ; CHECK-NEXT: ret double %exp 13 14 define double @pow_exp2(double %x, double %y) { 15 %call = call fast double @exp2(double %x) nounwind readnone 16 %pow = call fast double @llvm.pow.f64(double %call, double %y) 17 ret double %pow 18 } 19 20 ; CHECK-LABEL: define double @pow_exp2( 21 ; CHECK-NEXT: %mul = fmul fast double %x, %y 22 ; CHECK-NEXT: %exp2 = call fast double @exp2(double %mul) 23 ; CHECK-NEXT: ret double %exp2 24 25 define double @pow_exp_not_fast(double %x, double %y) { 26 %call = call double @exp(double %x) 27 %pow = call fast double @llvm.pow.f64(double %call, double %y) 28 ret double %pow 29 } 30 31 ; CHECK-LABEL: define double @pow_exp_not_fast( 32 ; CHECK-NEXT: %call = call double @exp(double %x) 33 ; CHECK-NEXT: %pow = call fast double @llvm.pow.f64(double %call, double %y) 34 ; CHECK-NEXT: ret double %pow 35 36 define double @function_pointer(double ()* %fptr, double %p1) { 37 %call1 = call fast double %fptr() 38 %pow = call fast double @llvm.pow.f64(double %call1, double %p1) 39 ret double %pow 40 } 41 42 ; CHECK-LABEL: @function_pointer 43 ; CHECK-NEXT: %call1 = call fast double %fptr() 44 ; CHECK-NEXT: %pow = call fast double @llvm.pow.f64(double %call1, double %p1) 45 46 declare double @exp(double) 47 declare double @exp2(double) 48 declare double @llvm.pow.f64(double, double) 49 50