/* This file contains the definitions and documentation for the
   HSAIL builtins used in the GNU compiler.
   Copyright (C) 2016-2020 Free Software Foundation, Inc.

   Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
   for General Processor Tech.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */

/* Following builtins are used by the BRIG (the binary representation of
   HSAIL) frontend.  Software implementations are available in libhsail-rt.
   Use leading double underscore in the name to avoid name space clashes
   with kernel program symbols in case the builtin is implemented as
   a function call.  */

/* Work-item ID related builtins are not constant in the work-group function
   mode (each WI has a different return value).  */

#ifndef DEF_HSAIL_BUILTIN
#define DEF_HSAIL_BUILTIN(ENUM, HSAIL_OPCODE, HSAIL_TYPE,	\
			  NAME, TYPE, ATTRS)
#endif

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKITEMABSID, BRIG_OPCODE_WORKITEMABSID,
		  BRIG_TYPE_U32, "__hsail_workitemabsid", BT_FN_UINT_UINT_PTR,
		  ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_GRIDSIZE, BRIG_OPCODE_GRIDSIZE,
		  BRIG_TYPE_U32, "__hsail_gridsize", BT_FN_UINT_UINT_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKITEMFLATABSID_U32,
		  BRIG_OPCODE_WORKITEMFLATABSID, BRIG_TYPE_U32,
		  "__hsail_workitemflatabsid_u32", BT_FN_UINT_CONST_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKITEMFLATABSID_U64,
		  BRIG_OPCODE_WORKITEMFLATABSID, BRIG_TYPE_U64,
		  "__hsail_workitemflatabsid_u64", BT_FN_ULONG_CONST_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKITEMFLATID, BRIG_OPCODE_WORKITEMFLATID,
		  BRIG_TYPE_U32, "__hsail_workitemflatid", BT_FN_UINT_CONST_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKITEMID, BRIG_OPCODE_WORKITEMID,
		  BRIG_TYPE_U32, "__hsail_workitemid",
		  BT_FN_UINT_UINT_CONST_PTR, ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKGROUPID, BRIG_OPCODE_WORKGROUPID,
		  BRIG_TYPE_U32, "__hsail_workgroupid",
		  BT_FN_UINT_UINT_CONST_PTR, ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CURRENTWORKITEMFLATID,
		  BRIG_OPCODE_CURRENTWORKITEMFLATID,
		  BRIG_TYPE_U32, "__hsail_currentworkitemflatid",
		  BT_FN_UINT_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKITEMABSID_U64, BRIG_OPCODE_WORKITEMABSID,
		  BRIG_TYPE_U64, "__hsail_workitemabsid_u64",
		  BT_FN_ULONG_UINT_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_PACKETID, BRIG_OPCODE_PACKETID,
		  BRIG_TYPE_U64, "__hsail_packetid", BT_FN_ULONG_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_PACKETCOMPLETIONSIG_SIG64,
		  BRIG_OPCODE_PACKETCOMPLETIONSIG, BRIG_TYPE_SIG64,
		  "__hsail_packetcompletionsig_sig64", BT_FN_ULONG_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_PACKETCOMPLETIONSIG_SIG32,
		  BRIG_OPCODE_PACKETCOMPLETIONSIG, BRIG_TYPE_SIG32,
		  "__hsail_packetcompletionsig_sig32", BT_FN_UINT_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CURRENTWORKGROUPSIZE,
		  BRIG_OPCODE_CURRENTWORKGROUPSIZE, BRIG_TYPE_U32,
		  "__hsail_currentworkgroupsize", BT_FN_UINT_UINT_CONST_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WORKGROUPSIZE, BRIG_OPCODE_WORKGROUPSIZE,
		  BRIG_TYPE_U32, "__hsail_workgroupsize",
		  BT_FN_UINT_UINT_CONST_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_DIM, BRIG_OPCODE_DIM,
		  BRIG_TYPE_U32, "__hsail_dim", BT_FN_UINT_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_GRIDGROUPS, BRIG_OPCODE_GRIDGROUPS,
		  BRIG_TYPE_U32, "__hsail_gridgroups", BT_FN_UINT_UINT_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITEXTRACT_S32, BRIG_OPCODE_BITEXTRACT,
		  BRIG_TYPE_S32, "__hsail_bitextract_s32",
		  BT_FN_INT_INT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITEXTRACT_U32, BRIG_OPCODE_BITEXTRACT,
		  BRIG_TYPE_U32, "__hsail_bitextract_u32",
		  BT_FN_UINT_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITEXTRACT_S64, BRIG_OPCODE_BITEXTRACT,
		  BRIG_TYPE_S64, "__hsail_bitextract_s64",
		  BT_FN_LONG_LONG_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITEXTRACT_U64, BRIG_OPCODE_BITEXTRACT,
		  BRIG_TYPE_U64, "__hsail_bitextract_u64",
		  BT_FN_ULONG_ULONG_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITINSERT_U32, BRIG_OPCODE_BITINSERT,
		  BRIG_TYPE_U32, "__hsail_bitinsert_u32",
		  BT_FN_UINT_UINT_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITINSERT_U64, BRIG_OPCODE_BITINSERT,
		  BRIG_TYPE_U64, "__hsail_bitinsert_u64",
		  BT_FN_ULONG_ULONG_ULONG_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITMASK_B32, BRIG_OPCODE_BITMASK,
		  BRIG_TYPE_B32, "__hsail_bitmask_u32", BT_FN_UINT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITMASK_B64, BRIG_OPCODE_BITMASK,
		  BRIG_TYPE_B64, "__hsail_bitmask_u64", BT_FN_ULONG_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITREV_B32, BRIG_OPCODE_BITREV,
		  BRIG_TYPE_B32, "__hsail_bitrev_u32", BT_FN_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITREV_B64, BRIG_OPCODE_BITREV,
		  BRIG_TYPE_B64, "__hsail_bitrev_u64", BT_FN_ULONG_ULONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITSELECT_B32, BRIG_OPCODE_BITSELECT,
		  BRIG_TYPE_B32, "__hsail_bitselect_u32",
		  BT_FN_UINT_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITSELECT_U64, BRIG_OPCODE_BITSELECT,
		  BRIG_TYPE_B64, "__hsail_bitselect_u64",
		  BT_FN_ULONG_ULONG_ULONG_ULONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FIRSTBIT_U32, BRIG_OPCODE_FIRSTBIT,
		  BRIG_TYPE_U32, "__hsail_firstbit_u32", BT_FN_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FIRSTBIT_S32, BRIG_OPCODE_FIRSTBIT,
		  BRIG_TYPE_S32, "__hsail_firstbit_s32", BT_FN_UINT_INT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FIRSTBIT_U64, BRIG_OPCODE_FIRSTBIT,
		  BRIG_TYPE_U64, "__hsail_firstbit_u64", BT_FN_UINT_ULONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FIRSTBIT_S64, BRIG_OPCODE_FIRSTBIT,
		  BRIG_TYPE_S64, "__hsail_firstbit_s64", BT_FN_UINT_LONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LASTBIT_U32, BRIG_OPCODE_LASTBIT,
		  BRIG_TYPE_U32, "__hsail_lastbit_u32", BT_FN_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LASTBIT_U64, BRIG_OPCODE_LASTBIT,
		  BRIG_TYPE_U64, "__hsail_lastbit_u64", BT_FN_UINT_ULONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BORROW_U32, BRIG_OPCODE_BORROW,
		  BRIG_TYPE_U32, "__hsail_borrow_u32", BT_FN_UINT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BORROW_U64, BRIG_OPCODE_BORROW,
		  BRIG_TYPE_U64, "__hsail_borrow_u64", BT_FN_ULONG_ULONG_ULONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CARRY_U32, BRIG_OPCODE_CARRY,
		  BRIG_TYPE_U32, "__hsail_carry_u32", BT_FN_UINT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CARRY_U64, BRIG_OPCODE_CARRY,
		  BRIG_TYPE_U64, "__hsail_carry_u64", BT_FN_ULONG_ULONG_ULONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_REM_S32, BRIG_OPCODE_REM,
		  BRIG_TYPE_S32, "__hsail_rem_s32", BT_FN_INT_INT_INT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_REM_S64, BRIG_OPCODE_REM,
		  BRIG_TYPE_S64, "__hsail_rem_s64", BT_FN_LONG_LONG_LONG,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_MIN_F32, BRIG_OPCODE_MIN,
		  BRIG_TYPE_F32, "__hsail_min_f32", BT_FN_FLOAT_FLOAT_FLOAT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_MAX_F32, BRIG_OPCODE_MAX,
		  BRIG_TYPE_F32, "__hsail_max_f32", BT_FN_FLOAT_FLOAT_FLOAT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_MIN_F64, BRIG_OPCODE_MIN,
		  BRIG_TYPE_F64, "__hsail_min_f64", BT_FN_DOUBLE_DOUBLE_DOUBLE,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_MAX_F64, BRIG_OPCODE_MAX,
		  BRIG_TYPE_F64, "__hsail_max_f64", BT_FN_DOUBLE_DOUBLE_DOUBLE,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CLASS_F32, BRIG_OPCODE_CLASS,
		  BRIG_TYPE_F32, "__hsail_class_f32", BT_FN_UINT_FLOAT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CLASS_F64, BRIG_OPCODE_CLASS,
		  BRIG_TYPE_F64, "__hsail_class_f64", BT_FN_UINT_DOUBLE_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CLASS_F32_F16, BRIG_OPCODE_CLASS,
		  BRIG_TYPE_F16, "__hsail_class_f32_f16",
		  BT_FN_UINT_FLOAT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FRACT_F32, BRIG_OPCODE_FRACT,
		  BRIG_TYPE_F32, "__hsail_fract_f32", BT_FN_FLOAT_FLOAT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_FRACT_F64, BRIG_OPCODE_FRACT,
		  BRIG_TYPE_F64, "__hsail_fract_f64", BT_FN_DOUBLE_DOUBLE,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BARRIER, BRIG_OPCODE_BARRIER,
		  BRIG_TYPE_NONE, "__hsail_barrier", BT_FN_VOID_PTR,
		  ATTR_RT_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_INITFBAR, BRIG_OPCODE_INITFBAR,
		  BRIG_TYPE_NONE, "__hsail_initfbar", BT_FN_VOID_UINT_PTR,
		  ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_JOINFBAR, BRIG_OPCODE_JOINFBAR,
		  BRIG_TYPE_NONE, "__hsail_joinfbar", BT_FN_VOID_UINT_PTR,
		  ATTR_NOTHROW_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_WAITFBAR, BRIG_OPCODE_WAITFBAR,
		  BRIG_TYPE_NONE, "__hsail_waitfbar", BT_FN_VOID_UINT_PTR,
		  ATTR_RT_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_ARRIVEFBAR, BRIG_OPCODE_ARRIVEFBAR,
		  BRIG_TYPE_NONE, "__hsail_arrivefbar", BT_FN_VOID_UINT_PTR,
		  ATTR_RT_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LEAVEFBAR, BRIG_OPCODE_LEAVEFBAR,
		  BRIG_TYPE_NONE, "__hsail_leavefbar", BT_FN_VOID_UINT_PTR,
		  ATTR_NOTHROW_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_RELEASEFBAR, BRIG_OPCODE_RELEASEFBAR,
		  BRIG_TYPE_NONE, "__hsail_releasefbar", BT_FN_VOID_UINT_PTR,
		  ATTR_NOTHROW_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BITALIGN, BRIG_OPCODE_BITALIGN,
		  BRIG_TYPE_B32, "__hsail_bitalign",
		  BT_FN_UINT_ULONG_ULONG_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_BYTEALIGN, BRIG_OPCODE_BYTEALIGN,
		  BRIG_TYPE_B32, "__hsail_bytealign",
		  BT_FN_UINT_ULONG_ULONG_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LERP, BRIG_OPCODE_LERP,
		  BRIG_TYPE_U8X4, "__hsail_lerp", BT_FN_UINT_UINT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_PACKCVT, BRIG_OPCODE_PACKCVT,
		  BRIG_TYPE_U8X4, "__hsail_packcvt",
		  BT_FN_UINT_FLOAT_FLOAT_FLOAT_FLOAT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_UNPACKCVT, BRIG_OPCODE_UNPACKCVT,
		  BRIG_TYPE_F32, "__hsail_unpackcvt", BT_FN_FLOAT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SAD_U16X2, BRIG_OPCODE_SAD,
		  BRIG_TYPE_U16X2, "__hsail_sad_u16x2",
		  BT_FN_UINT_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SAD_U32, BRIG_OPCODE_SAD,
		  BRIG_TYPE_U32, "__hsail_sad_u32", BT_FN_UINT_UINT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SAD_U8X4, BRIG_OPCODE_SAD,
		  BRIG_TYPE_U8X4, "__hsail_sad_u8x4",
		  BT_FN_UINT_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SADHI_U8X4, BRIG_OPCODE_SADHI,
		  BRIG_TYPE_U16X2, "__hsail_sadhi_u16x2_u8x4",
		  BT_FN_UINT_UINT_UINT_UINT,
		  ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CLOCK, BRIG_OPCODE_CLOCK,
		  BRIG_TYPE_U64, "__hsail_clock", BT_FN_ULONG,
		  ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CUID, BRIG_OPCODE_CUID,
		  BRIG_TYPE_U32, "__hsail_cuid", BT_FN_UINT_PTR,
		  ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_MAXCUID, BRIG_OPCODE_MAXCUID,
		  BRIG_TYPE_U32, "__hsail_maxcuid", BT_FN_UINT_PTR,
		  ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_DEBUGTRAP, BRIG_OPCODE_DEBUGTRAP,
		  BRIG_TYPE_U32, "__hsail_debugtrap", BT_FN_VOID_UINT_PTR,
		  ATTR_NORETURN_NOTHROW_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_GROUPBASEPTR, BRIG_OPCODE_GROUPBASEPTR,
		  BRIG_TYPE_U32, "__hsail_groupbaseptr", BT_FN_UINT_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_KERNARGBASEPTR_U64,
		  BRIG_OPCODE_KERNARGBASEPTR, BRIG_TYPE_U64,
		  "__hsail_kernargbaseptr_u64", BT_FN_ULONG_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_KERNARGBASEPTR_U32,
		  BRIG_OPCODE_KERNARGBASEPTR, BRIG_TYPE_U32,
		  "__hsail_kernargbaseptr_u32", BT_FN_UINT_PTR,
		  ATTR_PURE_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_ALLOCA, BRIG_OPCODE_ALLOCA,
		  BRIG_TYPE_U32, "__hsail_alloca", BT_FN_UINT_UINT_UINT_PTR,
		  ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LDQUEUEWRITEINDEX,
		  BRIG_OPCODE_LDQUEUEWRITEINDEX,
		  BRIG_TYPE_U64, "__hsail_ldqueuewriteindex",
		  BT_FN_ULONG_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_LDQUEUEREADINDEX,
		  BRIG_OPCODE_LDQUEUEREADINDEX,
		  BRIG_TYPE_U64, "__hsail_ldqueuereadindex",
		  BT_FN_ULONG_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_STQUEUEWRITEINDEX,
		  BRIG_OPCODE_STQUEUEWRITEINDEX,
		  BRIG_TYPE_U64, "__hsail_stqueuewriteindex",
		  BT_FN_VOID_UINT64_UINT64, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_STQUEUEREADINDEX,
		  BRIG_OPCODE_STQUEUEREADINDEX,
		  BRIG_TYPE_U64, "__hsail_stqueuereadindex",
		  BT_FN_VOID_UINT64_UINT64, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_ADDQUEUEWRITEINDEX,
		  BRIG_OPCODE_ADDQUEUEWRITEINDEX,
		  BRIG_TYPE_U64, "__hsail_addqueuewriteindex",
		  BT_FN_ULONG_ULONG_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_CASQUEUEWRITEINDEX,
		  BRIG_OPCODE_CASQUEUEWRITEINDEX,
		  BRIG_TYPE_U64, "__hsail_casqueuewriteindex",
		  BT_FN_ULONG_ULONG_ULONG_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SEGMENTP_GLOBAL,
		  BRIG_OPCODE_SEGMENTP,
		  BRIG_TYPE_U32, "__hsail_segmentp_global",
		  BT_FN_UINT32_UINT64_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SEGMENTP_GROUP,
		  BRIG_OPCODE_SEGMENTP,
		  BRIG_TYPE_U32, "__hsail_segmentp_group",
		  BT_FN_UINT32_UINT64_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_BUILTIN (BUILT_IN_HSAIL_SEGMENTP_PRIVATE,
		  BRIG_OPCODE_SEGMENTP,
		  BRIG_TYPE_U32, "__hsail_segmentp_private",
		  BT_FN_UINT32_UINT64_PTR, ATTR_NOTHROW_LEAF_LIST)

