//===--- BuiltinsPTX.def - PTX Builtin function database ----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the PTX-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

// Special Registers

BUILTIN(__nvvm_read_ptx_sreg_tid_x, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_tid_y, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_tid_z, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_tid_w, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_ntid_x, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_ntid_y, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_ntid_z, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_ntid_w, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_ctaid_x, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_ctaid_y, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_ctaid_z, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_ctaid_w, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_nctaid_x, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_nctaid_y, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_nctaid_z, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_nctaid_w, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_laneid, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_warpid, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_nwarpid, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_smid, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_nsmid, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_gridid, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_lanemask_eq, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_lanemask_le, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_lanemask_lt, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_lanemask_ge, "i", "nc")
BUILTIN(__nvvm_read_ptx_sreg_lanemask_gt, "i", "nc")

BUILTIN(__nvvm_read_ptx_sreg_clock, "i", "n")
BUILTIN(__nvvm_read_ptx_sreg_clock64, "LLi", "n")

BUILTIN(__nvvm_read_ptx_sreg_pm0, "i", "n")
BUILTIN(__nvvm_read_ptx_sreg_pm1, "i", "n")
BUILTIN(__nvvm_read_ptx_sreg_pm2, "i", "n")
BUILTIN(__nvvm_read_ptx_sreg_pm3, "i", "n")

// MISC

BUILTIN(__nvvm_prmt, "UiUiUiUi", "")

// Min Max

BUILTIN(__nvvm_fmax_ftz_f, "fff",  "")
BUILTIN(__nvvm_fmax_f, "fff",  "")
BUILTIN(__nvvm_fmin_ftz_f, "fff",  "")
BUILTIN(__nvvm_fmin_f, "fff",  "")

BUILTIN(__nvvm_fmax_d, "ddd", "")
BUILTIN(__nvvm_fmin_d, "ddd", "")

// Multiplication

BUILTIN(__nvvm_mulhi_i, "iii", "")
BUILTIN(__nvvm_mulhi_ui, "UiUiUi", "")
BUILTIN(__nvvm_mulhi_ll, "LLiLLiLLi", "")
BUILTIN(__nvvm_mulhi_ull, "ULLiULLiULLi", "")

BUILTIN(__nvvm_mul_rn_ftz_f,  "fff", "")
BUILTIN(__nvvm_mul_rn_f,  "fff", "")
BUILTIN(__nvvm_mul_rz_ftz_f,  "fff", "")
BUILTIN(__nvvm_mul_rz_f,  "fff", "")
BUILTIN(__nvvm_mul_rm_ftz_f,  "fff", "")
BUILTIN(__nvvm_mul_rm_f,  "fff", "")
BUILTIN(__nvvm_mul_rp_ftz_f,  "fff", "")
BUILTIN(__nvvm_mul_rp_f,  "fff", "")

BUILTIN(__nvvm_mul_rn_d,  "ddd", "")
BUILTIN(__nvvm_mul_rz_d,  "ddd", "")
BUILTIN(__nvvm_mul_rm_d,  "ddd", "")
BUILTIN(__nvvm_mul_rp_d,  "ddd", "")

BUILTIN(__nvvm_mul24_i,  "iii", "")
BUILTIN(__nvvm_mul24_ui,  "UiUiUi", "")

// Div

BUILTIN(__nvvm_div_approx_ftz_f,  "fff", "")
BUILTIN(__nvvm_div_approx_f,  "fff", "")

BUILTIN(__nvvm_div_rn_ftz_f,  "fff", "")
BUILTIN(__nvvm_div_rn_f,  "fff", "")
BUILTIN(__nvvm_div_rz_ftz_f,  "fff", "")
BUILTIN(__nvvm_div_rz_f,  "fff", "")
BUILTIN(__nvvm_div_rm_ftz_f,  "fff", "")
BUILTIN(__nvvm_div_rm_f,  "fff", "")
BUILTIN(__nvvm_div_rp_ftz_f,  "fff", "")
BUILTIN(__nvvm_div_rp_f,  "fff", "")

