1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instcombine -S | FileCheck %s
3
4define double @pow_intrinsic_third_fast(double %x) {
5; CHECK-LABEL: @pow_intrinsic_third_fast(
6; CHECK-NEXT:    [[POW:%.*]] = call fast double @llvm.pow.f64(double [[X:%.*]], double 0x3FD5555555555555)
7; CHECK-NEXT:    ret double [[POW]]
8;
9  %pow = call fast double @llvm.pow.f64(double %x, double 0x3fd5555555555555)
10  ret double %pow
11}
12
13define float @powf_intrinsic_third_fast(float %x) {
14; CHECK-LABEL: @powf_intrinsic_third_fast(
15; CHECK-NEXT:    [[POW:%.*]] = call fast float @llvm.pow.f32(float [[X:%.*]], float 0x3FD5555560000000)
16; CHECK-NEXT:    ret float [[POW]]
17;
18  %pow = call fast float @llvm.pow.f32(float %x, float 0x3fd5555560000000)
19  ret float %pow
20}
21
22define double @pow_intrinsic_third_approx(double %x) {
23; CHECK-LABEL: @pow_intrinsic_third_approx(
24; CHECK-NEXT:    [[POW:%.*]] = call afn double @llvm.pow.f64(double [[X:%.*]], double 0x3FD5555555555555)
25; CHECK-NEXT:    ret double [[POW]]
26;
27  %pow = call afn double @llvm.pow.f64(double %x, double 0x3fd5555555555555)
28  ret double %pow
29}
30
31define float @powf_intrinsic_third_approx(float %x) {
32; CHECK-LABEL: @powf_intrinsic_third_approx(
33; CHECK-NEXT:    [[POW:%.*]] = call afn float @llvm.pow.f32(float [[X:%.*]], float 0x3FD5555560000000)
34; CHECK-NEXT:    ret float [[POW]]
35;
36  %pow = call afn float @llvm.pow.f32(float %x, float 0x3fd5555560000000)
37  ret float %pow
38}
39
40define double @pow_libcall_third_fast(double %x) {
41; CHECK-LABEL: @pow_libcall_third_fast(
42; CHECK-NEXT:    [[POW:%.*]] = call fast double @pow(double [[X:%.*]], double 0x3FD5555555555555)
43; CHECK-NEXT:    ret double [[POW]]
44;
45  %pow = call fast double @pow(double %x, double 0x3fd5555555555555)
46  ret double %pow
47}
48
49define float @powf_libcall_third_fast(float %x) {
50; CHECK-LABEL: @powf_libcall_third_fast(
51; CHECK-NEXT:    [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 0x3FD5555560000000)
52; CHECK-NEXT:    ret float [[POW]]
53;
54  %pow = call fast float @powf(float %x, float 0x3fd5555560000000)
55  ret float %pow
56}
57
58define double @pow_intrinsic_negthird_fast(double %x) {
59; CHECK-LABEL: @pow_intrinsic_negthird_fast(
60; CHECK-NEXT:    [[POW:%.*]] = call fast double @llvm.pow.f64(double [[X:%.*]], double 0xBFD5555555555555)
61; CHECK-NEXT:    ret double [[POW]]
62;
63  %pow = call fast double @llvm.pow.f64(double %x, double 0xbfd5555555555555)
64  ret double %pow
65}
66
67define float @powf_intrinsic_negthird_fast(float %x) {
68; CHECK-LABEL: @powf_intrinsic_negthird_fast(
69; CHECK-NEXT:    [[POW:%.*]] = call fast float @llvm.pow.f32(float [[X:%.*]], float 0xBFD5555560000000)
70; CHECK-NEXT:    ret float [[POW]]
71;
72  %pow = call fast float @llvm.pow.f32(float %x, float 0xbfd5555560000000)
73  ret float %pow
74}
75
76define double @pow_intrinsic_negthird_approx(double %x) {
77; CHECK-LABEL: @pow_intrinsic_negthird_approx(
78; CHECK-NEXT:    [[POW:%.*]] = call afn double @llvm.pow.f64(double [[X:%.*]], double 0xBFD5555555555555)
79; CHECK-NEXT:    ret double [[POW]]
80;
81  %pow = call afn double @llvm.pow.f64(double %x, double 0xbfd5555555555555)
82  ret double %pow
83}
84
85define float @powf_intrinsic_negthird_approx(float %x) {
86; CHECK-LABEL: @powf_intrinsic_negthird_approx(
87; CHECK-NEXT:    [[POW:%.*]] = call afn float @llvm.pow.f32(float [[X:%.*]], float 0xBFD5555560000000)
88; CHECK-NEXT:    ret float [[POW]]
89;
90  %pow = call afn float @llvm.pow.f32(float %x, float 0xbfd5555560000000)
91  ret float %pow
92}
93
94define double @pow_libcall_negthird_fast(double %x) {
95; CHECK-LABEL: @pow_libcall_negthird_fast(
96; CHECK-NEXT:    [[POW:%.*]] = call fast double @pow(double [[X:%.*]], double 0xBFD5555555555555)
97; CHECK-NEXT:    ret double [[POW]]
98;
99  %pow = call fast double @pow(double %x, double 0xbfd5555555555555)
100  ret double %pow
101}
102
103define float @powf_libcall_negthird_fast(float %x) {
104; CHECK-LABEL: @powf_libcall_negthird_fast(
105; CHECK-NEXT:    [[POW:%.*]] = call fast float @powf(float [[X:%.*]], float 0xBFD5555560000000)
106; CHECK-NEXT:    ret float [[POW]]
107;
108  %pow = call fast float @powf(float %x, float 0xbfd5555560000000)
109  ret float %pow
110}
111
112declare double @llvm.pow.f64(double, double) #0
113declare float @llvm.pow.f32(float, float) #0
114declare double @pow(double, double)
115declare float @powf(float, float)
116
117attributes #0 = { nounwind readnone speculatable }
118