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