BUILTIN(__nvvm_div_rn_d,  "ddd", "")
BUILTIN(__nvvm_div_rz_d,  "ddd", "")
BUILTIN(__nvvm_div_rm_d,  "ddd", "")
BUILTIN(__nvvm_div_rp_d,  "ddd", "")

// Sad

BUILTIN(__nvvm_sad_i, "iiii", "")
BUILTIN(__nvvm_sad_ui, "UiUiUiUi", "")

// Floor, Ceil

BUILTIN(__nvvm_floor_ftz_f, "ff", "")
BUILTIN(__nvvm_floor_f, "ff", "")
BUILTIN(__nvvm_floor_d, "dd", "")

BUILTIN(__nvvm_ceil_ftz_f, "ff", "")
BUILTIN(__nvvm_ceil_f, "ff", "")
BUILTIN(__nvvm_ceil_d, "dd", "")

// Abs

BUILTIN(__nvvm_fabs_ftz_f, "ff", "")
BUILTIN(__nvvm_fabs_f, "ff", "")
BUILTIN(__nvvm_fabs_d, "dd", "")

// Round

BUILTIN(__nvvm_round_ftz_f, "ff", "")
BUILTIN(__nvvm_round_f, "ff", "")
BUILTIN(__nvvm_round_d, "dd", "")

// Trunc

BUILTIN(__nvvm_trunc_ftz_f, "ff", "")
BUILTIN(__nvvm_trunc_f, "ff", "")
BUILTIN(__nvvm_trunc_d, "dd", "")

// Saturate

BUILTIN(__nvvm_saturate_ftz_f, "ff", "")
BUILTIN(__nvvm_saturate_f, "ff", "")
BUILTIN(__nvvm_saturate_d, "dd", "")

// Exp2, Log2

BUILTIN(__nvvm_ex2_approx_ftz_f, "ff", "")
BUILTIN(__nvvm_ex2_approx_f, "ff", "")
BUILTIN(__nvvm_ex2_approx_d, "dd", "")

BUILTIN(__nvvm_lg2_approx_ftz_f, "ff", "")
BUILTIN(__nvvm_lg2_approx_f, "ff", "")
BUILTIN(__nvvm_lg2_approx_d, "dd", "")

// Sin, Cos

BUILTIN(__nvvm_sin_approx_ftz_f, "ff", "")
BUILTIN(__nvvm_sin_approx_f, "ff", "")

BUILTIN(__nvvm_cos_approx_ftz_f, "ff", "")
BUILTIN(__nvvm_cos_approx_f, "ff", "")

// Fma

BUILTIN(__nvvm_fma_rn_ftz_f, "ffff", "")
BUILTIN(__nvvm_fma_rn_f, "ffff", "")
BUILTIN(__nvvm_fma_rz_ftz_f, "ffff", "")
BUILTIN(__nvvm_fma_rz_f, "ffff", "")
BUILTIN(__nvvm_fma_rm_ftz_f, "ffff", "")
BUILTIN(__nvvm_fma_rm_f, "ffff", "")
BUILTIN(__nvvm_fma_rp_ftz_f, "ffff", "")
BUILTIN(__nvvm_fma_rp_f, "ffff", "")
BUILTIN(__nvvm_fma_rn_d, "dddd", "")
BUILTIN(__nvvm_fma_rz_d, "dddd", "")
BUILTIN(__nvvm_fma_rm_d, "dddd", "")
BUILTIN(__nvvm_fma_rp_d, "dddd", "")

// Rcp

BUILTIN(__nvvm_rcp_rn_ftz_f, "ff", "")
BUILTIN(__nvvm_rcp_rn_f, "ff", "")
BUILTIN(__nvvm_rcp_rz_ftz_f, "ff", "")
BUILTIN(__nvvm_rcp_rz_f, "ff", "")
BUILTIN(__nvvm_rcp_rm_ftz_f, "ff", "")
BUILTIN(__nvvm_rcp_rm_f, "ff", "")
BUILTIN(__nvvm_rcp_rp_ftz_f, "ff", "")
BUILTIN(__nvvm_rcp_rp_f, "ff", "")

