blob: cb9b5974584aa077f96dbe1d21e80b59b830ca1c [file] [log] [blame]
Sanjay Patel241b8f82017-11-02 17:06:05 +00001// 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
Sanjay Patel040fbe32017-11-07 15:13:22 +00004// Test attributes and codegen of math builtins.
Sanjay Patel241b8f82017-11-02 17:06:05 +00005
Sanjay Patel040fbe32017-11-07 15:13:22 +00006void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
Sanjay Patel241b8f82017-11-02 17:06:05 +00007 __builtin_atan2(f,f); __builtin_atan2f(f,f) ; __builtin_atan2l(f, f);
8
9// NO__ERRNO: declare double @atan2(double, double) [[READNONE:#[0-9]+]]
10// NO__ERRNO: declare float @atan2f(float, float) [[READNONE]]
11// NO__ERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +000012// HAS_ERRNO: declare double @atan2(double, double) [[NOT_READNONE:#[0-9]+]]
13// HAS_ERRNO: declare float @atan2f(float, float) [[NOT_READNONE]]
14// HAS_ERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +000015
16 __builtin_copysign(f,f); __builtin_copysignf(f,f);__builtin_copysignl(f,f);
17
18// NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
19// NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
20// NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
21// HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
22// HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
23// HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
24
25 __builtin_fabs(f); __builtin_fabsf(f); __builtin_fabsl(f);
26
27// NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
28// NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
29// NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
30// HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
31// HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
32// HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
33
34 __builtin_fmod(f,f); __builtin_fmodf(f,f); __builtin_fmodl(f,f);
35
36// NO__ERRNO-NOT: .fmod
37// NO__ERRNO-NOT: @fmod
38// HAS_ERRNO-NOT: .fmod
39// HAS_ERRNO-NOT: @fmod
40
41 __builtin_frexp(f,i); __builtin_frexpf(f,i); __builtin_frexpl(f,i);
42
43// NO__ERRNO: declare double @frexp(double, i32*) [[NOT_READNONE:#[0-9]+]]
44// NO__ERRNO: declare float @frexpf(float, i32*) [[NOT_READNONE]]
45// NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80, i32*) [[NOT_READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +000046// HAS_ERRNO: declare double @frexp(double, i32*) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +000047// HAS_ERRNO: declare float @frexpf(float, i32*) [[NOT_READNONE]]
48// HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80, i32*) [[NOT_READNONE]]
49
50 __builtin_huge_val(); __builtin_huge_valf(); __builtin_huge_vall();
51
52// NO__ERRNO-NOT: .huge
53// NO__ERRNO-NOT: @huge
54// HAS_ERRNO-NOT: .huge
55// HAS_ERRNO-NOT: @huge
56
57 __builtin_inf(); __builtin_inff(); __builtin_infl();
58
59// NO__ERRNO-NOT: .inf
60// NO__ERRNO-NOT: @inf
61// HAS_ERRNO-NOT: .inf
62// HAS_ERRNO-NOT: @inf
63
64 __builtin_ldexp(f,f); __builtin_ldexpf(f,f); __builtin_ldexpl(f,f);
65
66// NO__ERRNO: declare double @ldexp(double, i32) [[READNONE]]
67// NO__ERRNO: declare float @ldexpf(float, i32) [[READNONE]]
68// NO__ERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +000069// HAS_ERRNO: declare double @ldexp(double, i32) [[NOT_READNONE]]
70// HAS_ERRNO: declare float @ldexpf(float, i32) [[NOT_READNONE]]
71// HAS_ERRNO: declare x86_fp80 @ldexpl(x86_fp80, i32) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +000072
73 __builtin_modf(f,d); __builtin_modff(f,fp); __builtin_modfl(f,l);
74
75// NO__ERRNO: declare double @modf(double, double*) [[NOT_READNONE]]
76// NO__ERRNO: declare float @modff(float, float*) [[NOT_READNONE]]
77// NO__ERRNO: declare x86_fp80 @modfl(x86_fp80, x86_fp80*) [[NOT_READNONE]]
78// HAS_ERRNO: declare double @modf(double, double*) [[NOT_READNONE]]
79// HAS_ERRNO: declare float @modff(float, float*) [[NOT_READNONE]]
80// HAS_ERRNO: declare x86_fp80 @modfl(x86_fp80, x86_fp80*) [[NOT_READNONE]]
81
82 __builtin_nan(c); __builtin_nanf(c); __builtin_nanl(c);
83
84// NO__ERRNO: declare double @nan(i8*) [[READNONE]]
85// NO__ERRNO: declare float @nanf(i8*) [[READNONE]]
86// NO__ERRNO: declare x86_fp80 @nanl(i8*) [[READNONE]]
87// HAS_ERRNO: declare double @nan(i8*) [[READNONE:#[0-9]+]]
88// HAS_ERRNO: declare float @nanf(i8*) [[READNONE]]
89// HAS_ERRNO: declare x86_fp80 @nanl(i8*) [[READNONE]]
90
91 __builtin_nans(c); __builtin_nansf(c); __builtin_nansl(c);
92
93// NO__ERRNO: declare double @nans(i8*) [[READNONE]]
94// NO__ERRNO: declare float @nansf(i8*) [[READNONE]]
95// NO__ERRNO: declare x86_fp80 @nansl(i8*) [[READNONE]]
96// HAS_ERRNO: declare double @nans(i8*) [[READNONE]]
97// HAS_ERRNO: declare float @nansf(i8*) [[READNONE]]
98// HAS_ERRNO: declare x86_fp80 @nansl(i8*) [[READNONE]]
99
100 __builtin_pow(f,f); __builtin_powf(f,f); __builtin_powl(f,f);
101
102// NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]]
103// NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]]
104// NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000105// HAS_ERRNO: declare double @pow(double, double) [[NOT_READNONE]]
106// HAS_ERRNO: declare float @powf(float, float) [[NOT_READNONE]]
107// HAS_ERRNO: declare x86_fp80 @powl(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000108
109 __builtin_powi(f,f); __builtin_powif(f,f); __builtin_powil(f,f);
110
111// NO__ERRNO: declare double @llvm.powi.f64(double, i32) [[READNONE_INTRINSIC]]
112// NO__ERRNO: declare float @llvm.powi.f32(float, i32) [[READNONE_INTRINSIC]]
113// NO__ERRNO: declare x86_fp80 @llvm.powi.f80(x86_fp80, i32) [[READNONE_INTRINSIC]]
114// HAS_ERRNO: declare double @llvm.powi.f64(double, i32) [[READNONE_INTRINSIC]]
115// HAS_ERRNO: declare float @llvm.powi.f32(float, i32) [[READNONE_INTRINSIC]]
116// HAS_ERRNO: declare x86_fp80 @llvm.powi.f80(x86_fp80, i32) [[READNONE_INTRINSIC]]
117
118 /* math */
119 __builtin_acos(f); __builtin_acosf(f); __builtin_acosl(f);
120
121// NO__ERRNO: declare double @acos(double) [[READNONE]]
122// NO__ERRNO: declare float @acosf(float) [[READNONE]]
123// NO__ERRNO: declare x86_fp80 @acosl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000124// HAS_ERRNO: declare double @acos(double) [[NOT_READNONE]]
125// HAS_ERRNO: declare float @acosf(float) [[NOT_READNONE]]
126// HAS_ERRNO: declare x86_fp80 @acosl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000127
128 __builtin_acosh(f); __builtin_acoshf(f); __builtin_acoshl(f);
129
130// NO__ERRNO: declare double @acosh(double) [[READNONE]]
131// NO__ERRNO: declare float @acoshf(float) [[READNONE]]
132// NO__ERRNO: declare x86_fp80 @acoshl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000133// HAS_ERRNO: declare double @acosh(double) [[NOT_READNONE]]
134// HAS_ERRNO: declare float @acoshf(float) [[NOT_READNONE]]
135// HAS_ERRNO: declare x86_fp80 @acoshl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000136
137 __builtin_asin(f); __builtin_asinf(f); __builtin_asinl(f);
138
139// NO__ERRNO: declare double @asin(double) [[READNONE]]
140// NO__ERRNO: declare float @asinf(float) [[READNONE]]
141// NO__ERRNO: declare x86_fp80 @asinl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000142// HAS_ERRNO: declare double @asin(double) [[NOT_READNONE]]
143// HAS_ERRNO: declare float @asinf(float) [[NOT_READNONE]]
144// HAS_ERRNO: declare x86_fp80 @asinl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000145
146 __builtin_asinh(f); __builtin_asinhf(f); __builtin_asinhl(f);
147
148// NO__ERRNO: declare double @asinh(double) [[READNONE]]
149// NO__ERRNO: declare float @asinhf(float) [[READNONE]]
150// NO__ERRNO: declare x86_fp80 @asinhl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000151// HAS_ERRNO: declare double @asinh(double) [[NOT_READNONE]]
152// HAS_ERRNO: declare float @asinhf(float) [[NOT_READNONE]]
153// HAS_ERRNO: declare x86_fp80 @asinhl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000154
155 __builtin_atan(f); __builtin_atanf(f); __builtin_atanl(f);
156
157// NO__ERRNO: declare double @atan(double) [[READNONE]]
158// NO__ERRNO: declare float @atanf(float) [[READNONE]]
159// NO__ERRNO: declare x86_fp80 @atanl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000160// HAS_ERRNO: declare double @atan(double) [[NOT_READNONE]]
161// HAS_ERRNO: declare float @atanf(float) [[NOT_READNONE]]
162// HAS_ERRNO: declare x86_fp80 @atanl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000163
164 __builtin_atanh(f); __builtin_atanhf(f); __builtin_atanhl(f);
165
166// NO__ERRNO: declare double @atanh(double) [[READNONE]]
167// NO__ERRNO: declare float @atanhf(float) [[READNONE]]
168// NO__ERRNO: declare x86_fp80 @atanhl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000169// HAS_ERRNO: declare double @atanh(double) [[NOT_READNONE]]
170// HAS_ERRNO: declare float @atanhf(float) [[NOT_READNONE]]
171// HAS_ERRNO: declare x86_fp80 @atanhl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000172
173 __builtin_cbrt(f); __builtin_cbrtf(f); __builtin_cbrtl(f);
174
175// NO__ERRNO: declare double @cbrt(double) [[READNONE]]
176// NO__ERRNO: declare float @cbrtf(float) [[READNONE]]
177// NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000178// HAS_ERRNO: declare double @cbrt(double) [[NOT_READNONE]]
179// HAS_ERRNO: declare float @cbrtf(float) [[NOT_READNONE]]
180// HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000181
182 __builtin_ceil(f); __builtin_ceilf(f); __builtin_ceill(f);
183
184// NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
185// NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
186// NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
187// HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
188// HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
189// HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
190
191 __builtin_cos(f); __builtin_cosf(f); __builtin_cosl(f);
192
193// NO__ERRNO: declare double @cos(double) [[READNONE]]
194// NO__ERRNO: declare float @cosf(float) [[READNONE]]
195// NO__ERRNO: declare x86_fp80 @cosl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000196// HAS_ERRNO: declare double @cos(double) [[NOT_READNONE]]
197// HAS_ERRNO: declare float @cosf(float) [[NOT_READNONE]]
198// HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000199
200 __builtin_cosh(f); __builtin_coshf(f); __builtin_coshl(f);
201
202// NO__ERRNO: declare double @cosh(double) [[READNONE]]
203// NO__ERRNO: declare float @coshf(float) [[READNONE]]
204// NO__ERRNO: declare x86_fp80 @coshl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000205// HAS_ERRNO: declare double @cosh(double) [[NOT_READNONE]]
206// HAS_ERRNO: declare float @coshf(float) [[NOT_READNONE]]
207// HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000208
209 __builtin_erf(f); __builtin_erff(f); __builtin_erfl(f);
210
211// NO__ERRNO: declare double @erf(double) [[READNONE]]
212// NO__ERRNO: declare float @erff(float) [[READNONE]]
213// NO__ERRNO: declare x86_fp80 @erfl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000214// HAS_ERRNO: declare double @erf(double) [[NOT_READNONE]]
215// HAS_ERRNO: declare float @erff(float) [[NOT_READNONE]]
216// HAS_ERRNO: declare x86_fp80 @erfl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000217
218 __builtin_erfc(f); __builtin_erfcf(f); __builtin_erfcl(f);
219
220// NO__ERRNO: declare double @erfc(double) [[READNONE]]
221// NO__ERRNO: declare float @erfcf(float) [[READNONE]]
222// NO__ERRNO: declare x86_fp80 @erfcl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000223// HAS_ERRNO: declare double @erfc(double) [[NOT_READNONE]]
224// HAS_ERRNO: declare float @erfcf(float) [[NOT_READNONE]]
225// HAS_ERRNO: declare x86_fp80 @erfcl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000226
227 __builtin_exp(f); __builtin_expf(f); __builtin_expl(f);
228
229// NO__ERRNO: declare double @exp(double) [[READNONE]]
230// NO__ERRNO: declare float @expf(float) [[READNONE]]
231// NO__ERRNO: declare x86_fp80 @expl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000232// HAS_ERRNO: declare double @exp(double) [[NOT_READNONE]]
233// HAS_ERRNO: declare float @expf(float) [[NOT_READNONE]]
234// HAS_ERRNO: declare x86_fp80 @expl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000235
236 __builtin_exp2(f); __builtin_exp2f(f); __builtin_exp2l(f);
237
238// NO__ERRNO: declare double @exp2(double) [[READNONE]]
239// NO__ERRNO: declare float @exp2f(float) [[READNONE]]
240// NO__ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000241// HAS_ERRNO: declare double @exp2(double) [[NOT_READNONE]]
242// HAS_ERRNO: declare float @exp2f(float) [[NOT_READNONE]]
243// HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000244
245 __builtin_expm1(f); __builtin_expm1f(f); __builtin_expm1l(f);
246
247// NO__ERRNO: declare double @expm1(double) [[READNONE]]
248// NO__ERRNO: declare float @expm1f(float) [[READNONE]]
249// NO__ERRNO: declare x86_fp80 @expm1l(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000250// HAS_ERRNO: declare double @expm1(double) [[NOT_READNONE]]
251// HAS_ERRNO: declare float @expm1f(float) [[NOT_READNONE]]
252// HAS_ERRNO: declare x86_fp80 @expm1l(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000253
254 __builtin_fdim(f,f); __builtin_fdimf(f,f); __builtin_fdiml(f,f);
255
256// NO__ERRNO: declare double @fdim(double, double) [[READNONE]]
257// NO__ERRNO: declare float @fdimf(float, float) [[READNONE]]
258// NO__ERRNO: declare x86_fp80 @fdiml(x86_fp80, x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000259// HAS_ERRNO: declare double @fdim(double, double) [[NOT_READNONE]]
260// HAS_ERRNO: declare float @fdimf(float, float) [[NOT_READNONE]]
261// HAS_ERRNO: declare x86_fp80 @fdiml(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000262
263 __builtin_floor(f); __builtin_floorf(f); __builtin_floorl(f);
264
265// NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
266// NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
267// NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
268// HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
269// HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
270// HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
271
272 __builtin_fma(f,f,f); __builtin_fmaf(f,f,f); __builtin_fmal(f,f,f);
273
274// NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]]
275// NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
276// NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
277// HAS_ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]]
278// HAS_ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
279// HAS_ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
280
281 __builtin_fmax(f,f); __builtin_fmaxf(f,f); __builtin_fmaxl(f,f);
282
283// NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
284// NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
285// NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
286// HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
287// HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
288// HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
289
290 __builtin_fmin(f,f); __builtin_fminf(f,f); __builtin_fminl(f,f);
291
292// NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
293// NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
294// NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
295// HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
296// HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
297// HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
298
299 __builtin_hypot(f,f); __builtin_hypotf(f,f); __builtin_hypotl(f,f);
300
301// NO__ERRNO: declare double @hypot(double, double) [[READNONE]]
302// NO__ERRNO: declare float @hypotf(float, float) [[READNONE]]
303// NO__ERRNO: declare x86_fp80 @hypotl(x86_fp80, x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000304// HAS_ERRNO: declare double @hypot(double, double) [[NOT_READNONE]]
305// HAS_ERRNO: declare float @hypotf(float, float) [[NOT_READNONE]]
306// HAS_ERRNO: declare x86_fp80 @hypotl(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000307
308 __builtin_ilogb(f); __builtin_ilogbf(f); __builtin_ilogbl(f);
309
310// NO__ERRNO: declare i32 @ilogb(double) [[READNONE]]
311// NO__ERRNO: declare i32 @ilogbf(float) [[READNONE]]
312// NO__ERRNO: declare i32 @ilogbl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000313// HAS_ERRNO: declare i32 @ilogb(double) [[NOT_READNONE]]
314// HAS_ERRNO: declare i32 @ilogbf(float) [[NOT_READNONE]]
315// HAS_ERRNO: declare i32 @ilogbl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000316
317 __builtin_lgamma(f); __builtin_lgammaf(f); __builtin_lgammal(f);
318
Sanjay Patelc5c82072017-11-02 20:39:26 +0000319// NO__ERRNO: declare double @lgamma(double) [[NOT_READNONE]]
320// NO__ERRNO: declare float @lgammaf(float) [[NOT_READNONE]]
321// NO__ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NOT_READNONE]]
322// HAS_ERRNO: declare double @lgamma(double) [[NOT_READNONE]]
323// HAS_ERRNO: declare float @lgammaf(float) [[NOT_READNONE]]
324// HAS_ERRNO: declare x86_fp80 @lgammal(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000325
326 __builtin_llrint(f); __builtin_llrintf(f); __builtin_llrintl(f);
327
328// NO__ERRNO: declare i64 @llrint(double) [[READNONE]]
329// NO__ERRNO: declare i64 @llrintf(float) [[READNONE]]
330// NO__ERRNO: declare i64 @llrintl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000331// HAS_ERRNO: declare i64 @llrint(double) [[NOT_READNONE]]
332// HAS_ERRNO: declare i64 @llrintf(float) [[NOT_READNONE]]
333// HAS_ERRNO: declare i64 @llrintl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000334
335 __builtin_llround(f); __builtin_llroundf(f); __builtin_llroundl(f);
336
337// NO__ERRNO: declare i64 @llround(double) [[READNONE]]
338// NO__ERRNO: declare i64 @llroundf(float) [[READNONE]]
339// NO__ERRNO: declare i64 @llroundl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000340// HAS_ERRNO: declare i64 @llround(double) [[NOT_READNONE]]
341// HAS_ERRNO: declare i64 @llroundf(float) [[NOT_READNONE]]
342// HAS_ERRNO: declare i64 @llroundl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000343
344 __builtin_log(f); __builtin_logf(f); __builtin_logl(f);
345
346// NO__ERRNO: declare double @log(double) [[READNONE]]
347// NO__ERRNO: declare float @logf(float) [[READNONE]]
348// NO__ERRNO: declare x86_fp80 @logl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000349// HAS_ERRNO: declare double @log(double) [[NOT_READNONE]]
350// HAS_ERRNO: declare float @logf(float) [[NOT_READNONE]]
351// HAS_ERRNO: declare x86_fp80 @logl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000352
353 __builtin_log10(f); __builtin_log10f(f); __builtin_log10l(f);
354
355// NO__ERRNO: declare double @log10(double) [[READNONE]]
356// NO__ERRNO: declare float @log10f(float) [[READNONE]]
357// NO__ERRNO: declare x86_fp80 @log10l(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000358// HAS_ERRNO: declare double @log10(double) [[NOT_READNONE]]
359// HAS_ERRNO: declare float @log10f(float) [[NOT_READNONE]]
360// HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000361
362 __builtin_log1p(f); __builtin_log1pf(f); __builtin_log1pl(f);
363
364// NO__ERRNO: declare double @log1p(double) [[READNONE]]
365// NO__ERRNO: declare float @log1pf(float) [[READNONE]]
366// NO__ERRNO: declare x86_fp80 @log1pl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000367// HAS_ERRNO: declare double @log1p(double) [[NOT_READNONE]]
368// HAS_ERRNO: declare float @log1pf(float) [[NOT_READNONE]]
369// HAS_ERRNO: declare x86_fp80 @log1pl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000370
371 __builtin_log2(f); __builtin_log2f(f); __builtin_log2l(f);
372
373// NO__ERRNO: declare double @log2(double) [[READNONE]]
374// NO__ERRNO: declare float @log2f(float) [[READNONE]]
375// NO__ERRNO: declare x86_fp80 @log2l(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000376// HAS_ERRNO: declare double @log2(double) [[NOT_READNONE]]
377// HAS_ERRNO: declare float @log2f(float) [[NOT_READNONE]]
378// HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000379
380 __builtin_logb(f); __builtin_logbf(f); __builtin_logbl(f);
381
382// NO__ERRNO: declare double @logb(double) [[READNONE]]
383// NO__ERRNO: declare float @logbf(float) [[READNONE]]
384// NO__ERRNO: declare x86_fp80 @logbl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000385// HAS_ERRNO: declare double @logb(double) [[NOT_READNONE]]
386// HAS_ERRNO: declare float @logbf(float) [[NOT_READNONE]]
387// HAS_ERRNO: declare x86_fp80 @logbl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000388
389 __builtin_lrint(f); __builtin_lrintf(f); __builtin_lrintl(f);
390
391// NO__ERRNO: declare i64 @lrint(double) [[READNONE]]
392// NO__ERRNO: declare i64 @lrintf(float) [[READNONE]]
393// NO__ERRNO: declare i64 @lrintl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000394// HAS_ERRNO: declare i64 @lrint(double) [[NOT_READNONE]]
395// HAS_ERRNO: declare i64 @lrintf(float) [[NOT_READNONE]]
396// HAS_ERRNO: declare i64 @lrintl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000397
398 __builtin_lround(f); __builtin_lroundf(f); __builtin_lroundl(f);
399
400// NO__ERRNO: declare i64 @lround(double) [[READNONE]]
401// NO__ERRNO: declare i64 @lroundf(float) [[READNONE]]
402// NO__ERRNO: declare i64 @lroundl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000403// HAS_ERRNO: declare i64 @lround(double) [[NOT_READNONE]]
404// HAS_ERRNO: declare i64 @lroundf(float) [[NOT_READNONE]]
405// HAS_ERRNO: declare i64 @lroundl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000406
407 __builtin_nearbyint(f); __builtin_nearbyintf(f); __builtin_nearbyintl(f);
408
409// NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
410// NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
411// NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
412// HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
413// HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
414// HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
415
416 __builtin_nextafter(f,f); __builtin_nextafterf(f,f); __builtin_nextafterl(f,f);
417
418// NO__ERRNO: declare double @nextafter(double, double) [[READNONE]]
419// NO__ERRNO: declare float @nextafterf(float, float) [[READNONE]]
420// NO__ERRNO: declare x86_fp80 @nextafterl(x86_fp80, x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000421// HAS_ERRNO: declare double @nextafter(double, double) [[NOT_READNONE]]
422// HAS_ERRNO: declare float @nextafterf(float, float) [[NOT_READNONE]]
423// HAS_ERRNO: declare x86_fp80 @nextafterl(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000424
425 __builtin_nexttoward(f,f); __builtin_nexttowardf(f,f);__builtin_nexttowardl(f,f);
426
427// NO__ERRNO: declare double @nexttoward(double, x86_fp80) [[READNONE]]
428// NO__ERRNO: declare float @nexttowardf(float, x86_fp80) [[READNONE]]
429// NO__ERRNO: declare x86_fp80 @nexttowardl(x86_fp80, x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000430// HAS_ERRNO: declare double @nexttoward(double, x86_fp80) [[NOT_READNONE]]
431// HAS_ERRNO: declare float @nexttowardf(float, x86_fp80) [[NOT_READNONE]]
432// HAS_ERRNO: declare x86_fp80 @nexttowardl(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000433
434 __builtin_remainder(f,f); __builtin_remainderf(f,f); __builtin_remainderl(f,f);
435
436// NO__ERRNO: declare double @remainder(double, double) [[READNONE]]
437// NO__ERRNO: declare float @remainderf(float, float) [[READNONE]]
438// NO__ERRNO: declare x86_fp80 @remainderl(x86_fp80, x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000439// HAS_ERRNO: declare double @remainder(double, double) [[NOT_READNONE]]
440// HAS_ERRNO: declare float @remainderf(float, float) [[NOT_READNONE]]
441// HAS_ERRNO: declare x86_fp80 @remainderl(x86_fp80, x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000442
443 __builtin_remquo(f,f,i); __builtin_remquof(f,f,i); __builtin_remquol(f,f,i);
444
445// NO__ERRNO: declare double @remquo(double, double, i32*) [[NOT_READNONE]]
446// NO__ERRNO: declare float @remquof(float, float, i32*) [[NOT_READNONE]]
447// NO__ERRNO: declare x86_fp80 @remquol(x86_fp80, x86_fp80, i32*) [[NOT_READNONE]]
448// HAS_ERRNO: declare double @remquo(double, double, i32*) [[NOT_READNONE]]
449// HAS_ERRNO: declare float @remquof(float, float, i32*) [[NOT_READNONE]]
450// HAS_ERRNO: declare x86_fp80 @remquol(x86_fp80, x86_fp80, i32*) [[NOT_READNONE]]
451
452 __builtin_rint(f); __builtin_rintf(f); __builtin_rintl(f);
453
454// NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
455// NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
456// NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
457// HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
458// HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
459// HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
460
461 __builtin_round(f); __builtin_roundf(f); __builtin_roundl(f);
462
463// NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
464// NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
465// NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
466// HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
467// HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
468// HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
469
470 __builtin_scalbln(f,f); __builtin_scalblnf(f,f); __builtin_scalblnl(f,f);
471
472// NO__ERRNO: declare double @scalbln(double, i64) [[READNONE]]
473// NO__ERRNO: declare float @scalblnf(float, i64) [[READNONE]]
474// NO__ERRNO: declare x86_fp80 @scalblnl(x86_fp80, i64) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000475// HAS_ERRNO: declare double @scalbln(double, i64) [[NOT_READNONE]]
476// HAS_ERRNO: declare float @scalblnf(float, i64) [[NOT_READNONE]]
477// HAS_ERRNO: declare x86_fp80 @scalblnl(x86_fp80, i64) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000478
479 __builtin_scalbn(f,f); __builtin_scalbnf(f,f); __builtin_scalbnl(f,f);
480
481// NO__ERRNO: declare double @scalbn(double, i32) [[READNONE]]
482// NO__ERRNO: declare float @scalbnf(float, i32) [[READNONE]]
483// NO__ERRNO: declare x86_fp80 @scalbnl(x86_fp80, i32) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000484// HAS_ERRNO: declare double @scalbn(double, i32) [[NOT_READNONE]]
485// HAS_ERRNO: declare float @scalbnf(float, i32) [[NOT_READNONE]]
486// HAS_ERRNO: declare x86_fp80 @scalbnl(x86_fp80, i32) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000487
488 __builtin_sin(f); __builtin_sinf(f); __builtin_sinl(f);
489
490// NO__ERRNO: declare double @sin(double) [[READNONE]]
491// NO__ERRNO: declare float @sinf(float) [[READNONE]]
492// NO__ERRNO: declare x86_fp80 @sinl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000493// HAS_ERRNO: declare double @sin(double) [[NOT_READNONE]]
494// HAS_ERRNO: declare float @sinf(float) [[NOT_READNONE]]
495// HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000496
497 __builtin_sinh(f); __builtin_sinhf(f); __builtin_sinhl(f);
498
499// NO__ERRNO: declare double @sinh(double) [[READNONE]]
500// NO__ERRNO: declare float @sinhf(float) [[READNONE]]
501// NO__ERRNO: declare x86_fp80 @sinhl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000502// HAS_ERRNO: declare double @sinh(double) [[NOT_READNONE]]
503// HAS_ERRNO: declare float @sinhf(float) [[NOT_READNONE]]
504// HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000505
506 __builtin_sqrt(f); __builtin_sqrtf(f); __builtin_sqrtl(f);
507
508// NO__ERRNO: declare double @sqrt(double) [[READNONE]]
509// NO__ERRNO: declare float @sqrtf(float) [[READNONE]]
510// NO__ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000511// HAS_ERRNO: declare double @sqrt(double) [[NOT_READNONE]]
512// HAS_ERRNO: declare float @sqrtf(float) [[NOT_READNONE]]
513// HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000514
515 __builtin_tan(f); __builtin_tanf(f); __builtin_tanl(f);
516
517// NO__ERRNO: declare double @tan(double) [[READNONE]]
518// NO__ERRNO: declare float @tanf(float) [[READNONE]]
519// NO__ERRNO: declare x86_fp80 @tanl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000520// HAS_ERRNO: declare double @tan(double) [[NOT_READNONE]]
521// HAS_ERRNO: declare float @tanf(float) [[NOT_READNONE]]
522// HAS_ERRNO: declare x86_fp80 @tanl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000523
524 __builtin_tanh(f); __builtin_tanhf(f); __builtin_tanhl(f);
525
526// NO__ERRNO: declare double @tanh(double) [[READNONE]]
527// NO__ERRNO: declare float @tanhf(float) [[READNONE]]
528// NO__ERRNO: declare x86_fp80 @tanhl(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000529// HAS_ERRNO: declare double @tanh(double) [[NOT_READNONE]]
530// HAS_ERRNO: declare float @tanhf(float) [[NOT_READNONE]]
531// HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000532
533 __builtin_tgamma(f); __builtin_tgammaf(f); __builtin_tgammal(f);
534
535// NO__ERRNO: declare double @tgamma(double) [[READNONE]]
536// NO__ERRNO: declare float @tgammaf(float) [[READNONE]]
537// NO__ERRNO: declare x86_fp80 @tgammal(x86_fp80) [[READNONE]]
Sanjay Patelc5c82072017-11-02 20:39:26 +0000538// HAS_ERRNO: declare double @tgamma(double) [[NOT_READNONE]]
539// HAS_ERRNO: declare float @tgammaf(float) [[NOT_READNONE]]
540// HAS_ERRNO: declare x86_fp80 @tgammal(x86_fp80) [[NOT_READNONE]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000541
542 __builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f);
543
544// NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
545// NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
546// NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
547// HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
548// HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
549// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
Sanjay Patel241b8f82017-11-02 17:06:05 +0000550};
551
552
553// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
554// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
555// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
556
Sanjay Patel241b8f82017-11-02 17:06:05 +0000557// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
Sanjay Patelc5c82072017-11-02 20:39:26 +0000558// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}readnone{{.*}} }
559// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
Sanjay Patel241b8f82017-11-02 17:06:05 +0000560