#ifndef DEF_HSAIL_ATOMIC_BUILTIN
#define DEF_HSAIL_ATOMIC_BUILTIN(ENUM, ATOMIC_OPCODE, HSAIL_TYPE,	\
				 NAME, TYPE, ATTRS)
#endif

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MIN_S32, BRIG_ATOMIC_MIN,
			 BRIG_TYPE_S32, "__hsail_atomic_min_s32",
			 BT_FN_INT_PTR_INT, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MIN_S64, BRIG_ATOMIC_MIN,
			 BRIG_TYPE_S64, "__hsail_atomic_min_s64",
			 BT_FN_LONG_PTR_LONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MIN_U32, BRIG_ATOMIC_MIN,
			 BRIG_TYPE_U32, "__hsail_atomic_min_u32",
			 BT_FN_UINT_PTR_UINT, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MIN_U64, BRIG_ATOMIC_MIN,
			 BRIG_TYPE_U64, "__hsail_atomic_min_u64",
			 BT_FN_ULONG_PTR_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MAX_S32, BRIG_ATOMIC_MAX,
			 BRIG_TYPE_S32, "__hsail_atomic_max_s32",
			 BT_FN_INT_PTR_INT, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MAX_S64, BRIG_ATOMIC_MAX,
			 BRIG_TYPE_S64, "__hsail_atomic_max_s64",
			 BT_FN_LONG_PTR_LONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MAX_U32, BRIG_ATOMIC_MAX,
			 BRIG_TYPE_U32, "__hsail_atomic_max_u32",
			 BT_FN_UINT_PTR_UINT, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_MAX_U64, BRIG_ATOMIC_MAX,
			 BRIG_TYPE_U64, "__hsail_atomic_max_u64",
			 BT_FN_ULONG_PTR_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_WRAPDEC_U32,
			 BRIG_ATOMIC_WRAPDEC, BRIG_TYPE_U32,
			 "__hsail_atomic_wrapdec_u32",
			 BT_FN_UINT_PTR_UINT, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_WRAPDEC_U64,
			 BRIG_ATOMIC_WRAPDEC, BRIG_TYPE_U64,
			 "__hsail_atomic_wrapdec_u64",
			 BT_FN_ULONG_PTR_ULONG, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_WRAPINC_U32,
			 BRIG_ATOMIC_WRAPINC, BRIG_TYPE_U32,
			 "__hsail_atomic_wrapinc_u32",
			 BT_FN_UINT_PTR_UINT, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_ATOMIC_BUILTIN (BUILT_IN_HSAIL_ATOMIC_WRAPINC_U64,
			 BRIG_ATOMIC_WRAPINC, BRIG_TYPE_U64,
			 "__hsail_atomic_wrapinc_u64",
			 BT_FN_ULONG_PTR_ULONG, ATTR_NOTHROW_LEAF_LIST)