BUILTIN(__nvvm_rcp_rn_d, "dd", "")
BUILTIN(__nvvm_rcp_rz_d, "dd", "")
BUILTIN(__nvvm_rcp_rm_d, "dd", "")
BUILTIN(__nvvm_rcp_rp_d, "dd", "")
BUILTIN(__nvvm_rcp_approx_ftz_d, "dd", "")

// Sqrt

BUILTIN(__nvvm_sqrt_rn_ftz_f, "ff", "")
BUILTIN(__nvvm_sqrt_rn_f, "ff", "")
BUILTIN(__nvvm_sqrt_rz_ftz_f, "ff", "")
BUILTIN(__nvvm_sqrt_rz_f, "ff", "")
BUILTIN(__nvvm_sqrt_rm_ftz_f, "ff", "")
BUILTIN(__nvvm_sqrt_rm_f, "ff", "")
BUILTIN(__nvvm_sqrt_rp_ftz_f, "ff", "")
BUILTIN(__nvvm_sqrt_rp_f, "ff", "")
BUILTIN(__nvvm_sqrt_approx_ftz_f, "ff", "")
BUILTIN(__nvvm_sqrt_approx_f, "ff", "")

BUILTIN(__nvvm_sqrt_rn_d, "dd", "")
BUILTIN(__nvvm_sqrt_rz_d, "dd", "")
BUILTIN(__nvvm_sqrt_rm_d, "dd", "")
BUILTIN(__nvvm_sqrt_rp_d, "dd", "")

// Rsqrt

BUILTIN(__nvvm_rsqrt_approx_ftz_f, "ff", "")
BUILTIN(__nvvm_rsqrt_approx_f, "ff", "")
BUILTIN(__nvvm_rsqrt_approx_d, "dd", "")

// Add

BUILTIN(__nvvm_add_rn_ftz_f, "fff", "")
BUILTIN(__nvvm_add_rn_f, "fff", "")
BUILTIN(__nvvm_add_rz_ftz_f, "fff", "")
BUILTIN(__nvvm_add_rz_f, "fff", "")
BUILTIN(__nvvm_add_rm_ftz_f, "fff", "")
BUILTIN(__nvvm_add_rm_f, "fff", "")
BUILTIN(__nvvm_add_rp_ftz_f, "fff", "")
BUILTIN(__nvvm_add_rp_f, "fff", "")

BUILTIN(__nvvm_add_rn_d, "ddd", "")
BUILTIN(__nvvm_add_rz_d, "ddd", "")
BUILTIN(__nvvm_add_rm_d, "ddd", "")
BUILTIN(__nvvm_add_rp_d, "ddd", "")

// Convert

BUILTIN(__nvvm_d2f_rn_ftz, "fd", "")
BUILTIN(__nvvm_d2f_rn, "fd", "")
BUILTIN(__nvvm_d2f_rz_ftz, "fd", "")
BUILTIN(__nvvm_d2f_rz, "fd", "")
BUILTIN(__nvvm_d2f_rm_ftz, "fd", "")
BUILTIN(__nvvm_d2f_rm, "fd", "")
BUILTIN(__nvvm_d2f_rp_ftz, "fd", "")
BUILTIN(__nvvm_d2f_rp, "fd", "")

BUILTIN(__nvvm_d2i_rn, "id", "")
BUILTIN(__nvvm_d2i_rz, "id", "")
BUILTIN(__nvvm_d2i_rm, "id", "")
BUILTIN(__nvvm_d2i_rp, "id", "")

BUILTIN(__nvvm_d2ui_rn, "Uid", "")
BUILTIN(__nvvm_d2ui_rz, "Uid", "")
BUILTIN(__nvvm_d2ui_rm, "Uid", "")
BUILTIN(__nvvm_d2ui_rp, "Uid", "")

BUILTIN(__nvvm_i2d_rn, "di", "")
BUILTIN(__nvvm_i2d_rz, "di", "")
BUILTIN(__nvvm_i2d_rm, "di", "")
BUILTIN(__nvvm_i2d_rp, "di", "")

