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