#ifndef DEF_HSAIL_SAT_BUILTIN
#define DEF_HSAIL_SAT_BUILTIN(ENUM, HSAIL_OPCODE, HSAIL_TYPE,	\
			      NAME, TYPE, ATTRS)
#endif

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_U64, BRIG_OPCODE_ADD,
		      BRIG_TYPE_U64, "__hsail_sat_add_u64",
		      BT_FN_ULONG_ULONG_ULONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_S64, BRIG_OPCODE_ADD,
		      BRIG_TYPE_S64, "__hsail_sat_add_s64",
		      BT_FN_LONG_LONG_LONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_U32, BRIG_OPCODE_ADD,
		      BRIG_TYPE_U32, "__hsail_sat_add_u32",
		      BT_FN_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_S32, BRIG_OPCODE_ADD,
		      BRIG_TYPE_S32, "__hsail_sat_add_s32",
		      BT_FN_INT_INT_INT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_U16, BRIG_OPCODE_ADD,
		      BRIG_TYPE_U16, "__hsail_sat_add_u16",
		      BT_FN_UINT16_UINT16_UINT16, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_S16, BRIG_OPCODE_ADD,
		      BRIG_TYPE_S16, "__hsail_sat_add_s16",
		      BT_FN_INT16_INT16_INT16, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_U8, BRIG_OPCODE_ADD,
		      BRIG_TYPE_U8, "__hsail_sat_add_u8",
		      BT_FN_UINT8_UINT8_UINT8, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_ADD_S8, BRIG_OPCODE_ADD,
		      BRIG_TYPE_S8, "__hsail_sat_add_s8",
		      BT_FN_INT8_INT8_INT8, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_U64, BRIG_OPCODE_SUB,
		      BRIG_TYPE_U64, "__hsail_sat_sub_u64",
		      BT_FN_ULONG_ULONG_ULONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_S64, BRIG_OPCODE_SUB,
		      BRIG_TYPE_S64, "__hsail_sat_sub_s64",
		      BT_FN_LONG_LONG_LONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_U32, BRIG_OPCODE_SUB,
		      BRIG_TYPE_U32, "__hsail_sat_sub_u32",
		      BT_FN_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_S32, BRIG_OPCODE_SUB,
		      BRIG_TYPE_S32, "__hsail_sat_sub_s32",
		      BT_FN_INT_INT_INT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_U16, BRIG_OPCODE_SUB,
		      BRIG_TYPE_U16, "__hsail_sat_sub_u16",
		      BT_FN_UINT16_UINT16_UINT16, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_S16, BRIG_OPCODE_SUB,
		      BRIG_TYPE_S16, "__hsail_sat_sub_s16",
		      BT_FN_INT16_INT16_INT16, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_U8, BRIG_OPCODE_SUB,
		      BRIG_TYPE_U8, "__hsail_sat_sub_u8",
		      BT_FN_UINT8_UINT8_UINT8, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_SUB_S8, BRIG_OPCODE_SUB,
		      BRIG_TYPE_S8, "__hsail_sat_sub_s8",
		      BT_FN_INT8_INT8_INT8, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_U64, BRIG_OPCODE_MUL,
		      BRIG_TYPE_U64, "__hsail_sat_mul_u64",
		      BT_FN_ULONG_ULONG_ULONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_S64, BRIG_OPCODE_MUL,
		      BRIG_TYPE_S64, "__hsail_sat_mul_s64",
		      BT_FN_LONG_LONG_LONG, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_U32, BRIG_OPCODE_MUL,
		      BRIG_TYPE_U32, "__hsail_sat_mul_u32",
		      BT_FN_UINT_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_S32, BRIG_OPCODE_MUL,
		      BRIG_TYPE_S32, "__hsail_sat_mul_s32",
		      BT_FN_INT_INT_INT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_U16, BRIG_OPCODE_MUL,
		      BRIG_TYPE_U16, "__hsail_sat_mul_u16",
		      BT_FN_UINT16_UINT16_UINT16, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_S16, BRIG_OPCODE_MUL,
		      BRIG_TYPE_S16, "__hsail_sat_mul_s16",
		      BT_FN_INT16_INT16_INT16, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_U8, BRIG_OPCODE_MUL,
		      BRIG_TYPE_U8, "__hsail_sat_mul_u8",
		      BT_FN_UINT8_UINT8_UINT8, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_SAT_BUILTIN (BUILT_IN_HSAIL_SAT_MUL_S8, BRIG_OPCODE_MUL,
		      BRIG_TYPE_S8, "__hsail_sat_mul_s8",
		      BT_FN_INT8_INT8_INT8, ATTR_CONST_NOTHROW_LEAF_LIST)