BUILTIN(__nvvm_ui2d_rn, "dUi", "")
BUILTIN(__nvvm_ui2d_rz, "dUi", "")
BUILTIN(__nvvm_ui2d_rm, "dUi", "")
BUILTIN(__nvvm_ui2d_rp, "dUi", "")

BUILTIN(__nvvm_f2i_rn_ftz, "if", "")
BUILTIN(__nvvm_f2i_rn, "if", "")
BUILTIN(__nvvm_f2i_rz_ftz, "if", "")
BUILTIN(__nvvm_f2i_rz, "if", "")
BUILTIN(__nvvm_f2i_rm_ftz, "if", "")
BUILTIN(__nvvm_f2i_rm, "if", "")
BUILTIN(__nvvm_f2i_rp_ftz, "if", "")
BUILTIN(__nvvm_f2i_rp, "if", "")

BUILTIN(__nvvm_f2ui_rn_ftz, "Uif", "")
BUILTIN(__nvvm_f2ui_rn, "Uif", "")
BUILTIN(__nvvm_f2ui_rz_ftz, "Uif", "")
BUILTIN(__nvvm_f2ui_rz, "Uif", "")
BUILTIN(__nvvm_f2ui_rm_ftz, "Uif", "")
BUILTIN(__nvvm_f2ui_rm, "Uif", "")
BUILTIN(__nvvm_f2ui_rp_ftz, "Uif", "")
BUILTIN(__nvvm_f2ui_rp, "Uif", "")

BUILTIN(__nvvm_i2f_rn, "fi", "")
BUILTIN(__nvvm_i2f_rz, "fi", "")
BUILTIN(__nvvm_i2f_rm, "fi", "")
BUILTIN(__nvvm_i2f_rp, "fi", "")

BUILTIN(__nvvm_ui2f_rn, "fUi", "")
BUILTIN(__nvvm_ui2f_rz, "fUi", "")
BUILTIN(__nvvm_ui2f_rm, "fUi", "")
BUILTIN(__nvvm_ui2f_rp, "fUi", "")

BUILTIN(__nvvm_lohi_i2d, "dii", "")

BUILTIN(__nvvm_d2i_lo, "id", "")
BUILTIN(__nvvm_d2i_hi, "id", "")

BUILTIN(__nvvm_f2ll_rn_ftz, "LLif", "")
BUILTIN(__nvvm_f2ll_rn, "LLif", "")
BUILTIN(__nvvm_f2ll_rz_ftz, "LLif", "")
BUILTIN(__nvvm_f2ll_rz, "LLif", "")
BUILTIN(__nvvm_f2ll_rm_ftz, "LLif", "")
BUILTIN(__nvvm_f2ll_rm, "LLif", "")
BUILTIN(__nvvm_f2ll_rp_ftz, "LLif", "")
BUILTIN(__nvvm_f2ll_rp, "LLif", "")

BUILTIN(__nvvm_f2ull_rn_ftz, "ULLif", "")
BUILTIN(__nvvm_f2ull_rn, "ULLif", "")
BUILTIN(__nvvm_f2ull_rz_ftz, "ULLif", "")
BUILTIN(__nvvm_f2ull_rz, "ULLif", "")
BUILTIN(__nvvm_f2ull_rm_ftz, "ULLif", "")
BUILTIN(__nvvm_f2ull_rm, "ULLif", "")
BUILTIN(__nvvm_f2ull_rp_ftz, "ULLif", "")
BUILTIN(__nvvm_f2ull_rp, "ULLif", "")

BUILTIN(__nvvm_d2ll_rn, "LLid", "")
BUILTIN(__nvvm_d2ll_rz, "LLid", "")
BUILTIN(__nvvm_d2ll_rm, "LLid", "")
BUILTIN(__nvvm_d2ll_rp, "LLid", "")

BUILTIN(__nvvm_d2ull_rn, "ULLid", "")
BUILTIN(__nvvm_d2ull_rz, "ULLid", "")
BUILTIN(__nvvm_d2ull_rm, "ULLid", "")
BUILTIN(__nvvm_d2ull_rp, "ULLid", "")

