1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 define double @log_pow(double %x, double %y) {
4 %pow = call fast double @llvm.pow.f64(double %x, double %y)
5 %call = call fast double @log(double %pow)
9 ; CHECK-LABEL: define double @log_pow(
10 ; CHECK-NEXT: %log = call fast double @log(double %x)
11 ; CHECK-NEXT: %mul = fmul fast double %log, %y
12 ; CHECK-NEXT: ret double %mul
14 define double @log_pow_not_fast(double %x, double %y) {
15 %pow = call double @llvm.pow.f64(double %x, double %y)
16 %call = call fast double @log(double %pow)
20 ; CHECK-LABEL: define double @log_pow_not_fast(
21 ; CHECK-NEXT: %pow = call double @llvm.pow.f64(double %x, double %y)
22 ; CHECK-NEXT: %call = call fast double @log(double %pow)
23 ; CHECK-NEXT: ret double %call
25 define double @function_pointer(double ()* %fptr, double %p1) {
26 %call1 = call double %fptr()
27 %pow = call double @log(double %call1)
31 ; CHECK-LABEL: @function_pointer
32 ; CHECK-NEXT: %call1 = call double %fptr()
33 ; CHECK-NEXT: %pow = call double @log(double %call1)
34 ; CHECK-NEXT: ret double %pow
36 define double @log_exp2(double %x) {
37 %call2 = call fast double @exp2(double %x)
38 %call3 = call fast double @log(double %call2)
42 ; CHECK-LABEL: @log_exp2
43 ; CHECK-NEXT: %call2 = call fast double @exp2(double %x)
44 ; CHECK-NEXT: %logmul = fmul fast double %x, 0x3FE62E42FEFA39EF
45 ; CHECK-NEXT: ret double %logmul
47 define double @log_exp2_not_fast(double %x) {
48 %call2 = call double @exp2(double %x)
49 %call3 = call fast double @log(double %call2)
53 ; CHECK-LABEL: @log_exp2_not_fast
54 ; CHECK-NEXT: %call2 = call double @exp2(double %x)
55 ; CHECK-NEXT: %call3 = call fast double @log(double %call2)
56 ; CHECK-NEXT: ret double %call3
58 declare double @log(double) #0
59 declare double @exp2(double)
60 declare double @llvm.pow.f64(double, double)
62 attributes #0 = { nounwind readnone }