1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; Test that the pow() won't get simplified to when it's disabled.
4 ; RUN: opt < %s -disable-simplify-libcalls -instcombine -S | FileCheck %s
6 declare double @llvm.pow.f64(double, double)
7 declare double @pow(double, double)
9 define double @test_simplify_unavailable1(double %x) {
10 ; CHECK-LABEL: @test_simplify_unavailable1(
11 ; CHECK-NEXT: [[RETVAL:%.*]] = call double @llvm.pow.f64(double [[X:%.*]], double 5.000000e-01)
12 ; CHECK-NEXT: ret double [[RETVAL]]
14 %retval = call double @llvm.pow.f64(double %x, double 0.5)
18 ; Shrinking is disabled too.
20 define float @test_simplify_unavailable2(float %f, float %g) {
21 ; CHECK-LABEL: @test_simplify_unavailable2(
22 ; CHECK-NEXT: [[DF:%.*]] = fpext float [[F:%.*]] to double
23 ; CHECK-NEXT: [[DG:%.*]] = fpext float [[G:%.*]] to double
24 ; CHECK-NEXT: [[CALL:%.*]] = call fast double @pow(double [[DF]], double [[DG]])
25 ; CHECK-NEXT: [[FR:%.*]] = fptrunc double [[CALL]] to float
26 ; CHECK-NEXT: ret float [[FR]]
28 %df = fpext float %f to double
29 %dg = fpext float %g to double
30 %call = call fast double @pow(double %df, double %dg)
31 %fr = fptrunc double %call to float
35 ; Shrinking is disabled for the intrinsic too.
37 define float @test_simplify_unavailable3(float %f, float %g) {
38 ; CHECK-LABEL: @test_simplify_unavailable3(
39 ; CHECK-NEXT: [[DF:%.*]] = fpext float [[F:%.*]] to double
40 ; CHECK-NEXT: [[DG:%.*]] = fpext float [[G:%.*]] to double
41 ; CHECK-NEXT: [[CALL:%.*]] = call fast double @llvm.pow.f64(double [[DF]], double [[DG]])
42 ; CHECK-NEXT: [[FR:%.*]] = fptrunc double [[CALL]] to float
43 ; CHECK-NEXT: ret float [[FR]]
45 %df = fpext float %f to double
46 %dg = fpext float %g to double
47 %call = call fast double @llvm.pow.f64(double %df, double %dg)
48 %fr = fptrunc double %call to float