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