1 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
2 ; RUN: opt < %s -passes=instsimplify -disable-simplify-libcalls -S | FileCheck %s --check-prefix=FNOBUILTIN
4 declare double @acos(double) readnone nounwind willreturn
5 declare double @asin(double) readnone nounwind willreturn
6 declare double @atan(double) readnone nounwind willreturn
7 declare double @atan2(double, double) readnone nounwind willreturn
8 declare double @ceil(double) readnone nounwind willreturn
9 declare double @cos(double) readnone nounwind willreturn
10 declare double @cosh(double) readnone nounwind willreturn
11 declare double @exp(double) readnone nounwind willreturn
12 declare double @exp2(double) readnone nounwind willreturn
13 declare double @fabs(double) readnone nounwind willreturn
14 declare double @floor(double) readnone nounwind willreturn
15 declare double @fmod(double, double) readnone nounwind willreturn
16 declare double @log(double) readnone nounwind willreturn
17 declare double @log10(double) readnone nounwind willreturn
18 declare double @pow(double, double) readnone nounwind willreturn
19 declare double @round(double) readnone nounwind willreturn
20 declare double @sin(double) readnone nounwind willreturn
21 declare double @sinh(double) readnone nounwind willreturn
22 declare double @sqrt(double) readnone nounwind willreturn
23 declare double @tan(double) readnone nounwind willreturn
24 declare double @tanh(double) readnone nounwind willreturn
26 declare float @acosf(float) readnone nounwind willreturn
27 declare float @asinf(float) readnone nounwind willreturn
28 declare float @atanf(float) readnone nounwind willreturn
29 declare float @atan2f(float, float) readnone nounwind willreturn
30 declare float @ceilf(float) readnone nounwind willreturn
31 declare float @cosf(float) readnone nounwind willreturn
32 declare float @coshf(float) readnone nounwind willreturn
33 declare float @expf(float) readnone nounwind willreturn
34 declare float @exp2f(float) readnone nounwind willreturn
35 declare float @fabsf(float) readnone nounwind willreturn
36 declare float @floorf(float) readnone nounwind willreturn
37 declare float @fmodf(float, float) readnone nounwind willreturn
38 declare float @logf(float) readnone nounwind willreturn
39 declare float @log10f(float) readnone nounwind willreturn
40 declare float @powf(float, float) readnone nounwind willreturn
41 declare float @roundf(float) readnone nounwind willreturn
42 declare float @sinf(float) readnone nounwind willreturn
43 declare float @sinhf(float) readnone nounwind willreturn
44 declare float @sqrtf(float) readnone nounwind willreturn
45 declare float @tanf(float) readnone nounwind willreturn
46 declare float @tanhf(float) readnone nounwind willreturn
50 ; FNOBUILTIN-LABEL: @T(
54 %A = call double @cos(double 0.000000e+00)
55 %B = call double @sin(double 0.000000e+00)
56 %a = fadd double %A, %B
57 %C = call double @tan(double 0.000000e+00)
58 %b = fadd double %a, %C
59 %D = call double @sqrt(double 4.000000e+00)
60 %c = fadd double %b, %D
65 %1 = call double @acos(double 1.000000e+00)
66 store double %1, ptr %slot
68 %2 = call double @asin(double 1.000000e+00)
69 store double %2, ptr %slot
71 %3 = call double @atan(double 3.000000e+00)
72 store double %3, ptr %slot
74 %4 = call double @atan2(double 3.000000e+00, double 4.000000e+00)
75 store double %4, ptr %slot
77 %5 = call double @ceil(double 3.000000e+00)
78 store double %5, ptr %slot
80 %6 = call double @cosh(double 3.000000e+00)
81 store double %6, ptr %slot
83 %7 = call double @exp(double 3.000000e+00)
84 store double %7, ptr %slot
86 %8 = call double @exp2(double 3.000000e+00)
87 store double %8, ptr %slot
89 %9 = call double @fabs(double 3.000000e+00)
90 store double %9, ptr %slot
92 %10 = call double @floor(double 3.000000e+00)
93 store double %10, ptr %slot
95 %11 = call double @fmod(double 3.000000e+00, double 4.000000e+00)
96 store double %11, ptr %slot
98 %12 = call double @log(double 3.000000e+00)
99 store double %12, ptr %slot
101 %13 = call double @log10(double 3.000000e+00)
102 store double %13, ptr %slot
104 %14 = call double @pow(double 3.000000e+00, double 4.000000e+00)
105 store double %14, ptr %slot
107 %round_val = call double @round(double 3.000000e+00)
108 store double %round_val, ptr %slot
110 %15 = call double @sinh(double 3.000000e+00)
111 store double %15, ptr %slot
113 %16 = call double @tanh(double 3.000000e+00)
114 store double %16, ptr %slot
116 %17 = call float @acosf(float 1.000000e+00)
117 store float %17, ptr %slotf
119 %18 = call float @asinf(float 1.000000e+00)
120 store float %18, ptr %slotf
122 %19 = call float @atanf(float 3.000000e+00)
123 store float %19, ptr %slotf
125 %20 = call float @atan2f(float 3.000000e+00, float 4.000000e+00)
126 store float %20, ptr %slotf
128 %21 = call float @ceilf(float 3.000000e+00)
129 store float %21, ptr %slotf
131 %22 = call float @cosf(float 3.000000e+00)
132 store float %22, ptr %slotf
134 %23 = call float @coshf(float 3.000000e+00)
135 store float %23, ptr %slotf
137 %24 = call float @expf(float 3.000000e+00)
138 store float %24, ptr %slotf
140 %25 = call float @exp2f(float 3.000000e+00)
141 store float %25, ptr %slotf
143 %26 = call float @fabsf(float 3.000000e+00)
144 store float %26, ptr %slotf
146 %27 = call float @floorf(float 3.000000e+00)
147 store float %27, ptr %slotf
149 %28 = call float @fmodf(float 3.000000e+00, float 4.000000e+00)
150 store float %28, ptr %slotf
152 %29 = call float @logf(float 3.000000e+00)
153 store float %29, ptr %slotf
155 %30 = call float @log10f(float 3.000000e+00)
156 store float %30, ptr %slotf
158 %31 = call float @powf(float 3.000000e+00, float 4.000000e+00)
159 store float %31, ptr %slotf
161 %roundf_val = call float @roundf(float 3.000000e+00)
162 store float %roundf_val, ptr %slotf
164 %32 = call float @sinf(float 3.000000e+00)
165 store float %32, ptr %slotf
167 %33 = call float @sinhf(float 3.000000e+00)
168 store float %33, ptr %slotf
170 %34 = call float @sqrtf(float 3.000000e+00)
171 store float %34, ptr %slotf
173 %35 = call float @tanf(float 3.000000e+00)
174 store float %35, ptr %slotf
176 %36 = call float @tanhf(float 3.000000e+00)
177 store float %36, ptr %slotf
182 %E = call double @exp2(double 4.0)
183 %d = fadd double %c, %E
187 define double @test_intrinsic_pow() nounwind uwtable ssp {
189 ; CHECK-LABEL: @test_intrinsic_pow(
192 %0 = call double @llvm.pow.f64(double 1.500000e+00, double 3.000000e+00)
196 define float @test_intrinsic_pow_f32_overflow() nounwind uwtable ssp {
198 ; CHECK-LABEL: @test_intrinsic_pow_f32_overflow(
200 ; CHECK: ret float 0x7FF0000000000000
201 %0 = call float @llvm.pow.f32(float 40.0, float 50.0)
205 declare double @llvm.pow.f64(double, double) nounwind readonly
206 declare float @llvm.pow.f32(float, float) nounwind readonly