BUILTIN(__nvvm_ll2f_rn, "fLLi", "")
BUILTIN(__nvvm_ll2f_rz, "fLLi", "")
BUILTIN(__nvvm_ll2f_rm, "fLLi", "")
BUILTIN(__nvvm_ll2f_rp, "fLLi", "")

BUILTIN(__nvvm_ull2f_rn, "fULLi", "")
BUILTIN(__nvvm_ull2f_rz, "fULLi", "")
BUILTIN(__nvvm_ull2f_rm, "fULLi", "")
BUILTIN(__nvvm_ull2f_rp, "fULLi", "")

BUILTIN(__nvvm_ll2d_rn, "dLLi", "")
BUILTIN(__nvvm_ll2d_rz, "dLLi", "")
BUILTIN(__nvvm_ll2d_rm, "dLLi", "")
BUILTIN(__nvvm_ll2d_rp, "dLLi", "")

BUILTIN(__nvvm_ull2d_rn, "dULLi", "")
BUILTIN(__nvvm_ull2d_rz, "dULLi", "")
BUILTIN(__nvvm_ull2d_rm, "dULLi", "")
BUILTIN(__nvvm_ull2d_rp, "dULLi", "")

BUILTIN(__nvvm_f2h_rn_ftz, "Usf", "")
BUILTIN(__nvvm_f2h_rn, "Usf", "")

// Bitcast

BUILTIN(__nvvm_bitcast_f2i, "if", "")
BUILTIN(__nvvm_bitcast_i2f, "fi", "")

BUILTIN(__nvvm_bitcast_ll2d, "dLLi", "")
BUILTIN(__nvvm_bitcast_d2ll, "LLid", "")

// Sync

BUILTIN(__syncthreads, "v", "")
BUILTIN(__nvvm_bar0_popc, "ii", "")
BUILTIN(__nvvm_bar0_and, "ii", "")
BUILTIN(__nvvm_bar0_or, "ii", "")
BUILTIN(__nvvm_bar_sync, "vi", "n")

// Shuffle

BUILTIN(__nvvm_shfl_down_i32, "iiii", "")
BUILTIN(__nvvm_shfl_down_f32, "ffii", "")
BUILTIN(__nvvm_shfl_up_i32, "iiii", "")
BUILTIN(__nvvm_shfl_up_f32, "ffii", "")
BUILTIN(__nvvm_shfl_bfly_i32, "iiii", "")
BUILTIN(__nvvm_shfl_bfly_f32, "ffii", "")
BUILTIN(__nvvm_shfl_idx_i32, "iiii", "")
BUILTIN(__nvvm_shfl_idx_f32, "ffii", "")

// Membar

BUILTIN(__nvvm_membar_cta, "v", "")
BUILTIN(__nvvm_membar_gl, "v", "")
BUILTIN(__nvvm_membar_sys, "v", "")

// Memcpy, Memset

BUILTIN(__nvvm_memcpy, "vUc*Uc*zi","")
BUILTIN(__nvvm_memset, "vUc*Uczi","")

// Image

BUILTIN(__builtin_ptx_read_image2Dfi_, "V4fiiii", "")
BUILTIN(__builtin_ptx_read_image2Dff_, "V4fiiff", "")
BUILTIN(__builtin_ptx_read_image2Dii_, "V4iiiii", "")
BUILTIN(__builtin_ptx_read_image2Dif_, "V4iiiff", "")

BUILTIN(__builtin_ptx_read_image3Dfi_, "V4fiiiiii", "")
BUILTIN(__builtin_ptx_read_image3Dff_, "V4fiiffff", "")
BUILTIN(__builtin_ptx_read_image3Dii_, "V4iiiiiii", "")
BUILTIN(__builtin_ptx_read_image3Dif_, "V4iiiffff", "")

BUILTIN(__builtin_ptx_write_image2Df_, "viiiffff", "")
BUILTIN(__builtin_ptx_write_image2Di_, "viiiiiii", "")
BUILTIN(__builtin_ptx_write_image2Dui_, "viiiUiUiUiUi", "")
BUILTIN(__builtin_ptx_get_image_depthi_, "ii", "")
BUILTIN(__builtin_ptx_get_image_heighti_, "ii", "")
BUILTIN(__builtin_ptx_get_image_widthi_, "ii", "")
BUILTIN(__builtin_ptx_get_image_channel_data_typei_, "ii", "")
BUILTIN(__builtin_ptx_get_image_channel_orderi_, "ii", "")

