1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -S -o - -emit-llvm              %s | FileCheck %s --check-prefix=NO__ERRNO
2 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO
3 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-unknown-gnu -Wno-implicit-function-declaration -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
4 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-windows-msvc -Wno-implicit-function-declaration -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
5 
6 // Test attributes and builtin codegen of math library calls.
7 
foo(double * d,float f,float * fp,long double * l,int * i,const char * c)8 void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
9   f = fmod(f,f);     f = fmodf(f,f);    f = fmodl(f,f);
10 
11 // NO__ERRNO: frem double
12 // NO__ERRNO: frem float
13 // NO__ERRNO: frem x86_fp80
14 // HAS_ERRNO: declare double @fmod(double noundef, double noundef) [[NOT_READNONE:#[0-9]+]]
15 // HAS_ERRNO: declare float @fmodf(float noundef, float noundef) [[NOT_READNONE]]
16 // HAS_ERRNO: declare x86_fp80 @fmodl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
17 
18   atan2(f,f);    atan2f(f,f) ;  atan2l(f, f);
19 
20 // NO__ERRNO: declare double @atan2(double noundef, double noundef) [[READNONE:#[0-9]+]]
21 // NO__ERRNO: declare float @atan2f(float noundef, float noundef) [[READNONE]]
22 // NO__ERRNO: declare x86_fp80 @atan2l(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
23 // HAS_ERRNO: declare double @atan2(double noundef, double noundef) [[NOT_READNONE]]
24 // HAS_ERRNO: declare float @atan2f(float noundef, float noundef) [[NOT_READNONE]]
25 // HAS_ERRNO: declare x86_fp80 @atan2l(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
26 
27   copysign(f,f); copysignf(f,f);copysignl(f,f);
28 
29 // NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
30 // NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
31 // NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
32 // HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
33 // HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
34 // HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
35 
36   fabs(f);       fabsf(f);      fabsl(f);
37 
38 // NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
39 // NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
40 // NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
41 // HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
42 // HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
43 // HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
44 
45   frexp(f,i);    frexpf(f,i);   frexpl(f,i);
46 
47 // NO__ERRNO: declare double @frexp(double noundef, i32* noundef) [[NOT_READNONE:#[0-9]+]]
48 // NO__ERRNO: declare float @frexpf(float noundef, i32* noundef) [[NOT_READNONE]]
49 // NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, i32* noundef) [[NOT_READNONE]]
50 // HAS_ERRNO: declare double @frexp(double noundef, i32* noundef) [[NOT_READNONE]]
51 // HAS_ERRNO: declare float @frexpf(float noundef, i32* noundef) [[NOT_READNONE]]
52 // HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, i32* noundef) [[NOT_READNONE]]
53 
54   ldexp(f,f);    ldexpf(f,f);   ldexpl(f,f);
55 
56 // NO__ERRNO: declare double @ldexp(double noundef, i32 noundef) [[READNONE]]
57 // NO__ERRNO: declare float @ldexpf(float noundef, i32 noundef) [[READNONE]]
58 // NO__ERRNO: declare x86_fp80 @ldexpl(x86_fp80 noundef, i32 noundef) [[READNONE]]
59 // HAS_ERRNO: declare double @ldexp(double noundef, i32 noundef) [[NOT_READNONE]]
60 // HAS_ERRNO: declare float @ldexpf(float noundef, i32 noundef) [[NOT_READNONE]]
61 // HAS_ERRNO: declare x86_fp80 @ldexpl(x86_fp80 noundef, i32 noundef) [[NOT_READNONE]]
62 
63   modf(f,d);       modff(f,fp);      modfl(f,l);
64 
65 // NO__ERRNO: declare double @modf(double noundef, double* noundef) [[NOT_READNONE]]
66 // NO__ERRNO: declare float @modff(float noundef, float* noundef) [[NOT_READNONE]]
67 // NO__ERRNO: declare x86_fp80 @modfl(x86_fp80 noundef, x86_fp80* noundef) [[NOT_READNONE]]
68 // HAS_ERRNO: declare double @modf(double noundef, double* noundef) [[NOT_READNONE]]
69 // HAS_ERRNO: declare float @modff(float noundef, float* noundef) [[NOT_READNONE]]
70 // HAS_ERRNO: declare x86_fp80 @modfl(x86_fp80 noundef, x86_fp80* noundef) [[NOT_READNONE]]
71 
72   nan(c);        nanf(c);       nanl(c);
73 
74 // NO__ERRNO: declare double @nan(i8* noundef) [[READONLY:#[0-9]+]]
75 // NO__ERRNO: declare float @nanf(i8* noundef) [[READONLY]]
76 // NO__ERRNO: declare x86_fp80 @nanl(i8* noundef) [[READONLY]]
77 // HAS_ERRNO: declare double @nan(i8* noundef) [[READONLY:#[0-9]+]]
78 // HAS_ERRNO: declare float @nanf(i8* noundef) [[READONLY]]
79 // HAS_ERRNO: declare x86_fp80 @nanl(i8* noundef) [[READONLY]]
80 
81   pow(f,f);        powf(f,f);       powl(f,f);
82 
83 // NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]]
84 // NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]]
85 // NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
86 // HAS_ERRNO: declare double @pow(double noundef, double noundef) [[NOT_READNONE]]
87 // HAS_ERRNO: declare float @powf(float noundef, float noundef) [[NOT_READNONE]]
88 // HAS_ERRNO: declare x86_fp80 @powl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
89 
90   /* math */
91   acos(f);       acosf(f);      acosl(f);
92 
93 // NO__ERRNO: declare double @acos(double noundef) [[READNONE]]
94 // NO__ERRNO: declare float @acosf(float noundef) [[READNONE]]
95 // NO__ERRNO: declare x86_fp80 @acosl(x86_fp80 noundef) [[READNONE]]
96 // HAS_ERRNO: declare double @acos(double noundef) [[NOT_READNONE]]
97 // HAS_ERRNO: declare float @acosf(float noundef) [[NOT_READNONE]]
98 // HAS_ERRNO: declare x86_fp80 @acosl(x86_fp80 noundef) [[NOT_READNONE]]
99 
100   acosh(f);      acoshf(f);     acoshl(f);
101 
102 // NO__ERRNO: declare double @acosh(double noundef) [[READNONE]]
103 // NO__ERRNO: declare float @acoshf(float noundef) [[READNONE]]
104 // NO__ERRNO: declare x86_fp80 @acoshl(x86_fp80 noundef) [[READNONE]]
105 // HAS_ERRNO: declare double @acosh(double noundef) [[NOT_READNONE]]
106 // HAS_ERRNO: declare float @acoshf(float noundef) [[NOT_READNONE]]
107 // HAS_ERRNO: declare x86_fp80 @acoshl(x86_fp80 noundef) [[NOT_READNONE]]
108 
109   asin(f);       asinf(f);      asinl(f);
110 
111 // NO__ERRNO: declare double @asin(double noundef) [[READNONE]]
112 // NO__ERRNO: declare float @asinf(float noundef) [[READNONE]]
113 // NO__ERRNO: declare x86_fp80 @asinl(x86_fp80 noundef) [[READNONE]]
114 // HAS_ERRNO: declare double @asin(double noundef) [[NOT_READNONE]]
115 // HAS_ERRNO: declare float @asinf(float noundef) [[NOT_READNONE]]
116 // HAS_ERRNO: declare x86_fp80 @asinl(x86_fp80 noundef) [[NOT_READNONE]]
117 
118   asinh(f);      asinhf(f);     asinhl(f);
119 
120 // NO__ERRNO: declare double @asinh(double noundef) [[READNONE]]
121 // NO__ERRNO: declare float @asinhf(float noundef) [[READNONE]]
122 // NO__ERRNO: declare x86_fp80 @asinhl(x86_fp80 noundef) [[READNONE]]
123 // HAS_ERRNO: declare double @asinh(double noundef) [[NOT_READNONE]]
124 // HAS_ERRNO: declare float @asinhf(float noundef) [[NOT_READNONE]]
125 // HAS_ERRNO: declare x86_fp80 @asinhl(x86_fp80 noundef) [[NOT_READNONE]]
126 
127   atan(f);       atanf(f);      atanl(f);
128 
129 // NO__ERRNO: declare double @atan(double noundef) [[READNONE]]
130 // NO__ERRNO: declare float @atanf(float noundef) [[READNONE]]
131 // NO__ERRNO: declare x86_fp80 @atanl(x86_fp80 noundef) [[READNONE]]
132 // HAS_ERRNO: declare double @atan(double noundef) [[NOT_READNONE]]
133 // HAS_ERRNO: declare float @atanf(float noundef) [[NOT_READNONE]]
134 // HAS_ERRNO: declare x86_fp80 @atanl(x86_fp80 noundef) [[NOT_READNONE]]
135 
136   atanh(f);      atanhf(f);     atanhl(f);
137 
138 // NO__ERRNO: declare double @atanh(double noundef) [[READNONE]]
139 // NO__ERRNO: declare float @atanhf(float noundef) [[READNONE]]
140 // NO__ERRNO: declare x86_fp80 @atanhl(x86_fp80 noundef) [[READNONE]]
141 // HAS_ERRNO: declare double @atanh(double noundef) [[NOT_READNONE]]
142 // HAS_ERRNO: declare float @atanhf(float noundef) [[NOT_READNONE]]
143 // HAS_ERRNO: declare x86_fp80 @atanhl(x86_fp80 noundef) [[NOT_READNONE]]
144 
145   cbrt(f);       cbrtf(f);      cbrtl(f);
146 
147 // NO__ERRNO: declare double @cbrt(double noundef) [[READNONE]]
148 // NO__ERRNO: declare float @cbrtf(float noundef) [[READNONE]]
149 // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80 noundef) [[READNONE]]
150 // HAS_ERRNO: declare double @cbrt(double noundef) [[READNONE:#[0-9]+]]
151 // HAS_ERRNO: declare float @cbrtf(float noundef) [[READNONE]]
152 // HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80 noundef) [[READNONE]]
153 
154   ceil(f);       ceilf(f);      ceill(f);
155 
156 // NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
157 // NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
158 // NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
159 // HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
160 // HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
161 // HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
162 
163   cos(f);        cosf(f);       cosl(f);
164 
165 // NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]]
166 // NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]]
167 // NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]]
168 // HAS_ERRNO: declare double @cos(double noundef) [[NOT_READNONE]]
169 // HAS_ERRNO: declare float @cosf(float noundef) [[NOT_READNONE]]
170 // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80 noundef) [[NOT_READNONE]]
171 
172   cosh(f);       coshf(f);      coshl(f);
173 
174 // NO__ERRNO: declare double @cosh(double noundef) [[READNONE]]
175 // NO__ERRNO: declare float @coshf(float noundef) [[READNONE]]
176 // NO__ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[READNONE]]
177 // HAS_ERRNO: declare double @cosh(double noundef) [[NOT_READNONE]]
178 // HAS_ERRNO: declare float @coshf(float noundef) [[NOT_READNONE]]
179 // HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[NOT_READNONE]]
180 
181   erf(f);        erff(f);       erfl(f);
182 
183 // NO__ERRNO: declare double @erf(double noundef) [[READNONE]]
184 // NO__ERRNO: declare float @erff(float noundef) [[READNONE]]
185 // NO__ERRNO: declare x86_fp80 @erfl(x86_fp80 noundef) [[READNONE]]
186 // HAS_ERRNO: declare double @erf(double noundef) [[NOT_READNONE]]
187 // HAS_ERRNO: declare float @erff(float noundef) [[NOT_READNONE]]
188 // HAS_ERRNO: declare x86_fp80 @erfl(x86_fp80 noundef) [[NOT_READNONE]]
189 
190   erfc(f);       erfcf(f);      erfcl(f);
191 
192 // NO__ERRNO: declare double @erfc(double noundef) [[READNONE]]
193 // NO__ERRNO: declare float @erfcf(float noundef) [[READNONE]]
194 // NO__ERRNO: declare x86_fp80 @erfcl(x86_fp80 noundef) [[READNONE]]
195 // HAS_ERRNO: declare double @erfc(double noundef) [[NOT_READNONE]]
196 // HAS_ERRNO: declare float @erfcf(float noundef) [[NOT_READNONE]]
197 // HAS_ERRNO: declare x86_fp80 @erfcl(x86_fp80 noundef) [[NOT_READNONE]]
198 
199   exp(f);        expf(f);       expl(f);
200 
201 // NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]]
202 // NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]]
203 // NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]]
204 // HAS_ERRNO: declare double @exp(double noundef) [[NOT_READNONE]]
205 // HAS_ERRNO: declare float @expf(float noundef) [[NOT_READNONE]]
206 // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80 noundef) [[NOT_READNONE]]
207 
208   exp2(f);       exp2f(f);      exp2l(f);
209 
210 // NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]]
211 // NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]]
212 // NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]]
213 // HAS_ERRNO: declare double @exp2(double noundef) [[NOT_READNONE]]
214 // HAS_ERRNO: declare float @exp2f(float noundef) [[NOT_READNONE]]
215 // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80 noundef) [[NOT_READNONE]]
216 
217   expm1(f);      expm1f(f);     expm1l(f);
218 
219 // NO__ERRNO: declare double @expm1(double noundef) [[READNONE]]
220 // NO__ERRNO: declare float @expm1f(float noundef) [[READNONE]]
221 // NO__ERRNO: declare x86_fp80 @expm1l(x86_fp80 noundef) [[READNONE]]
222 // HAS_ERRNO: declare double @expm1(double noundef) [[NOT_READNONE]]
223 // HAS_ERRNO: declare float @expm1f(float noundef) [[NOT_READNONE]]
224 // HAS_ERRNO: declare x86_fp80 @expm1l(x86_fp80 noundef) [[NOT_READNONE]]
225 
226   fdim(f,f);       fdimf(f,f);      fdiml(f,f);
227 
228 // NO__ERRNO: declare double @fdim(double noundef, double noundef) [[READNONE]]
229 // NO__ERRNO: declare float @fdimf(float noundef, float noundef) [[READNONE]]
230 // NO__ERRNO: declare x86_fp80 @fdiml(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
231 // HAS_ERRNO: declare double @fdim(double noundef, double noundef) [[NOT_READNONE]]
232 // HAS_ERRNO: declare float @fdimf(float noundef, float noundef) [[NOT_READNONE]]
233 // HAS_ERRNO: declare x86_fp80 @fdiml(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
234 
235   floor(f);      floorf(f);     floorl(f);
236 
237 // NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
238 // NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
239 // NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
240 // HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
241 // HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
242 // HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
243 
244   fma(f,f,f);        fmaf(f,f,f);       fmal(f,f,f);
245 
246 // NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]]
247 // NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
248 // NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
249 // HAS_ERRNO: declare double @fma(double noundef, double noundef, double noundef) [[NOT_READNONE]]
250 // HAS_ERRNO: declare float @fmaf(float noundef, float noundef, float noundef) [[NOT_READNONE]]
251 // HAS_ERRNO: declare x86_fp80 @fmal(x86_fp80 noundef, x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
252 
253 // On GNU or Win, fma never sets errno, so we can convert to the intrinsic.
254 
255 // HAS_ERRNO_GNU: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
256 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
257 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
258 
259 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
260 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
261 // Long double is just double on win, so no f80 use/declaration.
262 // HAS_ERRNO_WIN-NOT: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80)
263 
264   fmax(f,f);       fmaxf(f,f);      fmaxl(f,f);
265 
266 // NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
267 // NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
268 // NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
269 // HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
270 // HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
271 // HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
272 
273   fmin(f,f);       fminf(f,f);      fminl(f,f);
274 
275 // NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
276 // NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
277 // NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
278 // HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
279 // HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
280 // HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
281 
282   hypot(f,f);      hypotf(f,f);     hypotl(f,f);
283 
284 // NO__ERRNO: declare double @hypot(double noundef, double noundef) [[READNONE]]
285 // NO__ERRNO: declare float @hypotf(float noundef, float noundef) [[READNONE]]
286 // NO__ERRNO: declare x86_fp80 @hypotl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
287 // HAS_ERRNO: declare double @hypot(double noundef, double noundef) [[NOT_READNONE]]
288 // HAS_ERRNO: declare float @hypotf(float noundef, float noundef) [[NOT_READNONE]]
289 // HAS_ERRNO: declare x86_fp80 @hypotl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
290 
291   ilogb(f);      ilogbf(f);     ilogbl(f);
292 
293 // NO__ERRNO: declare i32 @ilogb(double noundef) [[READNONE]]
294 // NO__ERRNO: declare i32 @ilogbf(float noundef) [[READNONE]]
295 // NO__ERRNO: declare i32 @ilogbl(x86_fp80 noundef) [[READNONE]]
296 // HAS_ERRNO: declare i32 @ilogb(double noundef) [[NOT_READNONE]]
297 // HAS_ERRNO: declare i32 @ilogbf(float noundef) [[NOT_READNONE]]
298 // HAS_ERRNO: declare i32 @ilogbl(x86_fp80 noundef) [[NOT_READNONE]]
299 
300   lgamma(f);     lgammaf(f);    lgammal(f);
301 
302 // NO__ERRNO: declare double @lgamma(double noundef) [[NOT_READNONE]]
303 // NO__ERRNO: declare float @lgammaf(float noundef) [[NOT_READNONE]]
304 // NO__ERRNO: declare x86_fp80 @lgammal(x86_fp80 noundef) [[NOT_READNONE]]
305 // HAS_ERRNO: declare double @lgamma(double noundef) [[NOT_READNONE]]
306 // HAS_ERRNO: declare float @lgammaf(float noundef) [[NOT_READNONE]]
307 // HAS_ERRNO: declare x86_fp80 @lgammal(x86_fp80 noundef) [[NOT_READNONE]]
308 
309   llrint(f);     llrintf(f);    llrintl(f);
310 
311 // NO__ERRNO: declare i64 @llvm.llrint.i64.f64(double) [[READNONE_INTRINSIC]]
312 // NO__ERRNO: declare i64 @llvm.llrint.i64.f32(float) [[READNONE_INTRINSIC]]
313 // NO__ERRNO: declare i64 @llvm.llrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
314 // HAS_ERRNO: declare i64 @llrint(double noundef) [[NOT_READNONE]]
315 // HAS_ERRNO: declare i64 @llrintf(float noundef) [[NOT_READNONE]]
316 // HAS_ERRNO: declare i64 @llrintl(x86_fp80 noundef) [[NOT_READNONE]]
317 
318   llround(f);    llroundf(f);   llroundl(f);
319 
320 // NO__ERRNO: declare i64 @llvm.llround.i64.f64(double) [[READNONE_INTRINSIC]]
321 // NO__ERRNO: declare i64 @llvm.llround.i64.f32(float) [[READNONE_INTRINSIC]]
322 // NO__ERRNO: declare i64 @llvm.llround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
323 // HAS_ERRNO: declare i64 @llround(double noundef) [[NOT_READNONE]]
324 // HAS_ERRNO: declare i64 @llroundf(float noundef) [[NOT_READNONE]]
325 // HAS_ERRNO: declare i64 @llroundl(x86_fp80 noundef) [[NOT_READNONE]]
326 
327   log(f);        logf(f);       logl(f);
328 
329 // NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]]
330 // NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]]
331 // NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]]
332 // HAS_ERRNO: declare double @log(double noundef) [[NOT_READNONE]]
333 // HAS_ERRNO: declare float @logf(float noundef) [[NOT_READNONE]]
334 // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80 noundef) [[NOT_READNONE]]
335 
336   log10(f);      log10f(f);     log10l(f);
337 
338 // NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]]
339 // NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]]
340 // NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]]
341 // HAS_ERRNO: declare double @log10(double noundef) [[NOT_READNONE]]
342 // HAS_ERRNO: declare float @log10f(float noundef) [[NOT_READNONE]]
343 // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80 noundef) [[NOT_READNONE]]
344 
345   log1p(f);      log1pf(f);     log1pl(f);
346 
347 // NO__ERRNO: declare double @log1p(double noundef) [[READNONE]]
348 // NO__ERRNO: declare float @log1pf(float noundef) [[READNONE]]
349 // NO__ERRNO: declare x86_fp80 @log1pl(x86_fp80 noundef) [[READNONE]]
350 // HAS_ERRNO: declare double @log1p(double noundef) [[NOT_READNONE]]
351 // HAS_ERRNO: declare float @log1pf(float noundef) [[NOT_READNONE]]
352 // HAS_ERRNO: declare x86_fp80 @log1pl(x86_fp80 noundef) [[NOT_READNONE]]
353 
354   log2(f);       log2f(f);      log2l(f);
355 
356 // NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]]
357 // NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]]
358 // NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]]
359 // HAS_ERRNO: declare double @log2(double noundef) [[NOT_READNONE]]
360 // HAS_ERRNO: declare float @log2f(float noundef) [[NOT_READNONE]]
361 // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80 noundef) [[NOT_READNONE]]
362 
363   logb(f);       logbf(f);      logbl(f);
364 
365 // NO__ERRNO: declare double @logb(double noundef) [[READNONE]]
366 // NO__ERRNO: declare float @logbf(float noundef) [[READNONE]]
367 // NO__ERRNO: declare x86_fp80 @logbl(x86_fp80 noundef) [[READNONE]]
368 // HAS_ERRNO: declare double @logb(double noundef) [[NOT_READNONE]]
369 // HAS_ERRNO: declare float @logbf(float noundef) [[NOT_READNONE]]
370 // HAS_ERRNO: declare x86_fp80 @logbl(x86_fp80 noundef) [[NOT_READNONE]]
371 
372   lrint(f);      lrintf(f);     lrintl(f);
373 
374 // NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
375 // NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
376 // NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
377 // HAS_ERRNO: declare i64 @lrint(double noundef) [[NOT_READNONE]]
378 // HAS_ERRNO: declare i64 @lrintf(float noundef) [[NOT_READNONE]]
379 // HAS_ERRNO: declare i64 @lrintl(x86_fp80 noundef) [[NOT_READNONE]]
380 
381   lround(f);     lroundf(f);    lroundl(f);
382 
383 // NO__ERRNO: declare i64 @llvm.lround.i64.f64(double) [[READNONE_INTRINSIC]]
384 // NO__ERRNO: declare i64 @llvm.lround.i64.f32(float) [[READNONE_INTRINSIC]]
385 // NO__ERRNO: declare i64 @llvm.lround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
386 // HAS_ERRNO: declare i64 @lround(double noundef) [[NOT_READNONE]]
387 // HAS_ERRNO: declare i64 @lroundf(float noundef) [[NOT_READNONE]]
388 // HAS_ERRNO: declare i64 @lroundl(x86_fp80 noundef) [[NOT_READNONE]]
389 
390   nearbyint(f);  nearbyintf(f); nearbyintl(f);
391 
392 // NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
393 // NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
394 // NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
395 // HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
396 // HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
397 // HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
398 
399   nextafter(f,f);  nextafterf(f,f); nextafterl(f,f);
400 
401 // NO__ERRNO: declare double @nextafter(double noundef, double noundef) [[READNONE]]
402 // NO__ERRNO: declare float @nextafterf(float noundef, float noundef) [[READNONE]]
403 // NO__ERRNO: declare x86_fp80 @nextafterl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
404 // HAS_ERRNO: declare double @nextafter(double noundef, double noundef) [[NOT_READNONE]]
405 // HAS_ERRNO: declare float @nextafterf(float noundef, float noundef) [[NOT_READNONE]]
406 // HAS_ERRNO: declare x86_fp80 @nextafterl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
407 
408   nexttoward(f,f); nexttowardf(f,f);nexttowardl(f,f);
409 
410 // NO__ERRNO: declare double @nexttoward(double noundef, x86_fp80 noundef) [[READNONE]]
411 // NO__ERRNO: declare float @nexttowardf(float noundef, x86_fp80 noundef) [[READNONE]]
412 // NO__ERRNO: declare x86_fp80 @nexttowardl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
413 // HAS_ERRNO: declare double @nexttoward(double noundef, x86_fp80 noundef) [[NOT_READNONE]]
414 // HAS_ERRNO: declare float @nexttowardf(float noundef, x86_fp80 noundef) [[NOT_READNONE]]
415 // HAS_ERRNO: declare x86_fp80 @nexttowardl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
416 
417   remainder(f,f);  remainderf(f,f); remainderl(f,f);
418 
419 // NO__ERRNO: declare double @remainder(double noundef, double noundef) [[READNONE]]
420 // NO__ERRNO: declare float @remainderf(float noundef, float noundef) [[READNONE]]
421 // NO__ERRNO: declare x86_fp80 @remainderl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
422 // HAS_ERRNO: declare double @remainder(double noundef, double noundef) [[NOT_READNONE]]
423 // HAS_ERRNO: declare float @remainderf(float noundef, float noundef) [[NOT_READNONE]]
424 // HAS_ERRNO: declare x86_fp80 @remainderl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
425 
426   remquo(f,f,i);  remquof(f,f,i); remquol(f,f,i);
427 
428 // NO__ERRNO: declare double @remquo(double noundef, double noundef, i32* noundef) [[NOT_READNONE]]
429 // NO__ERRNO: declare float @remquof(float noundef, float noundef, i32* noundef) [[NOT_READNONE]]
430 // NO__ERRNO: declare x86_fp80 @remquol(x86_fp80 noundef, x86_fp80 noundef, i32* noundef) [[NOT_READNONE]]
431 // HAS_ERRNO: declare double @remquo(double noundef, double noundef, i32* noundef) [[NOT_READNONE]]
432 // HAS_ERRNO: declare float @remquof(float noundef, float noundef, i32* noundef) [[NOT_READNONE]]
433 // HAS_ERRNO: declare x86_fp80 @remquol(x86_fp80 noundef, x86_fp80 noundef, i32* noundef) [[NOT_READNONE]]
434 
435   rint(f);       rintf(f);      rintl(f);
436 
437 // NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
438 // NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
439 // NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
440 // HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
441 // HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
442 // HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
443 
444   round(f);      roundf(f);     roundl(f);
445 
446 // NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
447 // NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
448 // NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
449 // HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
450 // HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
451 // HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
452 
453   scalbln(f,f);    scalblnf(f,f);   scalblnl(f,f);
454 
455 // NO__ERRNO: declare double @scalbln(double noundef, i64 noundef) [[READNONE]]
456 // NO__ERRNO: declare float @scalblnf(float noundef, i64 noundef) [[READNONE]]
457 // NO__ERRNO: declare x86_fp80 @scalblnl(x86_fp80 noundef, i64 noundef) [[READNONE]]
458 // HAS_ERRNO: declare double @scalbln(double noundef, i64 noundef) [[NOT_READNONE]]
459 // HAS_ERRNO: declare float @scalblnf(float noundef, i64 noundef) [[NOT_READNONE]]
460 // HAS_ERRNO: declare x86_fp80 @scalblnl(x86_fp80 noundef, i64 noundef) [[NOT_READNONE]]
461 
462   scalbn(f,f);     scalbnf(f,f);    scalbnl(f,f);
463 
464 // NO__ERRNO: declare double @scalbn(double noundef, i32 noundef) [[READNONE]]
465 // NO__ERRNO: declare float @scalbnf(float noundef, i32 noundef) [[READNONE]]
466 // NO__ERRNO: declare x86_fp80 @scalbnl(x86_fp80 noundef, i32 noundef) [[READNONE]]
467 // HAS_ERRNO: declare double @scalbn(double noundef, i32 noundef) [[NOT_READNONE]]
468 // HAS_ERRNO: declare float @scalbnf(float noundef, i32 noundef) [[NOT_READNONE]]
469 // HAS_ERRNO: declare x86_fp80 @scalbnl(x86_fp80 noundef, i32 noundef) [[NOT_READNONE]]
470 
471   sin(f);        sinf(f);       sinl(f);
472 
473 // NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]]
474 // NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]]
475 // NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]]
476 // HAS_ERRNO: declare double @sin(double noundef) [[NOT_READNONE]]
477 // HAS_ERRNO: declare float @sinf(float noundef) [[NOT_READNONE]]
478 // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80 noundef) [[NOT_READNONE]]
479 
480   sinh(f);       sinhf(f);      sinhl(f);
481 
482 // NO__ERRNO: declare double @sinh(double noundef) [[READNONE]]
483 // NO__ERRNO: declare float @sinhf(float noundef) [[READNONE]]
484 // NO__ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[READNONE]]
485 // HAS_ERRNO: declare double @sinh(double noundef) [[NOT_READNONE]]
486 // HAS_ERRNO: declare float @sinhf(float noundef) [[NOT_READNONE]]
487 // HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[NOT_READNONE]]
488 
489   sqrt(f);       sqrtf(f);      sqrtl(f);
490 
491 // NO__ERRNO: declare double @llvm.sqrt.f64(double) [[READNONE_INTRINSIC]]
492 // NO__ERRNO: declare float @llvm.sqrt.f32(float) [[READNONE_INTRINSIC]]
493 // NO__ERRNO: declare x86_fp80 @llvm.sqrt.f80(x86_fp80) [[READNONE_INTRINSIC]]
494 // HAS_ERRNO: declare double @sqrt(double noundef) [[NOT_READNONE]]
495 // HAS_ERRNO: declare float @sqrtf(float noundef) [[NOT_READNONE]]
496 // HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80 noundef) [[NOT_READNONE]]
497 
498   tan(f);        tanf(f);       tanl(f);
499 
500 // NO__ERRNO: declare double @tan(double noundef) [[READNONE]]
501 // NO__ERRNO: declare float @tanf(float noundef) [[READNONE]]
502 // NO__ERRNO: declare x86_fp80 @tanl(x86_fp80 noundef) [[READNONE]]
503 // HAS_ERRNO: declare double @tan(double noundef) [[NOT_READNONE]]
504 // HAS_ERRNO: declare float @tanf(float noundef) [[NOT_READNONE]]
505 // HAS_ERRNO: declare x86_fp80 @tanl(x86_fp80 noundef) [[NOT_READNONE]]
506 
507   tanh(f);       tanhf(f);      tanhl(f);
508 
509 // NO__ERRNO: declare double @tanh(double noundef) [[READNONE]]
510 // NO__ERRNO: declare float @tanhf(float noundef) [[READNONE]]
511 // NO__ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[READNONE]]
512 // HAS_ERRNO: declare double @tanh(double noundef) [[NOT_READNONE]]
513 // HAS_ERRNO: declare float @tanhf(float noundef) [[NOT_READNONE]]
514 // HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[NOT_READNONE]]
515 
516   tgamma(f);     tgammaf(f);    tgammal(f);
517 
518 // NO__ERRNO: declare double @tgamma(double noundef) [[READNONE]]
519 // NO__ERRNO: declare float @tgammaf(float noundef) [[READNONE]]
520 // NO__ERRNO: declare x86_fp80 @tgammal(x86_fp80 noundef) [[READNONE]]
521 // HAS_ERRNO: declare double @tgamma(double noundef) [[NOT_READNONE]]
522 // HAS_ERRNO: declare float @tgammaf(float noundef) [[NOT_READNONE]]
523 // HAS_ERRNO: declare x86_fp80 @tgammal(x86_fp80 noundef) [[NOT_READNONE]]
524 
525   trunc(f);      truncf(f);     truncl(f);
526 
527 // NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
528 // NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
529 // NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
530 // HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
531 // HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
532 // HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
533 };
534 
535 // NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
536 // NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
537 // NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
538 // NO__ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
539 
540 // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
541 // HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
542 // HAS_ERRNO: attributes [[READONLY]] = { {{.*}}readonly{{.*}} }
543 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
544 
545 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
546 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
547