#ifndef DEF_HSAIL_INTR_BUILTIN
#define DEF_HSAIL_INTR_BUILTIN(ENUM, NAME, TYPE, ATTRS)
#endif

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_FTZ_F32_F16, "__hsail_ftz_f32_f16",
		       BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_FTZ_F32, "__hsail_ftz_f32",
		       BT_FN_FLOAT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_FTZ_F64, "__hsail_ftz_f64",
		       BT_FN_DOUBLE_DOUBLE, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_PUSH_FRAME, "__hsail_alloca_push_frame",
		       BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_POP_FRAME, "__hsail_alloca_pop_frame",
		       BT_FN_VOID_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_SETWORKITEMID, "__hsail_setworkitemid",
		       BT_FN_VOID_UINT32_UINT32_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_LAUNCH_WG_FUNC,
		       "__hsail_launch_wg_function",
		       BT_FN_VOID_PTR_PTR_UINT32, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_LAUNCH_KERNEL,
		       "__hsail_launch_kernel",
		       BT_FN_VOID_PTR_PTR_PTR, ATTR_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_F32_TO_F16, "__hsail_f32_to_f16",
		       BT_FN_UINT16_UINT32, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_INTR_BUILTIN (BUILT_IN_HSAIL_F16_TO_F32, "__hsail_f16_to_f32",
		       BT_FN_UINT32_UINT16, ATTR_CONST_NOTHROW_LEAF_LIST)