// Atomic
//
// We need the atom intrinsics because
// - they are used in converging analysis
// - they are used in address space analysis and optimization
// So it does not hurt to expose them as builtins.
//
BUILTIN(__nvvm_atom_add_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_add_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_add_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_add_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_add_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_add_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_add_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_add_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_add_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_add_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_add_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_add_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_add_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_add_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_add_gen_ll, "LLiLLiD*LLi", "n", "satom")
BUILTIN(__nvvm_atom_add_g_f, "ffD*1f", "n")
BUILTIN(__nvvm_atom_add_s_f, "ffD*3f", "n")
BUILTIN(__nvvm_atom_add_gen_f, "ffD*f", "n")
TARGET_BUILTIN(__nvvm_atom_cta_add_gen_f, "ffD*f", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_add_gen_f, "ffD*f", "n", "satom")
BUILTIN(__nvvm_atom_add_g_d, "ddD*1d", "n")
BUILTIN(__nvvm_atom_add_s_d, "ddD*3d", "n")
BUILTIN(__nvvm_atom_add_gen_d, "ddD*d", "n")
TARGET_BUILTIN(__nvvm_atom_cta_add_gen_d, "ddD*d", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_add_gen_d, "ddD*d", "n", "satom")

BUILTIN(__nvvm_atom_sub_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_sub_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_sub_gen_i, "iiD*i", "n")
BUILTIN(__nvvm_atom_sub_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_sub_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_sub_gen_l, "LiLiD*Li", "n")
BUILTIN(__nvvm_atom_sub_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_sub_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_sub_gen_ll, "LLiLLiD*LLi", "n")

BUILTIN(__nvvm_atom_xchg_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_xchg_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_xchg_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_xchg_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_xchg_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_xchg_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_xchg_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_xchg_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_xchg_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_xchg_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_xchg_gen_ll, "LLiLLiD*LLi", "n", "satom")

BUILTIN(__nvvm_atom_max_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_max_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_max_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_max_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_max_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_max_g_ui, "UiUiD*1Ui", "n")
BUILTIN(__nvvm_atom_max_s_ui, "UiUiD*3Ui", "n")
BUILTIN(__nvvm_atom_max_gen_ui, "UiUiD*Ui", "n")
TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ui, "UiUiD*Ui", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ui, "UiUiD*Ui", "n", "satom")
BUILTIN(__nvvm_atom_max_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_max_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_max_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_max_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_max_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_max_g_ul, "ULiULiD*1ULi", "n")
BUILTIN(__nvvm_atom_max_s_ul, "ULiULiD*3ULi", "n")
BUILTIN(__nvvm_atom_max_gen_ul, "ULiULiD*ULi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ul, "ULiULiD*ULi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ul, "ULiULiD*ULi", "n", "satom")
BUILTIN(__nvvm_atom_max_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_max_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_max_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ll, "LLiLLiD*LLi", "n", "satom")
BUILTIN(__nvvm_atom_max_g_ull, "ULLiULLiD*1ULLi", "n")
BUILTIN(__nvvm_atom_max_s_ull, "ULLiULLiD*3ULLi", "n")
BUILTIN(__nvvm_atom_max_gen_ull, "ULLiULLiD*ULLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_max_gen_ull, "ULLiULLiD*ULLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_max_gen_ull, "ULLiULLiD*ULLi", "n", "satom")

