summaryrefslogtreecommitdiff
path: root/lib/Target/AMDGPU/AMDILIntrinsics.td
blob: 213c8bbfbb7f510ccb5fdceb49feb528434548e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
//===- AMDILIntrinsics.td - Defines AMDIL Intrinscs -*- tablegen -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//==-----------------------------------------------------------------------===//
//
// This file defines all of the amdil-specific intrinsics
//
//===---------------------------------------------------------------===//
//===--------------------------------------------------------------------===//
// Intrinsic classes
// Generic versions of the above classes but for Target specific intrinsics
// instead of SDNode patterns.
//===--------------------------------------------------------------------===//
let TargetPrefix = "AMDIL", isTarget = 1 in {
     class VoidIntLong :
          Intrinsic<[llvm_i64_ty], [], []>;
     class VoidIntInt :
          Intrinsic<[llvm_i32_ty], [], []>;
     class VoidIntBool :
          Intrinsic<[llvm_i32_ty], [], []>;
     class UnaryIntInt :
          Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>], [IntrNoMem]>;
     class UnaryIntFloat :
          Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>], [IntrNoMem]>;
     class ConvertIntFTOI :
          Intrinsic<[llvm_anyint_ty], [llvm_anyfloat_ty], [IntrNoMem]>;
     class ConvertIntITOF :
          Intrinsic<[llvm_anyfloat_ty], [llvm_anyint_ty], [IntrNoMem]>;
     class UnaryIntNoRetInt :
          Intrinsic<[], [llvm_anyint_ty], []>;
     class UnaryIntNoRetFloat :
          Intrinsic<[], [llvm_anyfloat_ty], []>;
     class BinaryIntInt :
          Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     class BinaryIntFloat :
          Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     class BinaryIntNoRetInt :
          Intrinsic<[], [llvm_anyint_ty, LLVMMatchType<0>], []>;
     class BinaryIntNoRetFloat :
          Intrinsic<[], [llvm_anyfloat_ty, LLVMMatchType<0>], []>;
     class TernaryIntInt :
          Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>,
          LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     class TernaryIntFloat :
          Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>,
          LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     class QuaternaryIntInt :
          Intrinsic<[llvm_anyint_ty], [LLVMMatchType<0>,
          LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
     class UnaryAtomicInt :
          Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     class BinaryAtomicInt :
          Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     class TernaryAtomicInt :
          Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
     class UnaryAtomicIntNoRet :
          Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     class BinaryAtomicIntNoRet :
          Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
     class TernaryAtomicIntNoRet :
          Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], [IntrReadWriteArgMem]>;
}

