blob: db56628835fdf332c9f92e142894a5fac9b23f37 [file] [log] [blame]
Sanjay Patel040fbe32017-11-07 15:13:22 +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
4// Test attributes and builtin codegen of complex library calls.
5
6void foo(float f) {
7 cabs(f); cabsf(f); cabsl(f);
8
9// NO__ERRNO: declare double @cabs(double, double) [[READNONE:#[0-9]+]]
10// NO__ERRNO: declare float @cabsf(<2 x float>) [[READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000011// NO__ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE:#[0-9]+]]
12// HAS_ERRNO: declare double @cabs(double, double) [[NOT_READNONE:#[0-9]+]]
13// HAS_ERRNO: declare float @cabsf(<2 x float>) [[NOT_READNONE]]
14// HAS_ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000015
16 cacos(f); cacosf(f); cacosl(f);
17
18// NO__ERRNO: declare { double, double } @cacos(double, double) [[READNONE]]
19// NO__ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]]
20// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000021// HAS_ERRNO: declare { double, double } @cacos(double, double) [[NOT_READNONE]]
22// HAS_ERRNO: declare <2 x float> @cacosf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000023// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
24
25 cacosh(f); cacoshf(f); cacoshl(f);
26
27// NO__ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]]
28// NO__ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]]
29// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000030// HAS_ERRNO: declare { double, double } @cacosh(double, double) [[NOT_READNONE]]
31// HAS_ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000032// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
33
34 carg(f); cargf(f); cargl(f);
35
36// NO__ERRNO: declare double @carg(double, double) [[READNONE]]
37// NO__ERRNO: declare float @cargf(<2 x float>) [[READNONE]]
38// NO__ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000039// HAS_ERRNO: declare double @carg(double, double) [[NOT_READNONE]]
40// HAS_ERRNO: declare float @cargf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000041// HAS_ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
42
43 casin(f); casinf(f); casinl(f);
44
45// NO__ERRNO: declare { double, double } @casin(double, double) [[READNONE]]
46// NO__ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]]
47// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000048// HAS_ERRNO: declare { double, double } @casin(double, double) [[NOT_READNONE]]
49// HAS_ERRNO: declare <2 x float> @casinf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000050// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
51
52 casinh(f); casinhf(f); casinhl(f);
53
54// NO__ERRNO: declare { double, double } @casinh(double, double) [[READNONE]]
55// NO__ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]]
56// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000057// HAS_ERRNO: declare { double, double } @casinh(double, double) [[NOT_READNONE]]
58// HAS_ERRNO: declare <2 x float> @casinhf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000059// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
60
61 catan(f); catanf(f); catanl(f);
62
63// NO__ERRNO: declare { double, double } @catan(double, double) [[READNONE]]
64// NO__ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]]
65// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000066// HAS_ERRNO: declare { double, double } @catan(double, double) [[NOT_READNONE]]
67// HAS_ERRNO: declare <2 x float> @catanf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000068// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
69
70 catanh(f); catanhf(f); catanhl(f);
71
72// NO__ERRNO: declare { double, double } @catanh(double, double) [[READNONE]]
73// NO__ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]]
74// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000075// HAS_ERRNO: declare { double, double } @catanh(double, double) [[NOT_READNONE]]
76// HAS_ERRNO: declare <2 x float> @catanhf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000077// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
78
79 ccos(f); ccosf(f); ccosl(f);
80
81// NO__ERRNO: declare { double, double } @ccos(double, double) [[READNONE]]
82// NO__ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]]
83// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000084// HAS_ERRNO: declare { double, double } @ccos(double, double) [[NOT_READNONE]]
85// HAS_ERRNO: declare <2 x float> @ccosf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000086// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
87
88 ccosh(f); ccoshf(f); ccoshl(f);
89
90// NO__ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]]
91// NO__ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]]
92// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +000093// HAS_ERRNO: declare { double, double } @ccosh(double, double) [[NOT_READNONE]]
94// HAS_ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +000095// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
96
97 cexp(f); cexpf(f); cexpl(f);
98
99// NO__ERRNO: declare { double, double } @cexp(double, double) [[READNONE]]
100// NO__ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]]
101// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000102// HAS_ERRNO: declare { double, double } @cexp(double, double) [[NOT_READNONE]]
103// HAS_ERRNO: declare <2 x float> @cexpf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000104// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
105
106 cimag(f); cimagf(f); cimagl(f);
107
108// NO__ERRNO-NOT: .cimag
109// NO__ERRNO-NOT: @cimag
110// HAS_ERRNO-NOT: .cimag
111// HAS_ERRNO-NOT: @cimag
112
113 conj(f); conjf(f); conjl(f);
114
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000115// NO__ERRNO: declare { double, double } @conj(double, double) [[READNONE:#[0-9]+]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000116// NO__ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]]
117// NO__ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000118// HAS_ERRNO: declare { double, double } @conj(double, double) [[READNONE:#[0-9]+]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000119// HAS_ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]]
120// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
121
122 clog(f); clogf(f); clogl(f);
123
124// NO__ERRNO: declare { double, double } @clog(double, double) [[READNONE]]
125// NO__ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]]
126// NO__ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000127// HAS_ERRNO: declare { double, double } @clog(double, double) [[NOT_READNONE]]
128// HAS_ERRNO: declare <2 x float> @clogf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000129// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
130
131 cproj(f); cprojf(f); cprojl(f);
132
133// NO__ERRNO: declare { double, double } @cproj(double, double) [[READNONE]]
134// NO__ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]]
135// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
136// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE]]
137// HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]]
138// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
139
140 cpow(f,f); cpowf(f,f); cpowl(f,f);
141
142// NO__ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]]
143// NO__ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]]
144// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000145// HAS_ERRNO: declare { double, double } @cpow(double, double, double, double) [[NOT_READNONE]]
146// HAS_ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000147// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
148
149 creal(f); crealf(f); creall(f);
150
151// NO__ERRNO-NOT: .creal
152// NO__ERRNO-NOT: @creal
153// HAS_ERRNO-NOT: .creal
154// HAS_ERRNO-NOT: @creal
155
156 csin(f); csinf(f); csinl(f);
157
158// NO__ERRNO: declare { double, double } @csin(double, double) [[READNONE]]
159// NO__ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]]
160// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000161// HAS_ERRNO: declare { double, double } @csin(double, double) [[NOT_READNONE]]
162// HAS_ERRNO: declare <2 x float> @csinf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000163// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
164
165 csinh(f); csinhf(f); csinhl(f);
166
167// NO__ERRNO: declare { double, double } @csinh(double, double) [[READNONE]]
168// NO__ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]]
169// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000170// HAS_ERRNO: declare { double, double } @csinh(double, double) [[NOT_READNONE]]
171// HAS_ERRNO: declare <2 x float> @csinhf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000172// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
173
174 csqrt(f); csqrtf(f); csqrtl(f);
175
176// NO__ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]]
177// NO__ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]]
178// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000179// HAS_ERRNO: declare { double, double } @csqrt(double, double) [[NOT_READNONE]]
180// HAS_ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000181// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
182
183 ctan(f); ctanf(f); ctanl(f);
184
185// NO__ERRNO: declare { double, double } @ctan(double, double) [[READNONE]]
186// NO__ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]]
187// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000188// HAS_ERRNO: declare { double, double } @ctan(double, double) [[NOT_READNONE]]
189// HAS_ERRNO: declare <2 x float> @ctanf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000190// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
191
192 ctanh(f); ctanhf(f); ctanhl(f);
193
194// NO__ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]]
195// NO__ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]]
196// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000197// HAS_ERRNO: declare { double, double } @ctanh(double, double) [[NOT_READNONE]]
198// HAS_ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[NOT_READNONE]]
Sanjay Patel040fbe32017-11-07 15:13:22 +0000199// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]]
200};
201
202
203// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
204// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
205
Sanjay Patel040fbe32017-11-07 15:13:22 +0000206// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} }
Sanjay Patel7b61dc72017-11-18 19:31:57 +0000207// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} }
Sanjay Patel040fbe32017-11-07 15:13:22 +0000208