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