let TargetPrefix = "AMDIL", isTarget = 1 in {
  def int_AMDIL_abs : GCCBuiltin<"__amdil_abs">, UnaryIntInt;

  def int_AMDIL_bit_extract_i32 : GCCBuiltin<"__amdil_ibit_extract">,
          TernaryIntInt;
  def int_AMDIL_bit_extract_u32 : GCCBuiltin<"__amdil_ubit_extract">,
          TernaryIntInt;
  def int_AMDIL_bit_reverse_u32 : GCCBuiltin<"__amdil_ubit_reverse">,
          UnaryIntInt;
  def int_AMDIL_bit_count_i32 : GCCBuiltin<"__amdil_count_bits">,
          UnaryIntInt;
  def int_AMDIL_bit_find_first_lo : GCCBuiltin<"__amdil_ffb_lo">,
          UnaryIntInt;
  def int_AMDIL_bit_find_first_hi : GCCBuiltin<"__amdil_ffb_hi">,
          UnaryIntInt;
  def int_AMDIL_bit_find_first_sgn : GCCBuiltin<"__amdil_ffb_signed">,
          UnaryIntInt;
  def int_AMDIL_media_bitalign : GCCBuiltin<"__amdil_bitalign">,
                    TernaryIntInt;
  def int_AMDIL_media_bytealign : GCCBuiltin<"__amdil_bytealign">,
                    TernaryIntInt;
  def int_AMDIL_bit_insert_u32 : GCCBuiltin<"__amdil_ubit_insert">,
                    QuaternaryIntInt;
  def int_AMDIL_bfi : GCCBuiltin<"__amdil_bfi">,
      TernaryIntInt;
  def int_AMDIL_bfm : GCCBuiltin<"__amdil_bfm">,
      BinaryIntInt;
  def int_AMDIL_mad_i32 : GCCBuiltin<"__amdil_imad">,
          TernaryIntInt;
  def int_AMDIL_mad_u32 : GCCBuiltin<"__amdil_umad">,
          TernaryIntInt;
  def int_AMDIL_mad     : GCCBuiltin<"__amdil_mad">,
          TernaryIntFloat;
  def int_AMDIL_mulhi_i32 : GCCBuiltin<"__amdil_imul_high">,
          BinaryIntInt;
  def int_AMDIL_mulhi_u32 : GCCBuiltin<"__amdil_umul_high">,
          BinaryIntInt;
  def int_AMDIL_mul24_i32 : GCCBuiltin<"__amdil_imul24">,
          BinaryIntInt;
  def int_AMDIL_mul24_u32 : GCCBuiltin<"__amdil_umul24">,
          BinaryIntInt;
  def int_AMDIL_mulhi24_i32 : GCCBuiltin<"__amdil_imul24_high">,
          BinaryIntInt;
  def int_AMDIL_mulhi24_u32 : GCCBuiltin<"__amdil_umul24_high">,
          BinaryIntInt;
  def int_AMDIL_mad24_i32 : GCCBuiltin<"__amdil_imad24">,
          TernaryIntInt;
  def int_AMDIL_mad24_u32 : GCCBuiltin<"__amdil_umad24">,
          TernaryIntInt;
  def int_AMDIL_carry_i32 : GCCBuiltin<"__amdil_carry">,
          BinaryIntInt;
  def int_AMDIL_borrow_i32 : GCCBuiltin<"__amdil_borrow">,
          BinaryIntInt;
  def int_AMDIL_min_i32 : GCCBuiltin<"__amdil_imin">,
          BinaryIntInt;
  def int_AMDIL_min_u32 : GCCBuiltin<"__amdil_umin">,
          BinaryIntInt;
  def int_AMDIL_min     : GCCBuiltin<"__amdil_min">,
          BinaryIntFloat;
  def int_AMDIL_max_i32 : GCCBuiltin<"__amdil_imax">,
          BinaryIntInt;
  def int_AMDIL_max_u32 : GCCBuiltin<"__amdil_umax">,
          BinaryIntInt;
  def int_AMDIL_max     : GCCBuiltin<"__amdil_max">,
          BinaryIntFloat;
  def int_AMDIL_media_lerp_u4 : GCCBuiltin<"__amdil_u4lerp">,
          TernaryIntInt;
  def int_AMDIL_media_sad : GCCBuiltin<"__amdil_sad">,
          TernaryIntInt;
  def int_AMDIL_media_sad_hi : GCCBuiltin<"__amdil_sadhi">,
          TernaryIntInt;
  def int_AMDIL_fraction : GCCBuiltin<"__amdil_fraction">,
          UnaryIntFloat;
  def int_AMDIL_clamp : GCCBuiltin<"__amdil_clamp">,
          TernaryIntFloat;
  def int_AMDIL_pireduce : GCCBuiltin<"__amdil_pireduce">,
          UnaryIntFloat;
  def int_AMDIL_round_nearest : GCCBuiltin<"__amdil_round_nearest">,
          UnaryIntFloat;
  def int_AMDIL_round_neginf : GCCBuiltin<"__amdil_round_neginf">,
          UnaryIntFloat;
  def int_AMDIL_round_posinf : GCCBuiltin<"__amdil_round_posinf">,
          UnaryIntFloat;
  def int_AMDIL_round_zero : GCCBuiltin<"__amdil_round_zero">,
          UnaryIntFloat;
  def int_AMDIL_acos : GCCBuiltin<"__amdil_acos">,
          UnaryIntFloat;
  def int_AMDIL_atan : GCCBuiltin<"__amdil_atan">,
          UnaryIntFloat;
  def int_AMDIL_asin : GCCBuiltin<"__amdil_asin">,
          UnaryIntFloat;
  def int_AMDIL_cos : GCCBuiltin<"__amdil_cos">,
          UnaryIntFloat;
  def int_AMDIL_cos_vec : GCCBuiltin<"__amdil_cos_vec">,
          UnaryIntFloat;
  def int_AMDIL_tan : GCCBuiltin<"__amdil_tan">,
          UnaryIntFloat;
  def int_AMDIL_sin : GCCBuiltin<"__amdil_sin">,
          UnaryIntFloat;
  def int_AMDIL_sin_vec : GCCBuiltin<"__amdil_sin_vec">,
          UnaryIntFloat;
  def int_AMDIL_pow : GCCBuiltin<"__amdil_pow">, BinaryIntFloat;
  def int_AMDIL_div : GCCBuiltin<"__amdil_div">, BinaryIntFloat;
  def int_AMDIL_udiv : GCCBuiltin<"__amdil_udiv">, BinaryIntInt;
  def int_AMDIL_sqrt: GCCBuiltin<"__amdil_sqrt">,
          UnaryIntFloat;
  def int_AMDIL_sqrt_vec: GCCBuiltin<"__amdil_sqrt_vec">,
          UnaryIntFloat;
  def int_AMDIL_exp : GCCBuiltin<"__amdil_exp">,
          UnaryIntFloat;
  def int_AMDIL_exp_vec : GCCBuiltin<"__amdil_exp_vec">,
          UnaryIntFloat;
  def int_AMDIL_exn : GCCBuiltin<"__amdil_exn">,
          UnaryIntFloat;
  def int_AMDIL_log_vec : GCCBuiltin<"__amdil_log_vec">,
          UnaryIntFloat;
  def int_AMDIL_ln : GCCBuiltin<"__amdil_ln">,
          UnaryIntFloat;
  def int_AMDIL_sign: GCCBuiltin<"__amdil_sign">,
          UnaryIntFloat;
  def int_AMDIL_fma: GCCBuiltin<"__amdil_fma">,
          TernaryIntFloat;
  def int_AMDIL_rsq : GCCBuiltin<"__amdil_rsq">,
          UnaryIntFloat;
  def int_AMDIL_rsq_vec : GCCBuiltin<"__amdil_rsq_vec">,
          UnaryIntFloat;
  def int_AMDIL_length : GCCBuiltin<"__amdil_length">,
          UnaryIntFloat;
  def int_AMDIL_lerp : GCCBuiltin<"__amdil_lerp">,
          TernaryIntFloat;
  def int_AMDIL_media_sad4 : GCCBuiltin<"__amdil_sad4">,
      Intrinsic<[llvm_i32_ty], [llvm_v4i32_ty,
           llvm_v4i32_ty, llvm_i32_ty], []>;

  def int_AMDIL_frexp_f64 : GCCBuiltin<"__amdil_frexp">,
        Intrinsic<[llvm_v2i64_ty], [llvm_double_ty], []>;
 def int_AMDIL_ldexp : GCCBuiltin<"__amdil_ldexp">,
    Intrinsic<[llvm_anyfloat_ty], [llvm_anyfloat_ty, llvm_anyint_ty], []>;
  def int_AMDIL_drcp : GCCBuiltin<"__amdil_rcp">,
      Intrinsic<[llvm_double_ty], [llvm_double_ty], []>;
  def int_AMDIL_convert_f16_f32 : GCCBuiltin<"__amdil_half_to_float">,
      ConvertIntITOF;
  def int_AMDIL_convert_f32_f16 : GCCBuiltin<"__amdil_float_to_half">,
      ConvertIntFTOI;
  def int_AMDIL_convert_f32_i32_rpi : GCCBuiltin<"__amdil_float_to_int_rpi">,
      ConvertIntFTOI;
  def int_AMDIL_convert_f32_i32_flr : GCCBuiltin<"__amdil_float_to_int_flr">,
      ConvertIntFTOI;
  def int_AMDIL_convert_f32_f16_near : GCCBuiltin<"__amdil_float_to_half_near">,
      ConvertIntFTOI;
  def int_AMDIL_convert_f32_f16_neg_inf : GCCBuiltin<"__amdil_float_to_half_neg_inf">,
      ConvertIntFTOI;
  def int_AMDIL_convert_f32_f16_plus_inf : GCCBuiltin<"__amdil_float_to_half_plus_inf">,
      ConvertIntFTOI;
 def int_AMDIL_media_convert_f2v4u8 : GCCBuiltin<"__amdil_f_2_u4">,
      Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], []>;
  def int_AMDIL_media_unpack_byte_0 : GCCBuiltin<"__amdil_unpack_0">,
      ConvertIntITOF;
  def int_AMDIL_media_unpack_byte_1 : GCCBuiltin<"__amdil_unpack_1">,
      ConvertIntITOF;
  def int_AMDIL_media_unpack_byte_2 : GCCBuiltin<"__amdil_unpack_2">,
      ConvertIntITOF;
  def int_AMDIL_media_unpack_byte_3 : GCCBuiltin<"__amdil_unpack_3">,
      ConvertIntITOF;
  def int_AMDIL_dp2_add : GCCBuiltin<"__amdil_dp2_add">,
        Intrinsic<[llvm_float_ty], [llvm_v2f32_ty,
          llvm_v2f32_ty, llvm_float_ty], []>;
  def int_AMDIL_dp2 : GCCBuiltin<"__amdil_dp2">,
        Intrinsic<[llvm_float_ty], [llvm_v2f32_ty,
          llvm_v2f32_ty], []>;
  def int_AMDIL_dp3 : GCCBuiltin<"__amdil_dp3">,
        Intrinsic<[llvm_float_ty], [llvm_v4f32_ty,
          llvm_v4f32_ty], []>;
  def int_AMDIL_dp4 : GCCBuiltin<"__amdil_dp4">,
        Intrinsic<[llvm_float_ty], [llvm_v4f32_ty,
          llvm_v4f32_ty], []>;
}