[clang] [clang-tools-extra] [llvm] [clang] Refactor Builtins.def to be a tablegen file (PR #68324)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 23 16:21:18 PST 2024


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/68324

>From e2c94d99f108840e16c1509bd58549e6936cc157 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 15 Sep 2023 09:01:21 +0200
Subject: [PATCH 1/4] [clang] Refactor Builtins.def to be a tablegen file

---
 clang/include/clang/AST/Expr.h                |   21 +-
 clang/include/clang/Basic/Builtins.def        | 1672 +------
 clang/include/clang/Basic/Builtins.h          |    2 +-
 clang/include/clang/Basic/Builtins.td         | 4370 +++++++++++++++++
 clang/include/clang/Basic/BuiltinsBPF.def     |   33 -
 clang/include/clang/Basic/BuiltinsBPF.td      |   37 +
 clang/include/clang/Basic/BuiltinsBase.td     |  121 +
 clang/include/clang/Basic/CMakeLists.txt      |    8 +
 clang/include/clang/Basic/TargetBuiltins.h    |    2 +-
 clang/include/module.modulemap                |    2 -
 clang/lib/AST/Expr.cpp                        |    1 +
 clang/lib/AST/StmtPrinter.cpp                 |    2 +-
 clang/lib/Basic/Builtins.cpp                  |    2 +-
 clang/lib/Basic/Targets/BPF.cpp               |    2 +-
 clang/lib/Sema/OpenCLBuiltins.td              |   12 +-
 clang/lib/Sema/SemaChecking.cpp               |   20 +-
 clang/lib/Sema/SemaExpr.cpp                   |    2 +-
 clang/test/Analysis/bstring.c                 |   12 +-
 clang/test/CodeGen/callback_pthread_create.c  |    2 +-
 clang/utils/TableGen/CMakeLists.txt           |    1 +
 clang/utils/TableGen/ClangBuiltinsEmitter.cpp |  332 ++
 clang/utils/TableGen/MveEmitter.cpp           |    2 +-
 clang/utils/TableGen/TableGen.cpp             |    6 +
 clang/utils/TableGen/TableGenBackends.h       |    2 +
 24 files changed, 4921 insertions(+), 1745 deletions(-)
 create mode 100644 clang/include/clang/Basic/Builtins.td
 delete mode 100644 clang/include/clang/Basic/BuiltinsBPF.def
 create mode 100644 clang/include/clang/Basic/BuiltinsBPF.td
 create mode 100644 clang/include/clang/Basic/BuiltinsBase.td
 create mode 100644 clang/utils/TableGen/ClangBuiltinsEmitter.cpp

diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index fe20a84216d1f11..ec013dd0a2d2123 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -6420,7 +6420,7 @@ class AtomicExpr : public Expr {
   enum AtomicOp {
 #define BUILTIN(ID, TYPE, ATTRS)
 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) AO ## ID,
-#include "clang/Basic/Builtins.def"
+#include "clang/Basic/Builtins.inc"
     // Avoid trailing comma
     BI_First = 0
   };
@@ -6486,7 +6486,7 @@ class AtomicExpr : public Expr {
 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS)                                        \
   case AO##ID:                                                                 \
     return #ID;
-#include "clang/Basic/Builtins.def"
+#include "clang/Basic/Builtins.inc"
     }
     llvm_unreachable("not an atomic operator?");
   }
@@ -6513,8 +6513,8 @@ class AtomicExpr : public Expr {
   }
 
   bool isOpenCL() const {
-    return getOp() >= AO__opencl_atomic_init &&
-           getOp() <= AO__opencl_atomic_fetch_max;
+    return getOp() >= AO__opencl_atomic_compare_exchange_strong &&
+           getOp() <= AO__opencl_atomic_store;
   }
 
   SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
