1//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the standard builtin function database.  Users of this file
10// must define the BUILTIN macro to make use of this information.
11//
12//===----------------------------------------------------------------------===//
13
14// FIXME: This should really be a .td file, but that requires modifying tblgen.
15// Perhaps tblgen should have plugins.
16
17// The first value provided to the macro specifies the function name of the
18// builtin, and results in a clang::builtin::BIXX enum value for XX.
19
20// The second value provided to the macro specifies the type of the function
21// (result value, then each argument) as follows:
22//  v -> void
23//  b -> boolean
24//  c -> char
25//  s -> short
26//  i -> int
27//  h -> half
28//  f -> float
29//  d -> double
30//  z -> size_t
31//  w -> wchar_t
32//  F -> constant CFString
33//  G -> id
34//  H -> SEL
35//  M -> struct objc_super
36//  a -> __builtin_va_list
37//  A -> "reference" to __builtin_va_list
38//  V -> Vector, followed by the number of elements and the base type.
39//  q -> Scalable vector, followed by the number of elements and the base type.
40//  E -> ext_vector, followed by the number of elements and the base type.
41//  X -> _Complex, followed by the base type.
42//  Y -> ptrdiff_t
43//  P -> FILE
44//  J -> jmp_buf
45//  SJ -> sigjmp_buf
46//  K -> ucontext_t
47//  p -> pid_t
48//  . -> "...".  This may only occur at the end of the function list.
49//
50// Types may be prefixed with the following modifiers:
51//  L   -> long (e.g. Li for 'long int', Ld for 'long double')
52//  LL  -> long long (e.g. LLi for 'long long int', LLd for __float128)
53//  LLL -> __int128_t (e.g. LLLi)
54//  Z   -> int32_t (require a native 32-bit integer type on the target)
55//  W   -> int64_t (require a native 64-bit integer type on the target)
56//  N   -> 'int' size if target is LP64, 'L' otherwise.
57//  O   -> long for OpenCL targets, long long otherwise.
58//  S   -> signed
59//  U   -> unsigned
60//  I   -> Required to constant fold to an integer constant expression.
61//
62// Types may be postfixed with the following modifiers:
63// * -> pointer (optionally followed by an address space number, if no address
64//               space is specified than any address space will be accepted)
65// & -> reference (optionally followed by an address space number)
66// C -> const
67// D -> volatile
68// R -> restrict
69
70// The third value provided to the macro specifies information about attributes
71// of the function.  These must be kept in sync with the predicates in the
72// Builtin::Context class.  Currently we have:
73//  n -> nothrow
74//  r -> noreturn
75//  U -> pure
76//  c -> const
77//  t -> signature is meaningless, use custom typechecking
78//  T -> type is not important to semantic analysis and codegen; recognize as
79//       builtin even if type doesn't match signature, and don't warn if we
80//       can't be sure the type is right
81//  F -> this is a libc/libm function with a '__builtin_' prefix added.
82//  f -> this is a libc/libm function without the '__builtin_' prefix. It can
83//       be followed by ':headername:' to state which header this function
84//       comes from.
85//  h -> this function requires a specific header or an explicit declaration.
86//  i -> this is a runtime library implemented function without the
87//       '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
88//  p:N: -> this is a printf-like function whose Nth argument is the format
89//          string.
90//  P:N: -> similar to the p:N: attribute, but the function is like vprintf
91//          in that it accepts its arguments as a va_list rather than
92//          through an ellipsis
93//  s:N: -> this is a scanf-like function whose Nth argument is the format
94//          string.
95//  S:N: -> similar to the s:N: attribute, but the function is like vscanf
96//          in that it accepts its arguments as a va_list rather than
97//          through an ellipsis
98//  e -> const, but only when -fno-math-errno
99//  j -> returns_twice (like setjmp)
100//  u -> arguments are not evaluated for their side-effects
101//  V:N: -> requires vectors of at least N bits to be legal
102//  C<N,M_0,...,M_k> -> callback behavior: argument N is called with argument
103//                      M_0, ..., M_k as payload
104//  FIXME: gcc has nonnull
105
106#if defined(BUILTIN) && !defined(LIBBUILTIN)
107#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
108#endif
109
110#if defined(BUILTIN) && !defined(LANGBUILTIN)
111#  define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
112#endif
113
114// Standard libc/libm functions:
115BUILTIN(__builtin_atan2 , "ddd"  , "Fne")
116BUILTIN(__builtin_atan2f, "fff"  , "Fne")
117BUILTIN(__builtin_atan2l, "LdLdLd", "Fne")
118BUILTIN(__builtin_atan2f128, "LLdLLdLLd", "Fne")
119BUILTIN(__builtin_abs  , "ii"  , "ncF")
120BUILTIN(__builtin_copysign, "ddd", "ncF")
121BUILTIN(__builtin_copysignf, "fff", "ncF")
122BUILTIN(__builtin_copysignf16, "hhh", "ncF")
123BUILTIN(__builtin_copysignl, "LdLdLd", "ncF")
124BUILTIN(__builtin_copysignf128, "LLdLLdLLd", "ncF")
125BUILTIN(__builtin_fabs , "dd"  , "ncF")
126BUILTIN(__builtin_fabsf, "ff"  , "ncF")
127BUILTIN(__builtin_fabsl, "LdLd", "ncF")
128BUILTIN(__builtin_fabsf16, "hh"  , "ncF")
129BUILTIN(__builtin_fabsf128, "LLdLLd", "ncF")
130BUILTIN(__builtin_fmod , "ddd"  , "Fne")
131BUILTIN(__builtin_fmodf, "fff"  , "Fne")
132BUILTIN(__builtin_fmodf16, "hhh"  , "Fne")
133BUILTIN(__builtin_fmodl, "LdLdLd", "Fne")
134BUILTIN(__builtin_fmodf128, "LLdLLdLLd", "Fne")
135BUILTIN(__builtin_frexp , "ddi*"  , "Fn")
136BUILTIN(__builtin_frexpf, "ffi*"  , "Fn")
137BUILTIN(__builtin_frexpl, "LdLdi*", "Fn")
138BUILTIN(__builtin_frexpf128, "LLdLLdi*", "Fn")
139BUILTIN(__builtin_huge_val, "d", "nc")
140BUILTIN(__builtin_huge_valf, "f", "nc")
141BUILTIN(__builtin_huge_vall, "Ld", "nc")
142BUILTIN(__builtin_huge_valf128, "LLd", "nc")
143BUILTIN(__builtin_inf  , "d"   , "nc")
144BUILTIN(__builtin_inff , "f"   , "nc")
145BUILTIN(__builtin_infl , "Ld"  , "nc")
146BUILTIN(__builtin_inff128 , "LLd"  , "nc")
147BUILTIN(__builtin_labs , "LiLi"  , "Fnc")
148BUILTIN(__builtin_llabs, "LLiLLi", "Fnc")
149BUILTIN(__builtin_ldexp , "ddi"  , "Fne")
150BUILTIN(__builtin_ldexpf, "ffi"  , "Fne")
151BUILTIN(__builtin_ldexpl, "LdLdi", "Fne")
152BUILTIN(__builtin_ldexpf128, "LLdLLdi", "Fne")
153BUILTIN(__builtin_modf , "ddd*"  , "Fn")
154BUILTIN(__builtin_modff, "fff*"  , "Fn")
155BUILTIN(__builtin_modfl, "LdLdLd*", "Fn")
156BUILTIN(__builtin_modff128, "LLdLLdLLd*", "Fn")
157BUILTIN(__builtin_nan,  "dcC*" , "FnU")
158BUILTIN(__builtin_nanf, "fcC*" , "FnU")
159BUILTIN(__builtin_nanl, "LdcC*", "FnU")
160BUILTIN(__builtin_nanf128, "LLdcC*", "FnU")
161BUILTIN(__builtin_nans,  "dcC*" , "FnU")
162BUILTIN(__builtin_nansf, "fcC*" , "FnU")
163BUILTIN(__builtin_nansl, "LdcC*", "FnU")
164BUILTIN(__builtin_nansf128, "LLdcC*", "FnU")
165BUILTIN(__builtin_powi , "ddi"  , "Fnc")
166BUILTIN(__builtin_powif, "ffi"  , "Fnc")
167BUILTIN(__builtin_powil, "LdLdi", "Fnc")
168BUILTIN(__builtin_pow , "ddd"  , "Fne")
169BUILTIN(__builtin_powf, "fff"  , "Fne")
170BUILTIN(__builtin_powf16, "hhh"  , "Fne")
171BUILTIN(__builtin_powl, "LdLdLd", "Fne")
172BUILTIN(__builtin_powf128, "LLdLLdLLd", "Fne")
173
174// Standard unary libc/libm functions with double/float/long double variants:
175BUILTIN(__builtin_acos , "dd"  , "Fne")
176BUILTIN(__builtin_acosf, "ff"  , "Fne")
177BUILTIN(__builtin_acosl, "LdLd", "Fne")
178BUILTIN(__builtin_acosf128, "LLdLLd", "Fne")
179BUILTIN(__builtin_acosh , "dd"  , "Fne")
180BUILTIN(__builtin_acoshf, "ff"  , "Fne")
181BUILTIN(__builtin_acoshl, "LdLd", "Fne")
182BUILTIN(__builtin_acoshf128, "LLdLLd", "Fne")
183BUILTIN(__builtin_asin , "dd"  , "Fne")
184BUILTIN(__builtin_asinf, "ff"  , "Fne")
185BUILTIN(__builtin_asinl, "LdLd", "Fne")
186BUILTIN(__builtin_asinf128, "LLdLLd", "Fne")
187BUILTIN(__builtin_asinh , "dd"  , "Fne")
188BUILTIN(__builtin_asinhf, "ff"  , "Fne")
189BUILTIN(__builtin_asinhl, "LdLd", "Fne")
190BUILTIN(__builtin_asinhf128, "LLdLLd", "Fne")
191BUILTIN(__builtin_atan , "dd"  , "Fne")
192BUILTIN(__builtin_atanf, "ff"  , "Fne")
193BUILTIN(__builtin_atanl, "LdLd", "Fne")
194BUILTIN(__builtin_atanf128, "LLdLLd", "Fne")
195BUILTIN(__builtin_atanh , "dd", "Fne")
196BUILTIN(__builtin_atanhf, "ff", "Fne")
197BUILTIN(__builtin_atanhl, "LdLd", "Fne")
198BUILTIN(__builtin_atanhf128, "LLdLLd", "Fne")
199BUILTIN(__builtin_cbrt , "dd", "Fnc")
200BUILTIN(__builtin_cbrtf, "ff", "Fnc")
201BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
202BUILTIN(__builtin_cbrtf128, "LLdLLd", "Fnc")
203BUILTIN(__builtin_ceil , "dd"  , "Fnc")
204BUILTIN(__builtin_ceilf, "ff"  , "Fnc")
205BUILTIN(__builtin_ceilf16, "hh"  , "Fnc")
206BUILTIN(__builtin_ceill, "LdLd", "Fnc")
207BUILTIN(__builtin_ceilf128, "LLdLLd", "Fnc")
208BUILTIN(__builtin_cos , "dd"  , "Fne")
209BUILTIN(__builtin_cosf, "ff"  , "Fne")
210BUILTIN(__builtin_cosf16, "hh"  , "Fne")
211BUILTIN(__builtin_cosh , "dd"  , "Fne")
212BUILTIN(__builtin_coshf, "ff"  , "Fne")
213BUILTIN(__builtin_coshl, "LdLd", "Fne")
214BUILTIN(__builtin_coshf128, "LLdLLd", "Fne")
215BUILTIN(__builtin_cosl, "LdLd", "Fne")
216BUILTIN(__builtin_cosf128, "LLdLLd"  , "Fne")
217BUILTIN(__builtin_erf , "dd", "Fne")
218BUILTIN(__builtin_erff, "ff", "Fne")
219BUILTIN(__builtin_erfl, "LdLd", "Fne")
220BUILTIN(__builtin_erff128, "LLdLLd", "Fne")
221BUILTIN(__builtin_erfc , "dd", "Fne")
222BUILTIN(__builtin_erfcf, "ff", "Fne")
223BUILTIN(__builtin_erfcl, "LdLd", "Fne")
224BUILTIN(__builtin_erfcf128, "LLdLLd", "Fne")
225BUILTIN(__builtin_exp , "dd"  , "Fne")
226BUILTIN(__builtin_expf, "ff"  , "Fne")
227BUILTIN(__builtin_expf16, "hh"  , "Fne")
228BUILTIN(__builtin_expl, "LdLd", "Fne")
229BUILTIN(__builtin_expf128, "LLdLLd", "Fne")
230BUILTIN(__builtin_exp2 , "dd"  , "Fne")
231BUILTIN(__builtin_exp2f, "ff"  , "Fne")
232BUILTIN(__builtin_exp2f16, "hh"  , "Fne")
233BUILTIN(__builtin_exp2l, "LdLd", "Fne")
234BUILTIN(__builtin_exp2f128, "LLdLLd"  , "Fne")
235BUILTIN(__builtin_expm1 , "dd", "Fne")
236BUILTIN(__builtin_expm1f, "ff", "Fne")
237BUILTIN(__builtin_expm1l, "LdLd", "Fne")
238BUILTIN(__builtin_expm1f128, "LLdLLd", "Fne")
239BUILTIN(__builtin_fdim, "ddd", "Fne")
240BUILTIN(__builtin_fdimf, "fff", "Fne")
241BUILTIN(__builtin_fdiml, "LdLdLd", "Fne")
242BUILTIN(__builtin_fdimf128, "LLdLLdLLd", "Fne")
243BUILTIN(__builtin_floor , "dd"  , "Fnc")
244BUILTIN(__builtin_floorf, "ff"  , "Fnc")
245BUILTIN(__builtin_floorf16, "hh"  , "Fnc")
246BUILTIN(__builtin_floorl, "LdLd", "Fnc")
247BUILTIN(__builtin_floorf128, "LLdLLd", "Fnc")
248BUILTIN(__builtin_fma, "dddd", "Fne")
249BUILTIN(__builtin_fmaf, "ffff", "Fne")
250BUILTIN(__builtin_fmaf16, "hhhh", "Fne")
251BUILTIN(__builtin_fmal, "LdLdLdLd", "Fne")
252BUILTIN(__builtin_fmaf128, "LLdLLdLLdLLd", "Fne")
253BUILTIN(__builtin_fmax, "ddd", "Fnc")
254BUILTIN(__builtin_fmaxf, "fff", "Fnc")
255BUILTIN(__builtin_fmaxf16, "hhh", "Fnc")
256BUILTIN(__builtin_fmaxl, "LdLdLd", "Fnc")
257BUILTIN(__builtin_fmaxf128, "LLdLLdLLd", "Fnc")
258BUILTIN(__builtin_fmin, "ddd", "Fnc")
259BUILTIN(__builtin_fminf, "fff", "Fnc")
260BUILTIN(__builtin_fminf16, "hhh", "Fnc")
261BUILTIN(__builtin_fminl, "LdLdLd", "Fnc")
262BUILTIN(__builtin_fminf128, "LLdLLdLLd", "Fnc")
263BUILTIN(__builtin_hypot , "ddd"  , "Fne")
264BUILTIN(__builtin_hypotf, "fff"  , "Fne")
265BUILTIN(__builtin_hypotl, "LdLdLd", "Fne")
266BUILTIN(__builtin_hypotf128, "LLdLLdLLd", "Fne")
267BUILTIN(__builtin_ilogb , "id", "Fne")
268BUILTIN(__builtin_ilogbf, "if", "Fne")
269BUILTIN(__builtin_ilogbl, "iLd", "Fne")
270BUILTIN(__builtin_ilogbf128, "iLLd", "Fne")
271BUILTIN(__builtin_lgamma , "dd", "Fn")
272BUILTIN(__builtin_lgammaf, "ff", "Fn")
273BUILTIN(__builtin_lgammal, "LdLd", "Fn")
274BUILTIN(__builtin_lgammaf128, "LLdLLd", "Fn")
275BUILTIN(__builtin_llrint, "LLid", "Fne")
276BUILTIN(__builtin_llrintf, "LLif", "Fne")
277BUILTIN(__builtin_llrintl, "LLiLd", "Fne")
278BUILTIN(__builtin_llrintf128, "LLiLLd", "Fne")
279BUILTIN(__builtin_llround , "LLid", "Fne")
280BUILTIN(__builtin_llroundf, "LLif", "Fne")
281BUILTIN(__builtin_llroundl, "LLiLd", "Fne")
282BUILTIN(__builtin_llroundf128, "LLiLLd", "Fne")
283BUILTIN(__builtin_log , "dd"  , "Fne")
284BUILTIN(__builtin_log10 , "dd"  , "Fne")
285BUILTIN(__builtin_log10f, "ff"  , "Fne")
286BUILTIN(__builtin_log10f16, "hh"  , "Fne")
287BUILTIN(__builtin_log10l, "LdLd", "Fne")
288BUILTIN(__builtin_log10f128, "LLdLLd"  , "Fne")
289BUILTIN(__builtin_log1p , "dd"  , "Fne")
290BUILTIN(__builtin_log1pf, "ff"  , "Fne")
291BUILTIN(__builtin_log1pl, "LdLd", "Fne")
292BUILTIN(__builtin_log1pf128, "LLdLLd", "Fne")
293BUILTIN(__builtin_log2, "dd"  , "Fne")
294BUILTIN(__builtin_log2f, "ff"  , "Fne")
295BUILTIN(__builtin_log2f16, "hh"  , "Fne")
296BUILTIN(__builtin_log2l, "LdLd"  , "Fne")
297BUILTIN(__builtin_log2f128, "LLdLLd"  , "Fne")
298BUILTIN(__builtin_logb , "dd", "Fne")
299BUILTIN(__builtin_logbf, "ff", "Fne")
300BUILTIN(__builtin_logbl, "LdLd", "Fne")
301BUILTIN(__builtin_logbf128, "LLdLLd", "Fne")
302BUILTIN(__builtin_logf, "ff"  , "Fne")
303BUILTIN(__builtin_logf16, "hh"  , "Fne")
304BUILTIN(__builtin_logl, "LdLd", "Fne")
305BUILTIN(__builtin_logf128, "LLdLLd", "Fne")
306BUILTIN(__builtin_lrint , "Lid", "Fne")
307BUILTIN(__builtin_lrintf, "Lif", "Fne")
308BUILTIN(__builtin_lrintl, "LiLd", "Fne")
309BUILTIN(__builtin_lrintf128, "LiLLd", "Fne")
310BUILTIN(__builtin_lround , "Lid", "Fne")
311BUILTIN(__builtin_lroundf, "Lif", "Fne")
312BUILTIN(__builtin_lroundl, "LiLd", "Fne")
313BUILTIN(__builtin_lroundf128, "LiLLd", "Fne")
314BUILTIN(__builtin_nearbyint , "dd", "Fnc")
315BUILTIN(__builtin_nearbyintf, "ff", "Fnc")
316BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc")
317BUILTIN(__builtin_nearbyintf128, "LLdLLd", "Fnc")
318BUILTIN(__builtin_nextafter , "ddd", "Fne")
319BUILTIN(__builtin_nextafterf, "fff", "Fne")
320BUILTIN(__builtin_nextafterl, "LdLdLd", "Fne")
321BUILTIN(__builtin_nextafterf128, "LLdLLdLLd", "Fne")
322BUILTIN(__builtin_nexttoward , "ddLd", "Fne")
323BUILTIN(__builtin_nexttowardf, "ffLd", "Fne")
324BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fne")
325BUILTIN(__builtin_nexttowardf128, "LLdLLdLLd", "Fne")
326BUILTIN(__builtin_remainder , "ddd", "Fne")
327BUILTIN(__builtin_remainderf, "fff", "Fne")
328BUILTIN(__builtin_remainderl, "LdLdLd", "Fne")
329BUILTIN(__builtin_remainderf128, "LLdLLdLLd", "Fne")
330BUILTIN(__builtin_remquo , "dddi*", "Fn")
331BUILTIN(__builtin_remquof, "fffi*", "Fn")
332BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
333BUILTIN(__builtin_remquof128, "LLdLLdLLdi*", "Fn")
334BUILTIN(__builtin_rint , "dd", "Fnc")
335BUILTIN(__builtin_rintf, "ff", "Fnc")
336BUILTIN(__builtin_rintf16, "hh", "Fnc")
337BUILTIN(__builtin_rintl, "LdLd", "Fnc")
338BUILTIN(__builtin_rintf128, "LLdLLd", "Fnc")
339BUILTIN(__builtin_round, "dd"  , "Fnc")
340BUILTIN(__builtin_roundf, "ff"  , "Fnc")
341BUILTIN(__builtin_roundf16, "hh"  , "Fnc")
342BUILTIN(__builtin_roundl, "LdLd"  , "Fnc")
343BUILTIN(__builtin_roundf128, "LLdLLd"  , "Fnc")
344BUILTIN(__builtin_scalbln , "ddLi", "Fne")
345BUILTIN(__builtin_scalblnf, "ffLi", "Fne")
346BUILTIN(__builtin_scalblnl, "LdLdLi", "Fne")
347BUILTIN(__builtin_scalblnf128, "LLdLLdLi", "Fne")
348BUILTIN(__builtin_scalbn , "ddi", "Fne")
349BUILTIN(__builtin_scalbnf, "ffi", "Fne")
350BUILTIN(__builtin_scalbnl, "LdLdi", "Fne")
351BUILTIN(__builtin_scalbnf128, "LLdLLdi", "Fne")
352BUILTIN(__builtin_sin , "dd"  , "Fne")
353BUILTIN(__builtin_sinf, "ff"  , "Fne")
354BUILTIN(__builtin_sinf16, "hh"  , "Fne")
355BUILTIN(__builtin_sinh , "dd"  , "Fne")
356BUILTIN(__builtin_sinhf, "ff"  , "Fne")
357BUILTIN(__builtin_sinhl, "LdLd", "Fne")
358BUILTIN(__builtin_sinhf128, "LLdLLd", "Fne")
359BUILTIN(__builtin_sinl, "LdLd", "Fne")
360BUILTIN(__builtin_sinf128, "LLdLLd"  , "Fne")
361BUILTIN(__builtin_sqrt , "dd"  , "Fne")
362BUILTIN(__builtin_sqrtf, "ff"  , "Fne")
363BUILTIN(__builtin_sqrtf16, "hh"  , "Fne")
364BUILTIN(__builtin_sqrtl, "LdLd", "Fne")
365BUILTIN(__builtin_sqrtf128, "LLdLLd", "Fne")
366BUILTIN(__builtin_tan , "dd"  , "Fne")
367BUILTIN(__builtin_tanf, "ff"  , "Fne")
368BUILTIN(__builtin_tanh , "dd"  , "Fne")
369BUILTIN(__builtin_tanhf, "ff"  , "Fne")
370BUILTIN(__builtin_tanhl, "LdLd", "Fne")
371BUILTIN(__builtin_tanhf128, "LLdLLd", "Fne")
372BUILTIN(__builtin_tanl, "LdLd", "Fne")
373BUILTIN(__builtin_tanf128, "LLdLLd"  , "Fne")
374BUILTIN(__builtin_tgamma , "dd", "Fne")
375BUILTIN(__builtin_tgammaf, "ff", "Fne")
376BUILTIN(__builtin_tgammal, "LdLd", "Fne")
377BUILTIN(__builtin_tgammaf128, "LLdLLd", "Fne")
378BUILTIN(__builtin_trunc , "dd", "Fnc")
379BUILTIN(__builtin_truncf, "ff", "Fnc")
380BUILTIN(__builtin_truncl, "LdLd", "Fnc")
381BUILTIN(__builtin_truncf128, "LLdLLd", "Fnc")
382BUILTIN(__builtin_truncf16, "hh", "Fnc")
383
384// Access to floating point environment
385BUILTIN(__builtin_flt_rounds, "i", "n")
386
387// C99 complex builtins
388BUILTIN(__builtin_cabs, "dXd", "Fne")
389BUILTIN(__builtin_cabsf, "fXf", "Fne")
390BUILTIN(__builtin_cabsl, "LdXLd", "Fne")
391BUILTIN(__builtin_cacos, "XdXd", "Fne")
392BUILTIN(__builtin_cacosf, "XfXf", "Fne")
393BUILTIN(__builtin_cacosh, "XdXd", "Fne")
394BUILTIN(__builtin_cacoshf, "XfXf", "Fne")
395BUILTIN(__builtin_cacoshl, "XLdXLd", "Fne")
396BUILTIN(__builtin_cacosl, "XLdXLd", "Fne")
397BUILTIN(__builtin_carg, "dXd", "Fne")
398BUILTIN(__builtin_cargf, "fXf", "Fne")
399BUILTIN(__builtin_cargl, "LdXLd", "Fne")
400BUILTIN(__builtin_casin, "XdXd", "Fne")
401BUILTIN(__builtin_casinf, "XfXf", "Fne")
402BUILTIN(__builtin_casinh, "XdXd", "Fne")
403BUILTIN(__builtin_casinhf, "XfXf", "Fne")
404BUILTIN(__builtin_casinhl, "XLdXLd", "Fne")
405BUILTIN(__builtin_casinl, "XLdXLd", "Fne")
406BUILTIN(__builtin_catan, "XdXd", "Fne")
407BUILTIN(__builtin_catanf, "XfXf", "Fne")
408BUILTIN(__builtin_catanh, "XdXd", "Fne")
409BUILTIN(__builtin_catanhf, "XfXf", "Fne")
410BUILTIN(__builtin_catanhl, "XLdXLd", "Fne")
411BUILTIN(__builtin_catanl, "XLdXLd", "Fne")
412BUILTIN(__builtin_ccos, "XdXd", "Fne")
413BUILTIN(__builtin_ccosf, "XfXf", "Fne")
414BUILTIN(__builtin_ccosl, "XLdXLd", "Fne")
415BUILTIN(__builtin_ccosh, "XdXd", "Fne")
416BUILTIN(__builtin_ccoshf, "XfXf", "Fne")
417BUILTIN(__builtin_ccoshl, "XLdXLd", "Fne")
418BUILTIN(__builtin_cexp, "XdXd", "Fne")
419BUILTIN(__builtin_cexpf, "XfXf", "Fne")
420BUILTIN(__builtin_cexpl, "XLdXLd", "Fne")
421BUILTIN(__builtin_cimag, "dXd", "Fnc")
422BUILTIN(__builtin_cimagf, "fXf", "Fnc")
423BUILTIN(__builtin_cimagl, "LdXLd", "Fnc")
424BUILTIN(__builtin_conj, "XdXd", "Fnc")
425BUILTIN(__builtin_conjf, "XfXf", "Fnc")
426BUILTIN(__builtin_conjl, "XLdXLd", "Fnc")
427BUILTIN(__builtin_clog, "XdXd", "Fne")
428BUILTIN(__builtin_clogf, "XfXf", "Fne")
429BUILTIN(__builtin_clogl, "XLdXLd", "Fne")
430BUILTIN(__builtin_cproj, "XdXd", "Fnc")
431BUILTIN(__builtin_cprojf, "XfXf", "Fnc")
432BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc")
433BUILTIN(__builtin_cpow, "XdXdXd", "Fne")
434BUILTIN(__builtin_cpowf, "XfXfXf", "Fne")
435BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fne")
436BUILTIN(__builtin_creal, "dXd", "Fnc")
437BUILTIN(__builtin_crealf, "fXf", "Fnc")
438BUILTIN(__builtin_creall, "LdXLd", "Fnc")
439BUILTIN(__builtin_csin, "XdXd", "Fne")
440BUILTIN(__builtin_csinf, "XfXf", "Fne")
441BUILTIN(__builtin_csinl, "XLdXLd", "Fne")
442BUILTIN(__builtin_csinh, "XdXd", "Fne")
443BUILTIN(__builtin_csinhf, "XfXf", "Fne")
444BUILTIN(__builtin_csinhl, "XLdXLd", "Fne")
445BUILTIN(__builtin_csqrt, "XdXd", "Fne")
446BUILTIN(__builtin_csqrtf, "XfXf", "Fne")
447BUILTIN(__builtin_csqrtl, "XLdXLd", "Fne")
448BUILTIN(__builtin_ctan, "XdXd", "Fne")
449BUILTIN(__builtin_ctanf, "XfXf", "Fne")
450BUILTIN(__builtin_ctanl, "XLdXLd", "Fne")
451BUILTIN(__builtin_ctanh, "XdXd", "Fne")
452BUILTIN(__builtin_ctanhf, "XfXf", "Fne")
453BUILTIN(__builtin_ctanhl, "XLdXLd", "Fne")
454
455// GCC-compatible C99 CMPLX implementation.
456BUILTIN(__builtin_complex, "v.", "nct")
457
458// FP Comparisons.
459BUILTIN(__builtin_isgreater     , "i.", "Fnct")
460BUILTIN(__builtin_isgreaterequal, "i.", "Fnct")
461BUILTIN(__builtin_isless        , "i.", "Fnct")
462BUILTIN(__builtin_islessequal   , "i.", "Fnct")
463BUILTIN(__builtin_islessgreater , "i.", "Fnct")
464BUILTIN(__builtin_isunordered   , "i.", "Fnct")
465
466// Unary FP classification
467BUILTIN(__builtin_fpclassify, "iiiiii.", "Fnct")
468BUILTIN(__builtin_isfinite,   "i.", "Fnct")
469BUILTIN(__builtin_isinf,      "i.", "Fnct")
470BUILTIN(__builtin_isinf_sign, "i.", "Fnct")
471BUILTIN(__builtin_isnan,      "i.", "Fnct")
472BUILTIN(__builtin_isnormal,   "i.", "Fnct")
473
474// FP signbit builtins
475BUILTIN(__builtin_signbit, "i.", "Fnct")
476BUILTIN(__builtin_signbitf, "if", "Fnc")
477BUILTIN(__builtin_signbitl, "iLd", "Fnc")
478
479// Special FP builtins.
480BUILTIN(__builtin_canonicalize, "dd", "nc")
481BUILTIN(__builtin_canonicalizef, "ff", "nc")
482BUILTIN(__builtin_canonicalizef16, "hh", "nc")
483BUILTIN(__builtin_canonicalizel, "LdLd", "nc")
484
485// Builtins for arithmetic.
486BUILTIN(__builtin_clzs , "iUs"  , "nc")
487BUILTIN(__builtin_clz  , "iUi"  , "nc")
488BUILTIN(__builtin_clzl , "iULi" , "nc")
489BUILTIN(__builtin_clzll, "iULLi", "nc")
490// TODO: int clzimax(uintmax_t)
491BUILTIN(__builtin_ctzs , "iUs"  , "nc")
492BUILTIN(__builtin_ctz  , "iUi"  , "nc")
493BUILTIN(__builtin_ctzl , "iULi" , "nc")
494BUILTIN(__builtin_ctzll, "iULLi", "nc")
495// TODO: int ctzimax(uintmax_t)
496BUILTIN(__builtin_ffs  , "ii"  , "Fnc")
497BUILTIN(__builtin_ffsl , "iLi" , "Fnc")
498BUILTIN(__builtin_ffsll, "iLLi", "Fnc")
499BUILTIN(__builtin_parity  , "iUi"  , "nc")
500BUILTIN(__builtin_parityl , "iULi" , "nc")
501BUILTIN(__builtin_parityll, "iULLi", "nc")
502BUILTIN(__builtin_popcount  , "iUi"  , "nc")
503BUILTIN(__builtin_popcountl , "iULi" , "nc")
504BUILTIN(__builtin_popcountll, "iULLi", "nc")
505BUILTIN(__builtin_clrsb  , "ii"  , "nc")
506BUILTIN(__builtin_clrsbl , "iLi" , "nc")
507BUILTIN(__builtin_clrsbll, "iLLi", "nc")
508
509// The following builtins rely on that char == 8 bits, short == 16 bits and that
510// there exists native types on the target that are 32- and 64-bits wide, unless
511// these conditions are fulfilled these builtins will operate on a not intended
512// bitwidth.
513BUILTIN(__builtin_bswap16, "UsUs", "nc")
514BUILTIN(__builtin_bswap32, "UZiUZi", "nc")
515BUILTIN(__builtin_bswap64, "UWiUWi", "nc")
516
517BUILTIN(__builtin_bitreverse8, "UcUc", "nc")
518BUILTIN(__builtin_bitreverse16, "UsUs", "nc")
519BUILTIN(__builtin_bitreverse32, "UZiUZi", "nc")
520BUILTIN(__builtin_bitreverse64, "UWiUWi", "nc")
521
522BUILTIN(__builtin_rotateleft8, "UcUcUc", "nc")
523BUILTIN(__builtin_rotateleft16, "UsUsUs", "nc")
524BUILTIN(__builtin_rotateleft32, "UZiUZiUZi", "nc")
525BUILTIN(__builtin_rotateleft64, "UWiUWiUWi", "nc")
526BUILTIN(__builtin_rotateright8, "UcUcUc", "nc")
527BUILTIN(__builtin_rotateright16, "UsUsUs", "nc")
528BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "nc")
529BUILTIN(__builtin_rotateright64, "UWiUWiUWi", "nc")
530
531// Random GCC builtins
532BUILTIN(__builtin_constant_p, "i.", "nctu")
533BUILTIN(__builtin_classify_type, "i.", "nctu")
534BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "nc")
535BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc")
536BUILTIN(__builtin_va_start, "vA.", "nt")
537BUILTIN(__builtin_va_end, "vA", "n")
538BUILTIN(__builtin_va_copy, "vAA", "n")
539BUILTIN(__builtin_stdarg_start, "vA.", "nt")
540BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc")
541BUILTIN(__builtin_bcmp, "ivC*vC*z", "Fn")
542BUILTIN(__builtin_bcopy, "vv*v*z", "n")
543BUILTIN(__builtin_bzero, "vv*z", "nF")
544BUILTIN(__builtin_fprintf, "iP*cC*.", "Fp:1:")
545BUILTIN(__builtin_memchr, "v*vC*iz", "nF")
546BUILTIN(__builtin_memcmp, "ivC*vC*z", "nF")
547BUILTIN(__builtin_memcpy, "v*v*vC*z", "nF")
548BUILTIN(__builtin_memcpy_inline, "vv*vC*Iz", "nt")
549BUILTIN(__builtin_memmove, "v*v*vC*z", "nF")
550BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF")
551BUILTIN(__builtin_memset, "v*v*iz", "nF")
552BUILTIN(__builtin_printf, "icC*.", "Fp:0:")
553BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF")
554BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF")
555BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF")
556BUILTIN(__builtin_strcat, "c*c*cC*", "nF")
557BUILTIN(__builtin_strchr, "c*cC*i", "nF")
558BUILTIN(__builtin_strcmp, "icC*cC*", "nF")
559BUILTIN(__builtin_strcpy, "c*c*cC*", "nF")
560BUILTIN(__builtin_strcspn, "zcC*cC*", "nF")
561BUILTIN(__builtin_strdup, "c*cC*", "nF")
562BUILTIN(__builtin_strlen, "zcC*", "nF")
563BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF")
564BUILTIN(__builtin_strncat, "c*c*cC*z", "nF")
565BUILTIN(__builtin_strncmp, "icC*cC*z", "nF")
566BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF")
567BUILTIN(__builtin_strndup, "c*cC*z", "nF")
568BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF")
569BUILTIN(__builtin_strrchr, "c*cC*i", "nF")
570BUILTIN(__builtin_strspn, "zcC*cC*", "nF")
571BUILTIN(__builtin_strstr, "c*cC*cC*", "nF")
572BUILTIN(__builtin_wcschr, "w*wC*w", "nF")
573BUILTIN(__builtin_wcscmp, "iwC*wC*", "nF")
574BUILTIN(__builtin_wcslen, "zwC*", "nF")
575BUILTIN(__builtin_wcsncmp, "iwC*wC*z", "nF")
576BUILTIN(__builtin_wmemchr, "w*wC*wz", "nF")
577BUILTIN(__builtin_wmemcmp, "iwC*wC*z", "nF")
578BUILTIN(__builtin_wmemcpy, "w*w*wC*z", "nF")
579BUILTIN(__builtin_wmemmove, "w*w*wC*z", "nF")
580BUILTIN(__builtin_return_address, "v*IUi", "n")
581BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
582BUILTIN(__builtin_frame_address, "v*IUi", "n")
583BUILTIN(__builtin___clear_cache, "vc*c*", "n")
584BUILTIN(__builtin_setjmp, "iv**", "j")
585BUILTIN(__builtin_longjmp, "vv**i", "r")
586BUILTIN(__builtin_unwind_init, "v", "")
587BUILTIN(__builtin_eh_return_data_regno, "iIi", "nc")
588BUILTIN(__builtin_snprintf, "ic*zcC*.", "nFp:2:")
589BUILTIN(__builtin_vsprintf, "ic*cC*a", "nFP:1:")
590BUILTIN(__builtin_vsnprintf, "ic*zcC*a", "nFP:2:")
591BUILTIN(__builtin_thread_pointer, "v*", "nc")
592BUILTIN(__builtin_launder, "v*v*", "nt")
593LANGBUILTIN(__builtin_is_constant_evaluated, "b", "n", CXX_LANG)
594
595// GCC exception builtins
596BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t!
597BUILTIN(__builtin_frob_return_addr, "v*v*", "n")
598BUILTIN(__builtin_dwarf_cfa, "v*", "n")
599BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n")
600BUILTIN(__builtin_dwarf_sp_column, "Ui", "n")
601BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t
602
603// GCC Object size checking builtins
604BUILTIN(__builtin_object_size, "zvC*i", "nu")
605BUILTIN(__builtin_dynamic_object_size, "zvC*i", "nu") // Clang only.
606BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF")
607BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF")
608BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF")
609BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF")
610BUILTIN(__builtin___memset_chk, "v*v*izz", "nF")
611BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF")
612BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF")
613BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF")
614BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF")
615BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF")
616BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF")
617BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF")
618BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF")
619BUILTIN(__builtin___snprintf_chk, "ic*zizcC*.", "Fp:4:")
620BUILTIN(__builtin___sprintf_chk, "ic*izcC*.", "Fp:3:")
621BUILTIN(__builtin___vsnprintf_chk, "ic*zizcC*a", "FP:4:")
622BUILTIN(__builtin___vsprintf_chk, "ic*izcC*a", "FP:3:")
623BUILTIN(__builtin___fprintf_chk, "iP*icC*.", "Fp:2:")
624BUILTIN(__builtin___printf_chk, "iicC*.", "Fp:1:")
625BUILTIN(__builtin___vfprintf_chk, "iP*icC*a", "FP:2:")
626BUILTIN(__builtin___vprintf_chk, "iicC*a", "FP:1:")
627
628BUILTIN(__builtin_unpredictable, "LiLi"   , "nc")
629BUILTIN(__builtin_expect, "LiLiLi"   , "nc")
630BUILTIN(__builtin_expect_with_probability, "LiLiLid", "nc")
631BUILTIN(__builtin_prefetch, "vvC*.", "nc")
632BUILTIN(__builtin_readcyclecounter, "ULLi", "n")
633BUILTIN(__builtin_trap, "v", "nr")
634BUILTIN(__builtin_debugtrap, "v", "n")
635BUILTIN(__builtin_unreachable, "v", "nr")
636BUILTIN(__builtin_shufflevector, "v."   , "nct")
637BUILTIN(__builtin_convertvector, "v."   , "nct")
638BUILTIN(__builtin_alloca, "v*z"   , "Fn")
639BUILTIN(__builtin_alloca_with_align, "v*zIz", "Fn")
640BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
641
642BUILTIN(__builtin_matrix_transpose, "v.", "nFt")
643BUILTIN(__builtin_matrix_column_major_load, "v.", "nFt")
644BUILTIN(__builtin_matrix_column_major_store, "v.", "nFt")
645
646// "Overloaded" Atomic operator builtins.  These are overloaded to support data
647// types of i8, i16, i32, i64, and i128.  The front-end sees calls to the
648// non-suffixed version of these (which has a bogus type) and transforms them to
649// the right overloaded version in Sema (plus casts).
650
651// FIXME: These assume that char -> i8, short -> i16, int -> i32,
652// long long -> i64.
653
654BUILTIN(__sync_fetch_and_add, "v.", "t")
655BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt")
656BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt")
657BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt")
658BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt")
659BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt")
660
661BUILTIN(__sync_fetch_and_sub, "v.", "t")
662BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt")
663BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt")
664BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt")
665BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt")
666BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt")
667
668BUILTIN(__sync_fetch_and_or, "v.", "t")
669BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt")
670BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt")
671BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt")
672BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt")
673BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt")
674
675BUILTIN(__sync_fetch_and_and, "v.", "t")
676BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn")
677BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn")
678BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn")
679BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn")
680BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn")
681
682BUILTIN(__sync_fetch_and_xor, "v.", "t")
683BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn")
684BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn")
685BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn")
686BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn")
687BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn")
688
689BUILTIN(__sync_fetch_and_nand, "v.", "t")
690BUILTIN(__sync_fetch_and_nand_1, "ccD*c.", "tn")
691BUILTIN(__sync_fetch_and_nand_2, "ssD*s.", "tn")
692BUILTIN(__sync_fetch_and_nand_4, "iiD*i.", "tn")
693BUILTIN(__sync_fetch_and_nand_8, "LLiLLiD*LLi.", "tn")
694BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLiD*LLLi.", "tn")
695
696BUILTIN(__sync_add_and_fetch, "v.", "t")
697BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn")
698BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn")
699BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn")
700BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn")
701BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
702
703BUILTIN(__sync_sub_and_fetch, "v.", "t")
704BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn")
705BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn")
706BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn")
707BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn")
708BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
709
710BUILTIN(__sync_or_and_fetch, "v.", "t")
711BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn")
712BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn")
713BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn")
714BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn")
715BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
716
717BUILTIN(__sync_and_and_fetch, "v.", "t")
718BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn")
719BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn")
720BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn")
721BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn")
722BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
723
724BUILTIN(__sync_xor_and_fetch, "v.", "t")
725BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn")
726BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn")
727BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn")
728BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn")
729BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
730
731BUILTIN(__sync_nand_and_fetch, "v.", "t")
732BUILTIN(__sync_nand_and_fetch_1, "ccD*c.", "tn")
733BUILTIN(__sync_nand_and_fetch_2, "ssD*s.", "tn")
734BUILTIN(__sync_nand_and_fetch_4, "iiD*i.", "tn")
735BUILTIN(__sync_nand_and_fetch_8, "LLiLLiD*LLi.", "tn")
736BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
737
738BUILTIN(__sync_bool_compare_and_swap, "v.", "t")
739BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn")
740BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn")
741BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn")
742BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn")
743BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn")
744
745BUILTIN(__sync_val_compare_and_swap, "v.", "t")
746BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn")
747BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn")
748BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn")
749BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn")
750BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn")
751
752BUILTIN(__sync_lock_test_and_set, "v.", "t")
753BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn")
754BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn")
755BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn")
756BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn")
757BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn")
758
759BUILTIN(__sync_lock_release, "v.", "t")
760BUILTIN(__sync_lock_release_1, "vcD*.", "tn")
761BUILTIN(__sync_lock_release_2, "vsD*.", "tn")
762BUILTIN(__sync_lock_release_4, "viD*.", "tn")
763BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn")
764BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn")
765
766BUILTIN(__sync_swap, "v.", "t")
767BUILTIN(__sync_swap_1, "ccD*c.", "tn")
768BUILTIN(__sync_swap_2, "ssD*s.", "tn")
769BUILTIN(__sync_swap_4, "iiD*i.", "tn")
770BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn")
771BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn")
772
773// Some of our atomics builtins are handled by AtomicExpr rather than
774// as normal builtin CallExprs. This macro is used for such builtins.
775#ifndef ATOMIC_BUILTIN
776#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS)
777#endif
778
779// C11 _Atomic operations for <stdatomic.h>.
780ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t")
781ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t")
782ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t")
783ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t")
784ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t")
785ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t")
786ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t")
787ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t")
788ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t")
789ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t")
790ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t")
791ATOMIC_BUILTIN(__c11_atomic_fetch_max, "v.", "t")
792ATOMIC_BUILTIN(__c11_atomic_fetch_min, "v.", "t")
793BUILTIN(__c11_atomic_thread_fence, "vi", "n")
794BUILTIN(__c11_atomic_signal_fence, "vi", "n")
795BUILTIN(__c11_atomic_is_lock_free, "bz", "n")
796
797// GNU atomic builtins.
798ATOMIC_BUILTIN(__atomic_load, "v.", "t")
799ATOMIC_BUILTIN(__atomic_load_n, "v.", "t")
800ATOMIC_BUILTIN(__atomic_store, "v.", "t")
801ATOMIC_BUILTIN(__atomic_store_n, "v.", "t")
802ATOMIC_BUILTIN(__atomic_exchange, "v.", "t")
803ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t")
804ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t")
805ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t")
806ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t")
807ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t")
808ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t")
809ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t")
810ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t")
811ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t")
812ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t")
813ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t")
814ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t")
815ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t")
816ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t")
817ATOMIC_BUILTIN(__atomic_max_fetch, "v.", "t")
818ATOMIC_BUILTIN(__atomic_min_fetch, "v.", "t")
819ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t")
820BUILTIN(__atomic_test_and_set, "bvD*i", "n")
821BUILTIN(__atomic_clear, "vvD*i", "n")
822BUILTIN(__atomic_thread_fence, "vi", "n")
823BUILTIN(__atomic_signal_fence, "vi", "n")
824BUILTIN(__atomic_always_lock_free, "bzvCD*", "n")
825BUILTIN(__atomic_is_lock_free, "bzvCD*", "n")
826
827// OpenCL 2.0 atomic builtins.
828ATOMIC_BUILTIN(__opencl_atomic_init, "v.", "t")
829ATOMIC_BUILTIN(__opencl_atomic_load, "v.", "t")
830ATOMIC_BUILTIN(__opencl_atomic_store, "v.", "t")
831ATOMIC_BUILTIN(__opencl_atomic_exchange, "v.", "t")
832ATOMIC_BUILTIN(__opencl_atomic_compare_exchange_strong, "v.", "t")
833ATOMIC_BUILTIN(__opencl_atomic_compare_exchange_weak, "v.", "t")
834ATOMIC_BUILTIN(__opencl_atomic_fetch_add, "v.", "t")
835ATOMIC_BUILTIN(__opencl_atomic_fetch_sub, "v.", "t")
836ATOMIC_BUILTIN(__opencl_atomic_fetch_and, "v.", "t")
837ATOMIC_BUILTIN(__opencl_atomic_fetch_or, "v.", "t")
838ATOMIC_BUILTIN(__opencl_atomic_fetch_xor, "v.", "t")
839ATOMIC_BUILTIN(__opencl_atomic_fetch_min, "v.", "t")
840ATOMIC_BUILTIN(__opencl_atomic_fetch_max, "v.", "t")
841
842// GCC does not support these, they are a Clang extension.
843ATOMIC_BUILTIN(__atomic_fetch_min, "v.", "t")
844ATOMIC_BUILTIN(__atomic_fetch_max, "v.", "t")
845
846#undef ATOMIC_BUILTIN
847
848// Non-overloaded atomic builtins.
849BUILTIN(__sync_synchronize, "v", "n")
850// GCC does not support these, they are a Clang extension.
851BUILTIN(__sync_fetch_and_min, "iiD*i", "n")
852BUILTIN(__sync_fetch_and_max, "iiD*i", "n")
853BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n")
854BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n")
855
856// Random libc builtins.
857BUILTIN(__builtin_abort, "v", "Fnr")
858BUILTIN(__builtin_index, "c*cC*i", "Fn")
859BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
860
861// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
862BUILTIN(__warn_memset_zero_len, "v", "nU")
863
864// Microsoft builtins.  These are only active with -fms-extensions.
865LANGBUILTIN(_alloca,          "v*z", "n", ALL_MS_LANGUAGES)
866LANGBUILTIN(__annotation,     "wC*.","n", ALL_MS_LANGUAGES)
867LANGBUILTIN(__assume,         "vb",  "n", ALL_MS_LANGUAGES)
868LANGBUILTIN(_bittest,                "UcNiC*Ni", "n", ALL_MS_LANGUAGES)
869LANGBUILTIN(_bittestandcomplement,   "UcNi*Ni", "n", ALL_MS_LANGUAGES)
870LANGBUILTIN(_bittestandreset,        "UcNi*Ni", "n", ALL_MS_LANGUAGES)
871LANGBUILTIN(_bittestandset,          "UcNi*Ni", "n", ALL_MS_LANGUAGES)
872LANGBUILTIN(_bittest64,              "UcWiC*Wi", "n", ALL_MS_LANGUAGES)
873LANGBUILTIN(_bittestandcomplement64, "UcWi*Wi", "n", ALL_MS_LANGUAGES)
874LANGBUILTIN(_bittestandreset64,      "UcWi*Wi", "n", ALL_MS_LANGUAGES)
875LANGBUILTIN(_bittestandset64,        "UcWi*Wi", "n", ALL_MS_LANGUAGES)
876LIBBUILTIN(_byteswap_ushort, "UsUs",     "fnc", "stdlib.h", ALL_MS_LANGUAGES)
877LIBBUILTIN(_byteswap_ulong,  "UNiUNi",   "fnc", "stdlib.h", ALL_MS_LANGUAGES)
878LIBBUILTIN(_byteswap_uint64, "ULLiULLi", "fnc", "stdlib.h", ALL_MS_LANGUAGES)
879LANGBUILTIN(__debugbreak,     "v",   "n", ALL_MS_LANGUAGES)
880LANGBUILTIN(__exception_code, "UNi", "n", ALL_MS_LANGUAGES)
881LANGBUILTIN(_exception_code,  "UNi", "n", ALL_MS_LANGUAGES)
882LANGBUILTIN(__exception_info, "v*",  "n", ALL_MS_LANGUAGES)
883LANGBUILTIN(_exception_info,  "v*",  "n", ALL_MS_LANGUAGES)
884LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
885LANGBUILTIN(_abnormal_termination,  "i", "n", ALL_MS_LANGUAGES)
886LANGBUILTIN(__GetExceptionInfo, "v*.", "ntu", ALL_MS_LANGUAGES)
887LANGBUILTIN(_InterlockedAnd8,   "ccD*c",        "n", ALL_MS_LANGUAGES)
888LANGBUILTIN(_InterlockedAnd16,  "ssD*s",        "n", ALL_MS_LANGUAGES)
889LANGBUILTIN(_InterlockedAnd,    "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
890LANGBUILTIN(_InterlockedCompareExchange8,   "ccD*cc",         "n", ALL_MS_LANGUAGES)
891LANGBUILTIN(_InterlockedCompareExchange16,  "ssD*ss",         "n", ALL_MS_LANGUAGES)
892LANGBUILTIN(_InterlockedCompareExchange,    "NiNiD*NiNi",     "n", ALL_MS_LANGUAGES)
893LANGBUILTIN(_InterlockedCompareExchange64,  "LLiLLiD*LLiLLi", "n", ALL_MS_LANGUAGES)
894LANGBUILTIN(_InterlockedCompareExchangePointer, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES)
895LANGBUILTIN(_InterlockedCompareExchangePointer_nf, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES)
896LANGBUILTIN(_InterlockedDecrement16,        "ssD*",     "n", ALL_MS_LANGUAGES)
897LANGBUILTIN(_InterlockedDecrement,          "NiNiD*",   "n", ALL_MS_LANGUAGES)
898LANGBUILTIN(_InterlockedExchange,           "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
899LANGBUILTIN(_InterlockedExchange8,          "ccD*c",        "n", ALL_MS_LANGUAGES)
900LANGBUILTIN(_InterlockedExchange16,         "ssD*s",        "n", ALL_MS_LANGUAGES)
901LANGBUILTIN(_InterlockedExchangeAdd8,       "ccD*c",          "n", ALL_MS_LANGUAGES)
902LANGBUILTIN(_InterlockedExchangeAdd16,      "ssD*s",          "n", ALL_MS_LANGUAGES)
903LANGBUILTIN(_InterlockedExchangeAdd,        "NiNiD*Ni",       "n", ALL_MS_LANGUAGES)
904LANGBUILTIN(_InterlockedExchangePointer,    "v*v*D*v*",   "n", ALL_MS_LANGUAGES)
905LANGBUILTIN(_InterlockedExchangeSub8,   "ccD*c",        "n", ALL_MS_LANGUAGES)
906LANGBUILTIN(_InterlockedExchangeSub16,  "ssD*s",        "n", ALL_MS_LANGUAGES)
907LANGBUILTIN(_InterlockedExchangeSub,    "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
908LANGBUILTIN(_InterlockedIncrement16,        "ssD*",     "n", ALL_MS_LANGUAGES)
909LANGBUILTIN(_InterlockedIncrement,          "NiNiD*",   "n", ALL_MS_LANGUAGES)
910LANGBUILTIN(_InterlockedOr8,  "ccD*c",        "n", ALL_MS_LANGUAGES)
911LANGBUILTIN(_InterlockedOr16, "ssD*s",        "n", ALL_MS_LANGUAGES)
912LANGBUILTIN(_InterlockedOr,   "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
913LANGBUILTIN(_InterlockedXor8,  "ccD*c",       "n", ALL_MS_LANGUAGES)
914LANGBUILTIN(_InterlockedXor16, "ssD*s",       "n", ALL_MS_LANGUAGES)
915LANGBUILTIN(_InterlockedXor,   "NiNiD*Ni",    "n", ALL_MS_LANGUAGES)
916LANGBUILTIN(_interlockedbittestandreset,     "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
917LANGBUILTIN(_interlockedbittestandreset64,   "UcWiD*Wi", "n", ALL_MS_LANGUAGES)
918LANGBUILTIN(_interlockedbittestandreset_acq, "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
919LANGBUILTIN(_interlockedbittestandreset_nf,  "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
920LANGBUILTIN(_interlockedbittestandreset_rel, "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
921LANGBUILTIN(_interlockedbittestandset,       "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
922LANGBUILTIN(_interlockedbittestandset64,     "UcWiD*Wi", "n", ALL_MS_LANGUAGES)
923LANGBUILTIN(_interlockedbittestandset_acq,   "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
924LANGBUILTIN(_interlockedbittestandset_nf,    "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
925LANGBUILTIN(_interlockedbittestandset_rel,   "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
926LANGBUILTIN(__iso_volatile_load8,   "ccCD*",     "n", ALL_MS_LANGUAGES)
927LANGBUILTIN(__iso_volatile_load16,  "ssCD*",     "n", ALL_MS_LANGUAGES)
928LANGBUILTIN(__iso_volatile_load32,  "iiCD*",     "n", ALL_MS_LANGUAGES)
929LANGBUILTIN(__iso_volatile_load64,  "LLiLLiCD*", "n", ALL_MS_LANGUAGES)
930LANGBUILTIN(__iso_volatile_store8,  "vcD*c",     "n", ALL_MS_LANGUAGES)
931LANGBUILTIN(__iso_volatile_store16, "vsD*s",     "n", ALL_MS_LANGUAGES)
932LANGBUILTIN(__iso_volatile_store32, "viD*i",     "n", ALL_MS_LANGUAGES)
933LANGBUILTIN(__iso_volatile_store64, "vLLiD*LLi", "n", ALL_MS_LANGUAGES)
934LANGBUILTIN(__noop,           "i.",  "n", ALL_MS_LANGUAGES)
935LANGBUILTIN(__lzcnt16, "UsUs",    "nc", ALL_MS_LANGUAGES)
936LANGBUILTIN(__lzcnt,   "UiUi",    "nc", ALL_MS_LANGUAGES)
937LANGBUILTIN(__lzcnt64, "UWiUWi",  "nc", ALL_MS_LANGUAGES)
938LANGBUILTIN(__popcnt16, "UsUs",   "nc", ALL_MS_LANGUAGES)
939LANGBUILTIN(__popcnt,   "UiUi",   "nc", ALL_MS_LANGUAGES)
940LANGBUILTIN(__popcnt64, "UWiUWi", "nc", ALL_MS_LANGUAGES)
941LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
942LANGBUILTIN(_rotl8,  "UcUcUc",    "n", ALL_MS_LANGUAGES)
943LANGBUILTIN(_rotl16, "UsUsUc",    "n", ALL_MS_LANGUAGES)
944LANGBUILTIN(_rotl,   "UiUii",     "n", ALL_MS_LANGUAGES)
945LANGBUILTIN(_lrotl,  "ULiULii",   "n", ALL_MS_LANGUAGES)
946LANGBUILTIN(_rotl64, "UWiUWii",   "n", ALL_MS_LANGUAGES)
947LANGBUILTIN(_rotr8,  "UcUcUc",    "n", ALL_MS_LANGUAGES)
948LANGBUILTIN(_rotr16, "UsUsUc",    "n", ALL_MS_LANGUAGES)
949LANGBUILTIN(_rotr,   "UiUii",     "n", ALL_MS_LANGUAGES)
950LANGBUILTIN(_lrotr,  "ULiULii",   "n", ALL_MS_LANGUAGES)
951LANGBUILTIN(_rotr64, "UWiUWii",   "n", ALL_MS_LANGUAGES)
952LANGBUILTIN(__va_start,       "vc**.", "nt", ALL_MS_LANGUAGES)
953LANGBUILTIN(__fastfail, "vUi",    "nr", ALL_MS_LANGUAGES)
954
955// Microsoft library builtins.
956LIBBUILTIN(_setjmpex, "iJ", "fjT", "setjmpex.h", ALL_MS_LANGUAGES)
957
958// C99 library functions
959// C99 stdarg.h
960LIBBUILTIN(va_start, "vA.",       "fn",    "stdarg.h", ALL_LANGUAGES)
961LIBBUILTIN(va_end, "vA",          "fn",    "stdarg.h", ALL_LANGUAGES)
962LIBBUILTIN(va_copy, "vAA",        "fn",    "stdarg.h", ALL_LANGUAGES)
963// C99 stdlib.h
964LIBBUILTIN(abort, "v",            "fr",    "stdlib.h", ALL_LANGUAGES)
965LIBBUILTIN(calloc, "v*zz",        "f",     "stdlib.h", ALL_LANGUAGES)
966LIBBUILTIN(exit, "vi",            "fr",    "stdlib.h", ALL_LANGUAGES)
967LIBBUILTIN(_Exit, "vi",           "fr",    "stdlib.h", ALL_LANGUAGES)
968LIBBUILTIN(malloc, "v*z",         "f",     "stdlib.h", ALL_LANGUAGES)
969LIBBUILTIN(realloc, "v*v*z",      "f",     "stdlib.h", ALL_LANGUAGES)
970LIBBUILTIN(free,    "vv*",        "f",     "stdlib.h", ALL_LANGUAGES)
971LIBBUILTIN(strtod, "dcC*c**",     "f",     "stdlib.h", ALL_LANGUAGES)
972LIBBUILTIN(strtof, "fcC*c**",     "f",     "stdlib.h", ALL_LANGUAGES)
973LIBBUILTIN(strtold, "LdcC*c**",   "f",     "stdlib.h", ALL_LANGUAGES)
974LIBBUILTIN(strtol, "LicC*c**i",   "f",     "stdlib.h", ALL_LANGUAGES)
975LIBBUILTIN(strtoll, "LLicC*c**i", "f",     "stdlib.h", ALL_LANGUAGES)
976LIBBUILTIN(strtoul, "ULicC*c**i", "f",     "stdlib.h", ALL_LANGUAGES)
977LIBBUILTIN(strtoull, "ULLicC*c**i", "f",   "stdlib.h", ALL_LANGUAGES)
978// C99 string.h
979LIBBUILTIN(memcpy, "v*v*vC*z",    "f",     "string.h", ALL_LANGUAGES)
980LIBBUILTIN(memcmp, "ivC*vC*z",    "f",     "string.h", ALL_LANGUAGES)
981LIBBUILTIN(memmove, "v*v*vC*z",   "f",     "string.h", ALL_LANGUAGES)
982LIBBUILTIN(strcpy, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
983LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
984LIBBUILTIN(strcmp, "icC*cC*",     "f",     "string.h", ALL_LANGUAGES)
985LIBBUILTIN(strncmp, "icC*cC*z",   "f",     "string.h", ALL_LANGUAGES)
986LIBBUILTIN(strcat, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
987LIBBUILTIN(strncat, "c*c*cC*z",   "f",     "string.h", ALL_LANGUAGES)
988LIBBUILTIN(strxfrm, "zc*cC*z",    "f",     "string.h", ALL_LANGUAGES)
989LIBBUILTIN(memchr, "v*vC*iz",     "f",     "string.h", ALL_LANGUAGES)
990LIBBUILTIN(strchr, "c*cC*i",      "f",     "string.h", ALL_LANGUAGES)
991LIBBUILTIN(strcspn, "zcC*cC*",    "f",     "string.h", ALL_LANGUAGES)
992LIBBUILTIN(strpbrk, "c*cC*cC*",   "f",     "string.h", ALL_LANGUAGES)
993LIBBUILTIN(strrchr, "c*cC*i",     "f",     "string.h", ALL_LANGUAGES)
994LIBBUILTIN(strspn, "zcC*cC*",     "f",     "string.h", ALL_LANGUAGES)
995LIBBUILTIN(strstr, "c*cC*cC*",    "f",     "string.h", ALL_LANGUAGES)
996LIBBUILTIN(strtok, "c*c*cC*",     "f",     "string.h", ALL_LANGUAGES)
997LIBBUILTIN(memset, "v*v*iz",      "f",     "string.h", ALL_LANGUAGES)
998LIBBUILTIN(strerror, "c*i",       "f",     "string.h", ALL_LANGUAGES)
999LIBBUILTIN(strlen, "zcC*",        "f",     "string.h", ALL_LANGUAGES)
1000// C99 stdio.h
1001// FIXME: This list is incomplete.
1002LIBBUILTIN(printf, "icC*.",       "fp:0:", "stdio.h", ALL_LANGUAGES)
1003LIBBUILTIN(fprintf, "iP*cC*.",    "fp:1:", "stdio.h", ALL_LANGUAGES)
1004LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", "stdio.h", ALL_LANGUAGES)
1005LIBBUILTIN(sprintf, "ic*cC*.",    "fp:1:", "stdio.h", ALL_LANGUAGES)
1006LIBBUILTIN(vprintf, "icC*a",      "fP:0:", "stdio.h", ALL_LANGUAGES)
1007LIBBUILTIN(vfprintf, "iP*cC*a",   "fP:1:", "stdio.h", ALL_LANGUAGES)
1008LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", "stdio.h", ALL_LANGUAGES)
1009LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", "stdio.h", ALL_LANGUAGES)
1010LIBBUILTIN(scanf, "icC*R.",       "fs:0:", "stdio.h", ALL_LANGUAGES)
1011LIBBUILTIN(fscanf, "iP*RcC*R.",   "fs:1:", "stdio.h", ALL_LANGUAGES)
1012LIBBUILTIN(sscanf, "icC*RcC*R.",  "fs:1:", "stdio.h", ALL_LANGUAGES)
1013LIBBUILTIN(vscanf, "icC*Ra",      "fS:0:", "stdio.h", ALL_LANGUAGES)
1014LIBBUILTIN(vfscanf, "iP*RcC*Ra",  "fS:1:", "stdio.h", ALL_LANGUAGES)
1015LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES)
1016LIBBUILTIN(fopen, "P*cC*cC*",     "f",     "stdio.h", ALL_LANGUAGES)
1017LIBBUILTIN(fread, "zv*zzP*",      "f",     "stdio.h", ALL_LANGUAGES)
1018LIBBUILTIN(fwrite, "zvC*zzP*",    "f",     "stdio.h", ALL_LANGUAGES)
1019
1020// C99 ctype.h
1021LIBBUILTIN(isalnum, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1022LIBBUILTIN(isalpha, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1023LIBBUILTIN(isblank, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1024LIBBUILTIN(iscntrl, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1025LIBBUILTIN(isdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1026LIBBUILTIN(isgraph, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1027LIBBUILTIN(islower, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1028LIBBUILTIN(isprint, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1029LIBBUILTIN(ispunct, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1030LIBBUILTIN(isspace, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1031LIBBUILTIN(isupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1032LIBBUILTIN(isxdigit, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1033LIBBUILTIN(tolower, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1034LIBBUILTIN(toupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
1035// C99 wchar.h
1036// FIXME: This list is incomplete. We should cover at least the functions that
1037// take format strings.
1038LIBBUILTIN(wcschr,  "w*wC*w",   "f", "wchar.h", ALL_LANGUAGES)
1039LIBBUILTIN(wcscmp,  "iwC*wC*",  "f", "wchar.h", ALL_LANGUAGES)
1040LIBBUILTIN(wcslen,  "zwC*",     "f", "wchar.h", ALL_LANGUAGES)
1041LIBBUILTIN(wcsncmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES)
1042LIBBUILTIN(wmemchr, "w*wC*wz",  "f", "wchar.h", ALL_LANGUAGES)
1043LIBBUILTIN(wmemcmp, "iwC*wC*z", "f", "wchar.h", ALL_LANGUAGES)
1044LIBBUILTIN(wmemcpy, "w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
1045LIBBUILTIN(wmemmove,"w*w*wC*z", "f", "wchar.h", ALL_LANGUAGES)
1046
1047// C99
1048// In some systems setjmp is a macro that expands to _setjmp. We undefine
1049// it here to avoid having two identical LIBBUILTIN entries.
1050#undef setjmp
1051LIBBUILTIN(setjmp, "iJ",          "fjT",   "setjmp.h", ALL_LANGUAGES)
1052LIBBUILTIN(longjmp, "vJi",        "frT",   "setjmp.h", ALL_LANGUAGES)
1053
1054// Non-C library functions, active in GNU mode only.
1055// Functions with (returns_twice) attribute (marked as "j") are still active in
1056// all languages, because losing this attribute would result in miscompilation
1057// when these functions are used in non-GNU mode. PR16138.
1058LIBBUILTIN(alloca, "v*z",         "f",     "stdlib.h", ALL_GNU_LANGUAGES)
1059// POSIX string.h
1060LIBBUILTIN(memccpy, "v*v*vC*iz",  "f",     "string.h", ALL_GNU_LANGUAGES)
1061LIBBUILTIN(mempcpy, "v*v*vC*z",   "f",     "string.h", ALL_GNU_LANGUAGES)
1062LIBBUILTIN(stpcpy, "c*c*cC*",     "f",     "string.h", ALL_GNU_LANGUAGES)
1063LIBBUILTIN(stpncpy, "c*c*cC*z",   "f",     "string.h", ALL_GNU_LANGUAGES)
1064LIBBUILTIN(strdup, "c*cC*",       "f",     "string.h", ALL_GNU_LANGUAGES)
1065LIBBUILTIN(strndup, "c*cC*z",     "f",     "string.h", ALL_GNU_LANGUAGES)
1066// POSIX strings.h
1067LIBBUILTIN(index, "c*cC*i",       "f",     "strings.h", ALL_GNU_LANGUAGES)
1068LIBBUILTIN(rindex, "c*cC*i",      "f",     "strings.h", ALL_GNU_LANGUAGES)
1069LIBBUILTIN(bzero, "vv*z",         "f",     "strings.h", ALL_GNU_LANGUAGES)
1070LIBBUILTIN(bcmp, "ivC*vC*z",      "f",     "strings.h", ALL_GNU_LANGUAGES)
1071// In some systems str[n]casejmp is a macro that expands to _str[n]icmp.
1072// We undefine then here to avoid wrong name.
1073#undef strcasecmp
1074#undef strncasecmp
1075LIBBUILTIN(strcasecmp, "icC*cC*", "f",     "strings.h", ALL_GNU_LANGUAGES)
1076LIBBUILTIN(strncasecmp, "icC*cC*z", "f",   "strings.h", ALL_GNU_LANGUAGES)
1077// POSIX unistd.h
1078LIBBUILTIN(_exit, "vi",           "fr",    "unistd.h", ALL_GNU_LANGUAGES)
1079LIBBUILTIN(vfork, "p",            "fjT",   "unistd.h", ALL_LANGUAGES)
1080// POSIX pthread.h
1081// FIXME: Should specify argument types.
1082LIBBUILTIN(pthread_create, "",  "fC<2,3>", "pthread.h", ALL_GNU_LANGUAGES)
1083
1084// POSIX setjmp.h
1085
1086// FIXME: MinGW _setjmp has an additional void* parameter.
1087LIBBUILTIN(_setjmp, "iJ",         "fjT",   "setjmp.h", ALL_LANGUAGES)
1088LIBBUILTIN(__sigsetjmp, "iSJi",   "fjT",   "setjmp.h", ALL_LANGUAGES)
1089LIBBUILTIN(sigsetjmp, "iSJi",     "fjT",   "setjmp.h", ALL_LANGUAGES)
1090LIBBUILTIN(savectx, "iJ",         "fjT",   "setjmp.h", ALL_LANGUAGES)
1091LIBBUILTIN(getcontext, "iK*",     "fjT",   "setjmp.h", ALL_LANGUAGES)
1092
1093LIBBUILTIN(_longjmp, "vJi",       "frT",   "setjmp.h", ALL_GNU_LANGUAGES)
1094LIBBUILTIN(siglongjmp, "vSJi",    "frT",   "setjmp.h", ALL_GNU_LANGUAGES)
1095// non-standard but very common
1096LIBBUILTIN(strlcpy, "zc*cC*z",    "f",     "string.h", ALL_GNU_LANGUAGES)
1097LIBBUILTIN(strlcat, "zc*cC*z",    "f",     "string.h", ALL_GNU_LANGUAGES)
1098//   id objc_msgSend(id, SEL, ...)
1099LIBBUILTIN(objc_msgSend, "GGH.",   "f",     "objc/message.h", OBJC_LANG)
1100// long double objc_msgSend_fpret(id self, SEL op, ...)
1101LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", "objc/message.h", OBJC_LANG)
1102// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...)
1103LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", "objc/message.h", OBJC_LANG)
1104// void objc_msgSend_stret (id, SEL, ...)
1105LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", "objc/message.h", OBJC_LANG)
1106// id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
1107LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", "objc/message.h", OBJC_LANG)
1108// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
1109LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", "objc/message.h", OBJC_LANG)
1110//   id objc_getClass(const char *name)
1111LIBBUILTIN(objc_getClass, "GcC*",   "f",     "objc/runtime.h", OBJC_LANG)
1112//   id objc_getMetaClass(const char *name)
1113LIBBUILTIN(objc_getMetaClass, "GcC*",   "f", "objc/runtime.h", OBJC_LANG)
1114// void objc_enumerationMutation(id)
1115LIBBUILTIN(objc_enumerationMutation, "vG", "f", "objc/runtime.h", OBJC_LANG)
1116
1117// id objc_read_weak(id *location)
1118LIBBUILTIN(objc_read_weak, "GG*", "f", "objc/objc-auto.h", OBJC_LANG)
1119// id objc_assign_weak(id value, id *location)
1120LIBBUILTIN(objc_assign_weak, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
1121// id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
1122LIBBUILTIN(objc_assign_ivar, "GGGY", "f", "objc/objc-auto.h", OBJC_LANG)
1123// id objc_assign_global(id val, id *dest)
1124LIBBUILTIN(objc_assign_global, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
1125// id objc_assign_strongCast(id val, id *dest
1126LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", "objc/objc-auto.h", OBJC_LANG)
1127
1128// id objc_exception_extract(void *localExceptionData)
1129LIBBUILTIN(objc_exception_extract, "Gv*", "f", "objc/objc-exception.h", OBJC_LANG)
1130// void objc_exception_try_enter(void *localExceptionData)
1131LIBBUILTIN(objc_exception_try_enter, "vv*", "f", "objc/objc-exception.h", OBJC_LANG)
1132// void objc_exception_try_exit(void *localExceptionData)
1133LIBBUILTIN(objc_exception_try_exit, "vv*", "f", "objc/objc-exception.h", OBJC_LANG)
1134// int objc_exception_match(Class exceptionClass, id exception)
1135LIBBUILTIN(objc_exception_match, "iGG", "f", "objc/objc-exception.h", OBJC_LANG)
1136// void objc_exception_throw(id exception)
1137LIBBUILTIN(objc_exception_throw, "vG", "f", "objc/objc-exception.h", OBJC_LANG)
1138
1139// int objc_sync_enter(id obj)
1140LIBBUILTIN(objc_sync_enter, "iG", "f", "objc/objc-sync.h", OBJC_LANG)
1141// int objc_sync_exit(id obj)
1142LIBBUILTIN(objc_sync_exit, "iG", "f", "objc/objc-sync.h", OBJC_LANG)
1143
1144BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
1145
1146// void NSLog(NSString *fmt, ...)
1147LIBBUILTIN(NSLog, "vG.", "fp:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
1148// void NSLogv(NSString *fmt, va_list args)
1149LIBBUILTIN(NSLogv, "vGa", "fP:0:", "Foundation/NSObjCRuntime.h", OBJC_LANG)
1150
1151// Builtin math library functions
1152LIBBUILTIN(atan2, "ddd", "fne", "math.h", ALL_LANGUAGES)
1153LIBBUILTIN(atan2f, "fff", "fne", "math.h", ALL_LANGUAGES)
1154LIBBUILTIN(atan2l, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1155
1156LIBBUILTIN(abs, "ii", "fnc", "stdlib.h", ALL_LANGUAGES)
1157LIBBUILTIN(labs, "LiLi", "fnc", "stdlib.h", ALL_LANGUAGES)
1158LIBBUILTIN(llabs, "LLiLLi", "fnc", "stdlib.h", ALL_LANGUAGES)
1159
1160LIBBUILTIN(copysign, "ddd", "fnc", "math.h", ALL_LANGUAGES)
1161LIBBUILTIN(copysignf, "fff", "fnc", "math.h", ALL_LANGUAGES)
1162LIBBUILTIN(copysignl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
1163
1164LIBBUILTIN(fabs, "dd", "fnc", "math.h", ALL_LANGUAGES)
1165LIBBUILTIN(fabsf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1166LIBBUILTIN(fabsl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1167
1168// Some systems define finitef as alias of _finitef.
1169#if defined (finitef)
1170#undef finitef
1171#endif
1172LIBBUILTIN(finite, "id", "fnc", "math.h", GNU_LANG)
1173LIBBUILTIN(finitef, "if", "fnc", "math.h", GNU_LANG)
1174LIBBUILTIN(finitel, "iLd", "fnc", "math.h", GNU_LANG)
1175// glibc's math.h generates calls to __finite
1176LIBBUILTIN(__finite, "id", "fnc", "math.h", ALL_LANGUAGES)
1177LIBBUILTIN(__finitef, "if", "fnc", "math.h", ALL_LANGUAGES)
1178LIBBUILTIN(__finitel, "iLd", "fnc", "math.h", ALL_LANGUAGES)
1179
1180LIBBUILTIN(fmod, "ddd", "fne", "math.h", ALL_LANGUAGES)
1181LIBBUILTIN(fmodf, "fff", "fne", "math.h", ALL_LANGUAGES)
1182LIBBUILTIN(fmodl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1183
1184LIBBUILTIN(frexp, "ddi*", "fn", "math.h", ALL_LANGUAGES)
1185LIBBUILTIN(frexpf, "ffi*", "fn", "math.h", ALL_LANGUAGES)
1186LIBBUILTIN(frexpl, "LdLdi*", "fn", "math.h", ALL_LANGUAGES)
1187
1188LIBBUILTIN(ldexp, "ddi", "fne", "math.h", ALL_LANGUAGES)
1189LIBBUILTIN(ldexpf, "ffi", "fne", "math.h", ALL_LANGUAGES)
1190LIBBUILTIN(ldexpl, "LdLdi", "fne", "math.h", ALL_LANGUAGES)
1191
1192LIBBUILTIN(modf, "ddd*", "fn", "math.h", ALL_LANGUAGES)
1193LIBBUILTIN(modff, "fff*", "fn", "math.h", ALL_LANGUAGES)
1194LIBBUILTIN(modfl, "LdLdLd*", "fn", "math.h", ALL_LANGUAGES)
1195
1196LIBBUILTIN(nan,  "dcC*", "fUn", "math.h", ALL_LANGUAGES)
1197LIBBUILTIN(nanf, "fcC*", "fUn", "math.h", ALL_LANGUAGES)
1198LIBBUILTIN(nanl, "LdcC*", "fUn", "math.h", ALL_LANGUAGES)
1199
1200LIBBUILTIN(pow, "ddd", "fne", "math.h", ALL_LANGUAGES)
1201LIBBUILTIN(powf, "fff", "fne", "math.h", ALL_LANGUAGES)
1202LIBBUILTIN(powl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1203
1204LIBBUILTIN(acos, "dd", "fne", "math.h", ALL_LANGUAGES)
1205LIBBUILTIN(acosf, "ff", "fne", "math.h", ALL_LANGUAGES)
1206LIBBUILTIN(acosl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1207
1208LIBBUILTIN(acosh, "dd", "fne", "math.h", ALL_LANGUAGES)
1209LIBBUILTIN(acoshf, "ff", "fne", "math.h", ALL_LANGUAGES)
1210LIBBUILTIN(acoshl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1211
1212LIBBUILTIN(asin, "dd", "fne", "math.h", ALL_LANGUAGES)
1213LIBBUILTIN(asinf, "ff", "fne", "math.h", ALL_LANGUAGES)
1214LIBBUILTIN(asinl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1215
1216LIBBUILTIN(asinh, "dd", "fne", "math.h", ALL_LANGUAGES)
1217LIBBUILTIN(asinhf, "ff", "fne", "math.h", ALL_LANGUAGES)
1218LIBBUILTIN(asinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1219
1220LIBBUILTIN(atan, "dd", "fne", "math.h", ALL_LANGUAGES)
1221LIBBUILTIN(atanf, "ff", "fne", "math.h", ALL_LANGUAGES)
1222LIBBUILTIN(atanl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1223
1224LIBBUILTIN(atanh, "dd", "fne", "math.h", ALL_LANGUAGES)
1225LIBBUILTIN(atanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
1226LIBBUILTIN(atanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1227
1228LIBBUILTIN(cbrt, "dd", "fnc", "math.h", ALL_LANGUAGES)
1229LIBBUILTIN(cbrtf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1230LIBBUILTIN(cbrtl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1231
1232LIBBUILTIN(ceil, "dd", "fnc", "math.h", ALL_LANGUAGES)
1233LIBBUILTIN(ceilf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1234LIBBUILTIN(ceill, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1235
1236LIBBUILTIN(cos, "dd", "fne", "math.h", ALL_LANGUAGES)
1237LIBBUILTIN(cosf, "ff", "fne", "math.h", ALL_LANGUAGES)
1238LIBBUILTIN(cosl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1239
1240LIBBUILTIN(cosh, "dd", "fne", "math.h", ALL_LANGUAGES)
1241LIBBUILTIN(coshf, "ff", "fne", "math.h", ALL_LANGUAGES)
1242LIBBUILTIN(coshl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1243
1244LIBBUILTIN(erf, "dd", "fne", "math.h", ALL_LANGUAGES)
1245LIBBUILTIN(erff, "ff", "fne", "math.h", ALL_LANGUAGES)
1246LIBBUILTIN(erfl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1247
1248LIBBUILTIN(erfc, "dd", "fne", "math.h", ALL_LANGUAGES)
1249LIBBUILTIN(erfcf, "ff", "fne", "math.h", ALL_LANGUAGES)
1250LIBBUILTIN(erfcl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1251
1252LIBBUILTIN(exp, "dd", "fne", "math.h", ALL_LANGUAGES)
1253LIBBUILTIN(expf, "ff", "fne", "math.h", ALL_LANGUAGES)
1254LIBBUILTIN(expl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1255
1256LIBBUILTIN(exp2, "dd", "fne", "math.h", ALL_LANGUAGES)
1257LIBBUILTIN(exp2f, "ff", "fne", "math.h", ALL_LANGUAGES)
1258LIBBUILTIN(exp2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1259
1260LIBBUILTIN(expm1, "dd", "fne", "math.h", ALL_LANGUAGES)
1261LIBBUILTIN(expm1f, "ff", "fne", "math.h", ALL_LANGUAGES)
1262LIBBUILTIN(expm1l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1263
1264LIBBUILTIN(fdim, "ddd", "fne", "math.h", ALL_LANGUAGES)
1265LIBBUILTIN(fdimf, "fff", "fne", "math.h", ALL_LANGUAGES)
1266LIBBUILTIN(fdiml, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1267
1268LIBBUILTIN(floor, "dd", "fnc", "math.h", ALL_LANGUAGES)
1269LIBBUILTIN(floorf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1270LIBBUILTIN(floorl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1271
1272LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES)
1273LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES)
1274LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES)
1275
1276LIBBUILTIN(fmax, "ddd", "fnc", "math.h", ALL_LANGUAGES)
1277LIBBUILTIN(fmaxf, "fff", "fnc", "math.h", ALL_LANGUAGES)
1278LIBBUILTIN(fmaxl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
1279
1280LIBBUILTIN(fmin, "ddd", "fnc", "math.h", ALL_LANGUAGES)
1281LIBBUILTIN(fminf, "fff", "fnc", "math.h", ALL_LANGUAGES)
1282LIBBUILTIN(fminl, "LdLdLd", "fnc", "math.h", ALL_LANGUAGES)
1283
1284LIBBUILTIN(hypot, "ddd", "fne", "math.h", ALL_LANGUAGES)
1285LIBBUILTIN(hypotf, "fff", "fne", "math.h", ALL_LANGUAGES)
1286LIBBUILTIN(hypotl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1287
1288LIBBUILTIN(ilogb, "id", "fne", "math.h", ALL_LANGUAGES)
1289LIBBUILTIN(ilogbf, "if", "fne", "math.h", ALL_LANGUAGES)
1290LIBBUILTIN(ilogbl, "iLd", "fne", "math.h", ALL_LANGUAGES)
1291
1292// POSIX math.h declares a global, signgam, that lgamma writes to, so these
1293// shouldn't have "e" or "c" attributes
1294LIBBUILTIN(lgamma, "dd", "fn", "math.h", ALL_LANGUAGES)
1295LIBBUILTIN(lgammaf, "ff", "fn", "math.h", ALL_LANGUAGES)
1296LIBBUILTIN(lgammal, "LdLd", "fn", "math.h", ALL_LANGUAGES)
1297
1298LIBBUILTIN(llrint, "LLid", "fne", "math.h", ALL_LANGUAGES)
1299LIBBUILTIN(llrintf, "LLif", "fne", "math.h", ALL_LANGUAGES)
1300LIBBUILTIN(llrintl, "LLiLd", "fne", "math.h", ALL_LANGUAGES)
1301
1302LIBBUILTIN(llround, "LLid", "fne", "math.h", ALL_LANGUAGES)
1303LIBBUILTIN(llroundf, "LLif", "fne", "math.h", ALL_LANGUAGES)
1304LIBBUILTIN(llroundl, "LLiLd", "fne", "math.h", ALL_LANGUAGES)
1305
1306LIBBUILTIN(log, "dd", "fne", "math.h", ALL_LANGUAGES)
1307LIBBUILTIN(logf, "ff", "fne", "math.h", ALL_LANGUAGES)
1308LIBBUILTIN(logl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1309
1310LIBBUILTIN(log10, "dd", "fne", "math.h", ALL_LANGUAGES)
1311LIBBUILTIN(log10f, "ff", "fne", "math.h", ALL_LANGUAGES)
1312LIBBUILTIN(log10l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1313
1314LIBBUILTIN(log1p, "dd", "fne", "math.h", ALL_LANGUAGES)
1315LIBBUILTIN(log1pf, "ff", "fne", "math.h", ALL_LANGUAGES)
1316LIBBUILTIN(log1pl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1317
1318LIBBUILTIN(log2, "dd", "fne", "math.h", ALL_LANGUAGES)
1319LIBBUILTIN(log2f, "ff", "fne", "math.h", ALL_LANGUAGES)
1320LIBBUILTIN(log2l, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1321
1322LIBBUILTIN(logb, "dd", "fne", "math.h", ALL_LANGUAGES)
1323LIBBUILTIN(logbf, "ff", "fne", "math.h", ALL_LANGUAGES)
1324LIBBUILTIN(logbl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1325
1326LIBBUILTIN(lrint, "Lid", "fne", "math.h", ALL_LANGUAGES)
1327LIBBUILTIN(lrintf, "Lif", "fne", "math.h", ALL_LANGUAGES)
1328LIBBUILTIN(lrintl, "LiLd", "fne", "math.h", ALL_LANGUAGES)
1329
1330LIBBUILTIN(lround, "Lid", "fne", "math.h", ALL_LANGUAGES)
1331LIBBUILTIN(lroundf, "Lif", "fne", "math.h", ALL_LANGUAGES)
1332LIBBUILTIN(lroundl, "LiLd", "fne", "math.h", ALL_LANGUAGES)
1333
1334LIBBUILTIN(nearbyint, "dd", "fnc", "math.h", ALL_LANGUAGES)
1335LIBBUILTIN(nearbyintf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1336LIBBUILTIN(nearbyintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1337
1338LIBBUILTIN(nextafter, "ddd", "fne", "math.h", ALL_LANGUAGES)
1339LIBBUILTIN(nextafterf, "fff", "fne", "math.h", ALL_LANGUAGES)
1340LIBBUILTIN(nextafterl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1341
1342LIBBUILTIN(nexttoward, "ddLd", "fne", "math.h", ALL_LANGUAGES)
1343LIBBUILTIN(nexttowardf, "ffLd", "fne", "math.h", ALL_LANGUAGES)
1344LIBBUILTIN(nexttowardl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1345
1346LIBBUILTIN(remainder, "ddd", "fne", "math.h", ALL_LANGUAGES)
1347LIBBUILTIN(remainderf, "fff", "fne", "math.h", ALL_LANGUAGES)
1348LIBBUILTIN(remainderl, "LdLdLd", "fne", "math.h", ALL_LANGUAGES)
1349
1350LIBBUILTIN(remquo, "dddi*", "fn", "math.h", ALL_LANGUAGES)
1351LIBBUILTIN(remquof, "fffi*", "fn", "math.h", ALL_LANGUAGES)
1352LIBBUILTIN(remquol, "LdLdLdi*", "fn", "math.h", ALL_LANGUAGES)
1353
1354LIBBUILTIN(rint, "dd", "fnc", "math.h", ALL_LANGUAGES)
1355LIBBUILTIN(rintf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1356LIBBUILTIN(rintl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1357
1358LIBBUILTIN(round, "dd", "fnc", "math.h", ALL_LANGUAGES)
1359LIBBUILTIN(roundf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1360LIBBUILTIN(roundl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1361
1362LIBBUILTIN(scalbln, "ddLi", "fne", "math.h", ALL_LANGUAGES)
1363LIBBUILTIN(scalblnf, "ffLi", "fne", "math.h", ALL_LANGUAGES)
1364LIBBUILTIN(scalblnl, "LdLdLi", "fne", "math.h", ALL_LANGUAGES)
1365
1366LIBBUILTIN(scalbn, "ddi", "fne", "math.h", ALL_LANGUAGES)
1367LIBBUILTIN(scalbnf, "ffi", "fne", "math.h", ALL_LANGUAGES)
1368LIBBUILTIN(scalbnl, "LdLdi", "fne", "math.h", ALL_LANGUAGES)
1369
1370LIBBUILTIN(sin, "dd", "fne", "math.h", ALL_LANGUAGES)
1371LIBBUILTIN(sinf, "ff", "fne", "math.h", ALL_LANGUAGES)
1372LIBBUILTIN(sinl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1373
1374LIBBUILTIN(sinh, "dd", "fne", "math.h", ALL_LANGUAGES)
1375LIBBUILTIN(sinhf, "ff", "fne", "math.h", ALL_LANGUAGES)
1376LIBBUILTIN(sinhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1377
1378LIBBUILTIN(sqrt, "dd", "fne", "math.h", ALL_LANGUAGES)
1379LIBBUILTIN(sqrtf, "ff", "fne", "math.h", ALL_LANGUAGES)
1380LIBBUILTIN(sqrtl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1381
1382LIBBUILTIN(tan, "dd", "fne", "math.h", ALL_LANGUAGES)
1383LIBBUILTIN(tanf, "ff", "fne", "math.h", ALL_LANGUAGES)
1384LIBBUILTIN(tanl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1385
1386LIBBUILTIN(tanh, "dd", "fne", "math.h", ALL_LANGUAGES)
1387LIBBUILTIN(tanhf, "ff", "fne", "math.h", ALL_LANGUAGES)
1388LIBBUILTIN(tanhl, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1389
1390LIBBUILTIN(tgamma, "dd", "fne", "math.h", ALL_LANGUAGES)
1391LIBBUILTIN(tgammaf, "ff", "fne", "math.h", ALL_LANGUAGES)
1392LIBBUILTIN(tgammal, "LdLd", "fne", "math.h", ALL_LANGUAGES)
1393
1394LIBBUILTIN(trunc, "dd", "fnc", "math.h", ALL_LANGUAGES)
1395LIBBUILTIN(truncf, "ff", "fnc", "math.h", ALL_LANGUAGES)
1396LIBBUILTIN(truncl, "LdLd", "fnc", "math.h", ALL_LANGUAGES)
1397
1398LIBBUILTIN(cabs, "dXd", "fne", "complex.h", ALL_LANGUAGES)
1399LIBBUILTIN(cabsf, "fXf", "fne", "complex.h", ALL_LANGUAGES)
1400LIBBUILTIN(cabsl, "LdXLd", "fne", "complex.h", ALL_LANGUAGES)
1401
1402LIBBUILTIN(cacos, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1403LIBBUILTIN(cacosf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1404LIBBUILTIN(cacosl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1405
1406LIBBUILTIN(cacosh, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1407LIBBUILTIN(cacoshf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1408LIBBUILTIN(cacoshl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1409
1410LIBBUILTIN(carg, "dXd", "fne", "complex.h", ALL_LANGUAGES)
1411LIBBUILTIN(cargf, "fXf", "fne", "complex.h", ALL_LANGUAGES)
1412LIBBUILTIN(cargl, "LdXLd", "fne", "complex.h", ALL_LANGUAGES)
1413
1414LIBBUILTIN(casin, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1415LIBBUILTIN(casinf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1416LIBBUILTIN(casinl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1417
1418LIBBUILTIN(casinh, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1419LIBBUILTIN(casinhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1420LIBBUILTIN(casinhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1421
1422LIBBUILTIN(catan, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1423LIBBUILTIN(catanf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1424LIBBUILTIN(catanl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1425
1426LIBBUILTIN(catanh, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1427LIBBUILTIN(catanhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1428LIBBUILTIN(catanhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1429
1430LIBBUILTIN(ccos, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1431LIBBUILTIN(ccosf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1432LIBBUILTIN(ccosl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1433
1434LIBBUILTIN(ccosh, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1435LIBBUILTIN(ccoshf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1436LIBBUILTIN(ccoshl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1437
1438LIBBUILTIN(cexp, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1439LIBBUILTIN(cexpf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1440LIBBUILTIN(cexpl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1441
1442LIBBUILTIN(cimag, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
1443LIBBUILTIN(cimagf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
1444LIBBUILTIN(cimagl, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1445
1446LIBBUILTIN(conj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1447LIBBUILTIN(conjf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1448LIBBUILTIN(conjl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1449
1450LIBBUILTIN(clog, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1451LIBBUILTIN(clogf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1452LIBBUILTIN(clogl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1453
1454LIBBUILTIN(cproj, "XdXd", "fnc", "complex.h", ALL_LANGUAGES)
1455LIBBUILTIN(cprojf, "XfXf", "fnc", "complex.h", ALL_LANGUAGES)
1456LIBBUILTIN(cprojl, "XLdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1457
1458LIBBUILTIN(cpow, "XdXdXd", "fne", "complex.h", ALL_LANGUAGES)
1459LIBBUILTIN(cpowf, "XfXfXf", "fne", "complex.h", ALL_LANGUAGES)
1460LIBBUILTIN(cpowl, "XLdXLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1461
1462LIBBUILTIN(creal, "dXd", "fnc", "complex.h", ALL_LANGUAGES)
1463LIBBUILTIN(crealf, "fXf", "fnc", "complex.h", ALL_LANGUAGES)
1464LIBBUILTIN(creall, "LdXLd", "fnc", "complex.h", ALL_LANGUAGES)
1465
1466LIBBUILTIN(csin, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1467LIBBUILTIN(csinf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1468LIBBUILTIN(csinl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1469
1470LIBBUILTIN(csinh, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1471LIBBUILTIN(csinhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1472LIBBUILTIN(csinhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1473
1474LIBBUILTIN(csqrt, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1475LIBBUILTIN(csqrtf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1476LIBBUILTIN(csqrtl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1477
1478LIBBUILTIN(ctan, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1479LIBBUILTIN(ctanf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1480LIBBUILTIN(ctanl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1481
1482LIBBUILTIN(ctanh, "XdXd", "fne", "complex.h", ALL_LANGUAGES)
1483LIBBUILTIN(ctanhf, "XfXf", "fne", "complex.h", ALL_LANGUAGES)
1484LIBBUILTIN(ctanhl, "XLdXLd", "fne", "complex.h", ALL_LANGUAGES)
1485
1486// __sinpi and friends are OS X specific library functions, but otherwise much
1487// like the standard (non-complex) sin (etc).
1488LIBBUILTIN(__sinpi, "dd", "fne", "math.h", ALL_LANGUAGES)
1489LIBBUILTIN(__sinpif, "ff", "fne", "math.h", ALL_LANGUAGES)
1490
1491LIBBUILTIN(__cospi, "dd", "fne", "math.h", ALL_LANGUAGES)
1492LIBBUILTIN(__cospif, "ff", "fne", "math.h", ALL_LANGUAGES)
1493
1494LIBBUILTIN(__tanpi, "dd", "fne", "math.h", ALL_LANGUAGES)
1495LIBBUILTIN(__tanpif, "ff", "fne", "math.h", ALL_LANGUAGES)
1496
1497// Similarly, __exp10 is OS X only
1498LIBBUILTIN(__exp10, "dd", "fne", "math.h", ALL_LANGUAGES)
1499LIBBUILTIN(__exp10f, "ff", "fne", "math.h", ALL_LANGUAGES)
1500
1501// Blocks runtime Builtin math library functions
1502LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", "Blocks.h", ALL_LANGUAGES)
1503LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", "Blocks.h", ALL_LANGUAGES)
1504// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
1505
1506// Annotation function
1507BUILTIN(__builtin_annotation, "v.", "tn")
1508
1509// Invariants
1510BUILTIN(__builtin_assume, "vb", "n")
1511
1512// Multiprecision Arithmetic Builtins.
1513BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n")
1514BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n")
1515BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n")
1516BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n")
1517BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n")
1518BUILTIN(__builtin_subcb, "UcUcCUcCUcCUc*", "n")
1519BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n")
1520BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n")
1521BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n")
1522BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n")
1523
1524// Checked Arithmetic Builtins for Security.
1525BUILTIN(__builtin_add_overflow, "b.", "nt")
1526BUILTIN(__builtin_sub_overflow, "b.", "nt")
1527BUILTIN(__builtin_mul_overflow, "b.", "nt")
1528BUILTIN(__builtin_uadd_overflow, "bUiCUiCUi*", "n")
1529BUILTIN(__builtin_uaddl_overflow, "bULiCULiCULi*", "n")
1530BUILTIN(__builtin_uaddll_overflow, "bULLiCULLiCULLi*", "n")
1531BUILTIN(__builtin_usub_overflow, "bUiCUiCUi*", "n")
1532BUILTIN(__builtin_usubl_overflow, "bULiCULiCULi*", "n")
1533BUILTIN(__builtin_usubll_overflow, "bULLiCULLiCULLi*", "n")
1534BUILTIN(__builtin_umul_overflow, "bUiCUiCUi*", "n")
1535BUILTIN(__builtin_umull_overflow, "bULiCULiCULi*", "n")
1536BUILTIN(__builtin_umulll_overflow, "bULLiCULLiCULLi*", "n")
1537BUILTIN(__builtin_sadd_overflow, "bSiCSiCSi*", "n")
1538BUILTIN(__builtin_saddl_overflow, "bSLiCSLiCSLi*", "n")
1539BUILTIN(__builtin_saddll_overflow, "bSLLiCSLLiCSLLi*", "n")
1540BUILTIN(__builtin_ssub_overflow, "bSiCSiCSi*", "n")
1541BUILTIN(__builtin_ssubl_overflow, "bSLiCSLiCSLi*", "n")
1542BUILTIN(__builtin_ssubll_overflow, "bSLLiCSLLiCSLLi*", "n")
1543BUILTIN(__builtin_smul_overflow, "bSiCSiCSi*", "n")
1544BUILTIN(__builtin_smull_overflow, "bSLiCSLiCSLi*", "n")
1545BUILTIN(__builtin_smulll_overflow, "bSLLiCSLLiCSLLi*", "n")
1546
1547// Clang builtins (not available in GCC).
1548BUILTIN(__builtin_addressof, "v*v&", "nct")
1549BUILTIN(__builtin_operator_new, "v*z", "tc")
1550BUILTIN(__builtin_operator_delete, "vv*", "tn")
1551BUILTIN(__builtin_char_memchr, "c*cC*iz", "n")
1552BUILTIN(__builtin_dump_struct, "ivC*v*", "tn")
1553BUILTIN(__builtin_preserve_access_index, "v.", "t")
1554
1555// Alignment builtins (uses custom parsing to support pointers and integers)
1556BUILTIN(__builtin_is_aligned, "bvC*z", "nct")
1557BUILTIN(__builtin_align_up, "v*vC*z", "nct")
1558BUILTIN(__builtin_align_down, "v*vC*z", "nct")
1559
1560// Safestack builtins
1561BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")
1562BUILTIN(__builtin___get_unsafe_stack_bottom, "v*", "Fn")
1563BUILTIN(__builtin___get_unsafe_stack_top, "v*", "Fn")
1564BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn")
1565
1566// Nontemporal loads/stores builtins
1567BUILTIN(__builtin_nontemporal_store, "v.", "t")
1568BUILTIN(__builtin_nontemporal_load, "v.", "t")
1569
1570// Coroutine intrinsics.
1571BUILTIN(__builtin_coro_resume, "vv*", "")
1572BUILTIN(__builtin_coro_destroy, "vv*", "")
1573BUILTIN(__builtin_coro_done, "bv*", "n")
1574BUILTIN(__builtin_coro_promise, "v*v*IiIb", "n")
1575
1576BUILTIN(__builtin_coro_size, "z", "n")
1577BUILTIN(__builtin_coro_frame, "v*", "n")
1578BUILTIN(__builtin_coro_noop, "v*", "n")
1579BUILTIN(__builtin_coro_free, "v*v*", "n")
1580
1581BUILTIN(__builtin_coro_id, "v*Iiv*v*v*", "n")
1582BUILTIN(__builtin_coro_alloc, "b", "n")
1583BUILTIN(__builtin_coro_begin, "v*v*", "n")
1584BUILTIN(__builtin_coro_end, "bv*Ib", "n")
1585BUILTIN(__builtin_coro_suspend, "cIb", "n")
1586BUILTIN(__builtin_coro_param, "bv*v*", "n")
1587
1588// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
1589// We need the generic prototype, since the packet type could be anything.
1590LANGBUILTIN(read_pipe, "i.", "tn", OCLC20_LANG)
1591LANGBUILTIN(write_pipe, "i.", "tn", OCLC20_LANG)
1592
1593LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCLC20_LANG)
1594LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCLC20_LANG)
1595
1596LANGBUILTIN(commit_write_pipe, "v.", "tn", OCLC20_LANG)
1597LANGBUILTIN(commit_read_pipe, "v.", "tn", OCLC20_LANG)
1598
1599LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
1600LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
1601
1602LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
1603LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
1604
1605LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCLC20_LANG)
1606LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCLC20_LANG)
1607
1608LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCLC20_LANG)
1609LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCLC20_LANG)
1610
1611LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC20_LANG)
1612LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC20_LANG)
1613
1614// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
1615// Custom builtin check allows to perform special check of passed block arguments.
1616LANGBUILTIN(enqueue_kernel, "i.", "tn", OCLC20_LANG)
1617LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCLC20_LANG)
1618LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCLC20_LANG)
1619LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCLC20_LANG)
1620LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCLC20_LANG)
1621
1622// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
1623// FIXME: Pointer parameters of OpenCL builtins should have their address space
1624// requirement defined.
1625LANGBUILTIN(to_global, "v*v*", "tn", OCLC20_LANG)
1626LANGBUILTIN(to_local, "v*v*", "tn", OCLC20_LANG)
1627LANGBUILTIN(to_private, "v*v*", "tn", OCLC20_LANG)
1628
1629// OpenCL half load/store builtin
1630LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCLC_LANGUAGES)
1631LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCLC_LANGUAGES)
1632LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCLC_LANGUAGES)
1633LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCLC_LANGUAGES)
1634
1635// Builtins for os_log/os_trace
1636BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nut")
1637BUILTIN(__builtin_os_log_format, "v*v*cC*.", "p:0:nt")
1638
1639// OpenMP 4.0
1640LANGBUILTIN(omp_is_initial_device, "i", "nc", OMP_LANG)
1641
1642// Builtins for XRay
1643BUILTIN(__xray_customevent, "vcC*z", "")
1644BUILTIN(__xray_typedevent, "vzcC*z", "")
1645
1646// Win64-compatible va_list functions
1647BUILTIN(__builtin_ms_va_start, "vc*&.", "nt")
1648BUILTIN(__builtin_ms_va_end, "vc*&", "n")
1649BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
1650
1651#undef BUILTIN
1652#undef LIBBUILTIN
1653#undef LANGBUILTIN
1654