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