@@ -6539,12 +6539,13 @@ class AtomicExpr : public Expr {
   /// \return empty atomic scope model if the atomic op code does not have
   ///   scope operand.
   static std::unique_ptr<AtomicScopeModel> getScopeModel(AtomicOp Op) {
-    auto Kind =
-        (Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
-            ? AtomicScopeModelKind::OpenCL
-        : (Op >= AO__hip_atomic_load && Op <= AO__hip_atomic_fetch_max)
-            ? AtomicScopeModelKind::HIP
-            : AtomicScopeModelKind::None;
+    auto Kind = (Op >= AO__opencl_atomic_compare_exchange_strong &&
+                 Op <= AO__opencl_atomic_store)
+                    ? AtomicScopeModelKind::OpenCL
+                : (Op >= AO__hip_atomic_compare_exchange_strong &&
+                   Op <= AO__hip_atomic_store)
+                    ? AtomicScopeModelKind::HIP
+                    : AtomicScopeModelKind::None;
     return AtomicScopeModel::create(Kind);
   }
 
diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
index 586dcf05170eb58..f356f881d5ef9bc 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -5,17 +5,9 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
-//
-// This file defines the standard builtin function database.  Users of this file
-// must define the BUILTIN macro to make use of this information.
-//
-//===----------------------------------------------------------------------===//
 
-// FIXME: This should really be a .td file, but that requires modifying tblgen.
-// Perhaps tblgen should have plugins.
-
-// The first value provided to the macro specifies the function name of the
-// builtin, and results in a clang::builtin::BIXX enum value for XX.
+// This is only documentation for the database layout. This will be removed once
+// all builtin databases are converted to tablegen files
 
 // The second value provided to the macro specifies the type of the function
 // (result value, then each argument) as follows:
@@ -108,1663 +100,3 @@
 //                      M_0, ..., M_k as payload
 //  z -> this is a function in (possibly-versioned) namespace std
 //  E -> this function can be constant evaluated by Clang frontend
-//  FIXME: gcc has nonnull
-
-#if defined(BUILTIN) && !defined(LIBBUILTIN)
-#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
-#endif
-
-#if defined(BUILTIN) && !defined(LANGBUILTIN)
-#  define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
-#endif
-
-// Standard libc/libm functions:
-BUILTIN(__builtin_atan2 , "ddd"  , "Fne")
-BUILTIN(__builtin_atan2f, "fff"  , "Fne")
-BUILTIN(__builtin_atan2l, "LdLdLd", "Fne")
-BUILTIN(__builtin_atan2f128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_abs  , "ii"  , "ncF")
-BUILTIN(__builtin_copysign, "ddd", "ncFE")
-BUILTIN(__builtin_copysignf, "fff", "ncFE")
-BUILTIN(__builtin_copysignf16, "hhh", "ncF")
-BUILTIN(__builtin_copysignl, "LdLdLd", "ncFE")
-BUILTIN(__builtin_copysignf128, "LLdLLdLLd", "ncFE")
-BUILTIN(__builtin_fabs , "dd"  , "ncFE")
-BUILTIN(__builtin_fabsf, "ff"  , "ncFE")
-BUILTIN(__builtin_fabsl, "LdLd", "ncFE")
-BUILTIN(__builtin_fabsf16, "hh"  , "ncF")
-BUILTIN(__builtin_fabsf128, "LLdLLd", "ncFE")
-BUILTIN(__builtin_fmod , "ddd"  , "Fne")
-BUILTIN(__builtin_fmodf, "fff"  , "Fne")
-BUILTIN(__builtin_fmodf16, "hhh"  , "Fne")
-BUILTIN(__builtin_fmodl, "LdLdLd", "Fne")
-BUILTIN(__builtin_fmodf128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_frexp , "ddi*"  , "Fn")
-BUILTIN(__builtin_frexpf, "ffi*"  , "Fn")
-BUILTIN(__builtin_frexpl, "LdLdi*", "Fn")
-BUILTIN(__builtin_frexpf128, "LLdLLdi*", "Fn")
-BUILTIN(__builtin_frexpf16, "hhi*"  , "Fn")
-BUILTIN(__builtin_huge_val, "d", "ncE")
-BUILTIN(__builtin_huge_valf, "f", "ncE")
-BUILTIN(__builtin_huge_vall, "Ld", "ncE")
-BUILTIN(__builtin_huge_valf16, "x", "ncE")
-BUILTIN(__builtin_huge_valf128, "LLd", "ncE")
-BUILTIN(__builtin_inf  , "d"   , "ncE")
-BUILTIN(__builtin_inff , "f"   , "ncE")
-BUILTIN(__builtin_infl , "Ld"  , "ncE")
-BUILTIN(__builtin_inff16 , "x"  , "ncE")
-BUILTIN(__builtin_inff128 , "LLd"  , "ncE")
-BUILTIN(__builtin_labs , "LiLi"  , "Fnc")
-BUILTIN(__builtin_llabs, "LLiLLi", "Fnc")
-BUILTIN(__builtin_ldexp , "ddi"  , "Fne")
-BUILTIN(__builtin_ldexpf, "ffi"  , "Fne")
-BUILTIN(__builtin_ldexpl, "LdLdi", "Fne")
-BUILTIN(__builtin_ldexpf128, "LLdLLdi", "Fne")
-BUILTIN(__builtin_ldexpf16, "hhi", "Fne")
-BUILTIN(__builtin_modf , "ddd*"  , "Fn")
-BUILTIN(__builtin_modff, "fff*"  , "Fn")
-BUILTIN(__builtin_modfl, "LdLdLd*", "Fn")
-BUILTIN(__builtin_modff128, "LLdLLdLLd*", "Fn")
-BUILTIN(__builtin_nan,  "dcC*" , "FnUE")
-BUILTIN(__builtin_nanf, "fcC*" , "FnUE")
-BUILTIN(__builtin_nanl, "LdcC*", "FnUE")
-BUILTIN(__builtin_nanf16, "xcC*", "FnUE")
-BUILTIN(__builtin_nanf128, "LLdcC*", "FnUE")
-BUILTIN(__builtin_nans,  "dcC*" , "FnUE")
-BUILTIN(__builtin_nansf, "fcC*" , "FnUE")
-BUILTIN(__builtin_nansl, "LdcC*", "FnUE")
-BUILTIN(__builtin_nansf16, "xcC*", "FnUE")
-BUILTIN(__builtin_nansf128, "LLdcC*", "FnUE")
-BUILTIN(__builtin_powi , "ddi"  , "Fnc")
-BUILTIN(__builtin_powif, "ffi"  , "Fnc")
-BUILTIN(__builtin_powil, "LdLdi", "Fnc")
-BUILTIN(__builtin_pow , "ddd"  , "Fne")
-BUILTIN(__builtin_powf, "fff"  , "Fne")
-BUILTIN(__builtin_powf16, "hhh"  , "Fne")
-BUILTIN(__builtin_powl, "LdLdLd", "Fne")
-BUILTIN(__builtin_powf128, "LLdLLdLLd", "Fne")
-
-// Standard unary libc/libm functions with double/float/long double variants:
-BUILTIN(__builtin_acos , "dd"  , "Fne")
-BUILTIN(__builtin_acosf, "ff"  , "Fne")
-BUILTIN(__builtin_acosl, "LdLd", "Fne")
-BUILTIN(__builtin_acosf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_acosh , "dd"  , "Fne")
-BUILTIN(__builtin_acoshf, "ff"  , "Fne")
-BUILTIN(__builtin_acoshl, "LdLd", "Fne")
-BUILTIN(__builtin_acoshf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_asin , "dd"  , "Fne")
-BUILTIN(__builtin_asinf, "ff"  , "Fne")
-BUILTIN(__builtin_asinl, "LdLd", "Fne")
-BUILTIN(__builtin_asinf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_asinh , "dd"  , "Fne")
-BUILTIN(__builtin_asinhf, "ff"  , "Fne")
-BUILTIN(__builtin_asinhl, "LdLd", "Fne")
-BUILTIN(__builtin_asinhf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_atan , "dd"  , "Fne")
-BUILTIN(__builtin_atanf, "ff"  , "Fne")
-BUILTIN(__builtin_atanl, "LdLd", "Fne")
-BUILTIN(__builtin_atanf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_atanh , "dd", "Fne")
-BUILTIN(__builtin_atanhf, "ff", "Fne")
-BUILTIN(__builtin_atanhl, "LdLd", "Fne")
-BUILTIN(__builtin_atanhf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_cbrt , "dd", "Fnc")
-BUILTIN(__builtin_cbrtf, "ff", "Fnc")
-BUILTIN(__builtin_cbrtl, "LdLd", "Fnc")
-BUILTIN(__builtin_cbrtf128, "LLdLLd", "Fnc")
-BUILTIN(__builtin_ceil , "dd"  , "Fnc")
-BUILTIN(__builtin_ceilf, "ff"  , "Fnc")
-BUILTIN(__builtin_ceilf16, "hh"  , "Fnc")
-BUILTIN(__builtin_ceill, "LdLd", "Fnc")
-BUILTIN(__builtin_ceilf128, "LLdLLd", "Fnc")
-BUILTIN(__builtin_cos , "dd"  , "Fne")
-BUILTIN(__builtin_cosf, "ff"  , "Fne")
-BUILTIN(__builtin_cosf16, "hh"  , "Fne")
-BUILTIN(__builtin_cosh , "dd"  , "Fne")
-BUILTIN(__builtin_coshf, "ff"  , "Fne")
-BUILTIN(__builtin_coshl, "LdLd", "Fne")
-BUILTIN(__builtin_coshf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_cosl, "LdLd", "Fne")
-BUILTIN(__builtin_cosf128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_erf , "dd", "Fne")
-BUILTIN(__builtin_erff, "ff", "Fne")
-BUILTIN(__builtin_erfl, "LdLd", "Fne")
-BUILTIN(__builtin_erff128, "LLdLLd", "Fne")
-BUILTIN(__builtin_erfc , "dd", "Fne")
-BUILTIN(__builtin_erfcf, "ff", "Fne")
-BUILTIN(__builtin_erfcl, "LdLd", "Fne")
-BUILTIN(__builtin_erfcf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_exp , "dd"  , "Fne")
-BUILTIN(__builtin_expf, "ff"  , "Fne")
-BUILTIN(__builtin_expf16, "hh"  , "Fne")
-BUILTIN(__builtin_expl, "LdLd", "Fne")
-BUILTIN(__builtin_expf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_exp2 , "dd"  , "Fne")
-BUILTIN(__builtin_exp2f, "ff"  , "Fne")
-BUILTIN(__builtin_exp2f16, "hh"  , "Fne")
-BUILTIN(__builtin_exp2l, "LdLd", "Fne")
-BUILTIN(__builtin_exp2f128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_exp10 , "dd"  , "Fne")
-BUILTIN(__builtin_exp10f, "ff"  , "Fne")
-BUILTIN(__builtin_exp10f16, "hh"  , "Fne")
-BUILTIN(__builtin_exp10l, "LdLd", "Fne")
-BUILTIN(__builtin_exp10f128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_expm1 , "dd", "Fne")
-BUILTIN(__builtin_expm1f, "ff", "Fne")
-BUILTIN(__builtin_expm1l, "LdLd", "Fne")
-BUILTIN(__builtin_expm1f128, "LLdLLd", "Fne")
-BUILTIN(__builtin_fdim, "ddd", "Fne")
-BUILTIN(__builtin_fdimf, "fff", "Fne")
-BUILTIN(__builtin_fdiml, "LdLdLd", "Fne")
-BUILTIN(__builtin_fdimf128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_floor , "dd"  , "Fnc")
-BUILTIN(__builtin_floorf, "ff"  , "Fnc")
-BUILTIN(__builtin_floorf16, "hh"  , "Fnc")
-BUILTIN(__builtin_floorl, "LdLd", "Fnc")
-BUILTIN(__builtin_floorf128, "LLdLLd", "Fnc")
-BUILTIN(__builtin_fma, "dddd", "Fne")
-BUILTIN(__builtin_fmaf, "ffff", "Fne")
-BUILTIN(__builtin_fmaf16, "hhhh", "Fne")
-BUILTIN(__builtin_fmal, "LdLdLdLd", "Fne")
-BUILTIN(__builtin_fmaf128, "LLdLLdLLdLLd", "Fne")
-BUILTIN(__builtin_fmax, "ddd", "FncE")
-BUILTIN(__builtin_fmaxf, "fff", "FncE")
-BUILTIN(__builtin_fmaxf16, "hhh", "FncE")
-BUILTIN(__builtin_fmaxl, "LdLdLd", "FncE")
-BUILTIN(__builtin_fmaxf128, "LLdLLdLLd", "FncE")
-BUILTIN(__builtin_fmin, "ddd", "FncE")
-BUILTIN(__builtin_fminf, "fff", "FncE")
-BUILTIN(__builtin_fminf16, "hhh", "FncE")
-BUILTIN(__builtin_fminl, "LdLdLd", "FncE")
-BUILTIN(__builtin_fminf128, "LLdLLdLLd", "FncE")
-BUILTIN(__builtin_hypot , "ddd"  , "Fne")
-BUILTIN(__builtin_hypotf, "fff"  , "Fne")
-BUILTIN(__builtin_hypotl, "LdLdLd", "Fne")
-BUILTIN(__builtin_hypotf128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_ilogb , "id", "Fne")
-BUILTIN(__builtin_ilogbf, "if", "Fne")
-BUILTIN(__builtin_ilogbl, "iLd", "Fne")
-BUILTIN(__builtin_ilogbf128, "iLLd", "Fne")
-BUILTIN(__builtin_lgamma , "dd", "Fn")
-BUILTIN(__builtin_lgammaf, "ff", "Fn")
-BUILTIN(__builtin_lgammal, "LdLd", "Fn")
-BUILTIN(__builtin_lgammaf128, "LLdLLd", "Fn")
-BUILTIN(__builtin_llrint, "LLid", "Fne")
-BUILTIN(__builtin_llrintf, "LLif", "Fne")
-BUILTIN(__builtin_llrintl, "LLiLd", "Fne")
-BUILTIN(__builtin_llrintf128, "LLiLLd", "Fne")
-BUILTIN(__builtin_llround , "LLid", "Fne")
-BUILTIN(__builtin_llroundf, "LLif", "Fne")
-BUILTIN(__builtin_llroundl, "LLiLd", "Fne")
-BUILTIN(__builtin_llroundf128, "LLiLLd", "Fne")
-BUILTIN(__builtin_log , "dd"  , "Fne")
-BUILTIN(__builtin_log10 , "dd"  , "Fne")
-BUILTIN(__builtin_log10f, "ff"  , "Fne")
-BUILTIN(__builtin_log10f16, "hh"  , "Fne")
-BUILTIN(__builtin_log10l, "LdLd", "Fne")
-BUILTIN(__builtin_log10f128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_log1p , "dd"  , "Fne")
-BUILTIN(__builtin_log1pf, "ff"  , "Fne")
-BUILTIN(__builtin_log1pl, "LdLd", "Fne")
-BUILTIN(__builtin_log1pf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_log2, "dd"  , "Fne")
-BUILTIN(__builtin_log2f, "ff"  , "Fne")
-BUILTIN(__builtin_log2f16, "hh"  , "Fne")
-BUILTIN(__builtin_log2l, "LdLd"  , "Fne")
-BUILTIN(__builtin_log2f128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_logb , "dd", "Fne")
-BUILTIN(__builtin_logbf, "ff", "Fne")
-BUILTIN(__builtin_logbl, "LdLd", "Fne")
-BUILTIN(__builtin_logbf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_logf, "ff"  , "Fne")
-BUILTIN(__builtin_logf16, "hh"  , "Fne")
-BUILTIN(__builtin_logl, "LdLd", "Fne")
-BUILTIN(__builtin_logf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_lrint , "Lid", "Fne")
-BUILTIN(__builtin_lrintf, "Lif", "Fne")
-BUILTIN(__builtin_lrintl, "LiLd", "Fne")
-BUILTIN(__builtin_lrintf128, "LiLLd", "Fne")
-BUILTIN(__builtin_lround , "Lid", "Fne")
-BUILTIN(__builtin_lroundf, "Lif", "Fne")
-BUILTIN(__builtin_lroundl, "LiLd", "Fne")
-BUILTIN(__builtin_lroundf128, "LiLLd", "Fne")
-BUILTIN(__builtin_nearbyint , "dd", "Fnc")
-BUILTIN(__builtin_nearbyintf, "ff", "Fnc")
-BUILTIN(__builtin_nearbyintl, "LdLd", "Fnc")
-BUILTIN(__builtin_nearbyintf128, "LLdLLd", "Fnc")
-BUILTIN(__builtin_nextafter , "ddd", "Fne")
-BUILTIN(__builtin_nextafterf, "fff", "Fne")
-BUILTIN(__builtin_nextafterl, "LdLdLd", "Fne")
-BUILTIN(__builtin_nextafterf128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_nexttoward , "ddLd", "Fne")
-BUILTIN(__builtin_nexttowardf, "ffLd", "Fne")
-BUILTIN(__builtin_nexttowardl, "LdLdLd", "Fne")
-BUILTIN(__builtin_nexttowardf128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_remainder , "ddd", "Fne")
-BUILTIN(__builtin_remainderf, "fff", "Fne")
-BUILTIN(__builtin_remainderl, "LdLdLd", "Fne")
-BUILTIN(__builtin_remainderf128, "LLdLLdLLd", "Fne")
-BUILTIN(__builtin_remquo , "dddi*", "Fn")
-BUILTIN(__builtin_remquof, "fffi*", "Fn")
-BUILTIN(__builtin_remquol, "LdLdLdi*", "Fn")
-BUILTIN(__builtin_remquof128, "LLdLLdLLdi*", "Fn")
-BUILTIN(__builtin_rint , "dd", "Fnc")
-BUILTIN(__builtin_rintf, "ff", "Fnc")
-BUILTIN(__builtin_rintf16, "hh", "Fnc")
-BUILTIN(__builtin_rintl, "LdLd", "Fnc")
-BUILTIN(__builtin_rintf128, "LLdLLd", "Fnc")
-BUILTIN(__builtin_round, "dd"  , "Fnc")
-BUILTIN(__builtin_roundf, "ff"  , "Fnc")
-BUILTIN(__builtin_roundf16, "hh"  , "Fnc")
-BUILTIN(__builtin_roundl, "LdLd"  , "Fnc")
-BUILTIN(__builtin_roundf128, "LLdLLd"  , "Fnc")
-BUILTIN(__builtin_roundeven, "dd"  , "Fnc")
-BUILTIN(__builtin_roundevenf, "ff"  , "Fnc")
-BUILTIN(__builtin_roundevenf16, "hh"  , "Fnc")
-BUILTIN(__builtin_roundevenl, "LdLd"  , "Fnc")
-BUILTIN(__builtin_roundevenf128, "LLdLLd"  , "Fnc")
-BUILTIN(__builtin_scalbln , "ddLi", "Fne")
-BUILTIN(__builtin_scalblnf, "ffLi", "Fne")
-BUILTIN(__builtin_scalblnl, "LdLdLi", "Fne")
-BUILTIN(__builtin_scalblnf128, "LLdLLdLi", "Fne")
-BUILTIN(__builtin_scalbn , "ddi", "Fne")
-BUILTIN(__builtin_scalbnf, "ffi", "Fne")
-BUILTIN(__builtin_scalbnl, "LdLdi", "Fne")
-BUILTIN(__builtin_scalbnf128, "LLdLLdi", "Fne")
-BUILTIN(__builtin_sin , "dd"  , "Fne")
-BUILTIN(__builtin_sinf, "ff"  , "Fne")
-BUILTIN(__builtin_sinf16, "hh"  , "Fne")
-BUILTIN(__builtin_sinh , "dd"  , "Fne")
-BUILTIN(__builtin_sinhf, "ff"  , "Fne")
-BUILTIN(__builtin_sinhl, "LdLd", "Fne")
-BUILTIN(__builtin_sinhf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_sinl, "LdLd", "Fne")
-BUILTIN(__builtin_sinf128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_sqrt , "dd"  , "Fne")
-BUILTIN(__builtin_sqrtf, "ff"  , "Fne")
-BUILTIN(__builtin_sqrtf16, "hh"  , "Fne")
-BUILTIN(__builtin_sqrtl, "LdLd", "Fne")
-BUILTIN(__builtin_sqrtf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_tan , "dd"  , "Fne")
-BUILTIN(__builtin_tanf, "ff"  , "Fne")
-BUILTIN(__builtin_tanh , "dd"  , "Fne")
-BUILTIN(__builtin_tanhf, "ff"  , "Fne")
-BUILTIN(__builtin_tanhl, "LdLd", "Fne")
-BUILTIN(__builtin_tanhf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_tanl, "LdLd", "Fne")
-BUILTIN(__builtin_tanf128, "LLdLLd"  , "Fne")
-BUILTIN(__builtin_tgamma , "dd", "Fne")
-BUILTIN(__builtin_tgammaf, "ff", "Fne")
-BUILTIN(__builtin_tgammal, "LdLd", "Fne")
-BUILTIN(__builtin_tgammaf128, "LLdLLd", "Fne")
-BUILTIN(__builtin_trunc , "dd", "Fnc")
-BUILTIN(__builtin_truncf, "ff", "Fnc")
-BUILTIN(__builtin_truncl, "LdLd", "Fnc")
-BUILTIN(__builtin_truncf128, "LLdLLd", "Fnc")
-BUILTIN(__builtin_truncf16, "hh", "Fnc")
-
-// Access to floating point environment
-BUILTIN(__builtin_flt_rounds, "i", "n")
-BUILTIN(__builtin_set_flt_rounds, "vi", "n")
-
-// C99 complex builtins
-BUILTIN(__builtin_cabs, "dXd", "Fne")
-BUILTIN(__builtin_cabsf, "fXf", "Fne")
-BUILTIN(__builtin_cabsl, "LdXLd", "Fne")
-BUILTIN(__builtin_cacos, "XdXd", "Fne")
-BUILTIN(__builtin_cacosf, "XfXf", "Fne")
-BUILTIN(__builtin_cacosh, "XdXd", "Fne")
-BUILTIN(__builtin_cacoshf, "XfXf", "Fne")
-BUILTIN(__builtin_cacoshl, "XLdXLd", "Fne")
-BUILTIN(__builtin_cacosl, "XLdXLd", "Fne")
-BUILTIN(__builtin_carg, "dXd", "Fne")
-BUILTIN(__builtin_cargf, "fXf", "Fne")
-BUILTIN(__builtin_cargl, "LdXLd", "Fne")
-BUILTIN(__builtin_casin, "XdXd", "Fne")
-BUILTIN(__builtin_casinf, "XfXf", "Fne")
-BUILTIN(__builtin_casinh, "XdXd", "Fne")
-BUILTIN(__builtin_casinhf, "XfXf", "Fne")
-BUILTIN(__builtin_casinhl, "XLdXLd", "Fne")
-BUILTIN(__builtin_casinl, "XLdXLd", "Fne")
-BUILTIN(__builtin_catan, "XdXd", "Fne")
-BUILTIN(__builtin_catanf, "XfXf", "Fne")
-BUILTIN(__builtin_catanh, "XdXd", "Fne")
-BUILTIN(__builtin_catanhf, "XfXf", "Fne")
-BUILTIN(__builtin_catanhl, "XLdXLd", "Fne")
-BUILTIN(__builtin_catanl, "XLdXLd", "Fne")
-BUILTIN(__builtin_ccos, "XdXd", "Fne")
-BUILTIN(__builtin_ccosf, "XfXf", "Fne")
-BUILTIN(__builtin_ccosl, "XLdXLd", "Fne")
-BUILTIN(__builtin_ccosh, "XdXd", "Fne")
-BUILTIN(__builtin_ccoshf, "XfXf", "Fne")
-BUILTIN(__builtin_ccoshl, "XLdXLd", "Fne")
-BUILTIN(__builtin_cexp, "XdXd", "Fne")
-BUILTIN(__builtin_cexpf, "XfXf", "Fne")
-BUILTIN(__builtin_cexpl, "XLdXLd", "Fne")
-BUILTIN(__builtin_cimag, "dXd", "Fnc")
-BUILTIN(__builtin_cimagf, "fXf", "Fnc")
-BUILTIN(__builtin_cimagl, "LdXLd", "Fnc")
-BUILTIN(__builtin_conj, "XdXd", "Fnc")
-BUILTIN(__builtin_conjf, "XfXf", "Fnc")
-BUILTIN(__builtin_conjl, "XLdXLd", "Fnc")
-BUILTIN(__builtin_clog, "XdXd", "Fne")
-BUILTIN(__builtin_clogf, "XfXf", "Fne")
-BUILTIN(__builtin_clogl, "XLdXLd", "Fne")
-BUILTIN(__builtin_cproj, "XdXd", "Fnc")
-BUILTIN(__builtin_cprojf, "XfXf", "Fnc")
-BUILTIN(__builtin_cprojl, "XLdXLd", "Fnc")
-BUILTIN(__builtin_cpow, "XdXdXd", "Fne")
-BUILTIN(__builtin_cpowf, "XfXfXf", "Fne")
-BUILTIN(__builtin_cpowl, "XLdXLdXLd", "Fne")
-BUILTIN(__builtin_creal, "dXd", "Fnc")
-BUILTIN(__builtin_crealf, "fXf", "Fnc")
-BUILTIN(__builtin_creall, "LdXLd", "Fnc")
-BUILTIN(__builtin_csin, "XdXd", "Fne")
-BUILTIN(__builtin_csinf, "XfXf", "Fne")
-BUILTIN(__builtin_csinl, "XLdXLd", "Fne")
-BUILTIN(__builtin_csinh, "XdXd", "Fne")
-BUILTIN(__builtin_csinhf, "XfXf", "Fne")
-BUILTIN(__builtin_csinhl, "XLdXLd", "Fne")
-BUILTIN(__builtin_csqrt, "XdXd", "Fne")
-BUILTIN(__builtin_csqrtf, "XfXf", "Fne")
-BUILTIN(__builtin_csqrtl, "XLdXLd", "Fne")
-BUILTIN(__builtin_ctan, "XdXd", "Fne")
-BUILTIN(__builtin_ctanf, "XfXf", "Fne")
-BUILTIN(__builtin_ctanl, "XLdXLd", "Fne")
-BUILTIN(__builtin_ctanh, "XdXd", "Fne")
-BUILTIN(__builtin_ctanhf, "XfXf", "Fne")
-BUILTIN(__builtin_ctanhl, "XLdXLd", "Fne")
-
-// GCC-compatible C99 CMPLX implementation.
-BUILTIN(__builtin_complex, "v.", "nctE")
-
-// FP Comparisons.
-BUILTIN(__builtin_isgreater     , "i.", "Fnct")
-BUILTIN(__builtin_isgreaterequal, "i.", "Fnct")
-BUILTIN(__builtin_isless        , "i.", "Fnct")
-BUILTIN(__builtin_islessequal   , "i.", "Fnct")
-BUILTIN(__builtin_islessgreater , "i.", "Fnct")
-BUILTIN(__builtin_isunordered   , "i.", "Fnct")
-
-// Unary FP classification
-BUILTIN(__builtin_fpclassify, "iiiiii.", "FnctE")
-BUILTIN(__builtin_isfinite,   "i.", "FnctE")
-BUILTIN(__builtin_isinf,      "i.", "FnctE")
-BUILTIN(__builtin_isinf_sign, "i.", "FnctE")
-BUILTIN(__builtin_isnan,      "i.", "FnctE")
-BUILTIN(__builtin_isnormal,   "i.", "FnctE")
-BUILTIN(__builtin_isfpclass,  "i.", "nctE")
-
-// FP signbit builtins
-BUILTIN(__builtin_signbit, "i.", "Fnct")
-BUILTIN(__builtin_signbitf, "if", "Fnc")
-BUILTIN(__builtin_signbitl, "iLd", "Fnc")
-
-// Special FP builtins.
-BUILTIN(__builtin_canonicalize, "dd", "nc")
-BUILTIN(__builtin_canonicalizef, "ff", "nc")
-BUILTIN(__builtin_canonicalizef16, "hh", "nc")
-BUILTIN(__builtin_canonicalizel, "LdLd", "nc")
-
-// Builtins for arithmetic.
-BUILTIN(__builtin_clzs , "iUs"  , "ncE")
-BUILTIN(__builtin_clz  , "iUi"  , "ncE")
-BUILTIN(__builtin_clzl , "iULi" , "ncE")
-BUILTIN(__builtin_clzll, "iULLi", "ncE")
-// TODO: int clzimax(uintmax_t)
-BUILTIN(__builtin_ctzs , "iUs"  , "ncE")
-BUILTIN(__builtin_ctz  , "iUi"  , "ncE")
-BUILTIN(__builtin_ctzl , "iULi" , "ncE")
-BUILTIN(__builtin_ctzll, "iULLi", "ncE")
-// TODO: int ctzimax(uintmax_t)
-BUILTIN(__builtin_ffs  , "ii"  , "FncE")
-BUILTIN(__builtin_ffsl , "iLi" , "FncE")
-BUILTIN(__builtin_ffsll, "iLLi", "FncE")
-BUILTIN(__builtin_parity  , "iUi"  , "ncE")
-BUILTIN(__builtin_parityl , "iULi" , "ncE")
-BUILTIN(__builtin_parityll, "iULLi", "ncE")
-BUILTIN(__builtin_popcount  , "iUi"  , "ncE")
-BUILTIN(__builtin_popcountl , "iULi" , "ncE")
-BUILTIN(__builtin_popcountll, "iULLi", "ncE")
-BUILTIN(__builtin_clrsb  , "ii"  , "ncE")
-BUILTIN(__builtin_clrsbl , "iLi" , "ncE")
-BUILTIN(__builtin_clrsbll, "iLLi", "ncE")
-
-// The following builtins rely on that char == 8 bits, short == 16 bits and that
-// there exists native types on the target that are 32- and 64-bits wide, unless
-// these conditions are fulfilled these builtins will operate on a not intended
-// bitwidth.
-BUILTIN(__builtin_bswap16, "UsUs", "ncE")
-BUILTIN(__builtin_bswap32, "UZiUZi", "ncE")
-BUILTIN(__builtin_bswap64, "UWiUWi", "ncE")
-
-BUILTIN(__builtin_bitreverse8, "UcUc", "ncE")
-BUILTIN(__builtin_bitreverse16, "UsUs", "ncE")
-BUILTIN(__builtin_bitreverse32, "UZiUZi", "ncE")
-BUILTIN(__builtin_bitreverse64, "UWiUWi", "ncE")
-
-BUILTIN(__builtin_rotateleft8, "UcUcUc", "ncE")
-BUILTIN(__builtin_rotateleft16, "UsUsUs", "ncE")
-BUILTIN(__builtin_rotateleft32, "UZiUZiUZi", "ncE")
-BUILTIN(__builtin_rotateleft64, "UWiUWiUWi", "ncE")
-BUILTIN(__builtin_rotateright8, "UcUcUc", "ncE")
-BUILTIN(__builtin_rotateright16, "UsUsUs", "ncE")
-BUILTIN(__builtin_rotateright32, "UZiUZiUZi", "ncE")
-BUILTIN(__builtin_rotateright64, "UWiUWiUWi", "ncE")
-
-// Random GCC builtins
-BUILTIN(__builtin_calloc, "v*zz", "nF")
-BUILTIN(__builtin_constant_p, "i.", "nctuE")
-BUILTIN(__builtin_classify_type, "i.", "nctuE")
-BUILTIN(__builtin___CFStringMakeConstantString, "FC*cC*", "ncE")
-BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "ncE")
-BUILTIN(__builtin_va_start, "vA.", "nt")
-BUILTIN(__builtin_va_end, "vA", "n")
-BUILTIN(__builtin_va_copy, "vAA", "n")
-BUILTIN(__builtin_stdarg_start, "vA.", "nt")
-BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nctE")
-BUILTIN(__builtin_bcmp, "ivC*vC*z", "FnE")
-BUILTIN(__builtin_bcopy, "vv*v*z", "n")
-BUILTIN(__builtin_bzero, "vv*z", "nF")
-BUILTIN(__builtin_free, "vv*", "nF")
-BUILTIN(__builtin_malloc, "v*z", "nF")
-BUILTIN(__builtin_memchr, "v*vC*iz", "nFE")
-BUILTIN(__builtin_memcmp, "ivC*vC*z", "nFE")
-BUILTIN(__builtin_memcpy, "v*v*vC*z", "nFE")
-BUILTIN(__builtin_memcpy_inline, "vv*vC*Iz", "n")
-BUILTIN(__builtin_memmove, "v*v*vC*z", "nFE")
-BUILTIN(__builtin_mempcpy, "v*v*vC*z", "nF")
-BUILTIN(__builtin_memset, "v*v*iz", "nF")
-BUILTIN(__builtin_memset_inline, "vv*iIz", "n")
-BUILTIN(__builtin_stpcpy, "c*c*cC*", "nF")
-BUILTIN(__builtin_stpncpy, "c*c*cC*z", "nF")
-BUILTIN(__builtin_strcasecmp, "icC*cC*", "nF")
-BUILTIN(__builtin_strcat, "c*c*cC*", "nF")
-BUILTIN(__builtin_strchr, "c*cC*i", "nFE")
-BUILTIN(__builtin_strcmp, "icC*cC*", "nFE")
-BUILTIN(__builtin_strcpy, "c*c*cC*", "nF")
-BUILTIN(__builtin_strcspn, "zcC*cC*", "nF")
-BUILTIN(__builtin_strdup, "c*cC*", "nF")
-BUILTIN(__builtin_strlen, "zcC*", "nFE")
-BUILTIN(__builtin_strncasecmp, "icC*cC*z", "nF")
-BUILTIN(__builtin_strncat, "c*c*cC*z", "nF")
-BUILTIN(__builtin_strncmp, "icC*cC*z", "nFE")
-BUILTIN(__builtin_strncpy, "c*c*cC*z", "nF")
-BUILTIN(__builtin_strndup, "c*cC*z", "nF")
-BUILTIN(__builtin_strpbrk, "c*cC*cC*", "nF")
-BUILTIN(__builtin_strrchr, "c*cC*i", "nF")
-BUILTIN(__builtin_strspn, "zcC*cC*", "nF")
-BUILTIN(__builtin_strstr, "c*cC*cC*", "nF")
-BUILTIN(__builtin_wcschr, "w*wC*w", "nFE")
-BUILTIN(__builtin_wcscmp, "iwC*wC*", "nFE")
-BUILTIN(__builtin_wcslen, "zwC*", "nFE")
-BUILTIN(__builtin_wcsncmp, "iwC*wC*z", "nFE")
-BUILTIN(__builtin_wmemchr, "w*wC*wz", "nFE")
-BUILTIN(__builtin_wmemcmp, "iwC*wC*z", "nFE")
-BUILTIN(__builtin_wmemcpy, "w*w*wC*z", "nFE")
-BUILTIN(__builtin_wmemmove, "w*w*wC*z", "nFE")
-BUILTIN(__builtin_realloc, "v*v*z", "nF")
-BUILTIN(__builtin_return_address, "v*IUi", "n")
-BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
-BUILTIN(__builtin_frame_address, "v*IUi", "n")
-BUILTIN(__builtin___clear_cache, "vc*c*", "n")
-BUILTIN(__builtin_setjmp, "iv**", "j")
-BUILTIN(__builtin_longjmp, "vv**i", "r")
-BUILTIN(__builtin_unwind_init, "v", "")
-BUILTIN(__builtin_eh_return_data_regno, "iIi", "ncE")
-BUILTIN(__builtin_fprintf, "iP*RcC*R.", "nFp:1:")
-BUILTIN(__builtin_printf, "icC*R.", "nFp:0:")
-BUILTIN(__builtin_sprintf, "ic*RcC*R.", "nFp:1:")
-BUILTIN(__builtin_snprintf, "ic*RzcC*R.", "nFp:2:")
-BUILTIN(__builtin_vprintf, "icC*Ra", "nFP:0:")
-BUILTIN(__builtin_vfprintf, "iP*RcC*Ra", "nFP:1:")
-BUILTIN(__builtin_vsprintf, "ic*RcC*Ra", "nFP:1:")
-BUILTIN(__builtin_vsnprintf, "ic*RzcC*Ra", "nFP:2:")
-BUILTIN(__builtin_fscanf, "iP*RcC*R.", "Fs:1:")
-BUILTIN(__builtin_scanf, "icC*R.", "Fs:0:")
-BUILTIN(__builtin_sscanf, "icC*RcC*R.", "Fs:1:")
-BUILTIN(__builtin_vfscanf, "iP*RcC*Ra", "FS:1:")
-BUILTIN(__builtin_vscanf, "icC*Ra", "FS:0:")
-BUILTIN(__builtin_vsscanf, "icC*RcC*Ra", "FS:1:")
-BUILTIN(__builtin_thread_pointer, "v*", "nc")
-BUILTIN(__builtin_launder, "v*v*", "ntE")
-LANGBUILTIN(__builtin_is_constant_evaluated, "b", "nE", CXX_LANG)
-
-// GCC exception builtins
-BUILTIN(__builtin_eh_return, "vzv*", "r") // FIXME: Takes intptr_t, not size_t!
-BUILTIN(__builtin_frob_return_addr, "v*v*", "n")
-BUILTIN(__builtin_dwarf_cfa, "v*", "n")
-BUILTIN(__builtin_init_dwarf_reg_size_table, "vv*", "n")
-BUILTIN(__builtin_dwarf_sp_column, "Ui", "n")
-BUILTIN(__builtin_extend_pointer, "ULLiv*", "n") // _Unwind_Word == uint64_t
-
-// GCC Object size checking builtins
-BUILTIN(__builtin_object_size, "zvC*i", "nuE")
-BUILTIN(__builtin_dynamic_object_size, "zvC*i", "nuE") // Clang only.
-BUILTIN(__builtin___memcpy_chk, "v*v*vC*zz", "nF")
-BUILTIN(__builtin___memccpy_chk, "v*v*vC*izz", "nF")
-BUILTIN(__builtin___memmove_chk, "v*v*vC*zz", "nF")
-BUILTIN(__builtin___mempcpy_chk, "v*v*vC*zz", "nF")
-BUILTIN(__builtin___memset_chk, "v*v*izz", "nF")
-BUILTIN(__builtin___stpcpy_chk, "c*c*cC*z", "nF")
-BUILTIN(__builtin___strcat_chk, "c*c*cC*z", "nF")
-BUILTIN(__builtin___strcpy_chk, "c*c*cC*z", "nF")
-BUILTIN(__builtin___strlcat_chk, "zc*cC*zz", "nF")
-BUILTIN(__builtin___strlcpy_chk, "zc*cC*zz", "nF")
-BUILTIN(__builtin___strncat_chk, "c*c*cC*zz", "nF")
-BUILTIN(__builtin___strncpy_chk, "c*c*cC*zz", "nF")
-BUILTIN(__builtin___stpncpy_chk, "c*c*cC*zz", "nF")
-BUILTIN(__builtin___snprintf_chk, "ic*RzizcC*R.", "Fp:4:")
-BUILTIN(__builtin___sprintf_chk, "ic*RizcC*R.", "Fp:3:")
-BUILTIN(__builtin___vsnprintf_chk, "ic*RzizcC*Ra", "FP:4:")
-BUILTIN(__builtin___vsprintf_chk, "ic*RizcC*Ra", "FP:3:")
-BUILTIN(__builtin___fprintf_chk, "iP*RicC*R.", "Fp:2:")
-BUILTIN(__builtin___printf_chk, "iicC*R.", "Fp:1:")
-BUILTIN(__builtin___vfprintf_chk, "iP*RicC*Ra", "FP:2:")
-BUILTIN(__builtin___vprintf_chk, "iicC*Ra", "FP:1:")
-
-BUILTIN(__builtin_unpredictable, "LiLi"   , "nc")
-BUILTIN(__builtin_expect, "LiLiLi"   , "ncE")
-BUILTIN(__builtin_expect_with_probability, "LiLiLid", "ncE")
-BUILTIN(__builtin_prefetch, "vvC*.", "nc")
-BUILTIN(__builtin_readcyclecounter, "ULLi", "n")
-BUILTIN(__builtin_trap, "v", "nr")
-BUILTIN(__builtin_debugtrap, "v", "n")
-BUILTIN(__builtin_unreachable, "v", "nr")
-BUILTIN(__builtin_shufflevector, "v."   , "nct")
-BUILTIN(__builtin_convertvector, "v."   , "nct")
-BUILTIN(__builtin_alloca, "v*z"   , "Fn")
-BUILTIN(__builtin_alloca_uninitialized, "v*z", "Fn")
-BUILTIN(__builtin_alloca_with_align, "v*zIz", "Fn")
-BUILTIN(__builtin_alloca_with_align_uninitialized, "v*zIz", "Fn")
-BUILTIN(__builtin_call_with_static_chain, "v.", "nt")
-BUILTIN(__builtin_nondeterministic_value, "v.", "nt")
-
-BUILTIN(__builtin_elementwise_abs, "v.", "nct")
-BUILTIN(__builtin_elementwise_bitreverse, "v.", "nct")
-BUILTIN(__builtin_elementwise_max, "v.", "nct")
-BUILTIN(__builtin_elementwise_min, "v.", "nct")
-BUILTIN(__builtin_elementwise_ceil, "v.", "nct")
-BUILTIN(__builtin_elementwise_cos, "v.", "nct")
-BUILTIN(__builtin_elementwise_exp, "v.", "nct")
-BUILTIN(__builtin_elementwise_exp2, "v.", "nct")
-BUILTIN(__builtin_elementwise_floor, "v.", "nct")
-BUILTIN(__builtin_elementwise_log, "v.", "nct")
-BUILTIN(__builtin_elementwise_log2, "v.", "nct")
-BUILTIN(__builtin_elementwise_log10, "v.", "nct")
-BUILTIN(__builtin_elementwise_pow, "v.", "nct")
-BUILTIN(__builtin_elementwise_roundeven, "v.", "nct")
-BUILTIN(__builtin_elementwise_round, "v.", "nct")
-BUILTIN(__builtin_elementwise_rint, "v.", "nct")
-BUILTIN(__builtin_elementwise_nearbyint, "v.", "nct")
-BUILTIN(__builtin_elementwise_sin, "v.", "nct")
-BUILTIN(__builtin_elementwise_sqrt, "v.", "nct")
-BUILTIN(__builtin_elementwise_trunc, "v.", "nct")
-BUILTIN(__builtin_elementwise_canonicalize, "v.", "nct")
-BUILTIN(__builtin_elementwise_copysign, "v.", "nct")
-BUILTIN(__builtin_elementwise_fma, "v.", "nct")
-BUILTIN(__builtin_elementwise_add_sat, "v.", "nct")
-BUILTIN(__builtin_elementwise_sub_sat, "v.", "nct")
-BUILTIN(__builtin_reduce_max, "v.", "nct")
-BUILTIN(__builtin_reduce_min, "v.", "nct")
-BUILTIN(__builtin_reduce_xor, "v.", "nct")
-BUILTIN(__builtin_reduce_or, "v.", "nct")
-BUILTIN(__builtin_reduce_and, "v.", "nct")
-BUILTIN(__builtin_reduce_add, "v.", "nct")
-BUILTIN(__builtin_reduce_mul, "v.", "nct")
-
-BUILTIN(__builtin_matrix_transpose, "v.", "nFt")
-BUILTIN(__builtin_matrix_column_major_load, "v.", "nFt")
-BUILTIN(__builtin_matrix_column_major_store, "v.", "nFt")
-
-// "Overloaded" Atomic operator builtins.  These are overloaded to support data
-// types of i8, i16, i32, i64, and i128.  The front-end sees calls to the
-// non-suffixed version of these (which has a bogus type) and transforms them to
-// the right overloaded version in Sema (plus casts).
-
-// FIXME: These assume that char -> i8, short -> i16, int -> i32,
-// long long -> i64.
-
-BUILTIN(__sync_fetch_and_add, "v.", "t")
-BUILTIN(__sync_fetch_and_add_1, "ccD*c.", "nt")
-BUILTIN(__sync_fetch_and_add_2, "ssD*s.", "nt")
-BUILTIN(__sync_fetch_and_add_4, "iiD*i.", "nt")
-BUILTIN(__sync_fetch_and_add_8, "LLiLLiD*LLi.", "nt")
-BUILTIN(__sync_fetch_and_add_16, "LLLiLLLiD*LLLi.", "nt")
-
-BUILTIN(__sync_fetch_and_sub, "v.", "t")
-BUILTIN(__sync_fetch_and_sub_1, "ccD*c.", "nt")
-BUILTIN(__sync_fetch_and_sub_2, "ssD*s.", "nt")
-BUILTIN(__sync_fetch_and_sub_4, "iiD*i.", "nt")
-BUILTIN(__sync_fetch_and_sub_8, "LLiLLiD*LLi.", "nt")
-BUILTIN(__sync_fetch_and_sub_16, "LLLiLLLiD*LLLi.", "nt")
-
-BUILTIN(__sync_fetch_and_or, "v.", "t")
-BUILTIN(__sync_fetch_and_or_1, "ccD*c.", "nt")
-BUILTIN(__sync_fetch_and_or_2, "ssD*s.", "nt")
-BUILTIN(__sync_fetch_and_or_4, "iiD*i.", "nt")
-BUILTIN(__sync_fetch_and_or_8, "LLiLLiD*LLi.", "nt")
-BUILTIN(__sync_fetch_and_or_16, "LLLiLLLiD*LLLi.", "nt")
-
-BUILTIN(__sync_fetch_and_and, "v.", "t")
-BUILTIN(__sync_fetch_and_and_1, "ccD*c.", "tn")
-BUILTIN(__sync_fetch_and_and_2, "ssD*s.", "tn")
-BUILTIN(__sync_fetch_and_and_4, "iiD*i.", "tn")
-BUILTIN(__sync_fetch_and_and_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_fetch_and_and_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_fetch_and_xor, "v.", "t")
-BUILTIN(__sync_fetch_and_xor_1, "ccD*c.", "tn")
-BUILTIN(__sync_fetch_and_xor_2, "ssD*s.", "tn")
-BUILTIN(__sync_fetch_and_xor_4, "iiD*i.", "tn")
-BUILTIN(__sync_fetch_and_xor_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_fetch_and_xor_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_fetch_and_nand, "v.", "t")
-BUILTIN(__sync_fetch_and_nand_1, "ccD*c.", "tn")
-BUILTIN(__sync_fetch_and_nand_2, "ssD*s.", "tn")
-BUILTIN(__sync_fetch_and_nand_4, "iiD*i.", "tn")
-BUILTIN(__sync_fetch_and_nand_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_fetch_and_nand_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_add_and_fetch, "v.", "t")
-BUILTIN(__sync_add_and_fetch_1, "ccD*c.", "tn")
-BUILTIN(__sync_add_and_fetch_2, "ssD*s.", "tn")
-BUILTIN(__sync_add_and_fetch_4, "iiD*i.", "tn")
-BUILTIN(__sync_add_and_fetch_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_add_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_sub_and_fetch, "v.", "t")
-BUILTIN(__sync_sub_and_fetch_1, "ccD*c.", "tn")
-BUILTIN(__sync_sub_and_fetch_2, "ssD*s.", "tn")
-BUILTIN(__sync_sub_and_fetch_4, "iiD*i.", "tn")
-BUILTIN(__sync_sub_and_fetch_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_sub_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_or_and_fetch, "v.", "t")
-BUILTIN(__sync_or_and_fetch_1, "ccD*c.", "tn")
-BUILTIN(__sync_or_and_fetch_2, "ssD*s.", "tn")
-BUILTIN(__sync_or_and_fetch_4, "iiD*i.", "tn")
-BUILTIN(__sync_or_and_fetch_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_or_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_and_and_fetch, "v.", "t")
-BUILTIN(__sync_and_and_fetch_1, "ccD*c.", "tn")
-BUILTIN(__sync_and_and_fetch_2, "ssD*s.", "tn")
-BUILTIN(__sync_and_and_fetch_4, "iiD*i.", "tn")
-BUILTIN(__sync_and_and_fetch_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_and_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_xor_and_fetch, "v.", "t")
-BUILTIN(__sync_xor_and_fetch_1, "ccD*c.", "tn")
-BUILTIN(__sync_xor_and_fetch_2, "ssD*s.", "tn")
-BUILTIN(__sync_xor_and_fetch_4, "iiD*i.", "tn")
-BUILTIN(__sync_xor_and_fetch_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_xor_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_nand_and_fetch, "v.", "t")
-BUILTIN(__sync_nand_and_fetch_1, "ccD*c.", "tn")
-BUILTIN(__sync_nand_and_fetch_2, "ssD*s.", "tn")
-BUILTIN(__sync_nand_and_fetch_4, "iiD*i.", "tn")
-BUILTIN(__sync_nand_and_fetch_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_nand_and_fetch_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_bool_compare_and_swap, "v.", "t")
-BUILTIN(__sync_bool_compare_and_swap_1, "bcD*cc.", "tn")
-BUILTIN(__sync_bool_compare_and_swap_2, "bsD*ss.", "tn")
-BUILTIN(__sync_bool_compare_and_swap_4, "biD*ii.", "tn")
-BUILTIN(__sync_bool_compare_and_swap_8, "bLLiD*LLiLLi.", "tn")
-BUILTIN(__sync_bool_compare_and_swap_16, "bLLLiD*LLLiLLLi.", "tn")
-
-BUILTIN(__sync_val_compare_and_swap, "v.", "t")
-BUILTIN(__sync_val_compare_and_swap_1, "ccD*cc.", "tn")
-BUILTIN(__sync_val_compare_and_swap_2, "ssD*ss.", "tn")
-BUILTIN(__sync_val_compare_and_swap_4, "iiD*ii.", "tn")
-BUILTIN(__sync_val_compare_and_swap_8, "LLiLLiD*LLiLLi.", "tn")
-BUILTIN(__sync_val_compare_and_swap_16, "LLLiLLLiD*LLLiLLLi.", "tn")
-
-BUILTIN(__sync_lock_test_and_set, "v.", "t")
-BUILTIN(__sync_lock_test_and_set_1, "ccD*c.", "tn")
-BUILTIN(__sync_lock_test_and_set_2, "ssD*s.", "tn")
-BUILTIN(__sync_lock_test_and_set_4, "iiD*i.", "tn")
-BUILTIN(__sync_lock_test_and_set_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_lock_test_and_set_16, "LLLiLLLiD*LLLi.", "tn")
-
-BUILTIN(__sync_lock_release, "v.", "t")
-BUILTIN(__sync_lock_release_1, "vcD*.", "tn")
-BUILTIN(__sync_lock_release_2, "vsD*.", "tn")
-BUILTIN(__sync_lock_release_4, "viD*.", "tn")
-BUILTIN(__sync_lock_release_8, "vLLiD*.", "tn")
-BUILTIN(__sync_lock_release_16, "vLLLiD*.", "tn")
-
-BUILTIN(__sync_swap, "v.", "t")
-BUILTIN(__sync_swap_1, "ccD*c.", "tn")
-BUILTIN(__sync_swap_2, "ssD*s.", "tn")
-BUILTIN(__sync_swap_4, "iiD*i.", "tn")
-BUILTIN(__sync_swap_8, "LLiLLiD*LLi.", "tn")
-BUILTIN(__sync_swap_16, "LLLiLLLiD*LLLi.", "tn")
-
-// Some of our atomics builtins are handled by AtomicExpr rather than
-// as normal builtin CallExprs. This macro is used for such builtins.
-#ifndef ATOMIC_BUILTIN
-#define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS)
-#endif
-
-// C11 _Atomic operations for <stdatomic.h>.
-ATOMIC_BUILTIN(__c11_atomic_init, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_load, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_store, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_exchange, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_compare_exchange_strong, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_compare_exchange_weak, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_add, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_sub, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_and, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_or, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_xor, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_nand, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_max, "v.", "t")
-ATOMIC_BUILTIN(__c11_atomic_fetch_min, "v.", "t")
-BUILTIN(__c11_atomic_thread_fence, "vi", "n")
-BUILTIN(__c11_atomic_signal_fence, "vi", "n")
-BUILTIN(__c11_atomic_is_lock_free, "bz", "nE")
-
-// GNU atomic builtins.
-ATOMIC_BUILTIN(__atomic_load, "v.", "t")
-ATOMIC_BUILTIN(__atomic_load_n, "v.", "t")
-ATOMIC_BUILTIN(__atomic_store, "v.", "t")
-ATOMIC_BUILTIN(__atomic_store_n, "v.", "t")
-ATOMIC_BUILTIN(__atomic_exchange, "v.", "t")
-ATOMIC_BUILTIN(__atomic_exchange_n, "v.", "t")
-ATOMIC_BUILTIN(__atomic_compare_exchange, "v.", "t")
-ATOMIC_BUILTIN(__atomic_compare_exchange_n, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_add, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_sub, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_and, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_or, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_xor, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_nand, "v.", "t")
-ATOMIC_BUILTIN(__atomic_add_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_sub_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_and_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_or_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_xor_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_max_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_min_fetch, "v.", "t")
-ATOMIC_BUILTIN(__atomic_nand_fetch, "v.", "t")
-BUILTIN(__atomic_test_and_set, "bvD*i", "n")
-BUILTIN(__atomic_clear, "vvD*i", "n")
-BUILTIN(__atomic_thread_fence, "vi", "n")
-BUILTIN(__atomic_signal_fence, "vi", "n")
-BUILTIN(__atomic_always_lock_free, "bzvCD*", "nE")
-BUILTIN(__atomic_is_lock_free, "bzvCD*", "nE")
-
-// OpenCL 2.0 atomic builtins.
-ATOMIC_BUILTIN(__opencl_atomic_init, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_load, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_store, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_exchange, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_compare_exchange_strong, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_compare_exchange_weak, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_add, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_sub, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_and, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_or, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_xor, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_min, "v.", "t")
-ATOMIC_BUILTIN(__opencl_atomic_fetch_max, "v.", "t")
-
-// GCC does not support these, they are a Clang extension.
-ATOMIC_BUILTIN(__atomic_fetch_min, "v.", "t")
-ATOMIC_BUILTIN(__atomic_fetch_max, "v.", "t")
-
-// HIP atomic builtins.
-ATOMIC_BUILTIN(__hip_atomic_load, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_store, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_compare_exchange_weak, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_compare_exchange_strong, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_exchange, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_add, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_sub, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_and, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_or, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_xor, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_min, "v.", "t")
-ATOMIC_BUILTIN(__hip_atomic_fetch_max, "v.", "t")
-
-#undef ATOMIC_BUILTIN
-
-// Non-overloaded atomic builtins.
-BUILTIN(__sync_synchronize, "v", "n")
-// GCC does not support these, they are a Clang extension.
-BUILTIN(__sync_fetch_and_min, "iiD*i", "n")
-BUILTIN(__sync_fetch_and_max, "iiD*i", "n")
-BUILTIN(__sync_fetch_and_umin, "UiUiD*Ui", "n")
-BUILTIN(__sync_fetch_and_umax, "UiUiD*Ui", "n")
-
-// Random libc builtins.
-BUILTIN(__builtin_abort, "v", "Fnr")
-BUILTIN(__builtin_index, "c*cC*i", "Fn")
-BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
-
-// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
-BUILTIN(__warn_memset_zero_len, "v", "nU")
-
-// Microsoft builtins.  These are only active with -fms-extensions.
-LANGBUILTIN(_alloca,          "v*z", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__annotation,     "wC*.","n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__assume,         "vb",  "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittest,                "UcNiC*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittestandcomplement,   "UcNi*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittestandreset,        "UcNi*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittestandset,          "UcNi*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittest64,              "UcWiC*Wi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittestandcomplement64, "UcWi*Wi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittestandreset64,      "UcWi*Wi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_bittestandset64,        "UcWi*Wi", "n", ALL_MS_LANGUAGES)
-LIBBUILTIN(_byteswap_ushort, "UsUs",     "fnc", STDLIB_H, ALL_MS_LANGUAGES)
-LIBBUILTIN(_byteswap_ulong,  "UNiUNi",   "fnc", STDLIB_H, ALL_MS_LANGUAGES)
-LIBBUILTIN(_byteswap_uint64, "ULLiULLi", "fnc", STDLIB_H, ALL_MS_LANGUAGES)
-LANGBUILTIN(__debugbreak,     "v",   "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__exception_code, "UNi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_exception_code,  "UNi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__exception_info, "v*",  "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_exception_info,  "v*",  "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__abnormal_termination, "i", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_abnormal_termination,  "i", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__GetExceptionInfo, "v*.", "zntu", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedAnd8,   "ccD*c",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedAnd16,  "ssD*s",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedAnd,    "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedCompareExchange8,   "ccD*cc",         "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedCompareExchange16,  "ssD*ss",         "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedCompareExchange,    "NiNiD*NiNi",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedCompareExchange64,  "LLiLLiD*LLiLLi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedCompareExchangePointer, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedCompareExchangePointer_nf, "v*v*D*v*v*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedDecrement16,        "ssD*",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedDecrement,          "NiNiD*",   "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchange,           "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchange8,          "ccD*c",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchange16,         "ssD*s",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeAdd8,       "ccD*c",          "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeAdd16,      "ssD*s",          "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeAdd,        "NiNiD*Ni",       "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangePointer,    "v*v*D*v*",   "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeSub8,   "ccD*c",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeSub16,  "ssD*s",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedExchangeSub,    "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedIncrement16,        "ssD*",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedIncrement,          "NiNiD*",   "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedOr8,  "ccD*c",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedOr16, "ssD*s",        "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedOr,   "NiNiD*Ni",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedXor8,  "ccD*c",       "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedXor16, "ssD*s",       "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_InterlockedXor,   "NiNiD*Ni",    "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandreset,     "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandreset64,   "UcWiD*Wi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandreset_acq, "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandreset_nf,  "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandreset_rel, "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandset,       "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandset64,     "UcWiD*Wi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandset_acq,   "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandset_nf,    "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_interlockedbittestandset_rel,   "UcNiD*Ni", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_load8,   "ccCD*",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_load16,  "ssCD*",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_load32,  "iiCD*",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_load64,  "LLiLLiCD*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_store8,  "vcD*c",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_store16, "vsD*s",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_store32, "viD*i",     "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__iso_volatile_store64, "vLLiD*LLi", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__noop,           "i.",  "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(__lzcnt16, "UsUs",    "ncE", ALL_MS_LANGUAGES)
-LANGBUILTIN(__lzcnt,   "UiUi",    "ncE", ALL_MS_LANGUAGES)
-LANGBUILTIN(__lzcnt64, "UWiUWi",  "ncE", ALL_MS_LANGUAGES)
-LANGBUILTIN(__popcnt16, "UsUs",   "ncE", ALL_MS_LANGUAGES)
-LANGBUILTIN(__popcnt,   "UiUi",   "ncE", ALL_MS_LANGUAGES)
-LANGBUILTIN(__popcnt64, "UWiUWi", "ncE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_ReturnAddress, "v*", "n", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotl8,  "UcUcUc",    "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotl16, "UsUsUc",    "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotl,   "UiUii",     "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_lrotl,  "ULiULii",   "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotl64, "UWiUWii",   "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotr8,  "UcUcUc",    "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotr16, "UsUsUc",    "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotr,   "UiUii",     "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_lrotr,  "ULiULii",   "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(_rotr64, "UWiUWii",   "nE", ALL_MS_LANGUAGES)
-LANGBUILTIN(__va_start,       "vc**.", "nt", ALL_MS_LANGUAGES)
-LANGBUILTIN(__fastfail, "vUi",    "nr", ALL_MS_LANGUAGES)
-
-// Microsoft library builtins.
-LIBBUILTIN(_setjmpex, "iJ", "fjT", SETJMPEX_H, ALL_MS_LANGUAGES)
-
-// C99 library functions
-// C99 stdarg.h
-LIBBUILTIN(va_start, "vA.",       "fn",    STDARG_H, ALL_LANGUAGES)
-LIBBUILTIN(va_end, "vA",          "fn",    STDARG_H, ALL_LANGUAGES)
-LIBBUILTIN(va_copy, "vAA",        "fn",    STDARG_H, ALL_LANGUAGES)
-// C99 stdlib.h
-LIBBUILTIN(abort, "v",            "fr",    STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(calloc, "v*zz",        "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(exit, "vi",            "fr",    STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(_Exit, "vi",           "fr",    STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(malloc, "v*z",         "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(realloc, "v*v*z",      "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(free,    "vv*",        "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtod, "dcC*c**",     "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtof, "fcC*c**",     "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtold, "LdcC*c**",   "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtol, "LicC*c**i",   "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtoll, "LLicC*c**i", "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtoul, "ULicC*c**i", "f",     STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(strtoull, "ULLicC*c**i", "f",   STDLIB_H, ALL_LANGUAGES)
-// C11 stdlib.h
-LIBBUILTIN(aligned_alloc, "v*zz", "f",     STDLIB_H, ALL_LANGUAGES)
-// C99 string.h
-LIBBUILTIN(memcpy, "v*v*vC*z",    "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(memcmp, "ivC*vC*z",    "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(memmove, "v*v*vC*z",   "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strcpy, "c*c*cC*",     "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strncpy, "c*c*cC*z",   "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strcmp, "icC*cC*",     "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strncmp, "icC*cC*z",   "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strcat, "c*c*cC*",     "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strncat, "c*c*cC*z",   "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strxfrm, "zc*cC*z",    "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(memchr, "v*vC*iz",     "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strchr, "c*cC*i",      "fE",    STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strcspn, "zcC*cC*",    "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strpbrk, "c*cC*cC*",   "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strrchr, "c*cC*i",     "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strspn, "zcC*cC*",     "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strstr, "c*cC*cC*",    "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strtok, "c*c*cC*",     "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(memset, "v*v*iz",      "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strerror, "c*i",       "f",     STRING_H, ALL_LANGUAGES)
-LIBBUILTIN(strlen, "zcC*",        "fE",    STRING_H, ALL_LANGUAGES)
-// C99 stdio.h
-// FIXME: This list is incomplete.
-LIBBUILTIN(printf, "icC*.",       "fp:0:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(fprintf, "iP*cC*.",    "fp:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(snprintf, "ic*zcC*.",  "fp:2:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(sprintf, "ic*cC*.",    "fp:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vprintf, "icC*a",      "fP:0:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vfprintf, "iP*cC*a",   "fP:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vsnprintf, "ic*zcC*a", "fP:2:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vsprintf, "ic*cC*a",   "fP:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(scanf, "icC*R.",       "fs:0:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(fscanf, "iP*RcC*R.",   "fs:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(sscanf, "icC*RcC*R.",  "fs:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vscanf, "icC*Ra",      "fS:0:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vfscanf, "iP*RcC*Ra",  "fS:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(fopen, "P*cC*cC*",     "f",     STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(fread, "zv*zzP*",      "f",     STDIO_H, ALL_LANGUAGES)
-LIBBUILTIN(fwrite, "zvC*zzP*",    "f",     STDIO_H, ALL_LANGUAGES)
-
-// C99 ctype.h
-LIBBUILTIN(isalnum, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isalpha, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isblank, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(iscntrl, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isdigit, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isgraph, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(islower, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isprint, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(ispunct, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isspace, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isupper, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(isxdigit, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(tolower, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-LIBBUILTIN(toupper, "ii", "fnU", CTYPE_H, ALL_LANGUAGES)
-// C99 wchar.h
-// FIXME: This list is incomplete. We should cover at least the functions that
-// take format strings.
-LIBBUILTIN(wcschr,  "w*wC*w",   "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wcscmp,  "iwC*wC*",  "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wcslen,  "zwC*",     "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wcsncmp, "iwC*wC*z", "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wmemchr, "w*wC*wz",  "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wmemcmp, "iwC*wC*z", "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wmemcpy, "w*w*wC*z", "fE", WCHAR_H, ALL_LANGUAGES)
-LIBBUILTIN(wmemmove,"w*w*wC*z", "fE", WCHAR_H, ALL_LANGUAGES)
-
-// C99
-// In some systems setjmp is a macro that expands to _setjmp. We undefine
-// it here to avoid having two identical LIBBUILTIN entries.
-#undef setjmp
-LIBBUILTIN(setjmp, "iJ",          "fjT",   SETJMP_H, ALL_LANGUAGES)
-LIBBUILTIN(longjmp, "vJi",        "frT",   SETJMP_H, ALL_LANGUAGES)
-
-// Non-C library functions, active in GNU mode only.
-// Functions with (returns_twice) attribute (marked as "j") are still active in
-// all languages, because losing this attribute would result in miscompilation
-// when these functions are used in non-GNU mode. PR16138.
-LIBBUILTIN(alloca, "v*z",         "f",     STDLIB_H, ALL_GNU_LANGUAGES)
-// POSIX malloc.h
-LIBBUILTIN(memalign, "v*zz",      "f",     MALLOC_H, ALL_GNU_LANGUAGES)
-// POSIX string.h
-LIBBUILTIN(memccpy, "v*v*vC*iz",  "f",     STRING_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(mempcpy, "v*v*vC*z",   "f",     STRING_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(stpcpy, "c*c*cC*",     "f",     STRING_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(stpncpy, "c*c*cC*z",   "f",     STRING_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(strdup, "c*cC*",       "f",     STRING_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(strndup, "c*cC*z",     "f",     STRING_H, ALL_GNU_LANGUAGES)
-// POSIX strings.h
-LIBBUILTIN(index, "c*cC*i",       "f",     STRINGS_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(rindex, "c*cC*i",      "f",     STRINGS_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(bzero, "vv*z",         "f",     STRINGS_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(bcmp, "ivC*vC*z",      "fE",    STRINGS_H, ALL_GNU_LANGUAGES)
-// In some systems str[n]casejmp is a macro that expands to _str[n]icmp.
-// We undefine then here to avoid wrong name.
-#undef strcasecmp
-#undef strncasecmp
-LIBBUILTIN(strcasecmp, "icC*cC*", "f",     STRINGS_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(strncasecmp, "icC*cC*z", "f",   STRINGS_H, ALL_GNU_LANGUAGES)
-// POSIX unistd.h
-LIBBUILTIN(_exit, "vi",           "fr",    UNISTD_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(vfork, "p",            "fjT",   UNISTD_H, ALL_LANGUAGES)
-// POSIX pthread.h
-// FIXME: Should specify argument types.
-LIBBUILTIN(pthread_create, "",  "fC<2,3>", PTHREAD_H, ALL_GNU_LANGUAGES)
-
-// POSIX setjmp.h
-
-// FIXME: MinGW _setjmp has an additional void* parameter.
-LIBBUILTIN(_setjmp, "iJ",         "fjT",   SETJMP_H, ALL_LANGUAGES)
-LIBBUILTIN(__sigsetjmp, "iSJi",   "fjT",   SETJMP_H, ALL_LANGUAGES)
-LIBBUILTIN(sigsetjmp, "iSJi",     "fjT",   SETJMP_H, ALL_LANGUAGES)
-LIBBUILTIN(savectx, "iJ",         "fjT",   SETJMP_H, ALL_LANGUAGES)
-LIBBUILTIN(getcontext, "iK*",     "fjT",   SETJMP_H, ALL_LANGUAGES)
-
-LIBBUILTIN(_longjmp, "vJi",       "frT",   SETJMP_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(siglongjmp, "vSJi",    "frT",   SETJMP_H, ALL_GNU_LANGUAGES)
-// non-standard but very common
-LIBBUILTIN(strlcpy, "zc*cC*z",    "f",     STRING_H, ALL_GNU_LANGUAGES)
-LIBBUILTIN(strlcat, "zc*cC*z",    "f",     STRING_H, ALL_GNU_LANGUAGES)
-//   id objc_msgSend(id, SEL, ...)
-LIBBUILTIN(objc_msgSend, "GGH.",   "f",     OBJC_MESSAGE_H, OBJC_LANG)
-// long double objc_msgSend_fpret(id self, SEL op, ...)
-LIBBUILTIN(objc_msgSend_fpret, "LdGH.", "f", OBJC_MESSAGE_H, OBJC_LANG)
-// _Complex long double objc_msgSend_fp2ret(id self, SEL op, ...)
-LIBBUILTIN(objc_msgSend_fp2ret, "XLdGH.", "f", OBJC_MESSAGE_H, OBJC_LANG)
-// void objc_msgSend_stret (id, SEL, ...)
-LIBBUILTIN(objc_msgSend_stret, "vGH.", "f", OBJC_MESSAGE_H, OBJC_LANG)
-// id objc_msgSendSuper(struct objc_super *super, SEL op, ...)
-LIBBUILTIN(objc_msgSendSuper, "GM*H.", "f", OBJC_MESSAGE_H, OBJC_LANG)
-// void objc_msgSendSuper_stret(struct objc_super *super, SEL op, ...)
-LIBBUILTIN(objc_msgSendSuper_stret, "vM*H.", "f", OBJC_MESSAGE_H, OBJC_LANG)
-//   id objc_getClass(const char *name)
-LIBBUILTIN(objc_getClass, "GcC*",   "f",     OBJC_RUNTIME_H, OBJC_LANG)
-//   id objc_getMetaClass(const char *name)
-LIBBUILTIN(objc_getMetaClass, "GcC*",   "f", OBJC_RUNTIME_H, OBJC_LANG)
-// void objc_enumerationMutation(id)
-LIBBUILTIN(objc_enumerationMutation, "vG", "f", OBJC_RUNTIME_H, OBJC_LANG)
-
-// id objc_read_weak(id *location)
-LIBBUILTIN(objc_read_weak, "GG*", "f", OBJC_OBJC_AUTO_H, OBJC_LANG)
-// id objc_assign_weak(id value, id *location)
-LIBBUILTIN(objc_assign_weak, "GGG*", "f", OBJC_OBJC_AUTO_H, OBJC_LANG)
-// id objc_assign_ivar(id value, id dest, ptrdiff_t offset)
-LIBBUILTIN(objc_assign_ivar, "GGGY", "f", OBJC_OBJC_AUTO_H, OBJC_LANG)
-// id objc_assign_global(id val, id *dest)
-LIBBUILTIN(objc_assign_global, "GGG*", "f", OBJC_OBJC_AUTO_H, OBJC_LANG)
-// id objc_assign_strongCast(id val, id *dest
-LIBBUILTIN(objc_assign_strongCast, "GGG*", "f", OBJC_OBJC_AUTO_H, OBJC_LANG)
-
-// id objc_exception_extract(void *localExceptionData)
-LIBBUILTIN(objc_exception_extract, "Gv*", "f", OBJC_OBJC_EXCEPTION_H, OBJC_LANG)
-// void objc_exception_try_enter(void *localExceptionData)
-LIBBUILTIN(objc_exception_try_enter, "vv*", "f", OBJC_OBJC_EXCEPTION_H, OBJC_LANG)
-// void objc_exception_try_exit(void *localExceptionData)
-LIBBUILTIN(objc_exception_try_exit, "vv*", "f", OBJC_OBJC_EXCEPTION_H, OBJC_LANG)
-// int objc_exception_match(Class exceptionClass, id exception)
-LIBBUILTIN(objc_exception_match, "iGG", "f", OBJC_OBJC_EXCEPTION_H, OBJC_LANG)
-// void objc_exception_throw(id exception)
-LIBBUILTIN(objc_exception_throw, "vG", "f", OBJC_OBJC_EXCEPTION_H, OBJC_LANG)
-
-// int objc_sync_enter(id obj)
-LIBBUILTIN(objc_sync_enter, "iG", "f", OBJC_OBJC_SYNC_H, OBJC_LANG)
-// int objc_sync_exit(id obj)
-LIBBUILTIN(objc_sync_exit, "iG", "f", OBJC_OBJC_SYNC_H, OBJC_LANG)
-
-BUILTIN(__builtin_objc_memmove_collectable, "v*v*vC*z", "nF")
-
-// void NSLog(NSString *fmt, ...)
-LIBBUILTIN(NSLog, "vG.", "fp:0:", FOUNDATION_NSOBJCRUNTIME_H, OBJC_LANG)
-// void NSLogv(NSString *fmt, va_list args)
-LIBBUILTIN(NSLogv, "vGa", "fP:0:", FOUNDATION_NSOBJCRUNTIME_H, OBJC_LANG)
-
-// Builtin math library functions
-LIBBUILTIN(atan2, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(atan2f, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(atan2l, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(abs, "ii", "fnc", STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(labs, "LiLi", "fnc", STDLIB_H, ALL_LANGUAGES)
-LIBBUILTIN(llabs, "LLiLLi", "fnc", STDLIB_H, ALL_LANGUAGES)
-
-LIBBUILTIN(copysign, "ddd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(copysignf, "fff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(copysignl, "LdLdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(fabs, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fabsf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fabsl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-// Some systems define finitef as alias of _finitef.
-#if defined (finitef)
-#undef finitef
-#endif
-LIBBUILTIN(finite, "id", "fnc", MATH_H, GNU_LANG)
-LIBBUILTIN(finitef, "if", "fnc", MATH_H, GNU_LANG)
-LIBBUILTIN(finitel, "iLd", "fnc", MATH_H, GNU_LANG)
-// glibc's math.h generates calls to __finite
-LIBBUILTIN(__finite, "id", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(__finitef, "if", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(__finitel, "iLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(fmod, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fmodf, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fmodl, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(frexp, "ddi*", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(frexpf, "ffi*", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(frexpl, "LdLdi*", "fn", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ldexp, "ddi", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(ldexpf, "ffi", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(ldexpl, "LdLdi", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(modf, "ddd*", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(modff, "fff*", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(modfl, "LdLdLd*", "fn", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(nan,  "dcC*", "fUn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nanf, "fcC*", "fUn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nanl, "LdcC*", "fUn", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(pow, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(powf, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(powl, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(acos, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(acosf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(acosl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(acosh, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(acoshf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(acoshl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(asin, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(asinf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(asinl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(asinh, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(asinhf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(asinhl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(atan, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(atanf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(atanl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(atanh, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(atanhf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(atanhl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cbrt, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(cbrtf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(cbrtl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ceil, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(ceilf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(ceill, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cos, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(cosf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(cosl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cosh, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(coshf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(coshl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(erf, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(erff, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(erfl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(erfc, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(erfcf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(erfcl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(exp, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(expf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(expl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(exp2, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(exp2f, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(exp2l, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(expm1, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(expm1f, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(expm1l, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(fdim, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fdimf, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fdiml, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(floor, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(floorf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(floorl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(fma, "dddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fmaf, "ffff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fmal, "LdLdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(fmax, "ddd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fmaxf, "fff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fmaxl, "LdLdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(fmin, "ddd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fminf, "fff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(fminl, "LdLdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(hypot, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(hypotf, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(hypotl, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ilogb, "id", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(ilogbf, "if", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(ilogbl, "iLd", "fne", MATH_H, ALL_LANGUAGES)
-
-// POSIX math.h declares a global, signgam, that lgamma writes to, so these
-// shouldn't have "e", "c" or "g" attributes
-LIBBUILTIN(lgamma, "dd", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(lgammaf, "ff", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(lgammal, "LdLd", "fn", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(llrint, "LLid", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(llrintf, "LLif", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(llrintl, "LLiLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(llround, "LLid", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(llroundf, "LLif", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(llroundl, "LLiLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(log, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(logf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(logl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(log10, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(log10f, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(log10l, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(log1p, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(log1pf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(log1pl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(log2, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(log2f, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(log2l, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(logb, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(logbf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(logbl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(lrint, "Lid", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(lrintf, "Lif", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(lrintl, "LiLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(lround, "Lid", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(lroundf, "Lif", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(lroundl, "LiLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(nearbyint, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nearbyintf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nearbyintl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(nextafter, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nextafterf, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nextafterl, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(nexttoward, "ddLd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nexttowardf, "ffLd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(nexttowardl, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(remainder, "ddd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(remainderf, "fff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(remainderl, "LdLdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(remquo, "dddi*", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(remquof, "fffi*", "fn", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(remquol, "LdLdLdi*", "fn", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(rint, "dd", "fng", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(rintf, "ff", "fng", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(rintl, "LdLd", "fng", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(round, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(roundf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(roundl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(roundeven, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(roundevenf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(roundevenl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(scalbln, "ddLi", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(scalblnf, "ffLi", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(scalblnl, "LdLdLi", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(scalbn, "ddi", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(scalbnf, "ffi", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(scalbnl, "LdLdi", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(sin, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(sinf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(sinl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(sinh, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(sinhf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(sinhl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(sqrt, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(sqrtf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(sqrtl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(tan, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(tanf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(tanl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(tanh, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(tanhf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(tanhl, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(tgamma, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(tgammaf, "ff", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(tgammal, "LdLd", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(trunc, "dd", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(truncf, "ff", "fnc", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(truncl, "LdLd", "fnc", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cabs, "dXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cabsf, "fXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cabsl, "LdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cacos, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cacosf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cacosl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cacosh, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cacoshf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cacoshl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(carg, "dXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cargf, "fXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cargl, "LdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(casin, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(casinf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(casinl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(casinh, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(casinhf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(casinhl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(catan, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(catanf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(catanl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(catanh, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(catanhf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(catanhl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ccos, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ccosf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ccosl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ccosh, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ccoshf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ccoshl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cexp, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cexpf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cexpl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cimag, "dXd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cimagf, "fXf", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cimagl, "LdXLd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(conj, "XdXd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(conjf, "XfXf", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(conjl, "XLdXLd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(clog, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(clogf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(clogl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cproj, "XdXd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cprojf, "XfXf", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cprojl, "XLdXLd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(cpow, "XdXdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cpowf, "XfXfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(cpowl, "XLdXLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(creal, "dXd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(crealf, "fXf", "fnc", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(creall, "LdXLd", "fnc", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(csin, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(csinf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(csinl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(csinh, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(csinhf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(csinhl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(csqrt, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(csqrtf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(csqrtl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ctan, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ctanf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ctanl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-LIBBUILTIN(ctanh, "XdXd", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ctanhf, "XfXf", "fne", COMPLEX_H, ALL_LANGUAGES)
-LIBBUILTIN(ctanhl, "XLdXLd", "fne", COMPLEX_H, ALL_LANGUAGES)
-
-// __sinpi and friends are OS X specific library functions, but otherwise much
-// like the standard (non-complex) sin (etc).
-LIBBUILTIN(__sinpi, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(__sinpif, "ff", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(__cospi, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(__cospif, "ff", "fne", MATH_H, ALL_LANGUAGES)
-
-LIBBUILTIN(__tanpi, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(__tanpif, "ff", "fne", MATH_H, ALL_LANGUAGES)
-
-// Similarly, __exp10 is OS X only
-LIBBUILTIN(__exp10, "dd", "fne", MATH_H, ALL_LANGUAGES)
-LIBBUILTIN(__exp10f, "ff", "fne", MATH_H, ALL_LANGUAGES)
-
-// Blocks runtime Builtin math library functions
-LIBBUILTIN(_Block_object_assign, "vv*vC*iC", "f", BLOCKS_H, ALL_LANGUAGES)
-LIBBUILTIN(_Block_object_dispose, "vvC*iC", "f", BLOCKS_H, ALL_LANGUAGES)
-// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
-
-// C++ standard library builtins in namespace 'std'.
-LIBBUILTIN(addressof, "v*v&", "zfncThE", MEMORY, CXX_LANG)
-// Synonym for addressof used internally by libstdc++.
-LANGBUILTIN(__addressof, "v*v&", "zfncTE", CXX_LANG)
-LIBBUILTIN(as_const, "v&v&", "zfncThE", UTILITY, CXX_LANG)
-LIBBUILTIN(forward, "v&v&", "zfncThE", UTILITY, CXX_LANG)
-LIBBUILTIN(forward_like, "v&v&", "zfncThE", UTILITY, CXX_LANG)
-LIBBUILTIN(move, "v&v&", "zfncThE", UTILITY, CXX_LANG)
-LIBBUILTIN(move_if_noexcept, "v&v&", "zfncThE", UTILITY, CXX_LANG)
-
-// Annotation function
-BUILTIN(__builtin_annotation, "v.", "tn")
-
-// Invariants
-BUILTIN(__builtin_assume, "vb", "nE")
-BUILTIN(__builtin_assume_separate_storage, "vvCD*vCD*", "nE")
-
-// Multiprecision Arithmetic Builtins.
-BUILTIN(__builtin_addcb, "UcUcCUcCUcCUc*", "n")
-BUILTIN(__builtin_addcs, "UsUsCUsCUsCUs*", "n")
-BUILTIN(__builtin_addc, "UiUiCUiCUiCUi*", "n")
-BUILTIN(__builtin_addcl, "ULiULiCULiCULiCULi*", "n")
-BUILTIN(__builtin_addcll, "ULLiULLiCULLiCULLiCULLi*", "n")
-BUILTIN(__builtin_subcb, "UcUcCUcCUcCUc*", "n")
-BUILTIN(__builtin_subcs, "UsUsCUsCUsCUs*", "n")
-BUILTIN(__builtin_subc, "UiUiCUiCUiCUi*", "n")
-BUILTIN(__builtin_subcl, "ULiULiCULiCULiCULi*", "n")
-BUILTIN(__builtin_subcll, "ULLiULLiCULLiCULLiCULLi*", "n")
-
-// Checked Arithmetic Builtins for Security.
-BUILTIN(__builtin_add_overflow, "b.", "ntE")
-BUILTIN(__builtin_sub_overflow, "b.", "ntE")
-BUILTIN(__builtin_mul_overflow, "b.", "ntE")
-BUILTIN(__builtin_uadd_overflow, "bUiCUiCUi*", "nE")
-BUILTIN(__builtin_uaddl_overflow, "bULiCULiCULi*", "nE")
-BUILTIN(__builtin_uaddll_overflow, "bULLiCULLiCULLi*", "nE")
-BUILTIN(__builtin_usub_overflow, "bUiCUiCUi*", "nE")
-BUILTIN(__builtin_usubl_overflow, "bULiCULiCULi*", "nE")
-BUILTIN(__builtin_usubll_overflow, "bULLiCULLiCULLi*", "nE")
-BUILTIN(__builtin_umul_overflow, "bUiCUiCUi*", "nE")
-BUILTIN(__builtin_umull_overflow, "bULiCULiCULi*", "nE")
-BUILTIN(__builtin_umulll_overflow, "bULLiCULLiCULLi*", "nE")
-BUILTIN(__builtin_sadd_overflow, "bSiCSiCSi*", "nE")
-BUILTIN(__builtin_saddl_overflow, "bSLiCSLiCSLi*", "nE")
-BUILTIN(__builtin_saddll_overflow, "bSLLiCSLLiCSLLi*", "nE")
-BUILTIN(__builtin_ssub_overflow, "bSiCSiCSi*", "nE")
-BUILTIN(__builtin_ssubl_overflow, "bSLiCSLiCSLi*", "nE")
-BUILTIN(__builtin_ssubll_overflow, "bSLLiCSLLiCSLLi*", "nE")
-BUILTIN(__builtin_smul_overflow, "bSiCSiCSi*", "nE")
-BUILTIN(__builtin_smull_overflow, "bSLiCSLiCSLi*", "nE")
-BUILTIN(__builtin_smulll_overflow, "bSLLiCSLLiCSLLi*", "nE")
-
-// Clang builtins (not available in GCC).
-BUILTIN(__builtin_addressof, "v*v&", "nctE")
-BUILTIN(__builtin_function_start, "v*v&", "nctE")
-BUILTIN(__builtin_operator_new, "v*z", "tcE")
-BUILTIN(__builtin_operator_delete, "vv*", "tnE")
-BUILTIN(__builtin_char_memchr, "c*cC*iz", "nE")
-BUILTIN(__builtin_dump_struct, "v.", "t")
-BUILTIN(__builtin_preserve_access_index, "v.", "t")
-
-// Alignment builtins (uses custom parsing to support pointers and integers)
-BUILTIN(__builtin_is_aligned, "bvC*z", "nctE")
-BUILTIN(__builtin_align_up, "v*vC*z", "nctE")
-BUILTIN(__builtin_align_down, "v*vC*z", "nctE")
-
-// Safestack builtins
-BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn")
-BUILTIN(__builtin___get_unsafe_stack_bottom, "v*", "Fn")
-BUILTIN(__builtin___get_unsafe_stack_top, "v*", "Fn")
-BUILTIN(__builtin___get_unsafe_stack_ptr, "v*", "Fn")
-
-// Nontemporal loads/stores builtins
-BUILTIN(__builtin_nontemporal_store, "v.", "t")
-BUILTIN(__builtin_nontemporal_load, "v.", "t")
-
-// Coroutine intrinsics.
-LANGBUILTIN(__builtin_coro_resume, "vv*", "", COR_LANG)
-LANGBUILTIN(__builtin_coro_destroy, "vv*", "", COR_LANG)
-LANGBUILTIN(__builtin_coro_done, "bv*", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_promise, "v*v*IiIb", "n", COR_LANG)
-
-LANGBUILTIN(__builtin_coro_size, "z", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_align, "z", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_frame, "v*", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_noop, "v*", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_free, "v*v*", "n", COR_LANG)
-
-LANGBUILTIN(__builtin_coro_id, "v*Iiv*v*v*", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_alloc, "b", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_begin, "v*v*", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_end, "bv*Ib", "n", COR_LANG)
-LANGBUILTIN(__builtin_coro_suspend, "cIb", "n", COR_LANG)
-
-// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
-// We need the generic prototype, since the packet type could be anything.
-LANGBUILTIN(read_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(write_pipe, "i.", "tn", OCL_PIPE)
-
-LANGBUILTIN(reserve_read_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(reserve_write_pipe, "i.", "tn", OCL_PIPE)
-
-LANGBUILTIN(commit_write_pipe, "v.", "tn", OCL_PIPE)
-LANGBUILTIN(commit_read_pipe, "v.", "tn", OCL_PIPE)
-
-LANGBUILTIN(sub_group_reserve_read_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(sub_group_reserve_write_pipe, "i.", "tn", OCL_PIPE)
-
-LANGBUILTIN(sub_group_commit_read_pipe, "v.", "tn", OCL_PIPE)
-LANGBUILTIN(sub_group_commit_write_pipe, "v.", "tn", OCL_PIPE)
-
-LANGBUILTIN(work_group_reserve_read_pipe, "i.", "tn", OCL_PIPE)
-LANGBUILTIN(work_group_reserve_write_pipe, "i.", "tn", OCL_PIPE)
-
-LANGBUILTIN(work_group_commit_read_pipe, "v.", "tn", OCL_PIPE)
-LANGBUILTIN(work_group_commit_write_pipe, "v.", "tn", OCL_PIPE)
-
-LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCL_PIPE)
-LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCL_PIPE)
-
-// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
-// Custom builtin check allows to perform special check of passed block arguments.
-LANGBUILTIN(enqueue_kernel, "i.", "tn", OCL_DSE)
-LANGBUILTIN(get_kernel_work_group_size, "Ui.", "tn", OCL_DSE)
-LANGBUILTIN(get_kernel_preferred_work_group_size_multiple, "Ui.", "tn", OCL_DSE)
-LANGBUILTIN(get_kernel_max_sub_group_size_for_ndrange, "Ui.", "tn", OCL_DSE)
-LANGBUILTIN(get_kernel_sub_group_count_for_ndrange, "Ui.", "tn", OCL_DSE)
-
-// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
-// FIXME: Pointer parameters of OpenCL builtins should have their address space
-// requirement defined.
-LANGBUILTIN(to_global, "v*v*", "tn", OCL_GAS)
-LANGBUILTIN(to_local, "v*v*", "tn", OCL_GAS)
-LANGBUILTIN(to_private, "v*v*", "tn", OCL_GAS)
-
-// OpenCL half load/store builtin
-LANGBUILTIN(__builtin_store_half, "vdh*", "n", ALL_OCL_LANGUAGES)
-LANGBUILTIN(__builtin_store_halff, "vfh*", "n", ALL_OCL_LANGUAGES)
-LANGBUILTIN(__builtin_load_half, "dhC*", "nc", ALL_OCL_LANGUAGES)
-LANGBUILTIN(__builtin_load_halff, "fhC*", "nc", ALL_OCL_LANGUAGES)
-
-// Builtins for os_log/os_trace
-BUILTIN(__builtin_os_log_format_buffer_size, "zcC*.", "p:0:nutE")
-BUILTIN(__builtin_os_log_format, "v*v*cC*.", "p:0:nt")
-
-// CUDA/HIP
-LANGBUILTIN(__builtin_get_device_side_mangled_name, "cC*.", "ncT", CUDA_LANG)
-
-// HLSL
-LANGBUILTIN(__builtin_hlsl_wave_active_count_bits, "Uib", "nc", HLSL_LANG)
-LANGBUILTIN(__builtin_hlsl_create_handle, "v*Uc", "nc", HLSL_LANG)
-
-// Builtins for XRay
-BUILTIN(__xray_customevent, "vcC*z", "")
-BUILTIN(__xray_typedevent, "vzcC*z", "")
-
-// Win64-compatible va_list functions
-BUILTIN(__builtin_ms_va_start, "vc*&.", "nt")
-BUILTIN(__builtin_ms_va_end, "vc*&", "n")
-BUILTIN(__builtin_ms_va_copy, "vc*&c*&", "n")
-
-// Arithmetic Fence: to prevent FP reordering and reassociation optimizations
-LANGBUILTIN(__arithmetic_fence, "v.", "tE", ALL_LANGUAGES)
-
-#undef BUILTIN
-#undef LIBBUILTIN
-#undef LANGBUILTIN
diff --git a/clang/include/clang/Basic/Builtins.h b/clang/include/clang/Basic/Builtins.h
index 3fd5b02b5aa5882..f955d21169556a0 100644
--- a/clang/include/clang/Basic/Builtins.h
+++ b/clang/include/clang/Basic/Builtins.h
@@ -64,7 +64,7 @@ namespace Builtin {
 enum ID {
   NotBuiltin  = 0,      // This is not a builtin function.
 #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
-#include "clang/Basic/Builtins.def"
+#include "clang/Basic/Builtins.inc"
   FirstTSBuiltin
 };
 
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
new file mode 100644
index 000000000000000..0a3faf156bbd9f1
--- /dev/null
+++ b/clang/include/clang/Basic/Builtins.td
@@ -0,0 +1,4370 @@
+//===--- Builtins.td - Builtins function info database-----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+include "clang/Basic/BuiltinsBase.td"
+
+class FPMathTemplate : Template<["float", "double", "long double"],
+                                ["f",     "",       "l"]>;
+
+class FPMathWithF16Template :
+    Template<["float", "double", "long double", "__fp16", "__float128"],
+             ["f",     "",       "l",           "f16",    "f128"]>;
+
+class FPMathWithF16F128Template :
+    Template<["float", "double", "long double", "__fp16", "__float128"],
+             ["f",     "",       "l",           "f16",    "f128"]>;
+
+class F16F128MathTemplate : Template<["__fp16", "__float128"],
+                                     ["f16",    "f128"]>;
+
+class IntMathTemplate : Template<["int", "long int", "long long int"],
+                                 ["",     "l",       "ll"], /*AsPrefix=*/1>;
+
+class MSInt8_16_32Template : Template<["char", "short", "msint32_t"],
+                                      ["8",    "16",    ""]>;
+
+class Int8_16_32_64Template
+    : Template<["char", "short", "int", "long long int"],
+               ["8",    "16",    "32",  "64"]>;
+
+class MSInt8_16_32_64Template
+    : Template<["char", "short", "msint32_t", "long long int"],
+               ["8",    "16",    "",          "64"]>;
+
+class MSInt16_32Template : Template<["short", "msint32_t"],
+                                    ["16",    ""]>;
+
+class MSUInt16_32_64Template :
+    Template<["unsigned short", "unsigned int", "uint64_t"],
+             ["16",             "",             "64"]>;
+
+class MSInt32_64Template : Template<["msint32_t", "int64_t"],
+                                    ["",          "64"]>;
+
+class FloatDoubleTemplate : Template<["float", "double"],
+                                     ["f",     ""]>;
+
+// FIXME: These assume that char -> i8, short -> i16, int -> i32,
+// long long -> i64.
+class SyncBuiltinsTemplate :
+    Template<["char", "short", "int", "long long int", "__int128_t"],
+             ["1",    "2",     "4",   "8",             "16"]>;
+
+class BitInt8_16_32_64BuiltinsTemplate :
+    Template<["unsigned char", "unsigned short", "uint32_t", "uint64_t"],
+             ["8",             "16",             "32",       "64"]>;
+
+class BitShort_Int_Long_LongLongTemplate :
+    Template<["short", "int", "long int", "long long int"],
+             ["s",     "",    "l",        "ll"]>;
+
+class BitInt_Long_LongLongTemplate :
+    Template<["int", "long int", "long long int"],
+             ["",    "l",        "ll"]>;
+
+// Most of the types used in the prototypes are types from C, C++ or ObjC. There
+// are a few builtin-specific types and qualifiers.
+//
+// builtin-specific types:
+// - __builtin_va_list: This is the internal representation for va_lists
+// - __builtin_va_list_ref: A reference-like type to __builtin_va_list
+// - msint32_t: 'int' size if target is LP64, 'L' otherwise.
+//
+// builtin-specific qualifiers:
+// - _Constant: Argument has to constant-fold to an integer constant expression
+
+// __fp16 and __float128 builtin variants of libc/libm functions.
+def AcosF128 : Builtin {
+  let Spellings = ["__builtin_acosf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def AcoshF128 : Builtin {
+  let Spellings = ["__builtin_acoshf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def AsinF128 : Builtin {
+  let Spellings = ["__builtin_asinf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def AsinhF128 : Builtin {
+  let Spellings = ["__builtin_asinhf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def AtanF128 : Builtin {
+  let Spellings = ["__builtin_atanf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def AtanhF128 : Builtin {
+  let Spellings = ["__builtin_atanhf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def CbrtF128 : Builtin {
+  let Spellings = ["__builtin_cbrtf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "__float128(__float128)";
+}
+
+def CeilF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_ceil"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+def CosF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_cos"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def CoshF128 : Builtin {
+  let Spellings = ["__builtin_coshf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def ErfF128 : Builtin {
+  let Spellings = ["__builtin_erff128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def ErfcF128 : Builtin {
+  let Spellings = ["__builtin_erfcf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def ExpF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_exp"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Exp2F16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_exp2"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Exp10F16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_exp10"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Expm1F128 : Builtin {
+  let Spellings = ["__builtin_expm1f128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def FdimF128 : Builtin {
+  let Spellings = ["__builtin_fdimf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def FloorF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_floor"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+def FmaF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_fma"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T, T)";
+}
+
+def FmaxF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_fmax"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr];
+  let Prototype = "T(T, T)";
+}
+
+def FminF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_fmin"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr];
+  let Prototype = "T(T, T)";
+}
+
+def Atan2F128 : Builtin {
+  let Spellings = ["__builtin_atan2f128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def CopysignF16 : Builtin {
+  let Spellings = ["__builtin_copysignf16"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "__fp16(__fp16, __fp16)";
+}
+
+def CopysignF128 : Builtin {
+  let Spellings = ["__builtin_copysignf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def FabsF16 : Builtin {
+  let Spellings = ["__builtin_fabsf16"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "__fp16(__fp16)";
+}
+
+def FabsF128 : Builtin {
+  let Spellings = ["__builtin_fabsf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr];
+  let Prototype = "__float128(__float128)";
+}
+
+def FmodF16F128 : F16F128MathTemplate, Builtin {
+  let Spellings = ["__builtin_fmod"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+}
+
+def FrexpF16F128 : F16F128MathTemplate, Builtin {
+  let Spellings = ["__builtin_frexp"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "T(T, int*)";
+}
+
+def HugeVal : Builtin, FPMathWithF16F128Template {
+  let Spellings = ["__builtin_huge_val"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T()";
+}
+
+def Inf : Builtin, FPMathWithF16F128Template {
+  let Spellings = ["__builtin_inf"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T()";
+}
+
+def LdexpF16F128 : F16F128MathTemplate, Builtin {
+  let Spellings = ["__builtin_ldexp"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, int)";
+}
+
+def ModfF128 : Builtin {
+  let Spellings = ["__builtin_modff128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "__float128(__float128, __float128*)";
+}
+
+// This isn't a FPMathWithF16F128Template because the f16
+// version takes a _Float16 for some reason.
+def NanF16 : Builtin {
+  let Spellings = ["__builtin_nanf16"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Pure, Constexpr];
+  let Prototype = "_Float16(char const*)";
+}
+
+def NanF128 : Builtin {
+  let Spellings = ["__builtin_nanf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Pure, Constexpr];
+  let Prototype = "__float128(char const*)";
+}
+
+def Nans : Builtin,
+    Template<["float", "double", "long double", "_Float16", "__float128"],
+             ["f",     "",       "l",           "f16",      "f128"]> {
+  let Spellings = ["__builtin_nans"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Pure, Constexpr];
+  let Prototype = "T(char const*)";
+}
+
+def PowI : Builtin, FPMathTemplate {
+  let Spellings = ["__builtin_powi"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T, int)";
+}
+
+def PowF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_pow"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+}
+
+def HypotF128 : Builtin {
+  let Spellings = ["__builtin_hypotf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def ILogbF128 : Builtin {
+  let Spellings = ["__builtin_ilogbf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "int(__float128)";
+}
+
+def LgammaF128 : Builtin {
+  let Spellings = ["__builtin_lgammaf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "__float128(__float128)";
+}
+
+def LLrintF128 : Builtin {
+  let Spellings = ["__builtin_llrintf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long long int(__float128)";
+}
+
+def LLroundF128 : Builtin {
+  let Spellings = ["__builtin_llroundf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long long int(__float128)";
+}
+
+def Log10F16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_log10"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Log1pF128 : Builtin {
+  let Spellings = ["__builtin_log1pf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def Log2F16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_log2"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def LogbF128 : Builtin {
+  let Spellings = ["__builtin_logbf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def LogF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_log"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def LrintF128 : Builtin {
+  let Spellings = ["__builtin_lrintf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long int(__float128)";
+}
+
+def LroundF128 : Builtin {
+  let Spellings = ["__builtin_lroundf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long int(__float128)";
+}
+
+def NearbyintF128 : Builtin {
+  let Spellings = ["__builtin_nearbyintf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "__float128(__float128)";
+}
+
+def NextafterF128 : Builtin {
+  let Spellings = ["__builtin_nextafterf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def NexttowardF128 : Builtin {
+  let Spellings = ["__builtin_nexttowardf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def RemainderF128 : Builtin {
+  let Spellings = ["__builtin_remainderf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, __float128)";
+}
+
+def RemquoF128 : Builtin {
+  let Spellings = ["__builtin_remquof128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "__float128(__float128, __float128, int*)";
+}
+
+def RintF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_rint"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+def RoundF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_round"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+def RoundevenF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_roundeven"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+def ScanlblnF128 : Builtin {
+  let Spellings = ["__builtin_scalblnf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, long int)";
+}
+
+def ScanlbnF128 : Builtin {
+  let Spellings = ["__builtin_scalbnf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128, int)";
+}
+
+def SinF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_sin"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def SinhF128 : Builtin {
+  let Spellings = ["__builtin_sinhf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def SqrtF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_sqrt"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def TanF128 : Builtin {
+  let Spellings = ["__builtin_tanf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def TanhF128 : Builtin {
+  let Spellings = ["__builtin_tanhf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def TgammaF128 : Builtin {
+  let Spellings = ["__builtin_tgammaf128"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "__float128(__float128)";
+}
+
+def TruncF16F128 : Builtin, F16F128MathTemplate {
+  let Spellings = ["__builtin_trunc"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+// Access to floating point environment.
+def BuiltinFltRounds : Builtin {
+  let Spellings = ["__builtin_flt_rounds"];
+  let Attributes = [NoThrow];
+  let Prototype = "int()";
+}
+
+def BuiltinSetFltRounds : Builtin {
+  let Spellings = ["__builtin_set_flt_rounds"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(int)";
+}
+
+// GCC-compatible C99 CMPLX implementation.
+def BuiltinComplex : Builtin {
+  let Spellings = ["__builtin_complex"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void(...)";
+}
+
+// FP Comparison functions.
+def IsGreater : Builtin {
+  let Spellings = ["__builtin_isgreater"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+def IsGreaterEqual : Builtin {
+  let Spellings = ["__builtin_isgreaterequal"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+def IsLess : Builtin {
+  let Spellings = ["__builtin_isless"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+def IsLessEqual : Builtin {
+  let Spellings = ["__builtin_islessequal"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+def IsLessGreater : Builtin {
+  let Spellings = ["__builtin_islessgreater"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+def IsUnordered : Builtin {
+  let Spellings = ["__builtin_isunordered"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+// Unary FP classification.
+def FPClassify : Builtin {
+  let Spellings = ["__builtin_fpclassify"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(int, int, int, int, int, ...)";
+}
+
+def IsFinite : Builtin {
+  let Spellings = ["__builtin_isfinite"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsInf : Builtin {
+  let Spellings = ["__builtin_isinf"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsInfSign : Builtin {
+  let Spellings = ["__builtin_isinf_sign"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsNan : Builtin {
+  let Spellings = ["__builtin_isnan"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsNormal : Builtin {
+  let Spellings = ["__builtin_isnormal"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsFPClass : Builtin {
+  let Spellings = ["__builtin_isfpclass"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+// FP signbit builtins.
+def Signbit : Builtin {
+  let Spellings = ["__builtin_signbit"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking];
+  let Prototype = "int(...)";
+}
+
+def SignbitF : Builtin {
+  let Spellings = ["__builtin_signbitf"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "int(float)";
+}
+
+def SignbitL : Builtin {
+  let Spellings = ["__builtin_signbitl"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const];
+  let Prototype = "int(long double)";
+}
+
+// Special FP builtins.
+def Canonicalize : Builtin, FPMathWithF16Template {
+  let Spellings = ["__builtin_canonicalize"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+// Builtins for arithmetic.
+def Clz : Builtin, BitShort_Int_Long_LongLongTemplate {
+  let Spellings = ["__builtin_clz"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "int(unsigned T)";
+}
+
+// FIXME: Add int clzimax(uintmax_t)
+
+def Ctz : Builtin, BitShort_Int_Long_LongLongTemplate {
+  let Spellings = ["__builtin_ctz"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "int(unsigned T)";
+}
+
+// FIXME: Add int ctzimax(uintmax_t)
+
+def FFS : Builtin, BitInt_Long_LongLongTemplate {
+  let Spellings = ["__builtin_ffs"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const, Constexpr];
+  let Prototype = "int(T)";
+}
+
+def Parity : Builtin, BitInt_Long_LongLongTemplate {
+  let Spellings = ["__builtin_parity"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "int(unsigned T)";
+}
+
+def Popcount : Builtin, BitInt_Long_LongLongTemplate {
+  let Spellings = ["__builtin_popcount"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "int(unsigned T)";
+}
+
+def Clrsb : Builtin, BitInt_Long_LongLongTemplate {
+  let Spellings = ["__builtin_clrsb"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "int(T)";
+}
+
+// The following builtins rely on that char == 8 bits, short == 16 bits and that
+// there exists native types on the target that are 32- and 64-bits wide, unless
+// these conditions are fulfilled these builtins will operate on a not intended
+// bitwidth.
+def BSwap : Builtin, Template<["unsigned short", "uint32_t", "uint64_t"],
+                              ["16",             "32",       "64"]> {
+  let Spellings = ["__builtin_bswap"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T(T)";
+}
+
+def Bitreverse : BitInt8_16_32_64BuiltinsTemplate, Builtin {
+  let Spellings = ["__builtin_bitreverse"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T(T)";
+}
+
+def RotateLeft : BitInt8_16_32_64BuiltinsTemplate, Builtin {
+  let Spellings = ["__builtin_rotateleft"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T(T, T)";
+}
+
+def RotateRight : BitInt8_16_32_64BuiltinsTemplate, Builtin {
+  let Spellings = ["__builtin_rotateright"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T(T, T)";
+}
+
+// Random GCC builtins
+// FIXME: The builtins marked FunctionWithBuiltinPrefix below should be
+//        merged with the library definitions. They are currently not because
+//        the attributes are different.
+def BuiltinCalloc : Builtin {
+  let Spellings = ["__builtin_calloc"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(size_t, size_t)";
+}
+
+def BuiltinConstantP : Builtin {
+  let Spellings = ["__builtin_constant_p"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, UnevaluatedArguments, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def BuiltinClassifyType : Builtin {
+  let Spellings = ["__builtin_classify_type"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, UnevaluatedArguments, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def BuiltinCFStringMakeConstantString : Builtin {
+  let Spellings = ["__builtin___CFStringMakeConstantString"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "constant_CFString const*(char const*)";
+}
+
+def BuiltinNSStringMakeConstantString : Builtin {
+  let Spellings = ["__builtin___NSStringMakeConstantString"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "constant_CFString const*(char const*)";
+}
+
+def BuiltinVaStart : Builtin {
+  let Spellings = ["__builtin_va_start"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(__builtin_va_list_ref, ...)";
+}
+
+def BuiltinStdargStart : Builtin {
+  let Spellings = ["__builtin_stdarg_start"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(__builtin_va_list_ref, ...)";
+}
+
+def BuiltinAssumeAligned : Builtin {
+  let Spellings = ["__builtin_assume_aligned"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(void const*, size_t, ...)";
+}
+
+def BuiltinBcopy : Builtin {
+  let Spellings = ["__builtin_bcopy"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void*, void*, size_t)";
+}
+
+def BuiltinFree : Builtin {
+  let Spellings = ["__builtin_free"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void(void*)";
+}
+
+def BuiltinMalloc : Builtin {
+  let Spellings = ["__builtin_malloc"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(size_t)";
+}
+
+def BuiltinMemcpyInline : Builtin {
+  let Spellings = ["__builtin_memcpy_inline"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void*, void const*, _Constant size_t)";
+}
+
+def BuiltinMempcpy : Builtin {
+  let Spellings = ["__builtin_mempcpy"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, void const*, size_t)";
+}
+
+def BuiltinMemsetInline : Builtin {
+  let Spellings = ["__builtin_memset_inline"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void*, int, _Constant size_t)";
+}
+
+def BuiltinStrcspn : Builtin {
+  let Spellings = ["__builtin_strcspn"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "size_t(char const*, char const*)";
+}
+
+def BuiltinRealloc : Builtin {
+  let Spellings = ["__builtin_realloc"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, size_t)";
+}
+
+def BuiltinReturnAddress : Builtin {
+  let Spellings = ["__builtin_return_address"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(_Constant unsigned int)";
+}
+
+def ExtractReturnAddr : Builtin {
+  let Spellings = ["__builtin_extract_return_addr"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+def FrameAddress : Builtin {
+  let Spellings = ["__builtin_frame_address"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(_Constant unsigned int)";
+}
+
+def ClearCache : Builtin {
+  let Spellings = ["__builtin___clear_cache"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(char*, char*)";
+}
+
+def BuiltinSetjmp : Builtin {
+  let Spellings = ["__builtin_setjmp"];
+  let Attributes = [ReturnsTwice];
+  let Prototype = "int(void**)";
+}
+
+def BuiltinLongjmp : Builtin {
+  let Spellings = ["__builtin_longjmp"];
+  let Attributes = [NoReturn];
+  let Prototype = "void(void**, int)";
+}
+
+def UnwindInit : Builtin {
+  let Spellings = ["__builtin_unwind_init"];
+  let Prototype = "void()";
+}
+
+def EHReturnDataRegNo : Builtin {
+  let Spellings = ["__builtin_eh_return_data_regno"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "int(_Constant int)";
+}
+
+def ThreadPointer : Builtin {
+  let Spellings = ["__builtin_thread_pointer"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "void*()";
+}
+
+def Launder : Builtin {
+  let Spellings = ["__builtin_launder"];
+  let Attributes = [NoThrow, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(void*)";
+}
+
+def IsConstantEvaluated : LangBuiltin<"CXX_LANG"> {
+  let Spellings = ["__builtin_is_constant_evaluated"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool()";
+}
+
+// GCC exception builtins
+def EHReturn : Builtin {
+  let Spellings = ["__builtin_eh_return"];
+  let Attributes = [NoReturn];
+  // FIXME: Takes intptr_t, not size_t!
+  let Prototype = "void(size_t, void*)";
+}
+
+def FrobReturnAddr : Builtin {
+  let Spellings = ["__builtin_frob_return_addr"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+def DWARF_CFA : Builtin {
+  let Spellings = ["__builtin_dwarf_cfa"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*()";
+}
+
+def InitDWARFRegSizeTable : Builtin {
+  let Spellings = ["__builtin_init_dwarf_reg_size_table"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void*)";
+}
+
+def DWARFSpColumn : Builtin {
+  let Spellings = ["__builtin_dwarf_sp_column"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned int()";
+}
+
+def ExtendPointer : Builtin {
+  let Spellings = ["__builtin_extend_pointer"];
+  let Attributes = [NoThrow];
+  // _Unwind_Word == uint64_t
+  let Prototype = "unsigned long long int(void*)";
+}
+
+// GCC Object size checking builtins.
+def ObjectSize : Builtin {
+  let Spellings = ["__builtin_object_size"];
+  let Attributes = [NoThrow, UnevaluatedArguments, Constexpr];
+  let Prototype = "size_t(void const*, int)";
+}
+
+def DynamicObjectSize : Builtin { // Clang only
+  let Spellings = ["__builtin_dynamic_object_size"];
+  let Attributes = [NoThrow, UnevaluatedArguments, Constexpr];
+  let Prototype = "size_t(void const*, int)";
+}
+
+def MemcpyChk : Builtin {
+  let Spellings = ["__builtin___memcpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, void const*, size_t, size_t)";
+}
+
+def MemccpyChk : Builtin {
+  let Spellings = ["__builtin___memccpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, void const*, int, size_t, size_t)";
+}
+
+def MemmoveChk : Builtin {
+  let Spellings = ["__builtin___memmove_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, void const*, size_t, size_t)";
+}
+
+def MempcpyChk : Builtin {
+  let Spellings = ["__builtin___mempcpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, void const*, size_t, size_t)";
+}
+
+def MemsetChk : Builtin {
+  let Spellings = ["__builtin___memset_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(void*, int, size_t, size_t)";
+}
+
+def StpcpyChk : Builtin {
+  let Spellings = ["__builtin___stpcpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "char*(char*, char const*, size_t)";
+}
+
+def StrcatChk : Builtin {
+  let Spellings = ["__builtin___strcat_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "char*(char*, char const*, size_t)";
+}
+
+def StrcpyChk : Builtin {
+  let Spellings = ["__builtin___strcpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "char*(char*, char const*, size_t)";
+}
+
+def StrlcatChk : Builtin {
+  let Spellings = ["__builtin___strlcat_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "size_t(char*, char const*, size_t, size_t)";
+}
+
+def StrlcpyChk : Builtin {
+  let Spellings = ["__builtin___strlcpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "size_t(char*, char const*, size_t, size_t)";
+}
+
+def StrncatChk : Builtin {
+  let Spellings = ["__builtin___strncat_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "char*(char*, char const*, size_t, size_t)";
+}
+
+def StrncpyChk : Builtin {
+  let Spellings = ["__builtin___strncpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "char*(char*, char const*, size_t, size_t)";
+}
+
+def StpncpyChk : Builtin {
+  let Spellings = ["__builtin___stpncpy_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "int(char*, char*, char const*, size_t, size_t)";
+}
+
+def SNPrintfChk : Builtin {
+  let Spellings = ["__builtin___snprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<4>];
+  let Prototype = "int(char* restrict, size_t, int, size_t, char const* restrict, ...)";
+}
+
+def SPrintfChk : Builtin {
+  let Spellings = ["__builtin___sprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<3>];
+  let Prototype = "int(char* restrict, int, size_t, char const* restrict, ...)";
+}
+
+def VSNPrintfChk : Builtin {
+  let Spellings = ["__builtin___vsnprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<4>];
+  let Prototype = "int(char* restrict, size_t, int, size_t, char const* restrict, __builtin_va_list)";
+}
+
+def VSPrintfChk : Builtin {
+  let Spellings = ["__builtin___vsprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<3>];
+  let Prototype = "int(char* restrict, int, size_t, char const* restrict, __builtin_va_list)";
+}
+
+def FPrintfChk : Builtin {
+  let Spellings = ["__builtin___fprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<2>];
+  let Prototype = "int(FILE* restrict, int, char const* restrict, ...)";
+}
+
+def PrintfChk : Builtin {
+  let Spellings = ["__builtin___printf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, PrintfFormat<1>];
+  let Prototype = "int(int, int, char const* restrict, ...)";
+}
+
+def VFPrintfChk : Builtin {
+  let Spellings = ["__builtin___vfprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<2>];
+  let Prototype = "int(FILE* restrict, int, char const* restrict, __builtin_va_list)";
+}
+
+def VPrintfChk : Builtin {
+  let Spellings = ["__builtin___vprintf_chk"];
+  let Attributes = [FunctionWithBuiltinPrefix, VPrintfFormat<1>];
+  let Prototype = "int(int, char const* restrict, __builtin_va_list)";
+}
+
+def Unpredictable : Builtin {
+  let Spellings = ["__builtin_unpredictable"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "long int(long int)";
+}
+
+def Expect : Builtin {
+  let Spellings = ["__builtin_expect"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "long int(long int, long int)";
+}
+
+def ExpectWithProbability : Builtin {
+  let Spellings = ["__builtin_expect_with_probability"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "long int(long int, long int, double)";
+}
+
+def Prefetch : Builtin {
+  let Spellings = ["__builtin_prefetch"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "void(void const*, ...)";
+}
+
+def ReadCycleCounter : Builtin {
+  let Spellings = ["__builtin_readcyclecounter"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned long long int()";
+}
+
+def Trap : Builtin {
+  let Spellings = ["__builtin_trap"];
+  let Attributes = [NoThrow, NoReturn];
+  let Prototype = "void()";
+}
+
+def Debugtrap : Builtin {
+  let Spellings = ["__builtin_debugtrap"];
+  let Attributes = [NoThrow];
+  let Prototype = "void()";
+}
+
+def Unreachable : Builtin {
+  let Spellings = ["__builtin_unreachable"];
+  let Attributes = [NoThrow, NoReturn];
+  let Prototype = "void()";
+}
+
+def ShuffleVector : Builtin {
+  let Spellings = ["__builtin_shufflevector"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ConvertVector : Builtin {
+  let Spellings = ["__builtin_convertvector"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AllocaUninitialized : Builtin {
+  let Spellings = ["__builtin_alloca_uninitialized"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(size_t)";
+}
+
+def AllocaWithAlign : Builtin {
+  let Spellings = ["__builtin_alloca_with_align"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(size_t, _Constant size_t)";
+}
+
+def AllocaWithAlignUninitialized : Builtin {
+  let Spellings = ["__builtin_alloca_with_align_uninitialized"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
+  let Prototype = "void*(size_t, _Constant size_t)";
+}
+
+def CallWithStaticChain : Builtin {
+  let Spellings = ["__builtin_call_with_static_chain"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def NondetermenisticValue : Builtin {
+  let Spellings = ["__builtin_nondeterministic_value"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseAbs : Builtin {
+  let Spellings = ["__builtin_elementwise_abs"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseBitreverse : Builtin {
+  let Spellings = ["__builtin_elementwise_bitreverse"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseMax : Builtin {
+  let Spellings = ["__builtin_elementwise_max"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseMin : Builtin {
+  let Spellings = ["__builtin_elementwise_min"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseCeil : Builtin {
+  let Spellings = ["__builtin_elementwise_ceil"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseCos : Builtin {
+  let Spellings = ["__builtin_elementwise_cos"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseExp : Builtin {
+  let Spellings = ["__builtin_elementwise_exp"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseExp2 : Builtin {
+  let Spellings = ["__builtin_elementwise_exp2"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseFloor : Builtin {
+  let Spellings = ["__builtin_elementwise_floor"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseLog : Builtin {
+  let Spellings = ["__builtin_elementwise_log"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseLog2 : Builtin {
+  let Spellings = ["__builtin_elementwise_log2"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseLog10 : Builtin {
+  let Spellings = ["__builtin_elementwise_log10"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwisePow : Builtin {
+  let Spellings = ["__builtin_elementwise_pow"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseRoundEven : Builtin {
+  let Spellings = ["__builtin_elementwise_roundeven"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseRound : Builtin {
+  let Spellings = ["__builtin_elementwise_round"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseRint : Builtin {
+  let Spellings = ["__builtin_elementwise_rint"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseNearbyInt : Builtin {
+  let Spellings = ["__builtin_elementwise_nearbyint"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseSin : Builtin {
+  let Spellings = ["__builtin_elementwise_sin"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseSqrt : Builtin {
+  let Spellings = ["__builtin_elementwise_sqrt"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseTrunc : Builtin {
+  let Spellings = ["__builtin_elementwise_trunc"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseCanonicalize : Builtin {
+  let Spellings = ["__builtin_elementwise_canonicalize"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseCopysign : Builtin {
+  let Spellings = ["__builtin_elementwise_copysign"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseFma : Builtin {
+  let Spellings = ["__builtin_elementwise_fma"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseAddSat : Builtin {
+  let Spellings = ["__builtin_elementwise_add_sat"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ElementwiseSubSat : Builtin {
+  let Spellings = ["__builtin_elementwise_sub_sat"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceMax : Builtin {
+  let Spellings = ["__builtin_reduce_max"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceMin : Builtin {
+  let Spellings = ["__builtin_reduce_min"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceXor : Builtin {
+  let Spellings = ["__builtin_reduce_xor"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceOr : Builtin {
+  let Spellings = ["__builtin_reduce_or"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceAnd : Builtin {
+  let Spellings = ["__builtin_reduce_and"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceAdd : Builtin {
+  let Spellings = ["__builtin_reduce_add"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ReduceMul : Builtin {
+  let Spellings = ["__builtin_reduce_mul"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def MatrixTranspose : Builtin {
+  let Spellings = ["__builtin_matrix_transpose"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def MatrixColumnMajorLoad : Builtin {
+  let Spellings = ["__builtin_matrix_column_major_load"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def MatrixColumnMajorStore : Builtin {
+  let Spellings = ["__builtin_matrix_column_major_store"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+// "Overloaded" Atomic operator builtins.  These are overloaded to support data
+// types of i8, i16, i32, i64, and i128.  The front-end sees calls to the
+// non-suffixed version of these (which has a bogus type) and transforms them to
+// the right overloaded version in Sema (plus casts).
+
+def SyncFetchAndAdd : Builtin {
+  let Spellings = ["__sync_fetch_and_add"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncFetchAndAddN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_fetch_and_add_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncFetchAndSub : Builtin {
+  let Spellings = ["__sync_fetch_and_sub"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncFetchAndSubN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_fetch_and_sub_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncFetchAndOr : Builtin {
+  let Spellings = ["__sync_fetch_and_or"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncFetchAndOrN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_fetch_and_or_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncFetchAndAnd : Builtin {
+  let Spellings = ["__sync_fetch_and_and"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncFetchAndAndN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_fetch_and_and_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncFetchAndXor : Builtin {
+  let Spellings = ["__sync_fetch_and_xor"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncFetchAndXorN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_fetch_and_xor_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncFetchAndNand : Builtin {
+  let Spellings = ["__sync_fetch_and_nand"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncFetchAndNandN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_fetch_and_nand_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncAddAndFetch : Builtin {
+  let Spellings = ["__sync_add_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncAddAndFetchN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_add_and_fetch_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncSubAndFetch : Builtin {
+  let Spellings = ["__sync_sub_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncSubAndFetchN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_sub_and_fetch_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncOrAndFetch : Builtin {
+  let Spellings = ["__sync_or_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncOrAndFetchN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_or_and_fetch_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncAndAndFetch : Builtin {
+  let Spellings = ["__sync_and_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncAndAndFetchN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_and_and_fetch_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncXorAndFetch : Builtin {
+  let Spellings = ["__sync_xor_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncXorAndFetchN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_xor_and_fetch_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncNandAndFetch : Builtin {
+  let Spellings = ["__sync_nand_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncNandAndFetchN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_nand_and_fetch_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncBoolCompareAndSwap : Builtin {
+  let Spellings = ["__sync_bool_compare_and_swap"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncBoolCompareAndSwapN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_bool_compare_and_swap_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncValCompareAndSwap : Builtin {
+  let Spellings = ["__sync_val_compare_and_swap"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SynLockValCompareAndSwapN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_val_compare_and_swap_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncLockTestAndSet : Builtin {
+  let Spellings = ["__sync_lock_test_and_set"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SynLockLockTestAndSetN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_lock_test_and_set_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncLockReleaseN : Builtin {
+  let Spellings = ["__sync_lock_release"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SynLockReleaseN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_lock_release_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+def SyncSwap : Builtin {
+  let Spellings = ["__sync_swap"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def SyncSwapN : Builtin, SyncBuiltinsTemplate {
+  let Spellings = ["__sync_swap_"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "T(T volatile*, T, ...)";
+}
+
+// C11 _Atomic operations for <stdatomic.h>.
+def C11AtomicInit : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_init"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicLoad : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_load"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicStore : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_store"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicExchange : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicCompareExchangeStrong : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_compare_exchange_strong"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicCompareExchangeWeak : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_compare_exchange_weak"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchAdd : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_add"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchSub : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_sub"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchAnd : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_and"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchOr : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_or"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchXor : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_xor"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchNand : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_nand"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchMax : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_max"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicFetchMin : AtomicBuiltin {
+  let Spellings = ["__c11_atomic_fetch_min"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def C11AtomicThreadFence : Builtin {
+  let Spellings = ["__c11_atomic_thread_fence"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(int)";
+}
+
+def C11AtomicSignalFence : Builtin {
+  let Spellings = ["__c11_atomic_signal_fence"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(int)";
+}
+
+def C11AtomicIsLockFree : Builtin {
+  let Spellings = ["__c11_atomic_is_lock_free"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(size_t)";
+}
+
+// GNU atomic builtins.
+def AtomicLoad : AtomicBuiltin {
+  let Spellings = ["__atomic_load"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicLoadN : AtomicBuiltin {
+  let Spellings = ["__atomic_load_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicStore : AtomicBuiltin {
+  let Spellings = ["__atomic_store"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicStoreN : AtomicBuiltin {
+  let Spellings = ["__atomic_store_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicExchange : AtomicBuiltin {
+  let Spellings = ["__atomic_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicExchangeN : AtomicBuiltin {
+  let Spellings = ["__atomic_exchange_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicCompareExchange : AtomicBuiltin {
+  let Spellings = ["__atomic_compare_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicCompareExchangeN : AtomicBuiltin {
+  let Spellings = ["__atomic_compare_exchange_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchAdd : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_add"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchSub : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_sub"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchAnd : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_and"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchOr : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_or"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchXor : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_xor"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchNand : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_nand"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicAddFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_add_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicSubFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_sub_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicAndFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicOrFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_or_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicXorFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_xor_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicMaxFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_max_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicMinFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_min_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicNandFetch : AtomicBuiltin {
+  let Spellings = ["__atomic_nand_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicTestAndSet : Builtin {
+  let Spellings = ["__atomic_test_and_set"];
+  let Attributes = [NoThrow];
+  let Prototype = "bool(void volatile*, int)";
+}
+
+def AtomicClear : Builtin {
+  let Spellings = ["__atomic_clear"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void volatile*, int)";
+}
+
+def AtomicThreadFence : Builtin {
+  let Spellings = ["__atomic_thread_fence"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(int)";
+}
+
+def AtomicSignalFence : Builtin {
+  let Spellings = ["__atomic_signal_fence"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(int)";
+}
+
+def AtomicAlwaysLockFree : Builtin {
+  let Spellings = ["__atomic_always_lock_free"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(size_t, void const volatile*)";
+}
+
+def AtomicIsLockFree : Builtin {
+  let Spellings = ["__atomic_is_lock_free"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(size_t, void const volatile*)";
+}
+
+// OpenCL 2.0 atomic builtins.
+def OpenCLAtomicInit : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_init"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicLoad : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_load"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicStore : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_store"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicCompareExchangeWeak : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_compare_exchange_weak"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicCompareExchangeStrong : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_compare_exchange_strong"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicExchange : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchAdd : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_add"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchSub : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_sub"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchAnd : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_and"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchOr : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_or"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchXor : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_xor"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchMin : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_min"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def OpenCLAtomicFetchMax : AtomicBuiltin {
+  let Spellings = ["__opencl_atomic_fetch_max"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+// GCC does not support these, they are a Clang extension.
+def AtomicFetchMax : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_max"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def AtomicFetchMin : AtomicBuiltin {
+  let Spellings = ["__atomic_fetch_min"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+// HIP atomic builtins.
+def HipAtomicLoad : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_load"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicStore : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_store"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicCompareExchangeWeak : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_compare_exchange_weak"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicCompareExchangeStrong : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_compare_exchange_strong"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicExchange : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchAdd : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_add"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchSub : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_sub"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchAnd : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_and"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchOr : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_or"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchXor : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_xor"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchMin : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_min"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def HipAtomicFetchMax : AtomicBuiltin {
+  let Spellings = ["__hip_atomic_fetch_max"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+// Non-overloaded atomic builtins.
+def SyncSynchronize : Builtin {
+  let Spellings = ["__sync_synchronize"];
+  let Attributes = [NoThrow];
+  let Prototype = "void()";
+}
+
+// GCC does not support these, they are a Clang extension.
+def SyncFetchAndMin : Builtin {
+  let Spellings = ["__sync_fetch_and_min"];
+  let Attributes = [NoThrow];
+  let Prototype = "int(int volatile*, int)";
+}
+
+def SyncFetchAndMax : Builtin {
+  let Spellings = ["__sync_fetch_and_max"];
+  let Attributes = [NoThrow];
+  let Prototype = "int(int volatile*, int)";
+}
+
+def SyncFetchAndUMin : Builtin {
+  let Spellings = ["__sync_fetch_and_umin"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned int(unsigned int volatile*, unsigned int)";
+}
+
+def SyncFetchAndUMax : Builtin {
+  let Spellings = ["__sync_fetch_and_umax"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned int(unsigned int volatile*, unsigned int)";
+}
+
+// ignored glibc builtin, see https://sourceware.org/bugzilla/show_bug.cgi?id=25399
+def WarnMemsetZeroLen : Builtin {
+  let Spellings = ["__warn_memset_zero_len"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "void()";
+}
+
+// Microsoft builtins. These are only active with -fms-extensions.
+def Alloca : MSLangBuiltin {
+  let Spellings = ["_alloca"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(size_t)";
+}
+
+def MSAnnotation : MSLangBuiltin {
+  let Spellings = ["__annotation"];
+  let Attributes = [NoThrow];
+  let Prototype = "wchar_t const*(...)";
+}
+
+def MSAssume : MSLangBuiltin {
+  let Spellings = ["__assume"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "void(bool)";
+}
+
+def Bittest : MSLangBuiltin, MSInt32_64Template {
+  let Spellings = ["_bittest"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(T const*, T)";
+}
+
+def BittestAndComplement : MSLangBuiltin, MSInt32_64Template {
+  let Spellings = ["_bittestandcomplement"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(T*, T)";
+}
+
+def BittestAndReset : MSLangBuiltin, MSInt32_64Template {
+  let Spellings = ["_bittestandreset"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(T*, T)";
+}
+
+def BittestAndSet : MSLangBuiltin, MSInt32_64Template {
+  let Spellings = ["_bittestandset"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(T*, T)";
+}
+
+def MSByteswap : MSLibBuiltin<"stdlib.h">,
+    Template<["unsigned short", "msuint32_t", "unsigned long long int"],
+             ["_ushort",        "_ulong",     "_uint64"]> {
+  let Spellings = ["_byteswap"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+}
+
+def Debugbreak : MSLangBuiltin {
+  let Spellings = ["__debugbreak"];
+  let Attributes = [NoThrow];
+  let Prototype = "void()";
+}
+
+def ExceptionCode : MSLangBuiltin {
+  let Spellings = ["__exception_code", "_exception_code"];
+  let Attributes = [NoThrow];
+  let Prototype = "msuint32_t()";
+}
+
+def ExceptionInfo : MSLangBuiltin {
+  let Spellings = ["__exception_info", "_exception_info"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*()";
+}
+
+def AbnormalTermination : MSLangBuiltin {
+  let Spellings = ["__abnormal_termination", "_abnormal_termination"];
+  let Attributes = [NoThrow];
+  let Prototype = "int()";
+}
+
+def GetExceptionInfo : MSLangBuiltin {
+  let Spellings = ["__GetExceptionInfo"];
+  let Attributes = [NoThrow, CustomTypeChecking, UnevaluatedArguments];
+  let Prototype = "void*(...)";
+  let Namespace = "std";
+}
+
+def InterlockedAnd : MSLangBuiltin, MSInt8_16_32Template {
+  let Spellings = ["_InterlockedAnd"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T)";
+}
+
+def InterlockedCompareExchange : MSLangBuiltin, MSInt8_16_32_64Template {
+  let Spellings = ["_InterlockedCompareExchange"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T, T)";
+}
+
+def InterlockedCompareExchangePointer : MSLangBuiltin {
+  let Spellings = ["_InterlockedCompareExchangePointer"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void* volatile*, void*, void*)";
+}
+
+def InterlockedCompareExchangePointer_nf : MSLangBuiltin {
+  let Spellings = ["_InterlockedCompareExchangePointer_nf"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void* volatile*, void*, void*)";
+}
+
+def InterlockedDecrement : MSLangBuiltin, MSInt16_32Template {
+  let Spellings = ["_InterlockedDecrement"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*)";
+}
+
+def InterlockedExchange : MSLangBuiltin, MSInt8_16_32Template {
+  let Spellings = ["_InterlockedExchange"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T)";
+}
+
+def InterlockedExchangeAdd : MSLangBuiltin, MSInt8_16_32Template {
+  let Spellings = ["_InterlockedExchangeAdd"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T)";
+}
+
+def InterlockedExchangePointer : MSLangBuiltin {
+  let Spellings = ["_InterlockedExchangePointer"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void* volatile*, void*)";
+}
+
+def InterlockedExchangeSub : MSLangBuiltin, MSInt8_16_32Template {
+  let Spellings = ["_InterlockedExchangeSub"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T)";
+}
+
+def InterlockedIncrement : MSLangBuiltin, MSInt16_32Template {
+  let Spellings = ["_InterlockedIncrement"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*)";
+}
+
+def InterlockedOr : MSLangBuiltin, MSInt8_16_32Template {
+  let Spellings = ["_InterlockedOr"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T)";
+}
+
+def InterlockedXor : MSLangBuiltin, MSInt8_16_32Template {
+  let Spellings = ["_InterlockedXor"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T volatile*, T)";
+}
+
+def InterlockedBittestAndReset : MSLangBuiltin, MSInt32_64Template {
+  let Spellings = ["_interlockedbittestandreset"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(T volatile*, T)";
+}
+
+def InterlockedBittestAndReset_acq : MSLangBuiltin {
+  let Spellings = ["_interlockedbittestandreset_acq"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
+}
+
+def InterlockedBittestAndReset_nf : MSLangBuiltin {
+  let Spellings = ["_interlockedbittestandreset_nf"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
+}
+
+def InterlockedBittestAndReset_rel : MSLangBuiltin {
+  let Spellings = ["_interlockedbittestandreset_rel"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
+}
+
+def InterlockedBittestAndSet : MSLangBuiltin, MSInt32_64Template {
+  let Spellings = ["_interlockedbittestandset"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(T volatile*, T)";
+}
+
+def InterlockedBittestAndSet_acq : MSLangBuiltin {
+  let Spellings = ["_interlockedbittestandset_acq"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
+}
+
+def InterlockedBittestAndSet_nf : MSLangBuiltin {
+  let Spellings = ["_interlockedbittestandset_nf"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
+}
+
+def InterlockedBittestAndSet_rel : MSLangBuiltin {
+  let Spellings = ["_interlockedbittestandset_rel"];
+  let Attributes = [NoThrow];
+  let Prototype = "unsigned char(msint32_t volatile*, msint32_t)";
+}
+
+def IsoVolatileLoad : MSLangBuiltin, Int8_16_32_64Template {
+  let Spellings = ["__iso_volatile_load"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T const volatile*)";
+}
+
+def IsoVolatileStore : MSLangBuiltin, Int8_16_32_64Template {
+  let Spellings = ["__iso_volatile_store"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(T volatile*, T)";
+}
+
+def Noop : MSLangBuiltin {
+  let Spellings = ["__noop"];
+  let Attributes = [NoThrow];
+  let Prototype = "int(...)";
+}
+
+def MSCountLeadingZeroes : MSLangBuiltin, MSUInt16_32_64Template {
+  let Spellings = ["__lzcnt"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T(T)";
+}
+
+def MSPopCount : MSLangBuiltin, MSUInt16_32_64Template {
+  let Spellings = ["__popcnt"];
+  let Attributes = [NoThrow, Const, Constexpr];
+  let Prototype = "T(T)";
+}
+
+def MSReturnAddress : MSLangBuiltin {
+  let Spellings = ["_ReturnAddress"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*()";
+}
+
+def Rotl8 : MSLangBuiltin {
+  let Spellings = ["_rotl8"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned char(unsigned char, unsigned char)";
+}
+
+def Rotl16 : MSLangBuiltin {
+  let Spellings = ["_rotl16"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned short(unsigned short, unsigned char)";
+}
+
+def Rotl : MSLangBuiltin {
+  let Spellings = ["_rotl"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned int(unsigned int, int)";
+}
+
+def Lrotl : MSLangBuiltin {
+  let Spellings = ["_lrotl"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned long int(unsigned long int, int)";
+}
+
+def Rotl64 : MSLangBuiltin {
+  let Spellings = ["_rotl64"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "uint64_t(uint64_t, int)";
+}
+
+def Rotr8 : MSLangBuiltin {
+  let Spellings = ["_rotr8"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned char(unsigned char, unsigned char)";
+}
+
+def Rotr16 : MSLangBuiltin {
+  let Spellings = ["_rotr16"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned short(unsigned short, unsigned char)";
+}
+
+def Rotr : MSLangBuiltin {
+  let Spellings = ["_rotr"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned int(unsigned int, int)";
+}
+
+def Lrotr : MSLangBuiltin {
+  let Spellings = ["_lrotr"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "unsigned long int(unsigned long int, int)";
+}
+
+def Rotr64 : MSLangBuiltin {
+  let Spellings = ["_rotr64"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "uint64_t(uint64_t, int)";
+}
+
+def MSva_start : MSLangBuiltin {
+  let Spellings = ["__va_start"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(char**, ...)";
+}
+
+def FastFail : MSLangBuiltin {
+  let Spellings = ["__fastfail"];
+  let Attributes = [NoThrow, NoReturn];
+  let Prototype = "void(unsigned int)";
+}
+
+// Microsoft library builtins.
+def SetJmpEx : MSLibBuiltin<"setjmpex.h"> {
+  let Spellings = ["_setjmpex"];
+  let Attributes = [IgnoreSignature, ReturnsTwice];
+  let Prototype = "int(jmp_buf)";
+}
+
+// C99 library functions
+// C99 stdarg.h
+def VaStart : LibBuiltin<"stdarg.h"> {
+  let Spellings = ["va_start"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(__builtin_va_list_ref, ...)";
+}
+
+def VaEnd : LibBuiltin<"stdarg.h"> {
+  let Spellings = ["va_end"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(__builtin_va_list_ref)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VaCopy : LibBuiltin<"stdarg.h"> {
+  let Spellings = ["va_copy"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(__builtin_va_list_ref, __builtin_va_list_ref)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// C99 stdlib.h
+def Abort : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["abort"];
+  let Attributes = [NoThrow, NoReturn];
+  let Prototype = "void()";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Calloc : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["calloc"];
+  let Prototype = "void*(size_t, size_t)";
+}
+
+def Exit : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["exit", "_Exit"];
+  let Attributes = [NoReturn];
+  let Prototype = "void(int)";
+}
+
+def Malloc : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["malloc"];
+  let Prototype = "void*(size_t)";
+}
+
+def Realloc : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["realloc"];
+  let Prototype = "void*(void*, size_t)";
+}
+
+def Free : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["free"];
+  let Prototype = "void(void*)";
+}
+
+def StrToD : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtod"];
+  let Prototype = "double(char const*, char**)";
+}
+
+def StrToF : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtof"];
+  let Prototype = "float(char const*, char**)";
+}
+
+def StrToLd : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtold"];
+  let Prototype = "long double(char const*, char**)";
+}
+
+def StrToL : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtol"];
+  let Prototype = "long int(char const*, char**, int)";
+}
+
+def StrToLL : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtoll"];
+  let Prototype = "long long int(char const*, char**, int)";
+}
+
+def StrToUL : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtoul"];
+  let Prototype = "unsigned long int(char const*, char**, int)";
+}
+
+def StrToULL : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["strtoull"];
+  let Prototype = "unsigned long long int(char const*, char**, int)";
+}
+
+// C11 stdlib.h
+def AlignedAlloc : LibBuiltin<"stdlib.h"> {
+  let Spellings = ["aligned_alloc"];
+  let Prototype = "void*(size_t, size_t)";
+}
+
+// C99 string.h
+def MemCpy : LibBuiltin<"string.h"> {
+  let Spellings = ["memcpy"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "void*(void*, void const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def BuiltinMemCmp : Builtin {
+  let Spellings = ["__builtin_memcmp"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Constexpr];
+  let Prototype = "int(void const*, void const*, size_t)";
+}
+
+def MemCmp : LibBuiltin<"string.h"> {
+  let Spellings = ["memcmp"];
+  let Attributes = [Constexpr];
+  let Prototype = "int(void const*, void const*, size_t)";
+}
+
+def MemMove : LibBuiltin<"string.h"> {
+  let Spellings = ["memmove"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "void*(void*, void const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrCpy : LibBuiltin<"string.h"> {
+  let Spellings = ["strcpy"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrNCpy : LibBuiltin<"string.h"> {
+  let Spellings = ["strncpy"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char*, char const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrCmp : LibBuiltin<"string.h"> {
+  let Spellings = ["strcmp"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "int(char const*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrNCmp : LibBuiltin<"string.h"> {
+  let Spellings = ["strncmp"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "int(char const*, char const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrCat : LibBuiltin<"string.h"> {
+  let Spellings = ["strcat"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrNCat : LibBuiltin<"string.h"> {
+  let Spellings = ["strncat"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char*, char const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrxFrm : LibBuiltin<"string.h"> {
+  let Spellings = ["strxfrm"];
+  let Prototype = "size_t(char*, char const*, size_t)";
+}
+
+def MemChr : LibBuiltin<"string.h"> {
+  let Spellings = ["memchr"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "void*(void const*, int, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrChr : LibBuiltin<"string.h"> {
+  let Spellings = ["strchr"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "char*(char const*, int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrcSpn : LibBuiltin<"string.h"> {
+  let Spellings = ["strcspn"];
+  let Prototype = "size_t(char const*, char const*)";
+}
+
+def StrpBrk : LibBuiltin<"string.h"> {
+  let Spellings = ["strpbrk"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrrChr : LibBuiltin<"string.h"> {
+  let Spellings = ["strrchr"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*, int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrSpn : LibBuiltin<"string.h"> {
+  let Spellings = ["strspn"];
+  let Attributes = [NoThrow];
+  let Prototype = "size_t(char const*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrStr : LibBuiltin<"string.h"> {
+  let Spellings = ["strstr"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrTok : LibBuiltin<"string.h"> {
+  let Spellings = ["strtok"];
+  let Prototype = "char*(char*, char const*)";
+}
+
+def MemSet : LibBuiltin<"string.h"> {
+  let Spellings = ["memset"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void*, int, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrError : LibBuiltin<"string.h"> {
+  let Spellings = ["strerror"];
+  let Prototype = "char*(int)";
+}
+
+def StrLen : LibBuiltin<"string.h"> {
+  let Spellings = ["strlen"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "size_t(char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// C99 stdio.h
+// FIXME: This list is incomplete.
+def Printf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["printf"];
+  let Attributes = [PrintfFormat<0>];
+  let Prototype = "int(char const*, ...)";
+}
+
+// FIXME: The builtin and library function should have the same signature.
+def BuiltinPrintf : Builtin {
+  let Spellings = ["__builtin_printf"];
+  let Attributes = [NoThrow, PrintfFormat<0>, FunctionWithBuiltinPrefix];
+  let Prototype = "int(char const* restrict, ...)";
+}
+
+def FPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["fprintf"];
+  let Attributes = [NoThrow, PrintfFormat<1>];
+  let Prototype = "int(FILE* restrict, char const* restrict, ...)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def SnPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["snprintf"];
+  let Attributes = [NoThrow, PrintfFormat<2>];
+  let Prototype = "int(char* restrict, size_t, char const* restrict, ...)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def SPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["sprintf"];
+  let Attributes = [NoThrow, PrintfFormat<1>];
+  let Prototype = "int(char* restrict, char const* restrict, ...)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vprintf"];
+  let Attributes = [NoThrow, VPrintfFormat<0>];
+  let Prototype = "int(char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VfPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vfprintf"];
+  let Attributes = [NoThrow, VPrintfFormat<1>];
+  let Prototype = "int(FILE* restrict, char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VsnPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vsnprintf"];
+  let Attributes = [NoThrow, VPrintfFormat<2>];
+  let Prototype = "int(char* restrict, size_t, char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VsPrintf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vsprintf"];
+  let Attributes = [NoThrow, VPrintfFormat<1>];
+  let Prototype = "int(char* restrict, char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Scanf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["scanf"];
+  let Attributes = [ScanfFormat<0>];
+  let Prototype = "int(char const* restrict, ...)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def FScanf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["fscanf"];
+  let Attributes = [ScanfFormat<1>];
+  let Prototype = "int(FILE* restrict, char const* restrict, ...)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def SScanf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["sscanf"];
+  let Attributes = [ScanfFormat<1>];
+  let Prototype = "int(char const* restrict, char const* restrict, ...)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VScanf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vscanf"];
+  let Attributes = [VScanfFormat<0>];
+  let Prototype = "int(char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VFScanf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vfscanf"];
+  let Attributes = [VScanfFormat<1>];
+  let Prototype = "int(FILE* restrict, char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def VSScanf : LibBuiltin<"stdio.h"> {
+  let Spellings = ["vsscanf"];
+  let Attributes = [VScanfFormat<1>];
+  let Prototype = "int(char const* restrict, char const* restrict, __builtin_va_list)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Fopen : LibBuiltin<"stdio.h"> {
+  let Spellings = ["fopen"];
+  let Prototype = "FILE*(char const*, char const*)";
+}
+
+def Fread : LibBuiltin<"stdio.h"> {
+  let Spellings = ["fread"];
+  let Prototype = "size_t(void*, size_t, size_t, FILE*)";
+}
+
+def Fwrite : LibBuiltin<"stdio.h"> {
+  let Spellings = ["fwrite"];
+  let Prototype = "size_t(void const*, size_t, size_t, FILE*)";
+}
+
+// C99 ctype.h
+
+def IsAlNum : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isalnum"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsAlpha : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isalpha"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsBlank : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isblank"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsCntrl : LibBuiltin<"ctype.h"> {
+  let Spellings = ["iscntrl"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsDigit : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isdigit"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsGraph : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isgraph"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsLower : LibBuiltin<"ctype.h"> {
+  let Spellings = ["islower"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsPrint : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isprint"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsPunct : LibBuiltin<"ctype.h"> {
+  let Spellings = ["ispunct"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsSpace : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isspace"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsUpper : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isupper"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def IsXDigit : LibBuiltin<"ctype.h"> {
+  let Spellings = ["isxdigit"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def ToLower : LibBuiltin<"ctype.h"> {
+  let Spellings = ["tolower"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+def ToUpper : LibBuiltin<"ctype.h"> {
+  let Spellings = ["toupper"];
+  let Attributes = [NoThrow, Pure];
+  let Prototype = "int(int)";
+}
+
+// C99 wchar.h
+// FIXME: This list is incomplete. We should cover at least the functions that
+// take format strings.
+
+def WcsChr : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wcschr"];
+  let Attributes = [NoThrow, Pure, Constexpr];
+  let Prototype = "wchar_t*(wchar_t const*, wchar_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WcsCmp : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wcscmp"];
+  let Attributes = [NoThrow, Pure, Constexpr];
+  let Prototype = "int(wchar_t const*, wchar_t const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WcsLen : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wcslen"];
+  let Attributes = [NoThrow, Pure, Constexpr];
+  let Prototype = "size_t(wchar_t const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WcsnCmp : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wcsncmp"];
+  let Attributes = [NoThrow, Pure, Constexpr];
+  let Prototype = "int(wchar_t const*, wchar_t const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WMemChr : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wmemchr"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "wchar_t*(wchar_t const*, wchar_t, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WMemCmp : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wmemcmp"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "int(wchar_t const*, wchar_t const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WMemCpy : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wmemcpy"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "wchar_t*(wchar_t*, wchar_t const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def WMemMove : LibBuiltin<"wchar.h"> {
+  let Spellings = ["wmemmove"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "wchar_t*(wchar_t*, wchar_t const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// C99
+
+// FIXME: MinGW _setjmp has an additional void* parameter.
+def SetJmp : LibBuiltin<"setjmp.h"> {
+  let Spellings = ["setjmp", "_setjmp"];
+  let Attributes = [ReturnsTwice, IgnoreSignature];
+  let Prototype = "int(jmp_buf)";
+  let RequiresUndef = 1;
+}
+
+def LongJmp : LibBuiltin<"setjmp.h"> {
+  let Spellings = ["longjmp"];
+  let Attributes = [NoReturn, IgnoreSignature];
+  let Prototype = "void(jmp_buf, int)";
+}
+
+// Non-C library functions, active in GNU mode only.
+// Functions with [[gnu::returns_twice]] attribute are still active in
+// all languages, because losing this attribute would result in miscompilation
+// when these functions are used in non-GNU mode. PR16138.
+
+def AllocA : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["alloca"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// POSIX malloc.h
+
+def MemAlign : GNULibBuiltin<"malloc.h"> {
+  let Spellings = ["memalign"];
+  let Prototype = "void*(size_t, size_t)";
+}
+
+// POSIX string.h
+
+def MemcCpy : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["memccpy"];
+  let Prototype = "void*(void*, void const*, int, size_t)";
+}
+
+def MempCpy : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["mempcpy"];
+  let Prototype = "void*(void*, void const*, size_t)";
+}
+
+def StpCpy : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["stpcpy"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StpnCpy : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["stpncpy"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char*, char const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrDup : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["strdup"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def StrnDup : GNULibBuiltin<"stdlib.h"> {
+  let Spellings = ["strndup"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// POSIX strings.h
+
+def Index : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["index"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*, int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Rindex : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["rindex"];
+  let Attributes = [NoThrow];
+  let Prototype = "char*(char const*, int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def BZero : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["bzero"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// FIXME: This should be part of BCmp.
+def BuiltinBCmp : Builtin {
+  let Spellings = ["__builtin_bcmp"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Constexpr];
+  let Prototype = "int(void const*, void const*, size_t)";
+}
+
+def BCmp : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["bcmp"];
+  let Attributes = [Constexpr];
+  let Prototype = "int(void const*, void const*, size_t)";
+}
+
+def StrCaseCmp : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["strcasecmp"];
+  let Prototype = "int(char const*, char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+  let RequiresUndef = 1;
+}
+
+def StrnCaseCmp : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["strncasecmp"];
+  let Prototype = "int(char const*, char const*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+  let RequiresUndef = 1;
+}
+
+def GNU_Exit : GNULibBuiltin<"unistd.h"> {
+  let Spellings = ["_exit"];
+  let Attributes = [NoReturn];
+  let Prototype = "void(int)";
+}
+
+def VFork : LibBuiltin<"unistd.h"> {
+  let Spellings = ["vfork"];
+  let Attributes = [ReturnsTwice, IgnoreSignature];
+  let Prototype = "pid_t()";
+}
+
+// POSIX pthread.h
+// FIXME: This should be a GNULibBuiltin, but it's currently missing the prototype.
+
+def PthreadCreate : CustomEntry {
+  let Entry = "LIBBUILTIN(pthread_create, \"\",  \"fC<2,3>\", PTHREAD_H, ALL_GNU_LANGUAGES)";
+}
+
+def SigSetJmp : LibBuiltin<"setjmp.h"> {
+  let Spellings = ["sigsetjmp", "__sigsetjmp"];
+  let Attributes = [ReturnsTwice, IgnoreSignature];
+  let Prototype = "int(sigjmp_buf, int)";
+}
+
+def SaveCtx : LibBuiltin<"setjmp.h"> {
+  let Spellings = ["savectx"];
+  let Attributes = [ReturnsTwice, IgnoreSignature];
+  let Prototype = "int(sigjmp_buf)";
+}
+
+def GetContext : LibBuiltin<"setjmp.h"> {
+  let Spellings = ["getcontext"];
+  let Attributes = [ReturnsTwice, IgnoreSignature];
+  let Prototype = "int(ucontext_t*)";
+}
+
+def GNU_LongJmp : GNULibBuiltin<"setjmp.h"> {
+  let Spellings = ["_longjmp"];
+  let Attributes = [NoReturn, IgnoreSignature];
+  let Prototype = "void(jmp_buf, int)";
+}
+
+def SigLongJmp : GNULibBuiltin<"setjmp.h"> {
+  let Spellings = ["siglongjmp"];
+  let Attributes = [NoReturn, IgnoreSignature];
+  let Prototype = "void(sigjmp_buf, int)";
+}
+
+// non-standard but very common
+
+def StrlCpy : GNULibBuiltin<"string.h"> {
+  let Spellings = ["strlcpy"];
+  let Prototype = "size_t(char*, char const*, size_t)";
+}
+
+def StrlCat : GNULibBuiltin<"string.h"> {
+  let Spellings = ["strlcat"];
+  let Prototype = "size_t(char*, char const*, size_t)";
+}
+
+def ObjcMsgSend : ObjCLibBuiltin<"objc_message.h"> {
+  let Spellings = ["objc_msgSend"];
+  let Prototype = "id(id, SEL, ...)";
+}
+
+def ObjcMsgSendFpret : ObjCLibBuiltin<"objc_message.h"> {
+  let Spellings = ["objc_msgSend_fpret"];
+  let Prototype = "long double(id, SEL, ...)";
+}
+
+def ObjcMsgSendFp2ret : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_msgSend_fp2ret"];
+  let Prototype = "_Complex long double(id, SEL, ...)";
+}
+
+def ObjcMsgSendStret : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_msgSend_stret"];
+  let Prototype = "void(id, SEL, ...)";
+}
+
+def ObjcMsgSendSuper : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_msgSendSuper"];
+  let Prototype = "id(objc_super*, SEL, ...)";
+}
+
+def ObjcMsgSendSuperStret : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_msgSendSuper_stret"];
+  let Prototype = "void(objc_super*, SEL, ...)";
+}
+
+def ObjcGetClass : ObjCLibBuiltin<"objc/runtime.h"> {
+  let Spellings = ["objc_getClass"];
+  let Prototype = "id(char const*)";
+}
+
+def ObjcGetMetaClass : ObjCLibBuiltin<"objc/runtime.h"> {
+  let Spellings = ["objc_getMetaClass"];
+  let Prototype = "id(char const*)";
+}
+
+def ObjcEnumerationMutation : ObjCLibBuiltin<"objc/runtime.h"> {
+  let Spellings = ["objc_enumerationMutation"];
+  let Prototype = "void(id)";
+}
+
+def ObjcReadWeak : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_read_weak"];
+  let Prototype = "id(id*)";
+}
+
+def ObjcAssignWeak : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_assign_weak"];
+  let Prototype = "id(id, id*)";
+}
+
+def ObjcAssignIvar : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_assign_ivar"];
+  let Prototype = "id(id, id, ptrdiff_t)";
+}
+
+def ObjcAssignGlobal : ObjCLibBuiltin<"objc/message.h"> {
+  let Spellings = ["objc_assign_global"];
+  let Prototype = "id(id, id*)";
+}
+
+def ObjcAssignStrongCast : ObjCLibBuiltin<"objc/objc-auto.h"> {
+  let Spellings = ["objc_assign_strongCast"];
+  let Prototype = "id(id, id*)";
+}
+
+def ObjcExceptionExtract : ObjCLibBuiltin<"objc/objc_exception.h"> {
+  let Spellings = ["objc_exception_extract"];
+  let Prototype = "id(void*)";
+}
+
+def ObjcExceptionTryEnter : ObjCLibBuiltin<"objc/objc_exception.h"> {
+  let Spellings = ["objc_exception_try_enter"];
+  let Prototype = "void(void*)";
+}
+
+def ObjcExceptionTryExit : ObjCLibBuiltin<"objc/objc_exception.h"> {
+  let Spellings = ["objc_exception_try_exit"];
+  let Prototype = "void(void*)";
+}
+
+def ObjcExceptionMatch : ObjCLibBuiltin<"objc/objc_exception.h"> {
+  let Spellings = ["objc_exception_match"];
+  let Prototype = "int(id, id)";
+}
+
+def ObjcExceptionThrow : ObjCLibBuiltin<"objc/objc_exception.h"> {
+  let Spellings = ["objc_exception_throw"];
+  let Prototype = "void(id)";
+}
+
+def ObjcSyncEnter : ObjCLibBuiltin<"objc_objc_sync.h"> {
+  let Spellings = ["objc_sync_enter"];
+  let Prototype = "int(id)";
+}
+
+def ObjcSyncExit : ObjCLibBuiltin<"objc_objc_sync.h"> {
+  let Spellings = ["objc_sync_exit"];
+  let Prototype = "int(id)";
+}
+
+def ObjcMemmoveCollectable : Builtin {
+  let Spellings = ["__builtin_objc_memmove_collectable"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix];
+  let Prototype = "void*(void*, void const*, size_t)";
+}
+
+def NSLog : ObjCLibBuiltin<"foundation_nsobjcruntime.h"> {
+  let Spellings = ["NSLog"];
+  let Attributes = [PrintfFormat<0>];
+  let Prototype = "void(id, ...)";
+}
+
+def NSLogv : ObjCLibBuiltin<"foundation_nsobjcruntime.h"> {
+  let Spellings = ["NSLogv"];
+  let Attributes = [VPrintfFormat<0>];
+  let Prototype = "void(id, __builtin_va_list)";
+}
+
+def Atan2 : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["atan2"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Abs : IntMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["abs"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Copysign : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["copysign"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+  let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
+}
+
+def Fabs : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["fabs"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+  let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
+}
+
+def Finite : FPMathTemplate, GNULibBuiltin<"math.h"> {
+  let Spellings = ["finite"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "int(T)";
+  let RequiresUndef = 1;
+}
+
+def OSXFinite : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["__finite"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "int(T)";
+}
+
+def Fmod : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["fmod"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Frexp : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["frexp"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T, int*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ldexp : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["ldexp"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Modf : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["modf"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T, T*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Nan : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["nan"];
+  let Attributes = [Pure, NoThrow];
+  let Prototype = "T(char const*)";
+  let AddBuiltinPrefixedAlias = 1;
+  let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
+}
+
+def Pow : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["pow"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Acos : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["acos"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Acosh : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["acosh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Asin : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["asin"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Asinh : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["asinh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Atan : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["atan"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Atanh : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["atanh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cbrt : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["cbrt"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ceil : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["ceil"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cos : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["cos"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cosh : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["cosh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Erf : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["erf"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Erfc : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["erfc"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Exp : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["exp"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Exp2 : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["exp2"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// FIXME: Why is there no builtin without the prefix?
+def Exp10 : FPMathTemplate, Builtin {
+  let Spellings = ["__builtin_exp10"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow,
+                    ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Expm1 : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["expm1"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Fdim : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["fdim"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Floor : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["floor"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Fma : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["fma"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Fmax : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["fmax"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+  let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
+}
+
+def Fmin : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["fmin"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+  let OnlyBuiltinPrefixedAliasIsConstexpr = 1;
+}
+
+def Hypot : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["hypot"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ilogb : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["ilogb"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "int(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Lgamma : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["lgamma"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Llrint : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["llrint"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long long int(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Llround : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["llround"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long long int(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Log : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["log"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Log10 : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["log10"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Log1p : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["log1p"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Log2 : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["log2"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Logb : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["logb"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Lrint : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["lrint"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long int(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Lround : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["lround"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "long int(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Nearbyint : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["nearbyint"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Nextafter : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["nextafter"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Nexttoward : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["nexttoward"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, long double)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Remainder : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["remainder"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Remquo : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["remquo"];
+  let Attributes = [NoThrow];
+  let Prototype = "T(T, T, int*)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Rint : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["rint"];
+  let Attributes = [NoThrow, ConstIgnoringExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Round : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["round"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def RoundEven : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["roundeven"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Scalbln : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["scalbln"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, long int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Scalbn : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["scalbn"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T, int)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Sin : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["sin"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Sinh : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["sinh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Sqrt : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["sqrt"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Tan : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["tan"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Tanh : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["tanh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Tgamma : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["tgamma"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Trunc : FPMathTemplate, LibBuiltin<"math.h"> {
+  let Spellings = ["trunc"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cabs : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cabs"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cacos : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cacos"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cacosh : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cacosh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Carg : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["carg"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Casin : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["casin"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Casinh : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["casinh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Catan : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["catan"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Catanh : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["catanh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ccos : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["ccos"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ccosh : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["ccosh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cexp : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cexp"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cimag : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cimag"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Conj : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["conj"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Clog : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["clog"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cproj : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cproj"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Cpow : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["cpow"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T, _Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Creal : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["creal"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Csin : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["csin"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Csinh : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["csinh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Csqrt : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["csqrt"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ctan : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["ctan"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+def Ctanh : FPMathTemplate, LibBuiltin<"complex.h"> {
+  let Spellings = ["ctanh"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "_Complex T(_Complex T)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
+// __sinpi and friends are OS X specific library functions, but otherwise much
+// like the standard (non-complex) sin (etc).
+def Sinpi : LibBuiltin<"math.h">, FloatDoubleTemplate {
+  let Spellings = ["__sinpi"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Cospi : LibBuiltin<"math.h">, FloatDoubleTemplate {
+  let Spellings = ["__cospi"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+def Tanpi : LibBuiltin<"math.h">, FloatDoubleTemplate {
+  let Spellings = ["__tanpi"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+// Similarly, __exp10 is OS X only
+def OSXExp10 : LibBuiltin<"math.h">, FloatDoubleTemplate {
+  let Spellings = ["__exp10"];
+  let Attributes = [NoThrow, ConstIgnoringErrnoAndExceptions];
+  let Prototype = "T(T)";
+}
+
+// Blocks runtime Builtin math library functions.
+def BlockObjectAssign : LibBuiltin<"blocks.h"> {
+  let Spellings = ["_Block_object_assign"];
+  let Prototype = "void(void*, void const*, int const)";
+}
+
+def BlockObjectDispose : LibBuiltin<"blocks.h"> {
+  let Spellings = ["_Block_object_dispose"];
+  let Prototype = "void(void const*, int const)";
+}
+// FIXME: Also declare NSConcreteGlobalBlock and NSConcreteStackBlock.
+
+def Addressof : CxxLibBuiltin<"memory"> {
+  let Spellings = ["addressof", "__addressof"];
+  let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
+                    Constexpr];
+  let Prototype = "void*(void&)";
+  let Namespace = "std";
+}
+
+def AsConst : CxxLibBuiltin<"utility"> {
+  let Spellings = ["as_const"];
+  let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
+                    Constexpr];
+  let Prototype = "void&(void&)";
+  let Namespace = "std";
+}
+
+def Forward : CxxLibBuiltin<"utility"> {
+  let Spellings = ["forward"];
+  let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
+                    Constexpr];
+  let Prototype = "void&(void&)";
+  let Namespace = "std";
+}
+
+def ForwardLike : CxxLibBuiltin<"utility"> {
+  let Spellings = ["forward_like"];
+  let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
+                    Constexpr];
+  let Prototype = "void&(void&)";
+  let Namespace = "std";
+}
+
+def Move : CxxLibBuiltin<"utility"> {
+  let Spellings = ["move"];
+  let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
+                    Constexpr];
+  let Prototype = "void&(void&)";
+  let Namespace = "std";
+}
+
+def MoveIfNsoexcept : CxxLibBuiltin<"memory"> {
+  let Spellings = ["move_if_noexcept"];
+  let Attributes = [NoThrow, Const, IgnoreSignature, RequireDeclaration,
+                    Constexpr];
+  let Prototype = "void&(void&)";
+  let Namespace = "std";
+}
+
+def Annotation : Builtin {
+  let Spellings = ["__builtin_annotation"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+// Invariants
+def Assume : Builtin {
+  let Spellings = ["__builtin_assume"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "void(bool)";
+}
+
+def AssumeSeparateStorage : Builtin {
+  let Spellings = ["__builtin_assume_separate_storage"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "void(void const volatile*, void const volatile*)";
+}
+
+// Multiprecision Arithmetic Builtins.
+
+class MPATemplate : Template<
+    ["unsigned char",     "unsigned short",        "unsigned int",
+     "unsigned long int", "unsigned long long int"],
+    ["b",                 "s",                     "",
+     "l",                 "ll"]>;
+
+def Addc : Builtin, MPATemplate {
+  let Spellings = ["__builtin_addc"];
+  let Attributes = [NoThrow];
+  // FIXME: Why are these argumentes marked const?
+  let Prototype = "T(T const, T const, T const, T*)";
+}
+
+def Subc : Builtin, MPATemplate {
+  let Spellings = ["__builtin_subc"];
+  let Attributes = [NoThrow];
+  // FIXME: Why are these argumentes marked const?
+  let Prototype = "T(T const, T const, T const, T*)";
+}
+
+// Checked Arithmetic Builtins for Security.
+def AddOverflow : Builtin {
+  let Spellings = ["__builtin_add_overflow"];
+  let Attributes = [NoThrow, CustomTypeChecking, Constexpr];
+  let Prototype = "bool(...)";
+}
+
+def SubOverflow : Builtin {
+  let Spellings = ["__builtin_sub_overflow"];
+  let Attributes = [NoThrow, CustomTypeChecking, Constexpr];
+  let Prototype = "bool(...)";
+}
+
+def MulOverflow : Builtin {
+  let Spellings = ["__builtin_mul_overflow"];
+  let Attributes = [NoThrow, CustomTypeChecking, Constexpr];
+  let Prototype = "bool(...)";
+}
+
+class UOverflowTemplate :
+    Template<["unsigned int", "unsigned long int", "unsigned long long int"],
+             ["_overflow",    "l_overflow",        "ll_overflow"]>;
+
+def UaddOverflow : Builtin, UOverflowTemplate {
+  let Spellings = ["__builtin_uadd"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(T const, T const, T*)";
+}
+
+def UsubOverflow : Builtin, UOverflowTemplate {
+  let Spellings = ["__builtin_usub"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(T const, T const, T*)";
+}
+
+def UmulOverflow : Builtin, UOverflowTemplate {
+  let Spellings = ["__builtin_umul"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(T const, T const, T*)";
+}
+
+class SOverflowTemplate :
+    Template<["int",          "long int",          "long long int"],
+             ["_overflow",    "l_overflow",        "ll_overflow"]>;
+
+def SaddOverflow : Builtin, UOverflowTemplate {
+  let Spellings = ["__builtin_sadd"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(T const, T const, T*)";
+}
+
+def SsubOverflow : Builtin, UOverflowTemplate {
+  let Spellings = ["__builtin_ssub"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(T const, T const, T*)";
+}
+
+def SmulOverflow : Builtin, UOverflowTemplate {
+  let Spellings = ["__builtin_smul"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "bool(T const, T const, T*)";
+}
+
+// Clang builtins (not available in GCC).
+def BuiltinAddressof : Builtin {
+  let Spellings = ["__builtin_addressof"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(void&)";
+}
+
+def BuiltinFunctionStart : Builtin {
+  let Spellings = ["__builtin_function_start"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(void&)";
+}
+
+def BuiltinOperatorNew : Builtin {
+  let Spellings = ["__builtin_operator_new"];
+  let Attributes = [Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(size_t)";
+}
+
+def BuiltinOperatorDelete : Builtin {
+  let Spellings = ["__builtin_operator_delete"];
+  let Attributes = [NoThrow, CustomTypeChecking, Constexpr];
+  let Prototype = "void(void*)";
+}
+
+def BuiltinCharMemchr : Builtin {
+  let Spellings = ["__builtin_char_memchr"];
+  let Attributes = [NoThrow, Constexpr];
+  let Prototype = "char*(char const*, int, size_t)";
+}
+
+def BuiltinDumpStruct : Builtin {
+  let Spellings = ["__builtin_dump_struct"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def BuiltinPreserveAccessIndex : Builtin {
+  let Spellings = ["__builtin_preserve_access_index"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def IsAligned : Builtin {
+  let Spellings = ["__builtin_is_aligned"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "bool(void const*, size_t)";
+}
+
+def AlignUp : Builtin {
+  let Spellings = ["__builtin_align_up"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(void const*, size_t)";
+}
+
+def AlignDown : Builtin {
+  let Spellings = ["__builtin_align_down"];
+  let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
+  let Prototype = "void*(void const*, size_t)";
+}
+
+// Safestack builtins.
+def GetUnsafeStackStart : Builtin {
+  let Spellings = ["__builtin___get_unsafe_stack_start"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix];
+  let Prototype = "void*()";
+}
+
+def GetUnsafeStackBottom : Builtin {
+  let Spellings = ["__builtin___get_unsafe_stack_bottom"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix];
+  let Prototype = "void*()";
+}
+
+def GetUnsafeStackTop : Builtin {
+  let Spellings = ["__builtin___get_unsafe_stack_top"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix];
+  let Prototype = "void*()";
+}
+
+def GetUnsafeStackPtr : Builtin {
+  let Spellings = ["__builtin___get_unsafe_stack_ptr"];
+  let Attributes = [NoThrow, FunctionWithBuiltinPrefix];
+  let Prototype = "void*()";
+}
+
+// Nontemporal loads/stores builtins.
+def NontemporalStore : Builtin {
+  let Spellings = ["__builtin_nontemporal_store"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def NontemporalLoad : Builtin {
+  let Spellings = ["__builtin_nontemporal_load"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+// Coroutine intrinsics
+def CoroResume : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_resume"];
+  let Prototype = "void(void*)";
+}
+
+def CoroDestroy : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_destroy"];
+  let Prototype = "void(void*)";
+}
+
+def CoroDone : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_done"];
+  let Attributes = [NoThrow];
+  let Prototype = "bool(void*)";
+}
+
+def CoroPromise : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_promise"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void*, _Constant int, _Constant bool)";
+}
+
+def CoroSize : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_size"];
+  let Attributes = [NoThrow];
+  let Prototype = "size_t()";
+}
+
+def CoroAlign : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_align"];
+  let Attributes = [NoThrow];
+  let Prototype = "size_t()";
+}
+
+def CoroFrame : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_frame"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*()";
+}
+
+def CoroNoop : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_noop"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*()";
+}
+
+def CoroFree : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_free"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+def CoroId : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_id"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(_Constant int, void*, void*, void*)";
+}
+
+def CoroAlloc : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_alloc"];
+  let Attributes = [NoThrow];
+  let Prototype = "bool()";
+}
+
+def CoroBegin : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_begin"];
+  let Attributes = [NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+def CoroEnd : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_end"];
+  let Attributes = [NoThrow];
+  let Prototype = "bool(void*, _Constant bool)";
+}
+
+def CoroSuspend : CoroLangBuiltin {
+  let Spellings = ["__builtin_coro_suspend"];
+  let Attributes = [NoThrow];
+  let Prototype = "char(_Constant bool)";
+}
+
+// OpenCL v2.0 s6.13.16, s9.17.3.5 - Pipe functions.
+// We need the generic prototype, since the packet type could be anything.
+def ReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def WritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def ReserveReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["reserve_read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def ReserveWritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["reserve_write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def CommitWritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["commit_write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void(...)";
+}
+
+def CommitReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["commit_read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void(...)";
+}
+
+def SubGroupReserveReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["sub_group_reserve_read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def SubGroupReserveWritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["sub_group_reserve_write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def SubGroupCommitWritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["sub_group_commit_write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void(...)";
+}
+
+def SubGroupCommitReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["sub_group_commit_read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void(...)";
+}
+
+def WorkGroupReserveReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["work_group_reserve_read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def WorkGroupReserveWritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["work_group_reserve_write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def WorkGroupCommitWritePipe : OCLPipeLangBuiltin {
+  let Spellings = ["work_group_commit_write_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void(...)";
+}
+
+def WorkGroupCommitReadPipe : OCLPipeLangBuiltin {
+  let Spellings = ["work_group_commit_read_pipe"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void(...)";
+}
+
+def GetPipeNumPackets : OCLPipeLangBuiltin {
+  let Spellings = ["get_pipe_num_packets"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "unsigned int(...)";
+}
+
+def GetPipeMaxPackets : OCLPipeLangBuiltin {
+  let Spellings = ["get_pipe_max_packets"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "unsigned int(...)";
+}
+
+// OpenCL v2.0 s6.13.17 - Enqueue kernel functions.
+// Custom builtin check allows to perform special check of passed block arguments.
+def EnqueueKernel : OCL_DSELangBuiltin {
+  let Spellings = ["enqueue_kernel"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "int(...)";
+}
+
+def GetKernelWorkGroupSize : OCL_DSELangBuiltin {
+  let Spellings = ["get_kernel_work_group_size"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "unsigned int(...)";
+}
+
+def GetKernelPreferredWorkGroupSizeMultiple : OCL_DSELangBuiltin {
+  let Spellings = ["get_kernel_preferred_work_group_size_multiple"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "unsigned int(...)";
+}
+
+def GetKernelMaxSubGroupSizeForNDRange : OCL_DSELangBuiltin {
+  let Spellings = ["get_kernel_max_sub_group_size_for_ndrange"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "unsigned int(...)";
+}
+
+def GetKernelSubGroupCountForNDRange : OCL_DSELangBuiltin {
+  let Spellings = ["get_kernel_sub_group_count_for_ndrange"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "unsigned int(...)";
+}
+
+// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
+// FIXME: Pointer parameters of OpenCL builtins should have their address space
+// requirement defined.
+def ToGlobal : OCL_GASLangBuiltin {
+  let Spellings = ["to_global"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+def ToLocal : OCL_GASLangBuiltin {
+  let Spellings = ["to_local"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+def ToPrivate : OCL_GASLangBuiltin {
+  let Spellings = ["to_private"];
+  let Attributes = [CustomTypeChecking, NoThrow];
+  let Prototype = "void*(void*)";
+}
+
+// OpenCL half load/store builtin.
+def StoreHalf : OCLLangBuiltin, FloatDoubleTemplate {
+  let Spellings = ["__builtin_store_half"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(T, __fp16*)";
+}
+
+def LoadHalf : OCLLangBuiltin, FloatDoubleTemplate {
+  let Spellings = ["__builtin_load_half"];
+  // FIXME: Is this actually Const? This looks like it shoud be Pure.
+  let Attributes = [NoThrow, Const];
+  let Prototype = "T(__fp16 const*)";
+}
+
+// Builtins for os_log/os_trace.
+def OSLogFormatBufferSize : Builtin {
+  let Spellings = ["__builtin_os_log_format_buffer_size"];
+  let Attributes = [PrintfFormat<0>, NoThrow, UnevaluatedArguments,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "size_t(char const*, ...)";
+}
+
+def OSLogFormat : Builtin {
+  let Spellings = ["__builtin_os_log_format"];
+  // FIXME: The printf attribute looks suspiciously like it should be argument #1.
+  let Attributes = [PrintfFormat<0>, NoThrow, CustomTypeChecking];
+  let Prototype = "void*(void*, char const*, ...)";
+}
+
+// CUDA/HIP
+def GetDeviceSideMangledName : LangBuiltin<"CUDA_LANG"> {
+  let Spellings = ["__builtin_get_device_side_mangled_name"];
+  let Attributes = [NoThrow, Const, IgnoreSignature];
+  let Prototype = "char const*(...)";
+}
+
+// HLSL
+def HLSLWaveActiveCountBits : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_wave_active_count_bits"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "unsigned int(bool)";
+}
+
+def HLSLCreateHandle : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_create_handle"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "void*(unsigned char)";
+}
+
+// Builtins for XRay.
+def XRayCustomEvent : Builtin {
+  let Spellings = ["__xray_customevent"];
+  let Prototype = "void(char const*, size_t)";
+}
+
+def XRayTypedEvent : Builtin {
+  let Spellings = ["__xray_typedevent"];
+  let Prototype = "void(size_t, char const*, size_t)";
+}
+
+// Win64-compatible va_list functions.
+def MSVaStart : Builtin {
+  let Spellings = ["__builtin_ms_va_start"];
+  let Attributes = [NoThrow, CustomTypeChecking];
+  let Prototype = "void(char*&, ...)";
+}
+
+def MSVaEnd : Builtin {
+  let Spellings = ["__builtin_ms_va_end"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(char*&)";
+}
+
+def MSVaCopy : Builtin {
+  let Spellings = ["__builtin_ms_va_copy"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(char*&, char*&)";
+}
+
+// Arithmetic Fence: to prevent FP reordering and reassociation optimizations
+// FIXME: Should this just be a Builtin?
+def ArithmeticFence : LangBuiltin<"ALL_LANGUAGES"> {
+  let Spellings = ["__arithmetic_fence"];
+  let Attributes = [CustomTypeChecking, Constexpr];
+  let Prototype = "void(...)";
+}
diff --git a/clang/include/clang/Basic/BuiltinsBPF.def b/clang/include/clang/Basic/BuiltinsBPF.def
deleted file mode 100644
index 190062645ec4d16..000000000000000
--- a/clang/include/clang/Basic/BuiltinsBPF.def
+++ /dev/null
@@ -1,33 +0,0 @@
-//===--- BuiltinsBPF.def - BPF Builtin function database --------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the BPF-specific builtin function database.  Users of
-// this file must define the BUILTIN macro to make use of this information.
-//
-//===----------------------------------------------------------------------===//
-
-// The format of this database matches clang/Basic/Builtins.def.
-
-#if defined(BUILTIN) && !defined(TARGET_BUILTIN)
-#   define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
-#endif
-
-// Get record field information.
-TARGET_BUILTIN(__builtin_preserve_field_info, "Ui.", "t", "")
-
-// Get BTF type id.
-TARGET_BUILTIN(__builtin_btf_type_id, "LUi.", "t", "")
-
-// Get type information.
-TARGET_BUILTIN(__builtin_preserve_type_info, "Ui.", "t", "")
-
-// Preserve enum value.
-TARGET_BUILTIN(__builtin_preserve_enum_value, "Li.", "t", "")
-
-#undef BUILTIN
-#undef TARGET_BUILTIN
diff --git a/clang/include/clang/Basic/BuiltinsBPF.td b/clang/include/clang/Basic/BuiltinsBPF.td
new file mode 100644
index 000000000000000..169d05c87099844
--- /dev/null
+++ b/clang/include/clang/Basic/BuiltinsBPF.td
@@ -0,0 +1,37 @@
+//===--- BuiltinsBPF.td - BPF Builtin function database ---------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+include "clang/Basic/BuiltinsBase.td"
+
+// Get record field information
+def PreserveFieldInfo : TargetBuiltin {
+  let Spellings = ["__builtin_preserve_field_info"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "unsigned int(...)";
+}
+
+// Get BTF type id
+def BtfTypeID : TargetBuiltin {
+  let Spellings = ["__builtin_btf_type_id"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "long unsigned int(...)";
+}
+
+// Get type information
+def PreserveTypeInfo : TargetBuiltin {
+  let Spellings = ["__builtin_preserve_type_info"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "long unsigned int(...)";
+}
+
+// Preserve enum value
+def PreserveEnumValue : TargetBuiltin {
+  let Spellings = ["__builtin_preserve_enum_value"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "long int(...)";
+}
diff --git a/clang/include/clang/Basic/BuiltinsBase.td b/clang/include/clang/Basic/BuiltinsBase.td
new file mode 100644
index 000000000000000..b65b41be0326556
--- /dev/null
+++ b/clang/include/clang/Basic/BuiltinsBase.td
@@ -0,0 +1,121 @@
+//===--- BuiltinsBase.td - common structured used by builtins ---*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Attributes
+// ==========
+
+class Attribute<string mangling> {
+  string Mangling = mangling;
+}
+
+class IndexedAttribute<string baseMangling, int I> : Attribute<baseMangling> {
+  int Index = I;
+}
+
+// Standard Attributes
+// -------------------
+def NoReturn : Attribute<"r">;
+
+// Attributes from the gnu:: namespace
+// -----------------------------------
+def Const : Attribute<"c">;
+def NoThrow : Attribute<"n">;
+def Pure : Attribute<"U">;
+def ReturnsTwice : Attribute<"j">;
+//  FIXME: gcc has nonnull
+
+// builtin-specific attributes
+// ---------------------------
+
+// Signature is meaningless, use custom typechecking.
+def CustomTypeChecking : Attribute<"t">;
+
+// Type is not important to semantic analysis and codegen; recognize as builtin
+// even if type doesn't match signature, and don't warn if we can't be sure the
+// type is right.
+def IgnoreSignature : Attribute<"T">;
+
+// Arguments are not evaluated for their side-effects.
+def UnevaluatedArguments : Attribute<"u">;
+
+// FIXME: This is misused in a lot of the places it is used currently.
+// This function is equivalent to a library function without the __builtin_
+// prefix. This is relevant for CodeGen; it should not be used if custom CodeGen
+// is required for a builtin.
+def FunctionWithBuiltinPrefix : Attribute<"F">;
+
+// const, but only when -fno-math-errno and FP exceptions are ignored.
+def ConstIgnoringErrnoAndExceptions : Attribute<"e">;
+
+// const when FP exceptions are ignored.
+def ConstIgnoringExceptions : Attribute<"g">;
+
+// This function requires a specific header or an explicit declaration.
+def RequireDeclaration : Attribute<"h">;
+
+class PrintfFormat<int I> : IndexedAttribute<"p", I>;
+class VPrintfFormat<int I> : IndexedAttribute<"P", I>;
+class ScanfFormat<int I> : IndexedAttribute<"s", I>;
+class VScanfFormat<int I> : IndexedAttribute<"S", I>;
+
+// Other Attributes
+// ----------------
+
+// Builtin can be constant evaluated
+def Constexpr : Attribute<"E">;
+
+// Builtin kinds
+// =============
+
+class Builtin {
+  list<string> Spellings;
+  list<Attribute> Attributes = [];
+  string Prototype;
+  string Namespace;
+  // On some platforms, some functions are actually macros. In that case we need
+  // to #undef them.
+  bit RequiresUndef = 0;
+}
+
+class CustomEntry {
+  string Entry;
+}
+
+class AtomicBuiltin : Builtin;
+class TargetBuiltin : Builtin;
+
+class LibBuiltin<string header, string languages = "ALL_LANGUAGES"> : Builtin {
+  string Header = header;
+  string Languages = languages;
+  bit AddBuiltinPrefixedAlias = 0;
+  bit OnlyBuiltinPrefixedAliasIsConstexpr = 0;
+}
+
+class MSLibBuiltin<string header> : LibBuiltin<header, "ALL_MS_LANGUAGES">;
+class GNULibBuiltin<string header> : LibBuiltin<header, "ALL_GNU_LANGUAGES">;
+class ObjCLibBuiltin<string header> : LibBuiltin<header, "OBJC_LANG">;
+class CxxLibBuiltin<string header> : LibBuiltin<header, "CXX_LANG">;
+
+class LangBuiltin<string languages> : Builtin {
+  string Languages = languages;
+}
+
+class MSLangBuiltin : LangBuiltin<"ALL_MS_LANGUAGES">;
+class CoroLangBuiltin : LangBuiltin<"COR_LANG">;
+class OCLPipeLangBuiltin : LangBuiltin<"OCL_PIPE">;
+class OCL_DSELangBuiltin : LangBuiltin<"OCL_DSE">;
+class OCL_GASLangBuiltin : LangBuiltin<"OCL_GAS">;
+class OCLLangBuiltin : LangBuiltin<"ALL_OCL_LANGUAGES">;
+
+class Template<list<string> substitutions,
+               list<string> affixes,
+               bit as_prefix = 0> {
+  list<string> Substitutions = substitutions;
+  list<string> Affixes = affixes;
+  bit AsPrefix = as_prefix;
+}
diff --git a/clang/include/clang/Basic/CMakeLists.txt b/clang/include/clang/Basic/CMakeLists.txt
index 085e316fcc671df..36edef3d7a4c6d1 100644
--- a/clang/include/clang/Basic/CMakeLists.txt
+++ b/clang/include/clang/Basic/CMakeLists.txt
@@ -57,6 +57,14 @@ clang_tablegen(AttrHasAttributeImpl.inc -gen-clang-attr-has-attribute-impl
   TARGET ClangAttrHasAttributeImpl
   )
 
+clang_tablegen(Builtins.inc -gen-clang-builtins
+  SOURCE Builtins.td
+  TARGET ClangBuiltins)
+
+clang_tablegen(BuiltinsBPF.inc -gen-clang-builtins
+  SOURCE BuiltinsBPF.td
+  TARGET ClangBuiltinsBPF)
+
 # ARM NEON and MVE
 clang_tablegen(arm_neon.inc -gen-arm-neon-sema
   SOURCE arm_neon.td
diff --git a/clang/include/clang/Basic/TargetBuiltins.h b/clang/include/clang/Basic/TargetBuiltins.h
index 8f7881abf26f7f4..d5de5a286f7f628 100644
--- a/clang/include/clang/Basic/TargetBuiltins.h
+++ b/clang/include/clang/Basic/TargetBuiltins.h
@@ -84,7 +84,7 @@ namespace clang {
   enum {
     LastTIBuiltin = clang::Builtin::FirstTSBuiltin - 1,
   #define BUILTIN(ID, TYPE, ATTRS) BI##ID,
-  #include "clang/Basic/BuiltinsBPF.def"
+  #include "clang/Basic/BuiltinsBPF.inc"
     LastTSBuiltin
   };
   }
diff --git a/clang/include/module.modulemap b/clang/include/module.modulemap
index 6ea613c70306fa1..88596a0675dd132 100644
--- a/clang/include/module.modulemap
+++ b/clang/include/module.modulemap
@@ -42,8 +42,6 @@ module Clang_Basic {
   textual header "clang/Basic/BuiltinsAArch64NeonSVEBridge.def"
   textual header "clang/Basic/BuiltinsAArch64NeonSVEBridge_cg.def"
   textual header "clang/Basic/BuiltinsARM.def"
-  textual header "clang/Basic/BuiltinsBPF.def"
-  textual header "clang/Basic/Builtins.def"
   textual header "clang/Basic/BuiltinHeaders.def"
   textual header "clang/Basic/BuiltinsHexagon.def"
   textual header "clang/Basic/BuiltinsHexagonDep.def"
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index af82ca0784af413..65fa1c69cef412c 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4923,6 +4923,7 @@ AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef<Expr *> args, QualType t,
                        AtomicOp op, SourceLocation RP)
     : Expr(AtomicExprClass, t, VK_PRValue, OK_Ordinary),
       NumSubExprs(args.size()), BuiltinLoc(BLoc), RParenLoc(RP), Op(op) {
+  assert(op != AO__opencl_atomic_init || args.size() == 3);
   assert(args.size() == getNumSubExprs(op) && "wrong number of subexpressions");
   for (unsigned i = 0; i != args.size(); i++)
     SubExprs[i] = args[i];
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index a31aa0cfeeed8de..b53145cb4ea048f 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -1833,7 +1833,7 @@ void StmtPrinter::VisitAtomicExpr(AtomicExpr *Node) {
   case AtomicExpr::AO ## ID: \
     Name = #ID "("; \
     break;
-#include "clang/Basic/Builtins.def"
+#include "clang/Basic/Builtins.inc"
   }
   OS << Name;
 
diff --git a/clang/lib/Basic/Builtins.cpp b/clang/lib/Basic/Builtins.cpp
index d366989bafc560d..3467847ac1672ed 100644
--- a/clang/lib/Basic/Builtins.cpp
+++ b/clang/lib/Basic/Builtins.cpp
@@ -38,7 +38,7 @@ static constexpr Builtin::Info BuiltinInfo[] = {
   {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, LANGS},
 #define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, LANGS)                             \
   {#ID, TYPE, ATTRS, nullptr, HeaderDesc::HEADER, LANGS},
-#include "clang/Basic/Builtins.def"
+#include "clang/Basic/Builtins.inc"
 };
 
 const Builtin::Info &Builtin::Context::getRecord(unsigned ID) const {
diff --git a/clang/lib/Basic/Targets/BPF.cpp b/clang/lib/Basic/Targets/BPF.cpp
index d6288d2e0d0e176..8f4da5cefa8d8c9 100644
--- a/clang/lib/Basic/Targets/BPF.cpp
+++ b/clang/lib/Basic/Targets/BPF.cpp
@@ -22,7 +22,7 @@ using namespace clang::targets;
 static constexpr Builtin::Info BuiltinInfo[] = {
 #define BUILTIN(ID, TYPE, ATTRS)                                               \
   {#ID, TYPE, ATTRS, nullptr, HeaderDesc::NO_HEADER, ALL_LANGUAGES},
-#include "clang/Basic/BuiltinsBPF.def"
+#include "clang/Basic/BuiltinsBPF.inc"
 };
 
 void BPFTargetInfo::getTargetDefines(const LangOptions &Opts,
diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index 9db450281912d2f..3d163d723b62fb1 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -939,7 +939,7 @@ def : Builtin<"read_mem_fence", [Void, MemFenceFlags]>;
 def : Builtin<"write_mem_fence", [Void, MemFenceFlags]>;
 
 // OpenCL v3.0 s6.15.10 - Address Space Qualifier Functions.
-// to_global, to_local, to_private are declared in Builtins.def.
+// to_global, to_local, to_private are declared in Builtins.td.
 
 let Extension = FuncExtOpenCLCGenericAddressSpace in {
   // The OpenCL 3.0 specification defines these with a "gentype" argument indicating any builtin
@@ -1451,25 +1451,25 @@ let Extension = FuncExtOpenCLCWGCollectiveFunctions in {
 //--------------------------------------------------------------------
 // OpenCL2.0 : 6.13.16 : Pipe Functions
 // --- Table 27 ---
-// Defined in Builtins.def
+// Defined in Builtins.td
 
 // --- Table 28 ---
-// Builtins taking pipe arguments are defined in Builtins.def
+// Builtins taking pipe arguments are defined in Builtins.td
 let Extension = FuncExtOpenCLCPipes in {
   def : Builtin<"is_valid_reserve_id", [Bool, ReserveId]>;
 }
 
 // --- Table 29 ---
-// Defined in Builtins.def
+// Defined in Builtins.td
 
 
 //--------------------------------------------------------------------
 // OpenCL2.0 : 6.13.17 : Enqueuing Kernels
 // --- Table 30 ---
-// Defined in Builtins.def
+// Defined in Builtins.td
 
 // --- Table 32 ---
-// Defined in Builtins.def
+// Defined in Builtins.td
 
 // --- Table 33 ---
 let Extension = FuncExtOpenCLCDeviceEnqueue in {
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b867d55c174e68b..183f389b791f93f 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -2417,7 +2417,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
 #define ATOMIC_BUILTIN(ID, TYPE, ATTRS) \
   case Builtin::BI##ID: \
     return SemaAtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID);
-#include "clang/Basic/Builtins.def"
+#include "clang/Basic/Builtins.inc"
   case Builtin::BI__annotation:
     if (SemaBuiltinMSVCAnnotation(*this, TheCall))
       return ExprError();
@@ -7143,16 +7143,16 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
   static_assert(sizeof(NumArgs)/sizeof(NumArgs[0]) == NumForm
       && sizeof(NumVals)/sizeof(NumVals[0]) == NumForm,
       "need to update code for modified forms");
-  static_assert(AtomicExpr::AO__c11_atomic_init == 0 &&
-                    AtomicExpr::AO__c11_atomic_fetch_min + 1 ==
-                        AtomicExpr::AO__atomic_load,
+  static_assert(AtomicExpr::AO__atomic_add_fetch == 0 &&
+                    AtomicExpr::AO__atomic_xor_fetch + 1 ==
+                        AtomicExpr::AO__c11_atomic_compare_exchange_strong,
                 "need to update code for modified C11 atomics");
-  bool IsOpenCL = Op >= AtomicExpr::AO__opencl_atomic_init &&
-                  Op <= AtomicExpr::AO__opencl_atomic_fetch_max;
-  bool IsHIP = Op >= AtomicExpr::AO__hip_atomic_load &&
-               Op <= AtomicExpr::AO__hip_atomic_fetch_max;
-  bool IsC11 = (Op >= AtomicExpr::AO__c11_atomic_init &&
-               Op <= AtomicExpr::AO__c11_atomic_fetch_min) ||
+  bool IsOpenCL = Op >= AtomicExpr::AO__opencl_atomic_compare_exchange_strong &&
+                  Op <= AtomicExpr::AO__opencl_atomic_store;
+  bool IsHIP = Op >= AtomicExpr::AO__hip_atomic_compare_exchange_strong &&
+               Op <= AtomicExpr::AO__hip_atomic_store;
+  bool IsC11 = (Op >= AtomicExpr::AO__c11_atomic_compare_exchange_strong &&
+               Op <= AtomicExpr::AO__c11_atomic_store) ||
                IsOpenCL;
   bool IsN = Op == AtomicExpr::AO__atomic_load_n ||
              Op == AtomicExpr::AO__atomic_store_n ||
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 92496b03ecabe54..9cbf6c5aae9a4ab 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -7447,7 +7447,7 @@ ExprResult Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
     // Extract the return type from the (builtin) function pointer type.
     // FIXME Several builtins still have setType in
     // Sema::CheckBuiltinFunctionCall. One should review their definitions in
-    // Builtins.def to ensure they are correct before removing setType calls.
+    // Builtins.td to ensure they are correct before removing setType calls.
     QualType FnPtrTy = Context.getPointerType(FDecl->getType());
     Result = ImpCastExprToType(Fn, FnPtrTy, CK_BuiltinFnToFnPtr).get();
     ResultTy = FDecl->getCallResultType();
diff --git a/clang/test/Analysis/bstring.c b/clang/test/Analysis/bstring.c
index a7c7bdb23683e76..07b9645f20d854d 100644
--- a/clang/test/Analysis/bstring.c
+++ b/clang/test/Analysis/bstring.c
@@ -4,7 +4,7 @@
 // RUN:   -analyzer-checker=alpha.unix.cstring \
 // RUN:   -analyzer-disable-checker=alpha.unix.cstring.UninitializedRead \
 // RUN:   -analyzer-checker=debug.ExprInspection \
-// RUN:   -analyzer-config eagerly-assume=false  
+// RUN:   -analyzer-config eagerly-assume=false
 //
 // RUN: %clang_analyze_cc1 -verify %s -DUSE_BUILTINS \
 // RUN:   -analyzer-checker=core \
@@ -131,7 +131,7 @@ void memcpy5(void) {
 
 void memcpy6(void) {
   int a[4] = {0};
-  memcpy(a, a, 8); // expected-warning{{overlapping}}  
+  memcpy(a, a, 8); // expected-warning{{overlapping}}
 }
 
 void memcpy7(void) {
@@ -257,7 +257,7 @@ void mempcpy5(void) {
 
 void mempcpy6(void) {
   int a[4] = {0};
-  mempcpy(a, a, 8); // expected-warning{{overlapping}}  
+  mempcpy(a, a, 8); // expected-warning{{overlapping}}
 }
 
 void mempcpy7(void) {
@@ -319,7 +319,7 @@ void mempcpy15(void) {
 
   p1 = (&s2) + 1;
   p2 = mempcpy(&s2, &s1, sizeof(struct st));
-  
+
   clang_analyzer_eval(p1 == p2); // expected-warning{{TRUE}}
 }
 
@@ -405,7 +405,7 @@ void memmove2 (void) {
 #define bcmp BUILTIN(bcmp)
 int bcmp(const void *s1, const void *s2, size_t n);
 #define memcmp bcmp
-// 
+//
 #else /* VARIANT */
 
 #define memcmp BUILTIN(memcmp)
@@ -483,7 +483,7 @@ int memcmp8(char *a, size_t n) {
 //===----------------------------------------------------------------------===
 
 #define bcopy BUILTIN(bcopy)
-// __builtin_bcopy is not defined with const in Builtins.def.
+// __builtin_bcopy is not defined with const in Builtins.td.
 void bcopy(/*const*/ void *s1, void *s2, size_t n);
 
 
diff --git a/clang/test/CodeGen/callback_pthread_create.c b/clang/test/CodeGen/callback_pthread_create.c
index 80457cb3ade3bbf..31bc2e9098f45c5 100644
--- a/clang/test/CodeGen/callback_pthread_create.c
+++ b/clang/test/CodeGen/callback_pthread_create.c
@@ -1,4 +1,4 @@
-// FIXME: pthread_create() definition in Builtins.def doesn't match the real one, so it doesn't get recognized as a builtin and attributes aren't added.
+// FIXME: pthread_create() definition in Builtins.td doesn't match the real one, so it doesn't get recognized as a builtin and attributes aren't added.
 // RUN: false
 // XFAIL: *
 
diff --git a/clang/utils/TableGen/CMakeLists.txt b/clang/utils/TableGen/CMakeLists.txt
index f136cbfee5fa181..2ca4a96cadb670c 100644
--- a/clang/utils/TableGen/CMakeLists.txt
+++ b/clang/utils/TableGen/CMakeLists.txt
@@ -7,6 +7,7 @@ add_tablegen(clang-tblgen CLANG
   ClangASTNodesEmitter.cpp
   ClangASTPropertiesEmitter.cpp
   ClangAttrEmitter.cpp
+  ClangBuiltinsEmitter.cpp
   ClangCommentCommandInfoEmitter.cpp
   ClangCommentHTMLNamedCharacterReferenceEmitter.cpp
   ClangCommentHTMLTagsEmitter.cpp
diff --git a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
new file mode 100644
index 000000000000000..ac2dbc936c93f4b
--- /dev/null
+++ b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
@@ -0,0 +1,332 @@
+//=- ClangBuiltinsEmitter.cpp - Generate Clang builtins tables -*- C++ -*-====//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This tablegen backend emits Clang's builtins tables.
+//
+//===----------------------------------------------------------------------===//
+
+#include "TableGenBackends.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/TableGen/Error.h"
+#include "llvm/TableGen/Record.h"
+#include "llvm/TableGen/TableGenBackend.h"
+
+using namespace llvm;
+
+namespace {
+enum class BuiltinType {
+  Builtin,
+  AtomicBuiltin,
+  LibBuiltin,
+  LangBuiltin,
+  TargetBuiltin,
+};
+
+class PrototypeParser {
+public:
+  PrototypeParser(StringRef Substitution, const Record *Builtin)
+      : Loc(Builtin->getFieldLoc("Prototype")), Substitution(Substitution) {
+    ParsePrototype(Builtin->getValueAsString("Prototype"));
+  }
+
+private:
+  void ParsePrototype(StringRef Prototype) {
+    Prototype = Prototype.trim();
+    ParseTypes(Prototype);
+  }
+
+  void ParseTypes(StringRef &Prototype) {
+    auto ReturnType = Prototype.take_until([](char c) { return c == '('; });
+    ParseType(ReturnType);
+    Prototype = Prototype.drop_front(ReturnType.size() + 1);
+    if (!Prototype.ends_with(")"))
+      PrintFatalError(Loc, "Expected closing brace at end of prototype");
+    Prototype = Prototype.drop_back();
+    for (auto T = Prototype.split(','); !T.first.empty();
+         Prototype = T.second, T = Prototype.split(','))
+      ParseType(T.first);
+  }
+
+  void ParseType(StringRef T) {
+    T = T.trim();
+    if (T.consume_back("*")) {
+      ParseType(T);
+      Type += "*";
+    } else if (T.consume_back("const")) {
+      ParseType(T);
+      Type += "C";
+    } else if (T.consume_back("volatile")) {
+      ParseType(T);
+      Type += "D";
+    } else if (T.consume_back("restrict")) {
+      ParseType(T);
+      Type += "R";
+    } else if (T.consume_back("&")) {
+      ParseType(T);
+      Type += "&";
+    } else if (T.consume_front("long")) {
+      Type += "L";
+      ParseType(T);
+    } else if (T.consume_front("unsigned")) {
+      Type += "U";
+      ParseType(T);
+    } else if (T.consume_front("_Complex")) {
+      Type += "X";
+      ParseType(T);
+    } else if (T.consume_front("_Constant")) {
+      Type += "I";
+      ParseType(T);
+    } else if (T.consume_front("T")) {
+      if (Substitution.empty())
+        PrintFatalError(Loc, "Not a template");
+      ParseType(Substitution);
+    } else {
+      auto ReturnTypeVal = StringSwitch<std::string>(T)
+                               .Case("__builtin_va_list_ref", "A")
+                               .Case("__builtin_va_list", "a")
+                               .Case("__float128", "LLd")
+                               .Case("__fp16", "h")
+                               .Case("__int128_t", "LLLi")
+                               .Case("_Float16", "x")
+                               .Case("bool", "b")
+                               .Case("char", "c")
+                               .Case("constant_CFString", "F")
+                               .Case("double", "d")
+                               .Case("FILE", "P")
+                               .Case("float", "f")
+                               .Case("id", "G")
+                               .Case("int", "i")
+                               .Case("int32_t", "Zi")
+                               .Case("int64_t", "Wi")
+                               .Case("jmp_buf", "J")
+                               .Case("msint32_t", "Ni")
+                               .Case("msuint32_t", "UNi")
+                               .Case("objc_super", "M")
+                               .Case("pid_t", "p")
+                               .Case("ptrdiff_t", "Y")
+                               .Case("SEL", "H")
+                               .Case("short", "s")
+                               .Case("sigjmp_buf", "SJ")
+                               .Case("size_t", "z")
+                               .Case("ucontext_t", "K")
+                               .Case("uint32_t", "UZi")
+                               .Case("uint64_t", "UWi")
+                               .Case("void", "v")
+                               .Case("wchar_t", "w")
+                               .Case("...", ".")
+                               .Default("error");
+      if (ReturnTypeVal == "error")
+        PrintFatalError(Loc, "Unknown Type: " + T);
+      Type += ReturnTypeVal;
+    }
+  }
+
+public:
+  void Print(llvm::raw_ostream &OS) const { OS << ", \"" << Type << '\"'; }
+
+private:
+  SMLoc Loc;
+  StringRef Substitution;
+  std::string Type;
+};
+
+class HeaderNameParser {
+public:
+  HeaderNameParser(const Record *Builtin) {
+    for (char c : Builtin->getValueAsString("Header")) {
+      if (std::islower(c))
+        HeaderName += static_cast<char>(std::toupper(c));
+      else if (c == '.' || c == '_' || c == '/' || c == '-')
+        HeaderName += '_';
+      else
+        PrintFatalError(Builtin->getLoc(), "Unexpected header name");
+    }
+  }
+
+  void Print(llvm::raw_ostream &OS) const { OS << HeaderName; }
+
+private:
+  std::string HeaderName;
+};
+
+void PrintAttributes(const Record *Builtin, BuiltinType BT,
+                     llvm::raw_ostream &OS) {
+  OS << '\"';
+  if (Builtin->isSubClassOf("LibBuiltin")) {
+    if (BT == BuiltinType::LibBuiltin) {
+      OS << 'f';
+    } else {
+      OS << 'F';
+      if (Builtin->getValueAsBit("OnlyBuiltinPrefixedAliasIsConstexpr"))
+        OS << 'E';
+    }
+  }
+
+  if (auto NS = Builtin->getValueAsOptionalString("Namespace")) {
+    if (NS != "std")
+      PrintFatalError(Builtin->getFieldLoc("Namespace"), "Unknown namespace: ");
+    OS << "z";
+  }
+
+  for (const auto *Attr : Builtin->getValueAsListOfDefs("Attributes")) {
+    OS << Attr->getValueAsString("Mangling");
+    if (Attr->isSubClassOf("IndexedAttribute"))
+      OS << ':' << Attr->getValueAsInt("Index") << ':';
+  }
+  OS << '\"';
+}
+
+void EmitBuiltinDef(llvm::raw_ostream &OS, StringRef Substitution,
+                    const Record *Builtin, Twine Spelling, BuiltinType BT) {
+  switch (BT) {
+  case BuiltinType::LibBuiltin:
+    OS << "LIBBUILTIN";
+    break;
+  case BuiltinType::LangBuiltin:
+    OS << "LANGBUILTIN";
+    break;
+  case BuiltinType::Builtin:
+    OS << "BUILTIN";
+    break;
+  case BuiltinType::AtomicBuiltin:
+    OS << "ATOMIC_BUILTIN";
+    break;
+  case BuiltinType::TargetBuiltin:
+    OS << "TARGET_BUILTIN";
+    break;
+  }
+
+  OS << "(" << Spelling;
+  PrototypeParser{Substitution, Builtin}.Print(OS);
+  OS << ", ";
+  PrintAttributes(Builtin, BT, OS);
+
+  switch (BT) {
+  case BuiltinType::LibBuiltin: {
+    OS << ", ";
+    HeaderNameParser{Builtin}.Print(OS);
+    [[fallthrough]];
+  }
+  case BuiltinType::LangBuiltin: {
+    OS << ", " << Builtin->getValueAsString("Languages");
+    break;
+  }
+  case BuiltinType::TargetBuiltin:
+    OS << ", \"\"";
+    break;
+  case BuiltinType::AtomicBuiltin:
+  case BuiltinType::Builtin:
+    break;
+  }
+  OS << ")\n";
+}
+
+struct TemplateInsts {
+  std::vector<std::string> Substitution;
+  std::vector<std::string> Affix;
+  bool IsPrefix;
+};
+
+TemplateInsts getTemplateInsts(const Record *R) {
+  TemplateInsts temp;
+  auto Substitutions = R->getValueAsListOfStrings("Substitutions");
+  auto Affixes = R->getValueAsListOfStrings("Affixes");
+  temp.IsPrefix = R->getValueAsBit("AsPrefix");
+
+  if (Substitutions.size() != Affixes.size())
+    PrintFatalError(R->getLoc(), "Substitutions and affixes "
+                                 "don't have the same lengths");
+
+  for (auto [Affix, Substitution] : llvm::zip(Affixes, Substitutions)) {
+    temp.Substitution.emplace_back(Substitution);
+    temp.Affix.emplace_back(Affix);
+  }
+  return temp;
+}
+
+void EmitBuiltin(llvm::raw_ostream &OS, const Record *Builtin) {
+  TemplateInsts Templates = {};
+  if (Builtin->isSubClassOf("Template")) {
+    Templates = getTemplateInsts(Builtin);
+  } else {
+    Templates.Affix.emplace_back();
+    Templates.Substitution.emplace_back();
+  }
+
+  for (auto [Substitution, Affix] :
+       llvm::zip(Templates.Substitution, Templates.Affix)) {
+    for (StringRef Spelling : Builtin->getValueAsListOfStrings("Spellings")) {
+      auto FullSpelling =
+          (Templates.IsPrefix ? Affix + Spelling : Spelling + Affix).str();
+      BuiltinType BT = BuiltinType::Builtin;
+      if (Builtin->isSubClassOf("AtomicBuiltin")) {
+        BT = BuiltinType::AtomicBuiltin;
+      } else if (Builtin->isSubClassOf("LangBuiltin")) {
+        BT = BuiltinType::LangBuiltin;
+      } else if (Builtin->isSubClassOf("TargetBuiltin")) {
+        BT = BuiltinType::TargetBuiltin;
+      } else if (Builtin->isSubClassOf("LibBuiltin")) {
+        BT = BuiltinType::LibBuiltin;
+        if (Builtin->getValueAsBit("AddBuiltinPrefixedAlias"))
+          EmitBuiltinDef(OS, Substitution, Builtin,
+                         std::string("__builtin_") + FullSpelling,
+                         BuiltinType::Builtin);
+      }
+      EmitBuiltinDef(OS, Substitution, Builtin, FullSpelling, BT);
+    }
+  }
+}
+} // namespace
+
+void clang::EmitClangBuiltins(llvm::RecordKeeper &Records,
+                              llvm::raw_ostream &OS) {
+  emitSourceFileHeader("List of builtins that Clang recognizes", OS);
+
+  OS << R"c++(
+#if defined(BUILTIN) && !defined(LIBBUILTIN)
+#  define LIBBUILTIN(ID, TYPE, ATTRS, HEADER, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
+#if defined(BUILTIN) && !defined(LANGBUILTIN)
+#  define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
+// Some of our atomics builtins are handled by AtomicExpr rather than
+// as normal builtin CallExprs. This macro is used for such builtins.
+#ifndef ATOMIC_BUILTIN
+#  define ATOMIC_BUILTIN(ID, TYPE, ATTRS) BUILTIN(ID, TYPE, ATTRS)
+#endif
+
+#if defined(BUILTIN) && !defined(TARGET_BUILTIN)
+#  define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
+#endif
+)c++";
+
+  // AtomicBuiltins are order dependent
+  // emit them first to make manual checking easier
+  for (const auto *Builtin : Records.getAllDerivedDefinitions("AtomicBuiltin"))
+    EmitBuiltin(OS, Builtin);
+
+  for (const auto *Builtin : Records.getAllDerivedDefinitions("Builtin")) {
+    if (Builtin->isSubClassOf("AtomicBuiltin"))
+      continue;
+    EmitBuiltin(OS, Builtin);
+  }
+
+  for (const auto *Entry : Records.getAllDerivedDefinitions("CustomEntry")) {
+    OS << Entry->getValueAsString("Entry") << '\n';
+  }
+
+  OS << R"c++(
+#undef ATOMIC_BUILTIN
+#undef BUILTIN
+#undef LIBBUILTIN
+#undef LANGBUILTIN
+#undef TARGET_BUILTIN
+)c++";
+}
diff --git a/clang/utils/TableGen/MveEmitter.cpp b/clang/utils/TableGen/MveEmitter.cpp
index fae889d68346c33..ad0c407be7429ce 100644
--- a/clang/utils/TableGen/MveEmitter.cpp
+++ b/clang/utils/TableGen/MveEmitter.cpp
@@ -1846,7 +1846,7 @@ void MveEmitter::EmitHeader(raw_ostream &OS) {
         // declared 'static inline' without a body, which is fine
         // provided clang recognizes them as builtins, and has the
         // effect that this type signature is used in place of the one
-        // that Builtins.def didn't provide. That's how we can get
+        // that Builtins.td didn't provide. That's how we can get
         // structure types that weren't defined until this header was
         // included to be part of the type signature of a builtin that
         // was known to clang already.
diff --git a/clang/utils/TableGen/TableGen.cpp b/clang/utils/TableGen/TableGen.cpp
index 7efb6c731d3e5ee..6c1767d541df82f 100644
--- a/clang/utils/TableGen/TableGen.cpp
+++ b/clang/utils/TableGen/TableGen.cpp
@@ -49,6 +49,7 @@ enum ActionType {
   GenClangAttrNodeTraverse,
   GenClangBasicReader,
   GenClangBasicWriter,
+  GenClangBuiltins,
   GenClangDiagsDefs,
   GenClangDiagGroups,
   GenClangDiagsIndexName,
@@ -172,6 +173,8 @@ cl::opt<ActionType> Action(
                    "Generate clang attribute text node dumper"),
         clEnumValN(GenClangAttrNodeTraverse, "gen-clang-attr-node-traverse",
                    "Generate clang attribute traverser"),
+        clEnumValN(GenClangBuiltins, "gen-clang-builtins",
+                   "Generate clang builtins list"),
         clEnumValN(GenClangDiagsDefs, "gen-clang-diags-defs",
                    "Generate Clang diagnostics definitions"),
         clEnumValN(GenClangDiagGroups, "gen-clang-diag-groups",
@@ -373,6 +376,9 @@ bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
   case GenClangAttrNodeTraverse:
     EmitClangAttrNodeTraverse(Records, OS);
     break;
+  case GenClangBuiltins:
+    EmitClangBuiltins(Records, OS);
+    break;
   case GenClangDiagsDefs:
     EmitClangDiagsDefs(Records, OS, ClangComponent);
     break;
diff --git a/clang/utils/TableGen/TableGenBackends.h b/clang/utils/TableGen/TableGenBackends.h
index d8f447069376bca..d61f873ae4d3533 100644
--- a/clang/utils/TableGen/TableGenBackends.h
+++ b/clang/utils/TableGen/TableGenBackends.h
@@ -67,6 +67,8 @@ void EmitClangAttrNodeTraverse(llvm::RecordKeeper &Records,
                                llvm::raw_ostream &OS);
 void EmitClangAttrDocTable(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
 
+void EmitClangBuiltins(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);
+
 void EmitClangDiagsDefs(llvm::RecordKeeper &Records, llvm::raw_ostream &OS,
                         const std::string &Component);
 void EmitClangDiagGroups(llvm::RecordKeeper &Records, llvm::raw_ostream &OS);

>From 867df54ff54324a85add48b94e3d4d6f5824fae1 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 18 Jan 2024 06:21:41 +0100
Subject: [PATCH 2/4] Try to fix the CI

---
 clang/include/clang/AST/Expr.h        |   9 +-
 clang/include/clang/Basic/Builtins.td | 185 ++++++++++++++++++++++++--
 clang/lib/AST/Expr.cpp                |   1 -
 clang/lib/Sema/SemaChecking.cpp       |   6 +-
 4 files changed, 185 insertions(+), 16 deletions(-)

diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 1d2c719a73828c9..6f219e14a1431f5 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -6571,11 +6571,14 @@ class AtomicExpr : public Expr {
   /// \return empty atomic scope model if the atomic op code does not have
   ///   scope operand.
   static std::unique_ptr<AtomicScopeModel> getScopeModel(AtomicOp Op) {
-    if (Op >= AO__opencl_atomic_compare_exchange_strong && Op <= AO__opencl_atomic_store)
+    // FIXME: Allow grouping of builtins to be able to only check >= and <=
+    if (Op >= AO__opencl_atomic_compare_exchange_strong &&
+        Op <= AO__opencl_atomic_store && Op != AO__opencl_atomic_init)
       return AtomicScopeModel::create(AtomicScopeModelKind::OpenCL);
-    else if (Op >= AO__hip_atomic_compare_exchange_strong && Op <= AO__hip_atomic_store)
+    if (Op >= AO__hip_atomic_compare_exchange_strong &&
+        Op <= AO__hip_atomic_store)
       return AtomicScopeModel::create(AtomicScopeModelKind::HIP);
-    else if (Op >= AO__scoped_atomic_load && Op <= AO__scoped_atomic_fetch_max)
+    if (Op >= AO__scoped_atomic_add_fetch && Op <= AO__scoped_atomic_xor_fetch)
       return AtomicScopeModel::create(AtomicScopeModelKind::Generic);
     return AtomicScopeModel::create(AtomicScopeModelKind::None);
   }
diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index 0a3faf156bbd9f1..fdd1cf8221dcc76 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -599,6 +599,27 @@ def IsNormal : Builtin {
   let Prototype = "int(...)";
 }
 
+def IsSubnormal : Builtin {
+  let Spellings = ["__builtin_issubnormal"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsZero : Builtin {
+  let Spellings = ["__builtin_iszero"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
+def IsSignaling : Builtin {
+  let Spellings = ["__builtin_issignaling"];
+  let Attributes = [FunctionWithBuiltinPrefix, NoThrow, Const,
+                    CustomTypeChecking, Constexpr];
+  let Prototype = "int(...)";
+}
+
 def IsFPClass : Builtin {
   let Spellings = ["__builtin_isfpclass"];
   let Attributes = [NoThrow, Const, CustomTypeChecking, Constexpr];
@@ -754,12 +775,6 @@ def BuiltinAssumeAligned : Builtin {
   let Prototype = "void*(void const*, size_t, ...)";
 }
 
-def BuiltinBcopy : Builtin {
-  let Spellings = ["__builtin_bcopy"];
-  let Attributes = [NoThrow];
-  let Prototype = "void(void*, void*, size_t)";
-}
-
 def BuiltinFree : Builtin {
   let Spellings = ["__builtin_free"];
   let Attributes = [FunctionWithBuiltinPrefix, NoThrow];
@@ -1826,6 +1841,151 @@ def AtomicIsLockFree : Builtin {
   let Prototype = "bool(size_t, void const volatile*)";
 }
 
+// GNU atomic builtins with atomic scopes.
+def ScopedAtomicLoad : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_load"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicLoadN : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_load_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicStore : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_store"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicStoreN : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_store_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicExchange : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicExchangeN : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_exchange_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicCompareExchange : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_compare_exchange"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicCompareExchangeN : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_compare_exchange_n"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchAdd : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_add"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchSub : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_sub"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchAnd : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_and"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchOr : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_or"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchXor : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_xor"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchNand : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_nand"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchMin : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_min"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicFetchMax : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_fetch_max"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicAddFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_add_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicSubFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_sub_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicAndFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_and_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicOrFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_or_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicXorFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_xor_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicNandFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_nand_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicMinFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_min_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
+def ScopedAtomicMaxFetch : AtomicBuiltin {
+  let Spellings = ["__scoped_atomic_max_fetch"];
+  let Attributes = [CustomTypeChecking];
+  let Prototype = "void(...)";
+}
+
 // OpenCL 2.0 atomic builtins.
 def OpenCLAtomicInit : AtomicBuiltin {
   let Spellings = ["__opencl_atomic_init"];
@@ -2954,6 +3114,13 @@ def BZero : GNULibBuiltin<"strings.h"> {
   let AddBuiltinPrefixedAlias = 1;
 }
 
+def Bcopy : GNULibBuiltin<"strings.h"> {
+  let Spellings = ["bcopy"];
+  let Attributes = [NoThrow];
+  let Prototype = "void(void const*, void*, size_t)";
+  let AddBuiltinPrefixedAlias = 1;
+}
+
 // FIXME: This should be part of BCmp.
 def BuiltinBCmp : Builtin {
   let Spellings = ["__builtin_bcmp"];
@@ -3931,19 +4098,19 @@ class SOverflowTemplate :
     Template<["int",          "long int",          "long long int"],
              ["_overflow",    "l_overflow",        "ll_overflow"]>;
 
-def SaddOverflow : Builtin, UOverflowTemplate {
+def SaddOverflow : Builtin, SOverflowTemplate {
   let Spellings = ["__builtin_sadd"];
   let Attributes = [NoThrow, Constexpr];
   let Prototype = "bool(T const, T const, T*)";
 }
 
-def SsubOverflow : Builtin, UOverflowTemplate {
+def SsubOverflow : Builtin, SOverflowTemplate {
   let Spellings = ["__builtin_ssub"];
   let Attributes = [NoThrow, Constexpr];
   let Prototype = "bool(T const, T const, T*)";
 }
 
-def SmulOverflow : Builtin, UOverflowTemplate {
+def SmulOverflow : Builtin, SOverflowTemplate {
   let Spellings = ["__builtin_smul"];
   let Attributes = [NoThrow, Constexpr];
   let Prototype = "bool(T const, T const, T*)";
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index 3d977187236fff1..b125fc676da8419 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -4873,7 +4873,6 @@ AtomicExpr::AtomicExpr(SourceLocation BLoc, ArrayRef<Expr *> args, QualType t,
                        AtomicOp op, SourceLocation RP)
     : Expr(AtomicExprClass, t, VK_PRValue, OK_Ordinary),
       NumSubExprs(args.size()), BuiltinLoc(BLoc), RParenLoc(RP), Op(op) {
-  assert(op != AO__opencl_atomic_init || args.size() == 3);
   assert(args.size() == getNumSubExprs(op) && "wrong number of subexpressions");
   for (unsigned i = 0; i != args.size(); i++)
     SubExprs[i] = args[i];
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 710549ae34b6418..efa0bf14a96b22b 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -7741,10 +7741,10 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
                   Op <= AtomicExpr::AO__opencl_atomic_store;
   bool IsHIP = Op >= AtomicExpr::AO__hip_atomic_compare_exchange_strong &&
                Op <= AtomicExpr::AO__hip_atomic_store;
-  bool IsScoped = Op >= AtomicExpr::AO__scoped_atomic_load &&
-                  Op <= AtomicExpr::AO__scoped_atomic_fetch_max;
+  bool IsScoped = Op >= AtomicExpr::AO__scoped_atomic_add_fetch &&
+                  Op <= AtomicExpr::AO__scoped_atomic_xor_fetch;
   bool IsC11 = (Op >= AtomicExpr::AO__c11_atomic_compare_exchange_strong &&
-               Op <= AtomicExpr::AO__c11_atomic_store) ||
+                Op <= AtomicExpr::AO__c11_atomic_store) ||
                IsOpenCL;
   bool IsN = Op == AtomicExpr::AO__atomic_load_n ||
              Op == AtomicExpr::AO__atomic_store_n ||

>From 71a0d95cf49ae1b1baa2e3f7dd859b95c2b06314 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Thu, 18 Jan 2024 07:36:53 +0100
Subject: [PATCH 3/4] Don't remove the docs in Builtins.def

---
 clang/include/clang/Basic/Builtins.def | 102 +++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 clang/include/clang/Basic/Builtins.def

diff --git a/clang/include/clang/Basic/Builtins.def b/clang/include/clang/Basic/Builtins.def
new file mode 100644
index 000000000000000..f356f881d5ef9bc
--- /dev/null
+++ b/clang/include/clang/Basic/Builtins.def
@@ -0,0 +1,102 @@
+//===--- Builtins.def - Builtin function info database ----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// This is only documentation for the database layout. This will be removed once
+// all builtin databases are converted to tablegen files
+
+// The second value provided to the macro specifies the type of the function
+// (result value, then each argument) as follows:
+//  v -> void
+//  b -> boolean
+//  c -> char
+//  s -> short
+//  i -> int
+//  h -> half (__fp16, OpenCL)
+//  x -> half (_Float16)
+//  y -> half (__bf16)
+//  f -> float
+//  d -> double
+//  z -> size_t
+//  w -> wchar_t
+//  F -> constant CFString
+//  G -> id
+//  H -> SEL
+//  M -> struct objc_super
+//  a -> __builtin_va_list
+//  A -> "reference" to __builtin_va_list
+//  V -> Vector, followed by the number of elements and the base type.
+//  q -> Scalable vector, followed by the number of elements and the base type.
+//  Q -> target builtin type, followed by a character to distinguish the builtin type
+//    Qa -> AArch64 svcount_t builtin type.
+//  E -> ext_vector, followed by the number of elements and the base type.
+//  X -> _Complex, followed by the base type.
+//  Y -> ptrdiff_t
+//  P -> FILE
+//  J -> jmp_buf
+//  SJ -> sigjmp_buf
+//  K -> ucontext_t
+//  p -> pid_t
+//  . -> "...".  This may only occur at the end of the function list.
+//
+// Types may be prefixed with the following modifiers:
+//  L   -> long (e.g. Li for 'long int', Ld for 'long double')
+//  LL  -> long long (e.g. LLi for 'long long int', LLd for __float128)
+//  LLL -> __int128_t (e.g. LLLi)
+//  Z   -> int32_t (require a native 32-bit integer type on the target)
+//  W   -> int64_t (require a native 64-bit integer type on the target)
+//  N   -> 'int' size if target is LP64, 'L' otherwise.
+//  O   -> long for OpenCL targets, long long otherwise.
+//  S   -> signed
+//  U   -> unsigned
+//  I   -> Required to constant fold to an integer constant expression.
+//
+// Types may be postfixed with the following modifiers:
+// * -> pointer (optionally followed by an address space number, if no address
+//               space is specified than any address space will be accepted)
+// & -> reference (optionally followed by an address space number)
+// C -> const
+// D -> volatile
+// R -> restrict
+
+// The third value provided to the macro specifies information about attributes
+// of the function.  These must be kept in sync with the predicates in the
+// Builtin::Context class.  Currently we have:
+//  n -> nothrow
+//  r -> noreturn
+//  U -> pure
+//  c -> const
+//  t -> signature is meaningless, use custom typechecking
+//  T -> type is not important to semantic analysis and codegen; recognize as
+//       builtin even if type doesn't match signature, and don't warn if we
+//       can't be sure the type is right
+//  F -> this is a libc/libm function with a '__builtin_' prefix added.
+//  f -> this is a libc/libm function without a '__builtin_' prefix, or with
+//       'z', a C++ standard library function in namespace std::. This builtin
+//       is disableable by '-fno-builtin-foo' / '-fno-builtin-std-foo'.
+//  h -> this function requires a specific header or an explicit declaration.
+//  i -> this is a runtime library implemented function without the
+//       '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
+//  p:N: -> this is a printf-like function whose Nth argument is the format
+//          string.
+//  P:N: -> similar to the p:N: attribute, but the function is like vprintf
+//          in that it accepts its arguments as a va_list rather than
+//          through an ellipsis
+//  s:N: -> this is a scanf-like function whose Nth argument is the format
+//          string.
+//  S:N: -> similar to the s:N: attribute, but the function is like vscanf
+//          in that it accepts its arguments as a va_list rather than
+//          through an ellipsis
+//  e -> const, but only when -fno-math-errno and FP exceptions are ignored
+//  g -> const when FP exceptions are ignored
+//  j -> returns_twice (like setjmp)
+//  u -> arguments are not evaluated for their side-effects
+//  V:N: -> requires vectors of at least N bits to be legal
+//  C<N,M_0,...,M_k> -> callback behavior: argument N is called with argument
+//                      M_0, ..., M_k as payload
+//  z -> this is a function in (possibly-versioned) namespace std
+//  E -> this function can be constant evaluated by Clang frontend

>From ff03606e7d3b96d40909716b0a958f21c6b16fd2 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Wed, 24 Jan 2024 01:20:57 +0100
Subject: [PATCH 4/4] Try to fix windows

---
 clang/utils/TableGen/ClangBuiltinsEmitter.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
index ac2dbc936c93f4b..dc10fa14c59598e 100644
--- a/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
+++ b/clang/utils/TableGen/ClangBuiltinsEmitter.cpp
@@ -183,6 +183,8 @@ void PrintAttributes(const Record *Builtin, BuiltinType BT,
 
 void EmitBuiltinDef(llvm::raw_ostream &OS, StringRef Substitution,
                     const Record *Builtin, Twine Spelling, BuiltinType BT) {
+  if (Builtin->getValueAsBit("RequiresUndef"))
+    OS << "#undef " << Spelling << '\n';
   switch (BT) {
   case BuiltinType::LibBuiltin:
     OS << "LIBBUILTIN";



More information about the cfe-commits mailing list