1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -constprop -S | FileCheck %s
3 ; RUN: opt < %s -constprop -S -mtriple=unknown-unknown-linux-musl | FileCheck -check-prefix=MUSL %s
5 ; Test to verify constant folding can occur when math routines are mapped
6 ; to the __<func>_finite versions of functions due to __FINITE_MATH_ONLY__
7 ; being enabled on headers on Linux. All calls should constant fold away
10 target triple = "unknown-unknown-linux-gnu"
12 declare double @__acos_finite(double) #0
13 declare float @__acosf_finite(float) #0
14 declare double @__asin_finite(double) #0
15 declare float @__asinf_finite(float) #0
16 declare double @__atan2_finite(double, double) #0
17 declare float @__atan2f_finite(float, float) #0
18 declare double @__cosh_finite(double) #0
19 declare float @__coshf_finite(float) #0
20 declare double @__exp2_finite(double) #0
21 declare float @__exp2f_finite(float) #0
22 declare double @__exp_finite(double) #0
23 declare float @__expf_finite(float) #0
24 declare double @__log10_finite(double) #0
25 declare float @__log10f_finite(float) #0
26 declare double @__log_finite(double) #0
27 declare float @__logf_finite(float) #0
28 declare double @__pow_finite(double, double) #0
29 declare float @__powf_finite(float, float) #0
30 declare double @__sinh_finite(double) #0
31 declare float @__sinhf_finite(float) #0
33 attributes #0 = { nounwind readnone }
37 ; CHECK-NEXT: [[SLOT:%.*]] = alloca double
38 ; CHECK-NEXT: [[SLOTF:%.*]] = alloca float
39 ; CHECK-NEXT: store double 0.000000e+00, double* [[SLOT]]
40 ; CHECK-NEXT: store double 0x3FF921FB54442D18, double* [[SLOT]]
41 ; CHECK-NEXT: store double 0x3FE4978FA3269EE1, double* [[SLOT]]
42 ; CHECK-NEXT: store double 0x402422A497D6185E, double* [[SLOT]]
43 ; CHECK-NEXT: store double 0x403415E5BF6FB106, double* [[SLOT]]
44 ; CHECK-NEXT: store double 8.000000e+00, double* [[SLOT]]
45 ; CHECK-NEXT: store double 0x3FF193EA7AAD030{{[AB]}}, double* [[SLOT]]
46 ; CHECK-NEXT: store double 0x3FDE8927964FD5FD, double* [[SLOT]]
47 ; CHECK-NEXT: store double 1.000000e+00, double* [[SLOT]]
48 ; CHECK-NEXT: store double 0x40240926E70949AE, double* [[SLOT]]
49 ; CHECK-NEXT: store float 0.000000e+00, float* [[SLOTF]]
50 ; CHECK-NEXT: store float 0x3FF921FB60000000, float* [[SLOTF]]
51 ; CHECK-NEXT: store float 0x3FE4978FA0000000, float* [[SLOTF]]
52 ; CHECK-NEXT: store float 0x402422A4A0000000, float* [[SLOTF]]
53 ; CHECK-NEXT: store float 0x403415E5C0000000, float* [[SLOTF]]
54 ; CHECK-NEXT: store float 8.000000e+00, float* [[SLOTF]]
55 ; CHECK-NEXT: store float 0x3FF193EA80000000, float* [[SLOTF]]
56 ; CHECK-NEXT: store float 0x3FDE8927A0000000, float* [[SLOTF]]
57 ; CHECK-NEXT: store float 8.100000e+01, float* [[SLOTF]]
58 ; CHECK-NEXT: store float 0x40240926E0000000, float* [[SLOTF]]
59 ; CHECK-NEXT: ret void
62 ; MUSL-NEXT: [[SLOT:%.*]] = alloca double
63 ; MUSL-NEXT: [[SLOTF:%.*]] = alloca float
103 %slot = alloca double
104 %slotf = alloca float
106 %ACOS = call fast double @__acos_finite(double 1.000000e+00)
107 store double %ACOS, double* %slot
108 %ASIN = call fast double @__asin_finite(double 1.000000e+00)
109 store double %ASIN, double* %slot
110 %ATAN2 = call fast double @__atan2_finite(double 3.000000e+00, double 4.000000e+00)
111 store double %ATAN2, double* %slot
112 %COSH = call fast double @__cosh_finite(double 3.000000e+00)
113 store double %COSH, double* %slot
114 %EXP = call fast double @__exp_finite(double 3.000000e+00)
115 store double %EXP, double* %slot
116 %EXP2 = call fast double @__exp2_finite(double 3.000000e+00)
117 store double %EXP2, double* %slot
118 %LOG = call fast double @__log_finite(double 3.000000e+00)
119 store double %LOG, double* %slot
120 %LOG10 = call fast double @__log10_finite(double 3.000000e+00)
121 store double %LOG10, double* %slot
122 %POW = call fast double @__pow_finite(double 1.000000e+00, double 4.000000e+00)
123 store double %POW, double* %slot
124 %SINH = call fast double @__sinh_finite(double 3.000000e+00)
125 store double %SINH, double* %slot
127 %ACOSF = call fast float @__acosf_finite(float 1.000000e+00)
128 store float %ACOSF, float* %slotf
129 %ASINF = call fast float @__asinf_finite(float 1.000000e+00)
130 store float %ASINF, float* %slotf
131 %ATAN2F = call fast float @__atan2f_finite(float 3.000000e+00, float 4.000000e+00)
132 store float %ATAN2F, float* %slotf
133 %COSHF = call fast float @__coshf_finite(float 3.000000e+00)
134 store float %COSHF, float* %slotf
135 %EXPF = call fast float @__expf_finite(float 3.000000e+00)
136 store float %EXPF, float* %slotf
137 %EXP2F = call fast float @__exp2f_finite(float 3.000000e+00)
138 store float %EXP2F, float* %slotf
139 %LOGF = call fast float @__logf_finite(float 3.000000e+00)
140 store float %LOGF, float* %slotf
141 %LOG10F = call fast float @__log10f_finite(float 3.000000e+00)
142 store float %LOG10F, float* %slotf
143 %POWF = call fast float @__powf_finite(float 3.000000e+00, float 4.000000e+00)
144 store float %POWF, float* %slotf
145 %SINHF = call fast float @__sinhf_finite(float 3.000000e+00)
146 store float %SINHF, float* %slotf