Home | History | Annotate | Download | only in radeon
      1 //===- AMDILIntrinsics.td - Defines AMDIL Intrinscs -*- tablegen -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //==-----------------------------------------------------------------------===//
      9 //
     10 // This file defines all of the amdil-specific intrinsics
     11 //
     12 //===---------------------------------------------------------------===//
     13 //===--------------------------------------------------------------------===//
     14 // Intrinsic classes
     15 // Generic versions of the above classes but for Target specific intrinsics
     16 // instead of SDNode patterns.
     17 //===--------------------------------------------------------------------===//
     18 let TargetPrefix = "AMDIL", isTarget = 1 in {
     19      class VoidIntLong :
     20           Intrinsic<[llvm_i64_ty], [], []>;
     21      class VoidIntInt :
     22           Intrinsic<[llvm_i32_ty], [], []>;
     23      class VoidIntBool :
     24           Intrinsic<[llvm_i32_ty], [], []>;
     25      class UnaryIntInt :
     26           Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], [IntrNoMem]>;
     27      class UnaryIntFloat :
     28           Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
     29      class ConvertIntFTOI :
     30           Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty], [IntrNoMem]>;
     31      class ConvertIntITOF :
     32           Intrinsic<[llvm_anyfloat_ty], [llvm_anyint_ty], [IntrNoMem]>;
     33      class UnaryIntNoRetInt :
     34           Intrinsic<[], [llvm_anyint_ty], []>;
     35      class UnaryIntNoRetFloat :
     36           Intrinsic<[], [llvm_anyfloat_ty], []>;
     37      class BinaryIntInt :
     38           Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     39      class BinaryIntFloat :
     40           Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     41      class BinaryIntNoRetInt :
     42           Intrinsic<[], [llvm_anyint_ty, LLVMMatchType<0>], []>;
     43      class BinaryIntNoRetFloat :
     44           Intrinsic<[], [llvm_anyfloat_ty, LLVMMatchType<0>], []>;
     45      class TernaryIntInt :
     46           Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>,
     47           LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     48      class TernaryIntFloat :
     49           Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>,
     50           LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     51      class QuaternaryIntInt :
     52           Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>,
     53           LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     54      class UnaryAtomicInt :
     55           Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     56      class BinaryAtomicInt :
     57           Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     58      class TernaryAtomicInt :
     59           Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
     60      class UnaryAtomicIntNoRet :
     61           Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     62      class BinaryAtomicIntNoRet :
     63           Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     64      class TernaryAtomicIntNoRet :
     65           Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     66 }
     67 
     68 let TargetPrefix = "AMDIL", isTarget = 1 in {
     69   def int_AMDIL_fabs : GCCBuiltin<"__amdil_fabs">, UnaryIntFloat;
     70   def int_AMDIL_abs : GCCBuiltin<"__amdil_abs">, UnaryIntInt;
     71 
     72   def int_AMDIL_bit_extract_i32 : GCCBuiltin<"__amdil_ibit_extract">,
     73           TernaryIntInt;
     74   def int_AMDIL_bit_extract_u32 : GCCBuiltin<"__amdil_ubit_extract">,
     75           TernaryIntInt;
     76   def int_AMDIL_bit_reverse_u32 : GCCBuiltin<"__amdil_ubit_reverse">,
     77           UnaryIntInt;
     78   def int_AMDIL_bit_count_i32 : GCCBuiltin<"__amdil_count_bits">,
     79           UnaryIntInt;
     80   def int_AMDIL_bit_find_first_lo : GCCBuiltin<"__amdil_ffb_lo">,
     81           UnaryIntInt;
     82   def int_AMDIL_bit_find_first_hi : GCCBuiltin<"__amdil_ffb_hi">,
     83           UnaryIntInt;
     84   def int_AMDIL_bit_find_first_sgn : GCCBuiltin<"__amdil_ffb_signed">,
     85           UnaryIntInt;
     86   def int_AMDIL_media_bitalign : GCCBuiltin<"__amdil_bitalign">,
     87                     TernaryIntInt;
     88   def int_AMDIL_media_bytealign : GCCBuiltin<"__amdil_bytealign">,
     89                     TernaryIntInt;
     90   def int_AMDIL_bit_insert_u32 : GCCBuiltin<"__amdil_ubit_insert">,
     91                     QuaternaryIntInt;
     92   def int_AMDIL_bfi : GCCBuiltin<"__amdil_bfi">,
     93       TernaryIntInt;
     94   def int_AMDIL_bfm : GCCBuiltin<"__amdil_bfm">,
     95       BinaryIntInt;
     96   def int_AMDIL_mad_i32 : GCCBuiltin<"__amdil_imad">,
     97           TernaryIntInt;
     98   def int_AMDIL_mad_u32 : GCCBuiltin<"__amdil_umad">,
     99           TernaryIntInt;
    100   def int_AMDIL_mad     : GCCBuiltin<"__amdil_mad">,
    101           TernaryIntFloat;
    102   def int_AMDIL_mulhi_i32 : GCCBuiltin<"__amdil_imul_high">,
    103           BinaryIntInt;
    104   def int_AMDIL_mulhi_u32 : GCCBuiltin<"__amdil_umul_high">,
    105           BinaryIntInt;
    106   def int_AMDIL_mul24_i32 : GCCBuiltin<"__amdil_imul24">,
    107           BinaryIntInt;
    108   def int_AMDIL_mul24_u32 : GCCBuiltin<"__amdil_umul24">,
    109           BinaryIntInt;
    110   def int_AMDIL_mulhi24_i32 : GCCBuiltin<"__amdil_imul24_high">,
    111           BinaryIntInt;
    112   def int_AMDIL_mulhi24_u32 : GCCBuiltin<"__amdil_umul24_high">,
    113           BinaryIntInt;
    114   def int_AMDIL_mad24_i32 : GCCBuiltin<"__amdil_imad24">,
    115           TernaryIntInt;
    116   def int_AMDIL_mad24_u32 : GCCBuiltin<"__amdil_umad24">,
    117           TernaryIntInt;
    118   def int_AMDIL_carry_i32 : GCCBuiltin<"__amdil_carry">,
    119           BinaryIntInt;
    120   def int_AMDIL_borrow_i32 : GCCBuiltin<"__amdil_borrow">,
    121           BinaryIntInt;
    122   def int_AMDIL_min_i32 : GCCBuiltin<"__amdil_imin">,
    123           BinaryIntInt;
    124   def int_AMDIL_min_u32 : GCCBuiltin<"__amdil_umin">,
    125           BinaryIntInt;
    126   def int_AMDIL_min     : GCCBuiltin<"__amdil_min">,
    127           BinaryIntFloat;
    128   def int_AMDIL_max_i32 : GCCBuiltin<"__amdil_imax">,
    129           BinaryIntInt;
    130   def int_AMDIL_max_u32 : GCCBuiltin<"__amdil_umax">,
    131           BinaryIntInt;
    132   def int_AMDIL_max     : GCCBuiltin<"__amdil_max">,
    133           BinaryIntFloat;
    134   def int_AMDIL_media_lerp_u4 : GCCBuiltin<"__amdil_u4lerp">,
    135           TernaryIntInt;
    136   def int_AMDIL_media_sad : GCCBuiltin<"__amdil_sad">,
    137           TernaryIntInt;
    138   def int_AMDIL_media_sad_hi : GCCBuiltin<"__amdil_sadhi">,
    139           TernaryIntInt;
    140   def int_AMDIL_fraction : GCCBuiltin<"__amdil_fraction">,
    141           UnaryIntFloat;
    142   def int_AMDIL_clamp : GCCBuiltin<"__amdil_clamp">,
    143           TernaryIntFloat;
    144   def int_AMDIL_pireduce : GCCBuiltin<"__amdil_pireduce">,
    145           UnaryIntFloat;
    146   def int_AMDIL_round_nearest : GCCBuiltin<"__amdil_round_nearest">,
    147           UnaryIntFloat;
    148   def int_AMDIL_round_neginf : GCCBuiltin<"__amdil_round_neginf">,
    149           UnaryIntFloat;
    150   def int_AMDIL_round_posinf : GCCBuiltin<"__amdil_round_posinf">,
    151           UnaryIntFloat;
    152   def int_AMDIL_round_zero : GCCBuiltin<"__amdil_round_zero">,
    153           UnaryIntFloat;
    154   def int_AMDIL_acos : GCCBuiltin<"__amdil_acos">,
    155           UnaryIntFloat;
    156   def int_AMDIL_atan : GCCBuiltin<"__amdil_atan">,
    157           UnaryIntFloat;
    158   def int_AMDIL_asin : GCCBuiltin<"__amdil_asin">,
    159           UnaryIntFloat;
    160   def int_AMDIL_cos : GCCBuiltin<"__amdil_cos">,
    161           UnaryIntFloat;
    162   def int_AMDIL_cos_vec : GCCBuiltin<"__amdil_cos_vec">,
    163           UnaryIntFloat;
    164   def int_AMDIL_tan : GCCBuiltin<"__amdil_tan">,
    165           UnaryIntFloat;
    166   def int_AMDIL_sin : GCCBuiltin<"__amdil_sin">,
    167           UnaryIntFloat;
    168   def int_AMDIL_sin_vec : GCCBuiltin<"__amdil_sin_vec">,
    169           UnaryIntFloat;
    170   def int_AMDIL_pow : GCCBuiltin<"__amdil_pow">, BinaryIntFloat;
    171   def int_AMDIL_div : GCCBuiltin<"__amdil_div">, BinaryIntFloat;
    172   def int_AMDIL_udiv : GCCBuiltin<"__amdil_udiv">, BinaryIntInt;
    173   def int_AMDIL_sqrt: GCCBuiltin<"__amdil_sqrt">,
    174           UnaryIntFloat;
    175   def int_AMDIL_sqrt_vec: GCCBuiltin<"__amdil_sqrt_vec">,
    176           UnaryIntFloat;
    177   def int_AMDIL_exp : GCCBuiltin<"__amdil_exp">,
    178           UnaryIntFloat;
    179   def int_AMDIL_exp_vec : GCCBuiltin<"__amdil_exp_vec">,
    180           UnaryIntFloat;
    181   def int_AMDIL_exn : GCCBuiltin<"__amdil_exn">,
    182           UnaryIntFloat;
    183   def int_AMDIL_log : GCCBuiltin<"__amdil_log">,
    184           UnaryIntFloat;
    185   def int_AMDIL_log_vec : GCCBuiltin<"__amdil_log_vec">,
    186           UnaryIntFloat;
    187   def int_AMDIL_ln : GCCBuiltin<"__amdil_ln">,
    188           UnaryIntFloat;
    189   def int_AMDIL_sign: GCCBuiltin<"__amdil_sign">,
    190           UnaryIntFloat;
    191   def int_AMDIL_fma: GCCBuiltin<"__amdil_fma">,
    192           TernaryIntFloat;
    193   def int_AMDIL_rsq : GCCBuiltin<"__amdil_rsq">,
    194           UnaryIntFloat;
    195   def int_AMDIL_rsq_vec : GCCBuiltin<"__amdil_rsq_vec">,
    196           UnaryIntFloat;
    197   def int_AMDIL_length : GCCBuiltin<"__amdil_length">,
    198           UnaryIntFloat;
    199   def int_AMDIL_lerp : GCCBuiltin<"__amdil_lerp">,
    200           TernaryIntFloat;
    201   def int_AMDIL_media_sad4 : GCCBuiltin<"__amdil_sad4">,
    202       Intrinsic<[llvm_i32_ty], [llvm_v4i32_ty,
    203            llvm_v4i32_ty, llvm_i32_ty], []>;
    204 
    205   def int_AMDIL_frexp_f64 : GCCBuiltin<"__amdil_frexp">,
    206         Intrinsic<[llvm_v2i64_ty], [llvm_double_ty], []>;
    207  def int_AMDIL_ldexp : GCCBuiltin<"__amdil_ldexp">,
    208     Intrinsic<[llvm_anyfloat_ty], [llvm_anyfloat_ty, llvm_anyint_ty], []>;
    209   def int_AMDIL_drcp : GCCBuiltin<"__amdil_rcp">,
    210       Intrinsic<[llvm_double_ty], [llvm_double_ty], []>;
    211   def int_AMDIL_convert_f16_f32 : GCCBuiltin<"__amdil_half_to_float">,
    212       ConvertIntITOF;
    213   def int_AMDIL_convert_f32_f16 : GCCBuiltin<"__amdil_float_to_half">,
    214       ConvertIntFTOI;
    215   def int_AMDIL_convert_f32_i32_rpi : GCCBuiltin<"__amdil_float_to_int_rpi">,
    216       ConvertIntFTOI;
    217   def int_AMDIL_convert_f32_i32_flr : GCCBuiltin<"__amdil_float_to_int_flr">,
    218       ConvertIntFTOI;
    219   def int_AMDIL_convert_f32_f16_near : GCCBuiltin<"__amdil_float_to_half_near">,
    220       ConvertIntFTOI;
    221   def int_AMDIL_convert_f32_f16_neg_inf : GCCBuiltin<"__amdil_float_to_half_neg_inf">,
    222       ConvertIntFTOI;
    223   def int_AMDIL_convert_f32_f16_plus_inf : GCCBuiltin<"__amdil_float_to_half_plus_inf">,
    224       ConvertIntFTOI;
    225  def int_AMDIL_media_convert_f2v4u8 : GCCBuiltin<"__amdil_f_2_u4">,
    226       Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], []>;
    227   def int_AMDIL_media_unpack_byte_0 : GCCBuiltin<"__amdil_unpack_0">,
    228       ConvertIntITOF;
    229   def int_AMDIL_media_unpack_byte_1 : GCCBuiltin<"__amdil_unpack_1">,
    230       ConvertIntITOF;
    231   def int_AMDIL_media_unpack_byte_2 : GCCBuiltin<"__amdil_unpack_2">,
    232       ConvertIntITOF;
    233   def int_AMDIL_media_unpack_byte_3 : GCCBuiltin<"__amdil_unpack_3">,
    234       ConvertIntITOF;
    235   def int_AMDIL_dp2_add : GCCBuiltin<"__amdil_dp2_add">,
    236         Intrinsic<[llvm_float_ty], [llvm_v2f32_ty,
    237           llvm_v2f32_ty, llvm_float_ty], []>;
    238   def int_AMDIL_dp2 : GCCBuiltin<"__amdil_dp2">,
    239         Intrinsic<[llvm_float_ty], [llvm_v2f32_ty,
    240           llvm_v2f32_ty], []>;
    241   def int_AMDIL_dp3 : GCCBuiltin<"__amdil_dp3">,
    242         Intrinsic<[llvm_float_ty], [llvm_v4f32_ty,
    243           llvm_v4f32_ty], []>;
    244   def int_AMDIL_dp4 : GCCBuiltin<"__amdil_dp4">,
    245         Intrinsic<[llvm_float_ty], [llvm_v4f32_ty,
    246           llvm_v4f32_ty], []>;
    247 }
    248