1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm              %s | FileCheck %s -check-prefix=NO__ERRNO
2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO
3 // RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
4 // RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
5 
6 // Test attributes and codegen of math builtins.
7 
8 void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
9   __builtin_atan2(f,f);    __builtin_atan2f(f,f) ;  __builtin_atan2l(f, f);
10 
11 // NO__ERRNO: declare double @atan2(double, double) [[READNONE:#[0-9]+]]
12 // NO__ERRNO: declare float @atan2f(float, float) [[READNONE]]
13 // NO__ERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[READNONE]]
14 // HAS_ERRNO: declare double @atan2(double, double) [[NOT_READNONE:#[0-9]+]]
15 // HAS_ERRNO: declare float @atan2f(float, float) [[NOT_READNONE]]
16 // HAS_ERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NOT_READNONE]]
17 
18   __builtin_copysign(f,f); __builtin_copysignf(f,f);__builtin_copysignl(f,f);
19 
20 // NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
21 // NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
22 // NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
23 // HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
24 // HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
25 // HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
26 
27   __builtin_fabs(f);       __builtin_fabsf(f);      __builtin_fabsl(f);
28 
29 // NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
30 // NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
31 // NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
32 // HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
33 // HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
34 // HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
35 
36   __builtin_fmod(f,f);     __builtin_fmodf(f,f);    __builtin_fmodl(f,f);
37 
38 // NO__ERRNO-NOT: .fmod
39 // NO__ERRNO-NOT: @fmod
40 // HAS_ERRNO-NOT: .fmod
41 // HAS_ERRNO-NOT: @fmod
42 
43   __builtin_frexp(f,i);    __builtin_frexpf(f,i);   __builtin_frexpl(f,i);
44 
45 // NO__ERRNO: declare double @frexp(double, i32*) [[NOT_READNONE:#[0-9]+]]
46 // NO__ERRNO: declare float @frexpf(float, i32*) [[NOT_READNONE]]
47 // NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80, i32*) [[NOT_READNONE]]
48 // HAS_ERRNO: declare double @frexp(double, i32*) [[NOT_READNONE]]
49 // HAS_ERRNO: declare float @frexpf(float, i32*) [[NOT_READNONE]]
50 // HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80, i32*) [[NOT_READNONE]]
51 
52   __builtin_huge_val();    __builtin_huge_valf();   __builtin_huge_vall();
53 
54 // NO__ERRNO-NOT: .huge
55 // NO__ERRNO-NOT: @huge
56 // HAS_ERRNO-NOT: .huge
57 // HAS_ERRNO-NOT: @huge
58 
59   __builtin_inf();    __builtin_inff();   __builtin_infl();
60 
61 // NO__ERRNO-NOT: .inf
62 // NO__ERRNO-NOT: @inf
63 // HAS_ERRNO-NOT: .inf
64 // HAS_ERRNO-NOT: @inf
65 
66   __builtin_ldexp(f,f);    __builtin_ldexpf(f,f);   __builtin_ldexpl(f,f);
67 
68 // NO__ERRNO: declare double @ldexp(double, i32) [[READNONE]]
69 // NO__ERRNO: declare float @ldexpf(float, i32) [[READNONE]]
70 // NO__ERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[READNONE]]
71 // HAS_ERRNO: declare double @ldexp(double, i32) [[NOT_READNONE]]
72 // HAS_ERRNO: declare float @ldexpf(float, i32) [[NOT_READNONE]]
73 // HAS_ERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[NOT_READNONE]]
74 
75   __builtin_modf(f,d);       __builtin_modff(f,fp);      __builtin_modfl(f,l);
76 
77 // NO__ERRNO: declare double @modf(double, double*) [[NOT_READNONE]]
78 // NO__ERRNO: declare float @modff(float, float*) [[NOT_READNONE]]
79 // NO__ERRNO: declare x86_fp80 @modfl(x86_fp80, x86_fp80*) [[NOT_READNONE]]
80 // HAS_ERRNO: declare double @modf(double, double*) [[NOT_READNONE]]
81 // HAS_ERRNO: declare float @modff(float, float*) [[NOT_READNONE]]
82 // HAS_ERRNO: declare x86_fp80 @modfl(x86_fp80, x86_fp80*) [[NOT_READNONE]]
83 
84   __builtin_nan(c);        __builtin_nanf(c);       __builtin_nanl(c);
85 
86 // NO__ERRNO: declare double @nan(i8*) [[READNONE]]
87 // NO__ERRNO: declare float @nanf(i8*) [[READNONE]]
88 // NO__ERRNO: declare x86_fp80 @nanl(i8*) [[READNONE]]
89 // HAS_ERRNO: declare double @nan(i8*) [[READNONE:#[0-9]+]]
90 // HAS_ERRNO: declare float @nanf(i8*) [[READNONE]]
91 // HAS_ERRNO: declare x86_fp80 @nanl(i8*) [[READNONE]]
92 
93   __builtin_nans(c);        __builtin_nansf(c);       __builtin_nansl(c);
94 
95 // NO__ERRNO: declare double @nans(i8*) [[READNONE]]
96 // NO__ERRNO: declare float @nansf(i8*) [[READNONE]]
97 // NO__ERRNO: declare x86_fp80 @nansl(i8*) [[READNONE]]
98 // HAS_ERRNO: declare double @nans(i8*) [[READNONE]]
99 // HAS_ERRNO: declare float @nansf(i8*) [[READNONE]]
100 // HAS_ERRNO: declare x86_fp80 @nansl(i8*) [[READNONE]]
101 
102   __builtin_pow(f,f);        __builtin_powf(f,f);       __builtin_powl(f,f);
103 
104 // NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]]
105 // NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]]
106 // NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
107 // HAS_ERRNO: declare double @pow(double, double) [[NOT_READNONE]]
108 // HAS_ERRNO: declare float @powf(float, float) [[NOT_READNONE]]
109 // HAS_ERRNO: declare x86_fp80 @powl(x86_fp80, x86_fp80) [[NOT_READNONE]]
110 
111   __builtin_powi(f,f);        __builtin_powif(f,f);       __builtin_powil(f,f);
112 
113 // NO__ERRNO: declare double @llvm.powi.f64(double, i32) [[READNONE_INTRINSIC]]
114 // NO__ERRNO: declare float @llvm.powi.f32(float, i32) [[READNONE_INTRINSIC]]
115 // NO__ERRNO: declare x86_fp80 @llvm.powi.f80(x86_fp80, i32) [[READNONE_INTRINSIC]]
116 // HAS_ERRNO: declare double @llvm.powi.f64(double, i32) [[READNONE_INTRINSIC]]
117 // HAS_ERRNO: declare float @llvm.powi.f32(float, i32) [[READNONE_INTRINSIC]]
118 // HAS_ERRNO: declare x86_fp80 @llvm.powi.f80(x86_fp80, i32) [[READNONE_INTRINSIC]]
119 
120   /* math */
121   __builtin_acos(f);       __builtin_acosf(f);      __builtin_acosl(f);
122 
123 // NO__ERRNO: declare double @acos(double) [[READNONE]]
124 // NO__ERRNO: declare float @acosf(float) [[READNONE]]
125 // NO__ERRNO: declare x86_fp80 @acosl(x86_fp80) [[READNONE]]
126 // HAS_ERRNO: declare double @acos(double) [[NOT_READNONE]]
127 // HAS_ERRNO: declare float @acosf(float) [[NOT_READNONE]]
128 // HAS_ERRNO: declare x86_fp80 @acosl(x86_fp80) [[NOT_READNONE]]
129 
130   __builtin_acosh(f);      __builtin_acoshf(f);     __builtin_acoshl(f);
131 
132 // NO__ERRNO: declare double @acosh(double) [[READNONE]]
133 // NO__ERRNO: declare float @acoshf(float) [[READNONE]]
134 // NO__ERRNO: declare x86_fp80 @acoshl(x86_fp80) [[READNONE]]
135 // HAS_ERRNO: declare double @acosh(double) [[NOT_READNONE]]
136 // HAS_ERRNO: declare float @acoshf(float) [[NOT_READNONE]]
137 // HAS_ERRNO: declare x86_fp80 @acoshl(x86_fp80) [[NOT_READNONE]]
138 
139   __builtin_asin(f);       __builtin_asinf(f);      __builtin_asinl(f);
140 
141 // NO__ERRNO: declare double @asin(double) [[READNONE]]
142 // NO__ERRNO: declare float @asinf(float) [[READNONE]]
143 // NO__ERRNO: declare x86_fp80 @asinl(x86_fp80) [[READNONE]]
144 // HAS_ERRNO: declare double @asin(double) [[NOT_READNONE]]
145 // HAS_ERRNO: declare float @asinf(float) [[NOT_READNONE]]
146 // HAS_ERRNO: declare x86_fp80 @asinl(x86_fp80) [[NOT_READNONE]]
147 
148   __builtin_asinh(f);      __builtin_asinhf(f);     __builtin_asinhl(f);
149 
150 // NO__ERRNO: declare double @asinh(double) [[READNONE]]
151 // NO__ERRNO: declare float @asinhf(float) [[READNONE]]
152 // NO__ERRNO: declare x86_fp80 @asinhl(x86_fp80) [[READNONE]]
153 // HAS_ERRNO: declare double @asinh(double) [[NOT_READNONE]]
154 // HAS_ERRNO: declare float @asinhf(float) [[NOT_READNONE]]
155 // HAS_ERRNO: declare x86_fp80 @asinhl(x86_fp80) [[NOT_READNONE]]
156 
157   __builtin_atan(f);       __builtin_atanf(f);      __builtin_atanl(f);
158 
159 // NO__ERRNO: declare double @atan(double) [[READNONE]]
160 // NO__ERRNO: declare float @atanf(float) [[READNONE]]
161 // NO__ERRNO: declare x86_fp80 @atanl(x86_fp80) [[READNONE]]
162 // HAS_ERRNO: declare double @atan(double) [[NOT_READNONE]]
163 // HAS_ERRNO: declare float @atanf(float) [[NOT_READNONE]]
164 // HAS_ERRNO: declare x86_fp80 @atanl(x86_fp80) [[NOT_READNONE]]
165 
166   __builtin_atanh(f);      __builtin_atanhf(f);     __builtin_atanhl(f);
167 
168 // NO__ERRNO: declare double @atanh(double) [[READNONE]]
169 // NO__ERRNO: declare float @atanhf(float) [[READNONE]]
170 // NO__ERRNO: declare x86_fp80 @atanhl(x86_fp80) [[READNONE]]
171 // HAS_ERRNO: declare double @atanh(double) [[NOT_READNONE]]
172 // HAS_ERRNO: declare float @atanhf(float) [[NOT_READNONE]]
173 // HAS_ERRNO: declare x86_fp80 @atanhl(x86_fp80) [[NOT_READNONE]]
174 
175   __builtin_cbrt(f);       __builtin_cbrtf(f);      __builtin_cbrtl(f);
176 
177 // NO__ERRNO: declare double @cbrt(double) [[READNONE]]
178 // NO__ERRNO: declare float @cbrtf(float) [[READNONE]]
179 // NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
180 // HAS_ERRNO: declare double @cbrt(double) [[READNONE]]
181 // HAS_ERRNO: declare float @cbrtf(float) [[READNONE]]
182 // HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
183 
184   __builtin_ceil(f);       __builtin_ceilf(f);      __builtin_ceill(f);
185 
186 // NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
187 // NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
188 // NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
189 // HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
190 // HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
191 // HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
192 
193   __builtin_cos(f);        __builtin_cosf(f);       __builtin_cosl(f);
194 
195 // NO__ERRNO: declare double @cos(double) [[READNONE]]
196 // NO__ERRNO: declare float @cosf(float) [[READNONE]]
197 // NO__ERRNO: declare x86_fp80 @cosl(x86_fp80) [[READNONE]]
198 // HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]]
199 // HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]]
200 // HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]]
201 
202   __builtin_cosh(f);       __builtin_coshf(f);      __builtin_coshl(f);
203 
204 // NO__ERRNO: declare double @cosh(double) [[READNONE]]
205 // NO__ERRNO: declare float @coshf(float) [[READNONE]]
206 // NO__ERRNO: declare x86_fp80 @coshl(x86_fp80) [[READNONE]]
207 // HAS_ERRNO: declare double @cosh(double) [[NOT_READNONE]]
208 // HAS_ERRNO: declare float @coshf(float) [[NOT_READNONE]]
209 // HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80) [[NOT_READNONE]]
210 
211   __builtin_erf(f);        __builtin_erff(f);       __builtin_erfl(f);
212 
213 // NO__ERRNO: declare double @erf(double) [[READNONE]]
214 // NO__ERRNO: declare float @erff(float) [[READNONE]]
215 // NO__ERRNO: declare x86_fp80 @erfl(x86_fp80) [[READNONE]]
216 // HAS_ERRNO: declare double @erf(double) [[NOT_READNONE]]
217 // HAS_ERRNO: declare float @erff(float) [[NOT_READNONE]]
218 // HAS_ERRNO: declare x86_fp80 @erfl(x86_fp80) [[NOT_READNONE]]
219 
220   __builtin_erfc(f);       __builtin_erfcf(f);      __builtin_erfcl(f);
221 
222 // NO__ERRNO: declare double @erfc(double) [[READNONE]]
223 // NO__ERRNO: declare float @erfcf(float) [[READNONE]]
224 // NO__ERRNO: declare x86_fp80 @erfcl(x86_fp80) [[READNONE]]
225 // HAS_ERRNO: declare double @erfc(double) [[NOT_READNONE]]
226 // HAS_ERRNO: declare float @erfcf(float) [[NOT_READNONE]]
227 // HAS_ERRNO: declare x86_fp80 @erfcl(x86_fp80) [[NOT_READNONE]]
228 
229   __builtin_exp(f);        __builtin_expf(f);       __builtin_expl(f);
230 
231 // NO__ERRNO: declare double @exp(double) [[READNONE]]
232 // NO__ERRNO: declare float @expf(float) [[READNONE]]
233 // NO__ERRNO: declare x86_fp80 @expl(x86_fp80) [[READNONE]]
234 // HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]]
235 // HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]]
236 // HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]]
237 
238   __builtin_exp2(f);       __builtin_exp2f(f);      __builtin_exp2l(f);
239 
240 // NO__ERRNO: declare double @exp2(double) [[READNONE]]
241 // NO__ERRNO: declare float @exp2f(float) [[READNONE]]
242 // NO__ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[READNONE]]
243 // HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]]
244 // HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]]
245 // HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]]
246 
247   __builtin_expm1(f);      __builtin_expm1f(f);     __builtin_expm1l(f);
248 
249 // NO__ERRNO: declare double @expm1(double) [[READNONE]]
250 // NO__ERRNO: declare float @expm1f(float) [[READNONE]]
251 // NO__ERRNO: declare x86_fp80 @expm1l(x86_fp80) [[READNONE]]
252 // HAS_ERRNO: declare double @expm1(double) [[NOT_READNONE]]
253 // HAS_ERRNO: declare float @expm1f(float) [[NOT_READNONE]]
254 // HAS_ERRNO: declare x86_fp80 @expm1l(x86_fp80) [[NOT_READNONE]]
255 
256   __builtin_fdim(f,f);       __builtin_fdimf(f,f);      __builtin_fdiml(f,f);
257 
258 // NO__ERRNO: declare double @fdim(double, double) [[READNONE]]
259 // NO__ERRNO: declare float @fdimf(float, float) [[READNONE]]
260 // NO__ERRNO: declare x86_fp80 @fdiml(x86_fp80, x86_fp80) [[READNONE]]
261 // HAS_ERRNO: declare double @fdim(double, double) [[NOT_READNONE]]
262 // HAS_ERRNO: declare float @fdimf(float, float) [[NOT_READNONE]]
263 // HAS_ERRNO: declare x86_fp80 @fdiml(x86_fp80, x86_fp80) [[NOT_READNONE]]
264 
265   __builtin_floor(f);      __builtin_floorf(f);     __builtin_floorl(f);
266 
267 // NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
268 // NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
269 // NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
270 // HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
271 // HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
272 // HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
273 
274   __builtin_fma(f,f,f);        __builtin_fmaf(f,f,f);       __builtin_fmal(f,f,f);
275 
276 // NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]]
277 // NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
278 // NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
279 // HAS_ERRNO: declare double @fma(double, double, double) [[NOT_READNONE]]
280 // HAS_ERRNO: declare float @fmaf(float, float, float) [[NOT_READNONE]]
281 // HAS_ERRNO: declare x86_fp80 @fmal(x86_fp80, x86_fp80, x86_fp80) [[NOT_READNONE]]
282 
283 // On GNU or Win, fma never sets errno, so we can convert to the intrinsic.
284 
285 // HAS_ERRNO_GNU: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
286 // HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
287 // HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
288 
289 // HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
290 // HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
291 // Long double is just double on win, so no f80 use/declaration.
292 // HAS_ERRNO_WIN-NOT: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80)
293 
294   __builtin_fmax(f,f);       __builtin_fmaxf(f,f);      __builtin_fmaxl(f,f);
295 
296 // NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
297 // NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
298 // NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
299 // HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
300 // HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
301 // HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
302 
303   __builtin_fmin(f,f);       __builtin_fminf(f,f);      __builtin_fminl(f,f);
304 
305 // NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
306 // NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
307 // NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
308 // HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
309 // HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
310 // HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
311 
312   __builtin_hypot(f,f);      __builtin_hypotf(f,f);     __builtin_hypotl(f,f);
313 
314 // NO__ERRNO: declare double @hypot(double, double) [[READNONE]]
315 // NO__ERRNO: declare float @hypotf(float, float) [[READNONE]]
316 // NO__ERRNO: declare x86_fp80 @hypotl(x86_fp80, x86_fp80) [[READNONE]]
317 // HAS_ERRNO: declare double @hypot(double, double) [[NOT_READNONE]]
318 // HAS_ERRNO: declare float @hypotf(float, float) [[NOT_READNONE]]
319 // HAS_ERRNO: declare x86_fp80 @hypotl(x86_fp80, x86_fp80) [[NOT_READNONE]]
320 
321   __builtin_ilogb(f);      __builtin_ilogbf(f);     __builtin_ilogbl(f);
322 
323 // NO__ERRNO: declare i32 @ilogb(double) [[READNONE]]
324 // NO__ERRNO: declare i32 @ilogbf(float) [[READNONE]]
325 // NO__ERRNO: declare i32 @ilogbl(x86_fp80) [[READNONE]]
326 // HAS_ERRNO: declare i32 @ilogb(double) [[NOT_READNONE]]
327 // HAS_ERRNO: declare i32 @ilogbf(float) [[NOT_READNONE]]
328 // HAS_ERRNO: declare i32 @ilogbl(x86_fp80) [[NOT_READNONE]]
329 
330   __builtin_lgamma(f);     __builtin_lgammaf(f);    __builtin_lgammal(f);
331 
332 // NO__ERRNO: declare double @lgamma(double) [[NOT_READNONE]]
333 // NO__ERRNO: declare float @lgammaf(float) [[NOT_READNONE]]
334 // NO__ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NOT_READNONE]]
335 // HAS_ERRNO: declare double @lgamma(double) [[NOT_READNONE]]
336 // HAS_ERRNO: declare float @lgammaf(float) [[NOT_READNONE]]
337 // HAS_ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NOT_READNONE]]
338 
339   __builtin_llrint(f);     __builtin_llrintf(f);    __builtin_llrintl(f);
340 
341 // NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
342 // NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
343 // NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
344 // HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
345 // HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
346 // HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
347 
348   __builtin_llround(f);    __builtin_llroundf(f);   __builtin_llroundl(f);
349 
350 // NO__ERRNO: declare i64 @llround(double) [[READNONE]]
351 // NO__ERRNO: declare i64 @llroundf(float) [[READNONE]]
352 // NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]]
353 // HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]]
354 // HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]]
355 // HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]]
356 
357   __builtin_log(f);        __builtin_logf(f);       __builtin_logl(f);
358 
359 // NO__ERRNO: declare double @log(double) [[READNONE]]
360 // NO__ERRNO: declare float @logf(float) [[READNONE]]
361 // NO__ERRNO: declare x86_fp80 @logl(x86_fp80) [[READNONE]]
362 // HAS_ERRNO: declare double @log(double) [[NOT_READNONE]]
363 // HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]]
364 // HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]]
365 
366   __builtin_log10(f);      __builtin_log10f(f);     __builtin_log10l(f);
367 
368 // NO__ERRNO: declare double @log10(double) [[READNONE]]
369 // NO__ERRNO: declare float @log10f(float) [[READNONE]]
370 // NO__ERRNO: declare x86_fp80 @log10l(x86_fp80) [[READNONE]]
371 // HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]]
372 // HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]]
373 // HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]]
374 
375   __builtin_log1p(f);      __builtin_log1pf(f);     __builtin_log1pl(f);
376 
377 // NO__ERRNO: declare double @log1p(double) [[READNONE]]
378 // NO__ERRNO: declare float @log1pf(float) [[READNONE]]
379 // NO__ERRNO: declare x86_fp80 @log1pl(x86_fp80) [[READNONE]]
380 // HAS_ERRNO: declare double @log1p(double) [[NOT_READNONE]]
381 // HAS_ERRNO: declare float @log1pf(float) [[NOT_READNONE]]
382 // HAS_ERRNO: declare x86_fp80 @log1pl(x86_fp80) [[NOT_READNONE]]
383 
384   __builtin_log2(f);       __builtin_log2f(f);      __builtin_log2l(f);
385 
386 // NO__ERRNO: declare double @log2(double) [[READNONE]]
387 // NO__ERRNO: declare float @log2f(float) [[READNONE]]
388 // NO__ERRNO: declare x86_fp80 @log2l(x86_fp80) [[READNONE]]
389 // HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]]
390 // HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]]
391 // HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]]
392 
393   __builtin_logb(f);       __builtin_logbf(f);      __builtin_logbl(f);
394 
395 // NO__ERRNO: declare double @logb(double) [[READNONE]]
396 // NO__ERRNO: declare float @logbf(float) [[READNONE]]
397 // NO__ERRNO: declare x86_fp80 @logbl(x86_fp80) [[READNONE]]
398 // HAS_ERRNO: declare double @logb(double) [[NOT_READNONE]]
399 // HAS_ERRNO: declare float @logbf(float) [[NOT_READNONE]]
400 // HAS_ERRNO: declare x86_fp80 @logbl(x86_fp80) [[NOT_READNONE]]
401 
402   __builtin_lrint(f);      __builtin_lrintf(f);     __builtin_lrintl(f);
403 
404 // NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
405 // NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
406 // NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
407 // HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
408 // HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
409 // HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]
410 
411   __builtin_lround(f);     __builtin_lroundf(f);    __builtin_lroundl(f);
412 
413 // NO__ERRNO: declare i64 @lround(double) [[READNONE]]
414 // NO__ERRNO: declare i64 @lroundf(float) [[READNONE]]
415 // NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]]
416 // HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]]
417 // HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]]
418 // HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]]
419 
420   __builtin_nearbyint(f);  __builtin_nearbyintf(f); __builtin_nearbyintl(f);
421 
422 // NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
423 // NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
424 // NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
425 // HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
426 // HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
427 // HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
428 
429   __builtin_nextafter(f,f);  __builtin_nextafterf(f,f); __builtin_nextafterl(f,f);
430 
431 // NO__ERRNO: declare double @nextafter(double, double) [[READNONE]]
432 // NO__ERRNO: declare float @nextafterf(float, float) [[READNONE]]
433 // NO__ERRNO: declare x86_fp80 @nextafterl(x86_fp80, x86_fp80) [[READNONE]]
434 // HAS_ERRNO: declare double @nextafter(double, double) [[NOT_READNONE]]
435 // HAS_ERRNO: declare float @nextafterf(float, float) [[NOT_READNONE]]
436 // HAS_ERRNO: declare x86_fp80 @nextafterl(x86_fp80, x86_fp80) [[NOT_READNONE]]
437 
438   __builtin_nexttoward(f,f); __builtin_nexttowardf(f,f);__builtin_nexttowardl(f,f);
439 
440 // NO__ERRNO: declare double @nexttoward(double, x86_fp80) [[READNONE]]
441 // NO__ERRNO: declare float @nexttowardf(float, x86_fp80) [[READNONE]]
442 // NO__ERRNO: declare x86_fp80 @nexttowardl(x86_fp80, x86_fp80) [[READNONE]]
443 // HAS_ERRNO: declare double @nexttoward(double, x86_fp80) [[NOT_READNONE]]
444 // HAS_ERRNO: declare float @nexttowardf(float, x86_fp80) [[NOT_READNONE]]
445 // HAS_ERRNO: declare x86_fp80 @nexttowardl(x86_fp80, x86_fp80) [[NOT_READNONE]]
446 
447   __builtin_remainder(f,f);  __builtin_remainderf(f,f); __builtin_remainderl(f,f);
448 
449 // NO__ERRNO: declare double @remainder(double, double) [[READNONE]]
450 // NO__ERRNO: declare float @remainderf(float, float) [[READNONE]]
451 // NO__ERRNO: declare x86_fp80 @remainderl(x86_fp80, x86_fp80) [[READNONE]]
452 // HAS_ERRNO: declare double @remainder(double, double) [[NOT_READNONE]]
453 // HAS_ERRNO: declare float @remainderf(float, float) [[NOT_READNONE]]
454 // HAS_ERRNO: declare x86_fp80 @remainderl(x86_fp80, x86_fp80) [[NOT_READNONE]]
455 
456   __builtin_remquo(f,f,i);  __builtin_remquof(f,f,i); __builtin_remquol(f,f,i);
457 
458 // NO__ERRNO: declare double @remquo(double, double, i32*) [[NOT_READNONE]]
459 // NO__ERRNO: declare float @remquof(float, float, i32*) [[NOT_READNONE]]
460 // NO__ERRNO: declare x86_fp80 @remquol(x86_fp80, x86_fp80, i32*) [[NOT_READNONE]]
461 // HAS_ERRNO: declare double @remquo(double, double, i32*) [[NOT_READNONE]]
462 // HAS_ERRNO: declare float @remquof(float, float, i32*) [[NOT_READNONE]]
463 // HAS_ERRNO: declare x86_fp80 @remquol(x86_fp80, x86_fp80, i32*) [[NOT_READNONE]]
464 
465   __builtin_rint(f);       __builtin_rintf(f);      __builtin_rintl(f);
466 
467 // NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
468 // NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
469 // NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
470 // HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
471 // HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
472 // HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
473 
474   __builtin_round(f);      __builtin_roundf(f);     __builtin_roundl(f);
475 
476 // NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
477 // NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
478 // NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
479 // HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
480 // HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
481 // HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
482 
483   __builtin_scalbln(f,f);    __builtin_scalblnf(f,f);   __builtin_scalblnl(f,f);
484 
485 // NO__ERRNO: declare double @scalbln(double, i64) [[READNONE]]
486 // NO__ERRNO: declare float @scalblnf(float, i64) [[READNONE]]
487 // NO__ERRNO: declare x86_fp80 @scalblnl(x86_fp80, i64) [[READNONE]]
488 // HAS_ERRNO: declare double @scalbln(double, i64) [[NOT_READNONE]]
489 // HAS_ERRNO: declare float @scalblnf(float, i64) [[NOT_READNONE]]
490 // HAS_ERRNO: declare x86_fp80 @scalblnl(x86_fp80, i64) [[NOT_READNONE]]
491 
492   __builtin_scalbn(f,f);     __builtin_scalbnf(f,f);    __builtin_scalbnl(f,f);
493 
494 // NO__ERRNO: declare double @scalbn(double, i32) [[READNONE]]
495 // NO__ERRNO: declare float @scalbnf(float, i32) [[READNONE]]
496 // NO__ERRNO: declare x86_fp80 @scalbnl(x86_fp80, i32) [[READNONE]]
497 // HAS_ERRNO: declare double @scalbn(double, i32) [[NOT_READNONE]]
498 // HAS_ERRNO: declare float @scalbnf(float, i32) [[NOT_READNONE]]
499 // HAS_ERRNO: declare x86_fp80 @scalbnl(x86_fp80, i32) [[NOT_READNONE]]
500 
501   __builtin_sin(f);        __builtin_sinf(f);       __builtin_sinl(f);
502 
503 // NO__ERRNO: declare double @sin(double) [[READNONE]]
504 // NO__ERRNO: declare float @sinf(float) [[READNONE]]
505 // NO__ERRNO: declare x86_fp80 @sinl(x86_fp80) [[READNONE]]
506 // HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]]
507 // HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]]
508 // HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]]
509 
510   __builtin_sinh(f);       __builtin_sinhf(f);      __builtin_sinhl(f);
511 
512 // NO__ERRNO: declare double @sinh(double) [[READNONE]]
513 // NO__ERRNO: declare float @sinhf(float) [[READNONE]]
514 // NO__ERRNO: declare x86_fp80 @sinhl(x86_fp80) [[READNONE]]
515 // HAS_ERRNO: declare double @sinh(double) [[NOT_READNONE]]
516 // HAS_ERRNO: declare float @sinhf(float) [[NOT_READNONE]]
517 // HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80) [[NOT_READNONE]]
518 
519   __builtin_sqrt(f);       __builtin_sqrtf(f);      __builtin_sqrtl(f);
520 
521 // NO__ERRNO: declare double @sqrt(double) [[READNONE]]
522 // NO__ERRNO: declare float @sqrtf(float) [[READNONE]]
523 // NO__ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[READNONE]]
524 // HAS_ERRNO: declare double @sqrt(double) [[NOT_READNONE]]
525 // HAS_ERRNO: declare float @sqrtf(float) [[NOT_READNONE]]
526 // HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[NOT_READNONE]]
527 
528   __builtin_tan(f);        __builtin_tanf(f);       __builtin_tanl(f);
529 
530 // NO__ERRNO: declare double @tan(double) [[READNONE]]
531 // NO__ERRNO: declare float @tanf(float) [[READNONE]]
532 // NO__ERRNO: declare x86_fp80 @tanl(x86_fp80) [[READNONE]]
533 // HAS_ERRNO: declare double @tan(double) [[NOT_READNONE]]
534 // HAS_ERRNO: declare float @tanf(float) [[NOT_READNONE]]
535 // HAS_ERRNO: declare x86_fp80 @tanl(x86_fp80) [[NOT_READNONE]]
536 
537   __builtin_tanh(f);       __builtin_tanhf(f);      __builtin_tanhl(f);
538 
539 // NO__ERRNO: declare double @tanh(double) [[READNONE]]
540 // NO__ERRNO: declare float @tanhf(float) [[READNONE]]
541 // NO__ERRNO: declare x86_fp80 @tanhl(x86_fp80) [[READNONE]]
542 // HAS_ERRNO: declare double @tanh(double) [[NOT_READNONE]]
543 // HAS_ERRNO: declare float @tanhf(float) [[NOT_READNONE]]
544 // HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80) [[NOT_READNONE]]
545 
546   __builtin_tgamma(f);     __builtin_tgammaf(f);    __builtin_tgammal(f);
547 
548 // NO__ERRNO: declare double @tgamma(double) [[READNONE]]
549 // NO__ERRNO: declare float @tgammaf(float) [[READNONE]]
550 // NO__ERRNO: declare x86_fp80 @tgammal(x86_fp80) [[READNONE]]
551 // HAS_ERRNO: declare double @tgamma(double) [[NOT_READNONE]]
552 // HAS_ERRNO: declare float @tgammaf(float) [[NOT_READNONE]]
553 // HAS_ERRNO: declare x86_fp80 @tgammal(x86_fp80) [[NOT_READNONE]]
554 
555   __builtin_trunc(f);      __builtin_truncf(f);     __builtin_truncl(f);
556 
557 // NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
558 // NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
559 // NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
560 // HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
561 // HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
562 // HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
563 };
564 
565 
566 // NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
567 // NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
568 // NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
569 
570 // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
571 // HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
572 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
573 
574 // HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
575 // HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
576 
577