BUILTIN(__nvvm_atom_min_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_min_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_min_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_min_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_min_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_min_g_ui, "UiUiD*1Ui", "n")
BUILTIN(__nvvm_atom_min_s_ui, "UiUiD*3Ui", "n")
BUILTIN(__nvvm_atom_min_gen_ui, "UiUiD*Ui", "n")
TARGET_BUILTIN(__nvvm_atom_cta_min_gen_ui, "UiUiD*Ui", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_min_gen_ui, "UiUiD*Ui", "n", "satom")
BUILTIN(__nvvm_atom_min_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_min_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_min_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_min_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_min_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_min_g_ul, "ULiULiD*1ULi", "n")
BUILTIN(__nvvm_atom_min_s_ul, "ULiULiD*3ULi", "n")
BUILTIN(__nvvm_atom_min_gen_ul, "ULiULiD*ULi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_min_gen_ul, "ULiULiD*ULi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_min_gen_ul, "ULiULiD*ULi", "n", "satom")
BUILTIN(__nvvm_atom_min_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_min_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_min_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_min_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_min_gen_ll, "LLiLLiD*LLi", "n", "satom")
BUILTIN(__nvvm_atom_min_g_ull, "ULLiULLiD*1ULLi", "n")
BUILTIN(__nvvm_atom_min_s_ull, "ULLiULLiD*3ULLi", "n")
BUILTIN(__nvvm_atom_min_gen_ull, "ULLiULLiD*ULLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_min_gen_ull, "ULLiULLiD*ULLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_min_gen_ull, "ULLiULLiD*ULLi", "n", "satom")

BUILTIN(__nvvm_atom_inc_g_ui, "UiUiD*1Ui", "n")
BUILTIN(__nvvm_atom_inc_s_ui, "UiUiD*3Ui", "n")
BUILTIN(__nvvm_atom_inc_gen_ui, "UiUiD*Ui", "n")
TARGET_BUILTIN(__nvvm_atom_cta_inc_gen_ui, "UiUiD*Ui", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_inc_gen_ui, "UiUiD*Ui", "n", "satom")
BUILTIN(__nvvm_atom_dec_g_ui, "UiUiD*1Ui", "n")
BUILTIN(__nvvm_atom_dec_s_ui, "UiUiD*3Ui", "n")
BUILTIN(__nvvm_atom_dec_gen_ui, "UiUiD*Ui", "n")
TARGET_BUILTIN(__nvvm_atom_cta_dec_gen_ui, "UiUiD*Ui", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_dec_gen_ui, "UiUiD*Ui", "n", "satom")

BUILTIN(__nvvm_atom_and_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_and_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_and_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_and_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_and_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_and_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_and_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_and_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_and_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_and_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_and_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_and_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_and_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_and_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_and_gen_ll, "LLiLLiD*LLi", "n", "satom")

BUILTIN(__nvvm_atom_or_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_or_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_or_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_or_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_or_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_or_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_or_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_or_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_or_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_or_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_or_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_or_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_or_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_or_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_or_gen_ll, "LLiLLiD*LLi", "n", "satom")

BUILTIN(__nvvm_atom_xor_g_i, "iiD*1i", "n")
BUILTIN(__nvvm_atom_xor_s_i, "iiD*3i", "n")
BUILTIN(__nvvm_atom_xor_gen_i, "iiD*i", "n")
TARGET_BUILTIN(__nvvm_atom_cta_xor_gen_i, "iiD*i", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_xor_gen_i, "iiD*i", "n", "satom")
BUILTIN(__nvvm_atom_xor_g_l, "LiLiD*1Li", "n")
BUILTIN(__nvvm_atom_xor_s_l, "LiLiD*3Li", "n")
BUILTIN(__nvvm_atom_xor_gen_l, "LiLiD*Li", "n")
TARGET_BUILTIN(__nvvm_atom_cta_xor_gen_l, "LiLiD*Li", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_xor_gen_l, "LiLiD*Li", "n", "satom")
BUILTIN(__nvvm_atom_xor_g_ll, "LLiLLiD*1LLi", "n")
BUILTIN(__nvvm_atom_xor_s_ll, "LLiLLiD*3LLi", "n")
BUILTIN(__nvvm_atom_xor_gen_ll, "LLiLLiD*LLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_xor_gen_ll, "LLiLLiD*LLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_xor_gen_ll, "LLiLLiD*LLi", "n", "satom")