#ifndef DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN
#define DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN(ENUM, HSAIL_DEST_TYPE, HSAIL_SRC_TYPE, \
	NAME, TYPE, ATTRS)
#endif

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U8_F32,
				BRIG_TYPE_U8, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_u8_f32",
				BT_FN_UINT8_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S8_F32,
				BRIG_TYPE_S8, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_s8_f32",
				BT_FN_INT8_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U16_F32,
				BRIG_TYPE_U16, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_u16_f32",
				BT_FN_UINT16_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S16_F32,
				BRIG_TYPE_S16, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_s16_f32",
				BT_FN_INT16_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U32_F32,
				BRIG_TYPE_U32, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_u32_f32",
				BT_FN_UINT32_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S32_F32,
				BRIG_TYPE_S32, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_s32_f32",
				BT_FN_INT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U64_F32,
				BRIG_TYPE_U64, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_u64_f32",
				BT_FN_UINT64_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S64_F32,
				BRIG_TYPE_S64, BRIG_TYPE_F32,
		       		"__hsail_cvt_zeroi_sat_s64_f32",
				BT_FN_LONG_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U8_F64,
				BRIG_TYPE_U8, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_u8_f64",
				BT_FN_UINT8_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S8_F64,
				BRIG_TYPE_S8, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_s8_f64",
				BT_FN_INT8_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U16_F64,
				BRIG_TYPE_U16, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_u16_f64",
				BT_FN_UINT16_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S16_F64,
				BRIG_TYPE_S16, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_s16_f64",
				BT_FN_INT16_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U32_F64,
				BRIG_TYPE_U32, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_u32_f64",
				BT_FN_UINT32_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S32_F64,
				BRIG_TYPE_S32, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_s32_f64",
				BT_FN_INT_FLOAT, ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_U64_F64,
				BRIG_TYPE_U64, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_u64_f64",
				BT_FN_UINT64_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)

DEF_HSAIL_CVT_ZEROI_SAT_BUILTIN (BUILT_IN_HSAIL_CVT_ZEROI_SAT_S64_F64,
				BRIG_TYPE_S64, BRIG_TYPE_F64,
		       		"__hsail_cvt_zeroi_sat_s64_f64",
				BT_FN_LONG_FLOAT,
				ATTR_CONST_NOTHROW_LEAF_LIST)