BUILTIN(__nvvm_atom_cas_g_i, "iiD*1ii", "n")
BUILTIN(__nvvm_atom_cas_s_i, "iiD*3ii", "n")
BUILTIN(__nvvm_atom_cas_gen_i, "iiD*ii", "n")
TARGET_BUILTIN(__nvvm_atom_cta_cas_gen_i, "iiD*ii", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_cas_gen_i, "iiD*ii", "n", "satom")
BUILTIN(__nvvm_atom_cas_g_l, "LiLiD*1LiLi", "n")
BUILTIN(__nvvm_atom_cas_s_l, "LiLiD*3LiLi", "n")
BUILTIN(__nvvm_atom_cas_gen_l, "LiLiD*LiLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_cas_gen_l, "LiLiD*LiLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_cas_gen_l, "LiLiD*LiLi", "n", "satom")
BUILTIN(__nvvm_atom_cas_g_ll, "LLiLLiD*1LLiLLi", "n")
BUILTIN(__nvvm_atom_cas_s_ll, "LLiLLiD*3LLiLLi", "n")
BUILTIN(__nvvm_atom_cas_gen_ll, "LLiLLiD*LLiLLi", "n")
TARGET_BUILTIN(__nvvm_atom_cta_cas_gen_ll, "LLiLLiD*LLiLLi", "n", "satom")
TARGET_BUILTIN(__nvvm_atom_sys_cas_gen_ll, "LLiLLiD*LLiLLi", "n", "satom")

// Compiler Error Warn
BUILTIN(__nvvm_compiler_error, "vcC*4", "n")
BUILTIN(__nvvm_compiler_warn, "vcC*4", "n")

// __ldg.  This is not implemented as a builtin by nvcc.
BUILTIN(__nvvm_ldg_c, "ccC*", "")
BUILTIN(__nvvm_ldg_s, "ssC*", "")
BUILTIN(__nvvm_ldg_i, "iiC*", "")
BUILTIN(__nvvm_ldg_l, "LiLiC*", "")
BUILTIN(__nvvm_ldg_ll, "LLiLLiC*", "")

BUILTIN(__nvvm_ldg_uc, "UcUcC*", "")
BUILTIN(__nvvm_ldg_us, "UsUsC*", "")
BUILTIN(__nvvm_ldg_ui, "UiUiC*", "")
BUILTIN(__nvvm_ldg_ul, "ULiULiC*", "")
BUILTIN(__nvvm_ldg_ull, "ULLiULLiC*", "")

BUILTIN(__nvvm_ldg_f, "ffC*", "")
BUILTIN(__nvvm_ldg_d, "ddC*", "")

BUILTIN(__nvvm_ldg_c2, "E2cE2cC*", "")
BUILTIN(__nvvm_ldg_c4, "E4cE4cC*", "")
BUILTIN(__nvvm_ldg_s2, "E2sE2sC*", "")
BUILTIN(__nvvm_ldg_s4, "E4sE4sC*", "")
BUILTIN(__nvvm_ldg_i2, "E2iE2iC*", "")
BUILTIN(__nvvm_ldg_i4, "E4iE4iC*", "")
BUILTIN(__nvvm_ldg_ll2, "E2LLiE2LLiC*", "")

BUILTIN(__nvvm_ldg_uc2, "E2UcE2UcC*", "")
BUILTIN(__nvvm_ldg_uc4, "E4UcE4UcC*", "")
BUILTIN(__nvvm_ldg_us2, "E2UsE2UsC*", "")
BUILTIN(__nvvm_ldg_us4, "E4UsE4UsC*", "")
BUILTIN(__nvvm_ldg_ui2, "E2UiE2UiC*", "")
BUILTIN(__nvvm_ldg_ui4, "E4UiE4UiC*", "")
BUILTIN(__nvvm_ldg_ull2, "E2ULLiE2ULLiC*", "")

BUILTIN(__nvvm_ldg_f2, "E2fE2fC*", "")
BUILTIN(__nvvm_ldg_f4, "E4fE4fC*", "")
BUILTIN(__nvvm_ldg_d2, "E2dE2dC*", "")

#undef BUILTIN
#undef TARGET_BUILTIN
