Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//===- IntrinsicsPowerPC.td - Defines PowerPC intrinsics ---*- tablegen -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file defines all of the PowerPC-specific intrinsics.
10
//
11
//===----------------------------------------------------------------------===//
12
 
13
//===----------------------------------------------------------------------===//
14
// Definitions for all PowerPC intrinsics.
15
//
16
 
17
// Non-altivec intrinsics.
18
let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
19
  // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions.
20
  def int_ppc_dcba  : Intrinsic<[], [llvm_ptr_ty], []>;
21
  def int_ppc_dcbf : ClangBuiltin<"__builtin_dcbf">,
22
                      Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
23
  def int_ppc_dcbfps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
24
  def int_ppc_dcbstps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
25
  def int_ppc_dcbi  : Intrinsic<[], [llvm_ptr_ty], []>;
26
  def int_ppc_dcbt_with_hint: Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
27
    [IntrArgMemOnly, NoCapture<ArgIndex<0>>, ImmArg<ArgIndex<1>>]>;
28
  def int_ppc_dcbtst_with_hint: Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty],
29
    [IntrArgMemOnly, NoCapture<ArgIndex<0>>, ImmArg<ArgIndex<1>>]>;
30
  def int_ppc_dcbzl : Intrinsic<[], [llvm_ptr_ty], []>;
31
 
32
  // Get content from current FPSCR register
33
  def int_ppc_readflm : ClangBuiltin<"__builtin_readflm">,
34
                        Intrinsic<[llvm_double_ty], [],
35
                                  [IntrNoMerge, IntrHasSideEffects]>;
36
  // Set FPSCR register, and return previous content
37
  def int_ppc_setflm : ClangBuiltin<"__builtin_setflm">,
38
                       Intrinsic<[llvm_double_ty], [llvm_double_ty],
39
                                 [IntrHasSideEffects]>;
40
 
41
  // Intrinsics for [double]word extended forms of divide instructions
42
  def int_ppc_divwe : ClangBuiltin<"__builtin_divwe">,
43
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
44
                            [IntrNoMem]>;
45
  def int_ppc_divweu : ClangBuiltin<"__builtin_divweu">,
46
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
47
                            [IntrNoMem]>;
48
  def int_ppc_divde : ClangBuiltin<"__builtin_divde">,
49
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
50
                            [IntrNoMem]>;
51
  def int_ppc_divdeu : ClangBuiltin<"__builtin_divdeu">,
52
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
53
                            [IntrNoMem]>;
54
 
55
  def int_ppc_unpack_longdouble : ClangBuiltin<"__builtin_unpack_longdouble">,
56
      DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_ppcf128_ty, llvm_i32_ty],
57
                            [IntrNoMem]>;
58
  def int_ppc_pack_longdouble : ClangBuiltin<"__builtin_pack_longdouble">,
59
      DefaultAttrsIntrinsic<[llvm_ppcf128_ty], [llvm_double_ty, llvm_double_ty],
60
                            [IntrNoMem]>;
61
 
62
  // Generate a random number
63
  def int_ppc_darn : ClangBuiltin<"__builtin_darn">,
64
                     Intrinsic<[llvm_i64_ty], [],
65
                               [IntrNoMerge, IntrHasSideEffects]>;
66
  def int_ppc_darnraw : ClangBuiltin<"__builtin_darn_raw">,
67
                     Intrinsic<[llvm_i64_ty], [],
68
                               [IntrNoMerge, IntrHasSideEffects]>;
69
  def int_ppc_darn32 : ClangBuiltin<"__builtin_darn_32">,
70
                     Intrinsic<[llvm_i32_ty], [],
71
                               [IntrNoMerge, IntrHasSideEffects]>;
72
 
73
  // Bit permute doubleword
74
  def int_ppc_bpermd : ClangBuiltin<"__builtin_bpermd">,
75
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
76
                            [IntrNoMem]>;
77
 
78
  // Parallel Bits Deposit/Extract Doubleword Builtins.
79
  def int_ppc_pdepd
80
      : ClangBuiltin<"__builtin_pdepd">,
81
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
82
                              [IntrNoMem]>;
83
  def int_ppc_pextd
84
      : ClangBuiltin<"__builtin_pextd">,
85
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
86
                              [IntrNoMem]>;
87
 
88
  // Centrifuge Doubleword Builtin.
89
  def int_ppc_cfuged
90
      : ClangBuiltin<"__builtin_cfuged">,
91
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
92
                              [IntrNoMem]>;
93
 
94
  // Count Leading / Trailing Zeroes under bit Mask Builtins.
95
  def int_ppc_cntlzdm
96
      : ClangBuiltin<"__builtin_cntlzdm">,
97
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
98
                              [IntrNoMem]>;
99
  def int_ppc_cnttzdm
100
      : ClangBuiltin<"__builtin_cnttzdm">,
101
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
102
                              [IntrNoMem]>;
103
 
104
  def int_ppc_truncf128_round_to_odd
105
      : ClangBuiltin<"__builtin_truncf128_round_to_odd">,
106
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_f128_ty], [IntrNoMem]>;
107
  def int_ppc_sqrtf128_round_to_odd
108
      : ClangBuiltin<"__builtin_sqrtf128_round_to_odd">,
109
        DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty], [IntrNoMem]>;
110
  def int_ppc_addf128_round_to_odd
111
      : ClangBuiltin<"__builtin_addf128_round_to_odd">,
112
        DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
113
                              [IntrNoMem]>;
114
  def int_ppc_subf128_round_to_odd
115
      : ClangBuiltin<"__builtin_subf128_round_to_odd">,
116
        DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
117
                              [IntrNoMem]>;
118
  def int_ppc_mulf128_round_to_odd
119
      : ClangBuiltin<"__builtin_mulf128_round_to_odd">,
120
        DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
121
                              [IntrNoMem]>;
122
  def int_ppc_divf128_round_to_odd
123
      : ClangBuiltin<"__builtin_divf128_round_to_odd">,
124
        DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty],
125
                              [IntrNoMem]>;
126
  def int_ppc_fmaf128_round_to_odd
127
      : ClangBuiltin<"__builtin_fmaf128_round_to_odd">,
128
        DefaultAttrsIntrinsic<[llvm_f128_ty],
129
                              [llvm_f128_ty,llvm_f128_ty,llvm_f128_ty],
130
                              [IntrNoMem]>;
131
  def int_ppc_scalar_extract_expq
132
      : ClangBuiltin<"__builtin_vsx_scalar_extract_expq">,
133
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_f128_ty], [IntrNoMem]>;
134
  def int_ppc_scalar_insert_exp_qp
135
      : ClangBuiltin<"__builtin_vsx_scalar_insert_exp_qp">,
136
        DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_f128_ty, llvm_i64_ty],
137
                              [IntrNoMem]>;
138
 
139
  // Intrinsics defined to maintain XL compatibility
140
  def int_ppc_tdw
141
      : ClangBuiltin<"__builtin_ppc_tdw">,
142
        Intrinsic <[], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty], [ImmArg<ArgIndex<2>>]>;
143
  def int_ppc_tw
144
      : ClangBuiltin<"__builtin_ppc_tw">,
145
        Intrinsic <[], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], [ImmArg<ArgIndex<2>>]>;
146
  def int_ppc_trapd
147
      : ClangBuiltin<"__builtin_ppc_trapd">,
148
        Intrinsic <[], [llvm_i64_ty], []>;
149
  def int_ppc_trap
150
      : ClangBuiltin<"__builtin_ppc_trap">,
151
        Intrinsic <[], [llvm_i32_ty], []>;
152
  def int_ppc_fcfid
153
      : ClangBuiltin<"__builtin_ppc_fcfid">,
154
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
155
  def int_ppc_fcfud
156
      : ClangBuiltin<"__builtin_ppc_fcfud">,
157
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
158
  def int_ppc_fctid
159
      : ClangBuiltin<"__builtin_ppc_fctid">,
160
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
161
  def int_ppc_fctidz
162
      : ClangBuiltin<"__builtin_ppc_fctidz">,
163
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
164
  def int_ppc_fctiw
165
      : ClangBuiltin<"__builtin_ppc_fctiw">,
166
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
167
  def int_ppc_fctiwz
168
      : ClangBuiltin<"__builtin_ppc_fctiwz">,
169
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
170
  def int_ppc_fctudz
171
      : ClangBuiltin<"__builtin_ppc_fctudz">,
172
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
173
  def int_ppc_fctuwz
174
      : ClangBuiltin<"__builtin_ppc_fctuwz">,
175
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
176
 
177
  // XL compatible select functions
178
  // TODO: Add llvm_f128_ty support.
179
  def int_ppc_maxfe
180
      : DefaultAttrsIntrinsic<
181
            [llvm_ppcf128_ty],
182
            [llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_vararg_ty],
183
            [IntrNoMem]>;
184
  def int_ppc_maxfl
185
      : DefaultAttrsIntrinsic<
186
            [llvm_double_ty],
187
            [llvm_double_ty, llvm_double_ty, llvm_double_ty, llvm_vararg_ty],
188
            [IntrNoMem]>;
189
  def int_ppc_maxfs
190
      : DefaultAttrsIntrinsic<
191
            [llvm_float_ty],
192
            [llvm_float_ty, llvm_float_ty, llvm_float_ty, llvm_vararg_ty],
193
            [IntrNoMem]>;
194
  def int_ppc_minfe
195
      : DefaultAttrsIntrinsic<
196
            [llvm_ppcf128_ty],
197
            [llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_ppcf128_ty, llvm_vararg_ty],
198
            [IntrNoMem]>;
199
  def int_ppc_minfl
200
      : DefaultAttrsIntrinsic<
201
            [llvm_double_ty],
202
            [llvm_double_ty, llvm_double_ty, llvm_double_ty, llvm_vararg_ty],
203
            [IntrNoMem]>;
204
  def int_ppc_minfs
205
      : DefaultAttrsIntrinsic<
206
            [llvm_float_ty],
207
            [llvm_float_ty, llvm_float_ty, llvm_float_ty, llvm_vararg_ty],
208
            [IntrNoMem]>;
209
}
210
 
211
let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
212
  /// PowerPC_Vec_Intrinsic - Base class for all altivec intrinsics.
213
  class PowerPC_Vec_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
214
                              list<LLVMType> param_types,
215
                              list<IntrinsicProperty> properties>
216
    : ClangBuiltin<!strconcat("__builtin_altivec_", GCCIntSuffix)>,
217
      DefaultAttrsIntrinsic<ret_types, param_types, properties>;
218
 
219
  /// PowerPC_VSX_Intrinsic - Base class for all VSX intrinsics.
220
  class PowerPC_VSX_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
221
                              list<LLVMType> param_types,
222
                              list<IntrinsicProperty> properties>
223
    : ClangBuiltin<!strconcat("__builtin_vsx_", GCCIntSuffix)>,
224
      DefaultAttrsIntrinsic<ret_types, param_types, properties>;
225
}
226
 
227
//===----------------------------------------------------------------------===//
228
// PowerPC MMA Intrinsic Multi Class Definitions.
229
//
230
 
231
multiclass PowerPC_MMA_ACC_Intrinsic<list<LLVMType> args> {
232
  def NAME: DefaultAttrsIntrinsic<[llvm_v512i1_ty], args, [IntrNoMem]>;
233
  def pp : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
234
                                 !listconcat([llvm_v512i1_ty], args),
235
                                 [IntrNoMem]>;
236
  def pn : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
237
                                 !listconcat([llvm_v512i1_ty], args),
238
                                 [IntrNoMem]>;
239
  def np : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
240
                                 !listconcat([llvm_v512i1_ty], args),
241
                                 [IntrNoMem]>;
242
  def nn : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
243
                                 !listconcat([llvm_v512i1_ty], args),
244
                                 [IntrNoMem]>;
245
}
246
 
247
multiclass PowerPC_MMA_ACC_PP_Intrinsic<list<LLVMType> args> {
248
  def NAME: DefaultAttrsIntrinsic<[llvm_v512i1_ty], args, [IntrNoMem]>;
249
  def pp : DefaultAttrsIntrinsic<[llvm_v512i1_ty],
250
                                 !listconcat([llvm_v512i1_ty], args),
251
                                 [IntrNoMem]>;
252
}
253
 
254
//===----------------------------------------------------------------------===//
255
// PowerPC Altivec Intrinsic Class Definitions.
256
//
257
 
258
/// PowerPC_Vec_FF_Intrinsic - A PowerPC intrinsic that takes one v4f32
259
/// vector and returns one.  These intrinsics have no side effects.
260
class PowerPC_Vec_FF_Intrinsic<string GCCIntSuffix>
261
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
262
                          [llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
263
 
264
/// PowerPC_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
265
/// vectors and returns one.  These intrinsics have no side effects.
266
class PowerPC_Vec_FFF_Intrinsic<string GCCIntSuffix>
267
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
268
                          [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
269
                          [IntrNoMem]>;
270
 
271
/// PowerPC_Vec_BBB_Intrinsic - A PowerPC intrinsic that takes two v16i8
272
/// vectors and returns one.  These intrinsics have no side effects.
273
class PowerPC_Vec_BBB_Intrinsic<string GCCIntSuffix>
274
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
275
                          [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
276
                          [IntrNoMem]>;
277
 
278
/// PowerPC_Vec_HHH_Intrinsic - A PowerPC intrinsic that takes two v8i16
279
/// vectors and returns one.  These intrinsics have no side effects.
280
class PowerPC_Vec_HHH_Intrinsic<string GCCIntSuffix>
281
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
282
                          [llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
283
                          [IntrNoMem]>;
284
 
285
/// PowerPC_Vec_WWW_Intrinsic - A PowerPC intrinsic that takes two v4i32
286
/// vectors and returns one.  These intrinsics have no side effects.
287
class PowerPC_Vec_WWW_Intrinsic<string GCCIntSuffix>
288
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
289
                          [llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
290
                          [IntrNoMem]>;
291
 
292
/// PowerPC_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2i64
293
/// vectors and returns one.  These intrinsics have no side effects.
294
class PowerPC_Vec_DDD_Intrinsic<string GCCIntSuffix>
295
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
296
                          [llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
297
                          [IntrNoMem]>;
298
 
299
/// PowerPC_Vec_QQQ_Intrinsic - A PowerPC intrinsic that takes two v1i128
300
/// vectors and returns one. These intrinsics have no side effects.
301
class PowerPC_Vec_QQQ_Intrinsic<string GCCIntSuffix>
302
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
303
                         [llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
304
                         [IntrNoMem]>;
305
 
306
/// PowerPC_Vec_QDD_Intrinsic - A PowerPC intrinsic that takes two v2i64
307
/// vectors and returns one v1i128. These intrinsics have no side effects.
308
class PowerPC_Vec_QDD_Intrinsic<string GCCIntSuffix>
309
  : PowerPC_Vec_Intrinsic<GCCIntSuffix,
310
                          [llvm_v1i128_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
311
                          [IntrNoMem]>;
312
 
313
//===----------------------------------------------------------------------===//
314
// PowerPC VSX Intrinsic Class Definitions.
315
//
316
 
317
/// PowerPC_VSX_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2f64
318
/// vectors and returns one.  These intrinsics have no side effects.
319
class PowerPC_VSX_Vec_DDD_Intrinsic<string GCCIntSuffix>
320
  : PowerPC_VSX_Intrinsic<GCCIntSuffix,
321
                          [llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty],
322
                          [IntrNoMem]>;
323
 
324
/// PowerPC_VSX_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
325
/// vectors and returns one.  These intrinsics have no side effects.
326
class PowerPC_VSX_Vec_FFF_Intrinsic<string GCCIntSuffix>
327
  : PowerPC_VSX_Intrinsic<GCCIntSuffix,
328
                          [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
329
                          [IntrNoMem]>;
330
 
331
/// PowerPC_VSX_Sca_DDD_Intrinsic - A PowerPC intrinsic that takes two f64
332
/// scalars and returns one.  These intrinsics have no side effects.
333
class PowerPC_VSX_Sca_DDD_Intrinsic<string GCCIntSuffix>
334
  : PowerPC_VSX_Intrinsic<GCCIntSuffix,
335
                          [llvm_double_ty], [llvm_double_ty, llvm_double_ty],
336
                          [IntrNoMem]>;
337
 
338
//===----------------------------------------------------------------------===//
339
// PowerPC Altivec Intrinsic Definitions.
340
 
341
let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
342
  // Data Stream Control.
343
  def int_ppc_altivec_dss : ClangBuiltin<"__builtin_altivec_dss">,
344
              Intrinsic<[], [llvm_i32_ty], []>;
345
  def int_ppc_altivec_dssall : ClangBuiltin<"__builtin_altivec_dssall">,
346
              Intrinsic<[], [], []>;
347
  def int_ppc_altivec_dst : ClangBuiltin<"__builtin_altivec_dst">,
348
              Intrinsic<[],
349
                        [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
350
                        []>;
351
  def int_ppc_altivec_dstt : ClangBuiltin<"__builtin_altivec_dstt">,
352
              Intrinsic<[],
353
                        [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
354
                        []>;
355
  def int_ppc_altivec_dstst : ClangBuiltin<"__builtin_altivec_dstst">,
356
              Intrinsic<[],
357
                        [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
358
                        []>;
359
  def int_ppc_altivec_dststt : ClangBuiltin<"__builtin_altivec_dststt">,
360
              Intrinsic<[],
361
                        [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
362
                        []>;
363
 
364
  // VSCR access.
365
  def int_ppc_altivec_mfvscr : ClangBuiltin<"__builtin_altivec_mfvscr">,
366
              Intrinsic<[llvm_v8i16_ty], [], [IntrNoMem, IntrHasSideEffects]>;
367
  def int_ppc_altivec_mtvscr : ClangBuiltin<"__builtin_altivec_mtvscr">,
368
              Intrinsic<[], [llvm_v4i32_ty], [IntrNoMem, IntrHasSideEffects]>;
369
 
370
 
371
  // Loads.  These don't map directly to GCC builtins because they represent the
372
  // source address with a single pointer.
373
  def int_ppc_altivec_lvx :
374
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
375
                            [IntrReadMem, IntrArgMemOnly]>;
376
  def int_ppc_altivec_lvxl :
377
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
378
                            [IntrReadMem, IntrArgMemOnly]>;
379
  def int_ppc_altivec_lvebx :
380
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_ptr_ty],
381
                            [IntrReadMem, IntrArgMemOnly]>;
382
  def int_ppc_altivec_lvehx :
383
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_ptr_ty],
384
                            [IntrReadMem, IntrArgMemOnly]>;
385
  def int_ppc_altivec_lvewx :
386
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
387
                            [IntrReadMem, IntrArgMemOnly]>;
388
 
389
  // Stores.  These don't map directly to GCC builtins because they represent the
390
  // source address with a single pointer.
391
  def int_ppc_altivec_stvx :
392
              Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
393
                        [IntrWriteMem, IntrArgMemOnly]>;
394
  def int_ppc_altivec_stvxl :
395
              Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
396
                        [IntrWriteMem, IntrArgMemOnly]>;
397
  def int_ppc_altivec_stvebx :
398
              Intrinsic<[], [llvm_v16i8_ty, llvm_ptr_ty],
399
                        [IntrWriteMem, IntrArgMemOnly]>;
400
  def int_ppc_altivec_stvehx :
401
              Intrinsic<[], [llvm_v8i16_ty, llvm_ptr_ty],
402
                        [IntrWriteMem, IntrArgMemOnly]>;
403
  def int_ppc_altivec_stvewx :
404
              Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
405
                        [IntrWriteMem, IntrArgMemOnly]>;
406
 
407
  // Comparisons setting a vector.
408
  def int_ppc_altivec_vcmpbfp : ClangBuiltin<"__builtin_altivec_vcmpbfp">,
409
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
410
                            [IntrNoMem]>;
411
  def int_ppc_altivec_vcmpeqfp : ClangBuiltin<"__builtin_altivec_vcmpeqfp">,
412
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
413
                            [IntrNoMem]>;
414
  def int_ppc_altivec_vcmpgefp : ClangBuiltin<"__builtin_altivec_vcmpgefp">,
415
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
416
                            [IntrNoMem]>;
417
  def int_ppc_altivec_vcmpgtfp : ClangBuiltin<"__builtin_altivec_vcmpgtfp">,
418
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
419
                            [IntrNoMem]>;
420
 
421
  def int_ppc_altivec_vcmpequd : ClangBuiltin<"__builtin_altivec_vcmpequd">,
422
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
423
                            [IntrNoMem]>;
424
  def int_ppc_altivec_vcmpgtsd : ClangBuiltin<"__builtin_altivec_vcmpgtsd">,
425
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
426
                            [IntrNoMem]>;
427
  def int_ppc_altivec_vcmpgtud : ClangBuiltin<"__builtin_altivec_vcmpgtud">,
428
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
429
                            [IntrNoMem]>;
430
 
431
  def int_ppc_altivec_vcmpequw : ClangBuiltin<"__builtin_altivec_vcmpequw">,
432
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
433
                            [IntrNoMem]>;
434
  def int_ppc_altivec_vcmpgtsw : ClangBuiltin<"__builtin_altivec_vcmpgtsw">,
435
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
436
                            [IntrNoMem]>;
437
  def int_ppc_altivec_vcmpgtuw : ClangBuiltin<"__builtin_altivec_vcmpgtuw">,
438
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
439
                            [IntrNoMem]>;
440
  def int_ppc_altivec_vcmpnew : ClangBuiltin<"__builtin_altivec_vcmpnew">,
441
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
442
                            [IntrNoMem]>;
443
  def int_ppc_altivec_vcmpnezw : ClangBuiltin<"__builtin_altivec_vcmpnezw">,
444
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
445
                            [IntrNoMem]>;
446
 
447
  def int_ppc_altivec_vcmpequh : ClangBuiltin<"__builtin_altivec_vcmpequh">,
448
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
449
                            [IntrNoMem]>;
450
  def int_ppc_altivec_vcmpgtsh : ClangBuiltin<"__builtin_altivec_vcmpgtsh">,
451
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
452
                            [IntrNoMem]>;
453
  def int_ppc_altivec_vcmpgtuh : ClangBuiltin<"__builtin_altivec_vcmpgtuh">,
454
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
455
                            [IntrNoMem]>;
456
  def int_ppc_altivec_vcmpneh : ClangBuiltin<"__builtin_altivec_vcmpneh">,
457
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
458
                            [IntrNoMem]>;
459
  def int_ppc_altivec_vcmpnezh : ClangBuiltin<"__builtin_altivec_vcmpnezh">,
460
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
461
                            [IntrNoMem]>;
462
 
463
  def int_ppc_altivec_vcmpequb : ClangBuiltin<"__builtin_altivec_vcmpequb">,
464
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
465
                            [IntrNoMem]>;
466
  def int_ppc_altivec_vcmpgtsb : ClangBuiltin<"__builtin_altivec_vcmpgtsb">,
467
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
468
                            [IntrNoMem]>;
469
  def int_ppc_altivec_vcmpgtub : ClangBuiltin<"__builtin_altivec_vcmpgtub">,
470
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
471
                            [IntrNoMem]>;
472
  def int_ppc_altivec_vcmpneb : ClangBuiltin<"__builtin_altivec_vcmpneb">,
473
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
474
                            [IntrNoMem]>;
475
  def int_ppc_altivec_vcmpnezb : ClangBuiltin<"__builtin_altivec_vcmpnezb">,
476
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
477
                            [IntrNoMem]>;
478
 
479
  def int_ppc_altivec_vcmpequq : ClangBuiltin<"__builtin_altivec_vcmpequq">,
480
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
481
                            [IntrNoMem]>;
482
  def int_ppc_altivec_vcmpgtsq : ClangBuiltin<"__builtin_altivec_vcmpgtsq">,
483
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
484
                            [IntrNoMem]>;
485
  def int_ppc_altivec_vcmpgtuq : ClangBuiltin<"__builtin_altivec_vcmpgtuq">,
486
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
487
                            [IntrNoMem]>;
488
  def int_ppc_altivec_vcmpequq_p : ClangBuiltin<"__builtin_altivec_vcmpequq_p">,
489
      DefaultAttrsIntrinsic<[llvm_i32_ty],
490
                            [llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
491
                            [IntrNoMem]>;
492
  def int_ppc_altivec_vcmpgtsq_p : ClangBuiltin<"__builtin_altivec_vcmpgtsq_p">,
493
      DefaultAttrsIntrinsic<[llvm_i32_ty],
494
                            [llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
495
                            [IntrNoMem]>;
496
  def int_ppc_altivec_vcmpgtuq_p : ClangBuiltin<"__builtin_altivec_vcmpgtuq_p">,
497
      DefaultAttrsIntrinsic<[llvm_i32_ty],
498
                            [llvm_i32_ty,llvm_v1i128_ty,llvm_v1i128_ty],
499
                            [IntrNoMem]>;
500
 
501
  // Predicate Comparisons.  The first operand specifies interpretation of CR6.
502
  def int_ppc_altivec_vcmpbfp_p : ClangBuiltin<"__builtin_altivec_vcmpbfp_p">,
503
      DefaultAttrsIntrinsic<[llvm_i32_ty],
504
                            [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
505
                            [IntrNoMem]>;
506
  def int_ppc_altivec_vcmpeqfp_p : ClangBuiltin<"__builtin_altivec_vcmpeqfp_p">,
507
      DefaultAttrsIntrinsic<[llvm_i32_ty],
508
                            [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
509
                            [IntrNoMem]>;
510
  def int_ppc_altivec_vcmpgefp_p : ClangBuiltin<"__builtin_altivec_vcmpgefp_p">,
511
      DefaultAttrsIntrinsic<[llvm_i32_ty],
512
                            [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
513
                            [IntrNoMem]>;
514
  def int_ppc_altivec_vcmpgtfp_p : ClangBuiltin<"__builtin_altivec_vcmpgtfp_p">,
515
      DefaultAttrsIntrinsic<[llvm_i32_ty],
516
                            [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
517
                            [IntrNoMem]>;
518
 
519
  def int_ppc_altivec_vcmpequd_p : ClangBuiltin<"__builtin_altivec_vcmpequd_p">,
520
      DefaultAttrsIntrinsic<[llvm_i32_ty],
521
                            [llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
522
                            [IntrNoMem]>;
523
  def int_ppc_altivec_vcmpgtsd_p : ClangBuiltin<"__builtin_altivec_vcmpgtsd_p">,
524
      DefaultAttrsIntrinsic<[llvm_i32_ty],
525
                            [llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
526
                            [IntrNoMem]>;
527
  def int_ppc_altivec_vcmpgtud_p : ClangBuiltin<"__builtin_altivec_vcmpgtud_p">,
528
      DefaultAttrsIntrinsic<[llvm_i32_ty],
529
                            [llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
530
                            [IntrNoMem]>;
531
 
532
  def int_ppc_altivec_vcmpequw_p : ClangBuiltin<"__builtin_altivec_vcmpequw_p">,
533
      DefaultAttrsIntrinsic<[llvm_i32_ty],
534
                            [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
535
                            [IntrNoMem]>;
536
  def int_ppc_altivec_vcmpgtsw_p : ClangBuiltin<"__builtin_altivec_vcmpgtsw_p">,
537
      DefaultAttrsIntrinsic<[llvm_i32_ty],
538
                            [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
539
                            [IntrNoMem]>;
540
  def int_ppc_altivec_vcmpgtuw_p : ClangBuiltin<"__builtin_altivec_vcmpgtuw_p">,
541
      DefaultAttrsIntrinsic<[llvm_i32_ty],
542
                            [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
543
                            [IntrNoMem]>;
544
  def int_ppc_altivec_vcmpnew_p : ClangBuiltin<"__builtin_altivec_vcmpnew_p">,
545
      DefaultAttrsIntrinsic<[llvm_i32_ty],
546
                            [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
547
                            [IntrNoMem]>;
548
  def int_ppc_altivec_vcmpnezw_p : ClangBuiltin<"__builtin_altivec_vcmpnezw_p">,
549
      DefaultAttrsIntrinsic<[llvm_i32_ty],
550
                            [llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
551
                            [IntrNoMem]>;
552
 
553
  def int_ppc_altivec_vcmpequh_p : ClangBuiltin<"__builtin_altivec_vcmpequh_p">,
554
      DefaultAttrsIntrinsic<[llvm_i32_ty],
555
                            [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
556
                            [IntrNoMem]>;
557
  def int_ppc_altivec_vcmpgtsh_p : ClangBuiltin<"__builtin_altivec_vcmpgtsh_p">,
558
      DefaultAttrsIntrinsic<[llvm_i32_ty],
559
                            [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
560
                            [IntrNoMem]>;
561
  def int_ppc_altivec_vcmpgtuh_p : ClangBuiltin<"__builtin_altivec_vcmpgtuh_p">,
562
      DefaultAttrsIntrinsic<[llvm_i32_ty],
563
                            [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
564
                            [IntrNoMem]>;
565
  def int_ppc_altivec_vcmpneh_p : ClangBuiltin<"__builtin_altivec_vcmpneh_p">,
566
      DefaultAttrsIntrinsic<[llvm_i32_ty],
567
                            [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
568
                            [IntrNoMem]>;
569
  def int_ppc_altivec_vcmpnezh_p : ClangBuiltin<"__builtin_altivec_vcmpnezh_p">,
570
      DefaultAttrsIntrinsic<[llvm_i32_ty],
571
                            [llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
572
                            [IntrNoMem]>;
573
 
574
  def int_ppc_altivec_vcmpequb_p : ClangBuiltin<"__builtin_altivec_vcmpequb_p">,
575
      DefaultAttrsIntrinsic<[llvm_i32_ty],
576
                            [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
577
                            [IntrNoMem]>;
578
  def int_ppc_altivec_vcmpgtsb_p : ClangBuiltin<"__builtin_altivec_vcmpgtsb_p">,
579
      DefaultAttrsIntrinsic<[llvm_i32_ty],
580
                            [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
581
                            [IntrNoMem]>;
582
  def int_ppc_altivec_vcmpgtub_p : ClangBuiltin<"__builtin_altivec_vcmpgtub_p">,
583
      DefaultAttrsIntrinsic<[llvm_i32_ty],
584
                            [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
585
                            [IntrNoMem]>;
586
  def int_ppc_altivec_vcmpneb_p : ClangBuiltin<"__builtin_altivec_vcmpneb_p">,
587
      DefaultAttrsIntrinsic<[llvm_i32_ty],
588
                            [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
589
                            [IntrNoMem]>;
590
  def int_ppc_altivec_vcmpnezb_p : ClangBuiltin<"__builtin_altivec_vcmpnezb_p">,
591
      DefaultAttrsIntrinsic<[llvm_i32_ty],
592
                            [llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
593
                            [IntrNoMem]>;
594
  def int_ppc_altivec_vclzlsbb : ClangBuiltin<"__builtin_altivec_vclzlsbb">,
595
      DefaultAttrsIntrinsic<[llvm_i32_ty],[llvm_v16i8_ty],[IntrNoMem]>;
596
  def int_ppc_altivec_vctzlsbb : ClangBuiltin<"__builtin_altivec_vctzlsbb">,
597
      DefaultAttrsIntrinsic<[llvm_i32_ty],[llvm_v16i8_ty],[IntrNoMem]>;
598
  def int_ppc_altivec_vprtybw : ClangBuiltin<"__builtin_altivec_vprtybw">,
599
      DefaultAttrsIntrinsic<[llvm_v4i32_ty],[llvm_v4i32_ty],[IntrNoMem]>;
600
  def int_ppc_altivec_vprtybd : ClangBuiltin<"__builtin_altivec_vprtybd">,
601
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],[llvm_v2i64_ty],[IntrNoMem]>;
602
  def int_ppc_altivec_vprtybq : ClangBuiltin<"__builtin_altivec_vprtybq">,
603
      DefaultAttrsIntrinsic<[llvm_v1i128_ty],[llvm_v1i128_ty],[IntrNoMem]>;
604
 
605
  // BCD intrinsics.
606
  def int_ppc_bcdadd : ClangBuiltin<"__builtin_ppc_bcdadd">,
607
    DefaultAttrsIntrinsic<
608
    [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
609
    [IntrNoMem, ImmArg<ArgIndex<2>>]>;
610
  def int_ppc_bcdadd_p : ClangBuiltin<"__builtin_ppc_bcdadd_p">,
611
    DefaultAttrsIntrinsic<
612
    [llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty, llvm_v16i8_ty],
613
    [IntrNoMem, ImmArg<ArgIndex<0>>]>;
614
  def int_ppc_bcdsub : ClangBuiltin<"__builtin_ppc_bcdsub">,
615
    DefaultAttrsIntrinsic<
616
    [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
617
    [IntrNoMem, ImmArg<ArgIndex<2>>]>;
618
  def int_ppc_bcdsub_p : ClangBuiltin<"__builtin_ppc_bcdsub_p">,
619
    DefaultAttrsIntrinsic<
620
    [llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty, llvm_v16i8_ty],
621
    [IntrNoMem, ImmArg<ArgIndex<0>>]>;
622
 
623
  // P10 Vector Extract with Mask
624
  def int_ppc_altivec_vextractbm : ClangBuiltin<"__builtin_altivec_vextractbm">,
625
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
626
  def int_ppc_altivec_vextracthm : ClangBuiltin<"__builtin_altivec_vextracthm">,
627
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
628
  def int_ppc_altivec_vextractwm : ClangBuiltin<"__builtin_altivec_vextractwm">,
629
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
630
  def int_ppc_altivec_vextractdm : ClangBuiltin<"__builtin_altivec_vextractdm">,
631
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v2i64_ty], [IntrNoMem]>;
632
  def int_ppc_altivec_vextractqm : ClangBuiltin<"__builtin_altivec_vextractqm">,
633
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_v1i128_ty], [IntrNoMem]>;
634
 
635
  // P10 Vector Expand with Mask
636
  def int_ppc_altivec_vexpandbm : ClangBuiltin<"__builtin_altivec_vexpandbm">,
637
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
638
  def int_ppc_altivec_vexpandhm : ClangBuiltin<"__builtin_altivec_vexpandhm">,
639
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
640
  def int_ppc_altivec_vexpandwm : ClangBuiltin<"__builtin_altivec_vexpandwm">,
641
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
642
  def int_ppc_altivec_vexpanddm : ClangBuiltin<"__builtin_altivec_vexpanddm">,
643
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
644
  def int_ppc_altivec_vexpandqm : ClangBuiltin<"__builtin_altivec_vexpandqm">,
645
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v1i128_ty], [IntrNoMem]>;
646
 
647
  // P10 Vector Count with Mask intrinsics.
648
  def int_ppc_altivec_vcntmbb : ClangBuiltin<"__builtin_altivec_vcntmbb">,
649
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v16i8_ty, llvm_i32_ty],
650
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
651
  def int_ppc_altivec_vcntmbh : ClangBuiltin<"__builtin_altivec_vcntmbh">,
652
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v8i16_ty, llvm_i32_ty],
653
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
654
  def int_ppc_altivec_vcntmbw : ClangBuiltin<"__builtin_altivec_vcntmbw">,
655
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v4i32_ty, llvm_i32_ty],
656
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
657
  def int_ppc_altivec_vcntmbd : ClangBuiltin<"__builtin_altivec_vcntmbd">,
658
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v2i64_ty, llvm_i32_ty],
659
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
660
 
661
  // P10 Move to VSR with Mask Intrinsics.
662
  def int_ppc_altivec_mtvsrbm : ClangBuiltin<"__builtin_altivec_mtvsrbm">,
663
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_i64_ty], [IntrNoMem]>;
664
  def int_ppc_altivec_mtvsrhm : ClangBuiltin<"__builtin_altivec_mtvsrhm">,
665
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_i64_ty], [IntrNoMem]>;
666
  def int_ppc_altivec_mtvsrwm : ClangBuiltin<"__builtin_altivec_mtvsrwm">,
667
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_i64_ty], [IntrNoMem]>;
668
  def int_ppc_altivec_mtvsrdm : ClangBuiltin<"__builtin_altivec_mtvsrdm">,
669
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_i64_ty], [IntrNoMem]>;
670
  def int_ppc_altivec_mtvsrqm : ClangBuiltin<"__builtin_altivec_mtvsrqm">,
671
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_i64_ty], [IntrNoMem]>;
672
 
673
  // P10 Vector Parallel Bits Deposit/Extract Doubleword Builtins.
674
  def int_ppc_altivec_vpdepd : ClangBuiltin<"__builtin_altivec_vpdepd">,
675
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
676
                            [IntrNoMem]>;
677
  def int_ppc_altivec_vpextd : ClangBuiltin<"__builtin_altivec_vpextd">,
678
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
679
                            [IntrNoMem]>;
680
 
681
  // P10 Vector String Isolate Intrinsics.
682
  def int_ppc_altivec_vstribr : ClangBuiltin<"__builtin_altivec_vstribr">,
683
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
684
  def int_ppc_altivec_vstribl : ClangBuiltin<"__builtin_altivec_vstribl">,
685
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
686
  def int_ppc_altivec_vstrihr : ClangBuiltin<"__builtin_altivec_vstrihr">,
687
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
688
  def int_ppc_altivec_vstrihl : ClangBuiltin<"__builtin_altivec_vstrihl">,
689
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
690
  // Predicate Intrinsics: The first operand specifies interpretation of CR6.
691
  def int_ppc_altivec_vstribr_p : ClangBuiltin<"__builtin_altivec_vstribr_p">,
692
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty],
693
                            [IntrNoMem]>;
694
  def int_ppc_altivec_vstribl_p : ClangBuiltin<"__builtin_altivec_vstribl_p">,
695
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v16i8_ty],
696
                            [IntrNoMem]>;
697
  def int_ppc_altivec_vstrihr_p : ClangBuiltin<"__builtin_altivec_vstrihr_p">,
698
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v8i16_ty],
699
                            [IntrNoMem]>;
700
  def int_ppc_altivec_vstrihl_p : ClangBuiltin<"__builtin_altivec_vstrihl_p">,
701
      DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_v8i16_ty],
702
                            [IntrNoMem]>;
703
 
704
  // P10 Vector Centrifuge Builtin.
705
  def int_ppc_altivec_vcfuged : ClangBuiltin<"__builtin_altivec_vcfuged">,
706
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
707
                            [IntrNoMem]>;
708
 
709
  // P10 Vector Gather Every Nth Bit Builtin.
710
  def int_ppc_altivec_vgnb : ClangBuiltin<"__builtin_altivec_vgnb">,
711
      DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_v1i128_ty, llvm_i32_ty],
712
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
713
 
714
   // P10 Vector Clear Bytes
715
   def int_ppc_altivec_vclrlb :  ClangBuiltin<"__builtin_altivec_vclrlb">,
716
       DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_i32_ty],
717
                             [IntrNoMem]>;
718
   def int_ppc_altivec_vclrrb :  ClangBuiltin<"__builtin_altivec_vclrrb">,
719
       DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_i32_ty],
720
                             [IntrNoMem]>;
721
 
722
  // P10 Vector Shift Double Bit Immediate.
723
  def int_ppc_altivec_vsldbi : ClangBuiltin<"__builtin_altivec_vsldbi">,
724
      DefaultAttrsIntrinsic<[llvm_v16i8_ty],
725
                            [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
726
                            [IntrNoMem, ImmArg<ArgIndex<2>>]>;
727
  def int_ppc_altivec_vsrdbi : ClangBuiltin<"__builtin_altivec_vsrdbi">,
728
      DefaultAttrsIntrinsic<[llvm_v16i8_ty],
729
                            [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
730
                            [IntrNoMem, ImmArg<ArgIndex<2>>]>;
731
 
732
  // P10 Vector Insert.
733
  def int_ppc_altivec_vinsblx : ClangBuiltin<"__builtin_altivec_vinsblx">,
734
      DefaultAttrsIntrinsic<[llvm_v16i8_ty],
735
                            [llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty],
736
                            [IntrNoMem]>;
737
  def int_ppc_altivec_vinsbrx : ClangBuiltin<"__builtin_altivec_vinsbrx">,
738
      DefaultAttrsIntrinsic<[llvm_v16i8_ty],
739
                            [llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty],
740
                            [IntrNoMem]>;
741
  def int_ppc_altivec_vinshlx : ClangBuiltin<"__builtin_altivec_vinshlx">,
742
      DefaultAttrsIntrinsic<[llvm_v8i16_ty],
743
                            [llvm_v8i16_ty, llvm_i32_ty, llvm_i32_ty],
744
                            [IntrNoMem]>;
745
  def int_ppc_altivec_vinshrx : ClangBuiltin<"__builtin_altivec_vinshrx">,
746
      DefaultAttrsIntrinsic<[llvm_v8i16_ty],
747
                            [llvm_v8i16_ty, llvm_i32_ty, llvm_i32_ty],
748
                            [IntrNoMem]>;
749
  def int_ppc_altivec_vinswlx : ClangBuiltin<"__builtin_altivec_vinswlx">,
750
      DefaultAttrsIntrinsic<[llvm_v4i32_ty],
751
                            [llvm_v4i32_ty, llvm_i32_ty, llvm_i32_ty],
752
                            [IntrNoMem]>;
753
  def int_ppc_altivec_vinswrx : ClangBuiltin<"__builtin_altivec_vinswrx">,
754
      DefaultAttrsIntrinsic<[llvm_v4i32_ty],
755
                            [llvm_v4i32_ty, llvm_i32_ty, llvm_i32_ty],
756
                            [IntrNoMem]>;
757
  def int_ppc_altivec_vinsdlx : ClangBuiltin<"__builtin_altivec_vinsdlx">,
758
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
759
                            [llvm_v2i64_ty, llvm_i64_ty, llvm_i64_ty],
760
                            [IntrNoMem]>;
761
  def int_ppc_altivec_vinsdrx : ClangBuiltin<"__builtin_altivec_vinsdrx">,
762
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
763
                            [llvm_v2i64_ty, llvm_i64_ty, llvm_i64_ty],
764
                            [IntrNoMem]>;
765
  def int_ppc_altivec_vinsbvlx : ClangBuiltin<"__builtin_altivec_vinsbvlx">,
766
      DefaultAttrsIntrinsic<[llvm_v16i8_ty],
767
                            [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty],
768
                            [IntrNoMem]>;
769
  def int_ppc_altivec_vinsbvrx : ClangBuiltin<"__builtin_altivec_vinsbvrx">,
770
      DefaultAttrsIntrinsic<[llvm_v16i8_ty],
771
                            [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty],
772
                            [IntrNoMem]>;
773
  def int_ppc_altivec_vinshvlx : ClangBuiltin<"__builtin_altivec_vinshvlx">,
774
      DefaultAttrsIntrinsic<[llvm_v8i16_ty],
775
                            [llvm_v8i16_ty, llvm_i32_ty, llvm_v8i16_ty],
776
                            [IntrNoMem]>;
777
 def int_ppc_altivec_vinshvrx : ClangBuiltin<"__builtin_altivec_vinshvrx">,
778
     DefaultAttrsIntrinsic<[llvm_v8i16_ty],
779
                            [llvm_v8i16_ty, llvm_i32_ty, llvm_v8i16_ty],
780
                            [IntrNoMem]>;
781
  def int_ppc_altivec_vinswvlx : ClangBuiltin<"__builtin_altivec_vinswvlx">,
782
      DefaultAttrsIntrinsic<[llvm_v4i32_ty],
783
                            [llvm_v4i32_ty, llvm_i32_ty, llvm_v4i32_ty],
784
                            [IntrNoMem]>;
785
  def int_ppc_altivec_vinswvrx : ClangBuiltin<"__builtin_altivec_vinswvrx">,
786
      DefaultAttrsIntrinsic<[llvm_v4i32_ty],
787
                            [llvm_v4i32_ty, llvm_i32_ty, llvm_v4i32_ty],
788
                            [IntrNoMem]>;
789
  // P10 Vector Insert with immediate.
790
  def int_ppc_altivec_vinsw :
791
      DefaultAttrsIntrinsic<[llvm_v4i32_ty],
792
                            [llvm_v4i32_ty, llvm_i32_ty, llvm_i32_ty],
793
                            [IntrNoMem, ImmArg<ArgIndex<2>>]>;
794
  def int_ppc_altivec_vinsd :
795
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
796
                            [llvm_v2i64_ty, llvm_i64_ty, llvm_i32_ty],
797
                            [IntrNoMem, ImmArg<ArgIndex<2>>]>;
798
  // P10 Vector Extract.
799
  def int_ppc_altivec_vextdubvlx : ClangBuiltin<"__builtin_altivec_vextdubvlx">,
800
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
801
                            [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
802
                            [IntrNoMem]>;
803
  def int_ppc_altivec_vextdubvrx : ClangBuiltin<"__builtin_altivec_vextdubvrx">,
804
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
805
                            [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty],
806
                            [IntrNoMem]>;
807
  def int_ppc_altivec_vextduhvlx : ClangBuiltin<"__builtin_altivec_vextduhvlx">,
808
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
809
                            [llvm_v8i16_ty, llvm_v8i16_ty, llvm_i32_ty],
810
                            [IntrNoMem]>;
811
  def int_ppc_altivec_vextduhvrx : ClangBuiltin<"__builtin_altivec_vextduhvrx">,
812
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
813
                            [llvm_v8i16_ty, llvm_v8i16_ty, llvm_i32_ty],
814
                            [IntrNoMem]>;
815
  def int_ppc_altivec_vextduwvlx : ClangBuiltin<"__builtin_altivec_vextduwvlx">,
816
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
817
                            [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
818
                            [IntrNoMem]>;
819
  def int_ppc_altivec_vextduwvrx : ClangBuiltin<"__builtin_altivec_vextduwvrx">,
820
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
821
                            [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
822
                            [IntrNoMem]>;
823
  def int_ppc_altivec_vextddvlx : ClangBuiltin<"__builtin_altivec_vextddvlx">,
824
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
825
                            [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
826
                            [IntrNoMem]>;
827
  def int_ppc_altivec_vextddvrx : ClangBuiltin<"__builtin_altivec_vextddvrx">,
828
      DefaultAttrsIntrinsic<[llvm_v2i64_ty],
829
                            [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
830
                            [IntrNoMem]>;
831
}
832
 
833
// Vector average.
834
def int_ppc_altivec_vavgsb : PowerPC_Vec_BBB_Intrinsic<"vavgsb">;
835
def int_ppc_altivec_vavgsh : PowerPC_Vec_HHH_Intrinsic<"vavgsh">;
836
def int_ppc_altivec_vavgsw : PowerPC_Vec_WWW_Intrinsic<"vavgsw">;
837
def int_ppc_altivec_vavgub : PowerPC_Vec_BBB_Intrinsic<"vavgub">;
838
def int_ppc_altivec_vavguh : PowerPC_Vec_HHH_Intrinsic<"vavguh">;
839
def int_ppc_altivec_vavguw : PowerPC_Vec_WWW_Intrinsic<"vavguw">;
840
 
841
// Vector maximum.
842
def int_ppc_altivec_vmaxfp : PowerPC_Vec_FFF_Intrinsic<"vmaxfp">;
843
def int_ppc_altivec_vmaxsb : PowerPC_Vec_BBB_Intrinsic<"vmaxsb">;
844
def int_ppc_altivec_vmaxsh : PowerPC_Vec_HHH_Intrinsic<"vmaxsh">;
845
def int_ppc_altivec_vmaxsw : PowerPC_Vec_WWW_Intrinsic<"vmaxsw">;
846
def int_ppc_altivec_vmaxsd : PowerPC_Vec_DDD_Intrinsic<"vmaxsd">;
847
def int_ppc_altivec_vmaxub : PowerPC_Vec_BBB_Intrinsic<"vmaxub">;
848
def int_ppc_altivec_vmaxuh : PowerPC_Vec_HHH_Intrinsic<"vmaxuh">;
849
def int_ppc_altivec_vmaxuw : PowerPC_Vec_WWW_Intrinsic<"vmaxuw">;
850
def int_ppc_altivec_vmaxud : PowerPC_Vec_DDD_Intrinsic<"vmaxud">;
851
 
852
// Vector minimum.
853
def int_ppc_altivec_vminfp : PowerPC_Vec_FFF_Intrinsic<"vminfp">;
854
def int_ppc_altivec_vminsb : PowerPC_Vec_BBB_Intrinsic<"vminsb">;
855
def int_ppc_altivec_vminsh : PowerPC_Vec_HHH_Intrinsic<"vminsh">;
856
def int_ppc_altivec_vminsw : PowerPC_Vec_WWW_Intrinsic<"vminsw">;
857
def int_ppc_altivec_vminsd : PowerPC_Vec_DDD_Intrinsic<"vminsd">;
858
def int_ppc_altivec_vminub : PowerPC_Vec_BBB_Intrinsic<"vminub">;
859
def int_ppc_altivec_vminuh : PowerPC_Vec_HHH_Intrinsic<"vminuh">;
860
def int_ppc_altivec_vminuw : PowerPC_Vec_WWW_Intrinsic<"vminuw">;
861
def int_ppc_altivec_vminud : PowerPC_Vec_DDD_Intrinsic<"vminud">;
862
 
863
// Saturating adds.
864
def int_ppc_altivec_vaddubs : PowerPC_Vec_BBB_Intrinsic<"vaddubs">;
865
def int_ppc_altivec_vaddsbs : PowerPC_Vec_BBB_Intrinsic<"vaddsbs">;
866
def int_ppc_altivec_vadduhs : PowerPC_Vec_HHH_Intrinsic<"vadduhs">;
867
def int_ppc_altivec_vaddshs : PowerPC_Vec_HHH_Intrinsic<"vaddshs">;
868
def int_ppc_altivec_vadduws : PowerPC_Vec_WWW_Intrinsic<"vadduws">;
869
def int_ppc_altivec_vaddsws : PowerPC_Vec_WWW_Intrinsic<"vaddsws">;
870
def int_ppc_altivec_vaddcuw : PowerPC_Vec_WWW_Intrinsic<"vaddcuw">;
871
def int_ppc_altivec_vaddcuq : PowerPC_Vec_QQQ_Intrinsic<"vaddcuq">;
872
 
873
// Saturating subs.
874
def int_ppc_altivec_vsububs : PowerPC_Vec_BBB_Intrinsic<"vsububs">;
875
def int_ppc_altivec_vsubsbs : PowerPC_Vec_BBB_Intrinsic<"vsubsbs">;
876
def int_ppc_altivec_vsubuhs : PowerPC_Vec_HHH_Intrinsic<"vsubuhs">;
877
def int_ppc_altivec_vsubshs : PowerPC_Vec_HHH_Intrinsic<"vsubshs">;
878
def int_ppc_altivec_vsubuws : PowerPC_Vec_WWW_Intrinsic<"vsubuws">;
879
def int_ppc_altivec_vsubsws : PowerPC_Vec_WWW_Intrinsic<"vsubsws">;
880
def int_ppc_altivec_vsubcuw : PowerPC_Vec_WWW_Intrinsic<"vsubcuw">;
881
def int_ppc_altivec_vsubcuq : PowerPC_Vec_QQQ_Intrinsic<"vsubcuq">;
882
 
883
let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
884
  // Saturating multiply-adds.
885
  def int_ppc_altivec_vmhaddshs : ClangBuiltin<"__builtin_altivec_vmhaddshs">,
886
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
887
                             llvm_v8i16_ty, llvm_v8i16_ty],
888
                             [IntrNoMem, IntrHasSideEffects]>;
889
  def int_ppc_altivec_vmhraddshs : ClangBuiltin<"__builtin_altivec_vmhraddshs">,
890
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
891
                             llvm_v8i16_ty, llvm_v8i16_ty],
892
                             [IntrNoMem, IntrHasSideEffects]>;
893
 
894
  def int_ppc_altivec_vmaddfp : ClangBuiltin<"__builtin_altivec_vmaddfp">,
895
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
896
                             llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
897
  def int_ppc_altivec_vnmsubfp : ClangBuiltin<"__builtin_altivec_vnmsubfp">,
898
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
899
                             llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
900
 
901
  // Vector Multiply Sum Instructions.
902
  def int_ppc_altivec_vmsummbm : ClangBuiltin<"__builtin_altivec_vmsummbm">,
903
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
904
                             llvm_v4i32_ty], [IntrNoMem]>;
905
  def int_ppc_altivec_vmsumshm : ClangBuiltin<"__builtin_altivec_vmsumshm">,
906
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
907
                             llvm_v4i32_ty], [IntrNoMem]>;
908
  def int_ppc_altivec_vmsumshs : ClangBuiltin<"__builtin_altivec_vmsumshs">,
909
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
910
                             llvm_v4i32_ty], [IntrNoMem, IntrHasSideEffects]>;
911
  def int_ppc_altivec_vmsumubm : ClangBuiltin<"__builtin_altivec_vmsumubm">,
912
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
913
                             llvm_v4i32_ty], [IntrNoMem]>;
914
  def int_ppc_altivec_vmsumuhm : ClangBuiltin<"__builtin_altivec_vmsumuhm">,
915
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
916
                             llvm_v4i32_ty], [IntrNoMem]>;
917
  def int_ppc_altivec_vmsumudm : ClangBuiltin<"__builtin_altivec_vmsumudm">,
918
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
919
                             llvm_v1i128_ty], [IntrNoMem]>;
920
  def int_ppc_altivec_vmsumuhs : ClangBuiltin<"__builtin_altivec_vmsumuhs">,
921
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
922
                             llvm_v4i32_ty], [IntrNoMem, IntrHasSideEffects]>;
923
  def int_ppc_altivec_vmsumcud : ClangBuiltin<"__builtin_altivec_vmsumcud">,
924
      DefaultAttrsIntrinsic<[llvm_v1i128_ty],
925
                            [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v1i128_ty],
926
                            [IntrNoMem]>;
927
 
928
  // Vector Multiply Instructions.
929
  def int_ppc_altivec_vmulesb : ClangBuiltin<"__builtin_altivec_vmulesb">,
930
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
931
                            [IntrNoMem]>;
932
  def int_ppc_altivec_vmulesh : ClangBuiltin<"__builtin_altivec_vmulesh">,
933
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
934
                            [IntrNoMem]>;
935
  def int_ppc_altivec_vmulesw : ClangBuiltin<"__builtin_altivec_vmulesw">,
936
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
937
                            [IntrNoMem]>;
938
  def int_ppc_altivec_vmulesd : PowerPC_Vec_QDD_Intrinsic<"vmulesd">;
939
  def int_ppc_altivec_vmuleub : ClangBuiltin<"__builtin_altivec_vmuleub">,
940
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
941
                            [IntrNoMem]>;
942
  def int_ppc_altivec_vmuleuh : ClangBuiltin<"__builtin_altivec_vmuleuh">,
943
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
944
                            [IntrNoMem]>;
945
  def int_ppc_altivec_vmuleuw : ClangBuiltin<"__builtin_altivec_vmuleuw">,
946
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
947
                            [IntrNoMem]>;
948
  def int_ppc_altivec_vmuleud : PowerPC_Vec_QDD_Intrinsic<"vmuleud">;
949
 
950
  def int_ppc_altivec_vmulosb : ClangBuiltin<"__builtin_altivec_vmulosb">,
951
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
952
                            [IntrNoMem]>;
953
  def int_ppc_altivec_vmulosh : ClangBuiltin<"__builtin_altivec_vmulosh">,
954
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
955
                            [IntrNoMem]>;
956
  def int_ppc_altivec_vmulosw : ClangBuiltin<"__builtin_altivec_vmulosw">,
957
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
958
                            [IntrNoMem]>;
959
  def int_ppc_altivec_vmulosd : PowerPC_Vec_QDD_Intrinsic<"vmulosd">;
960
  def int_ppc_altivec_vmuloub : ClangBuiltin<"__builtin_altivec_vmuloub">,
961
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
962
                            [IntrNoMem]>;
963
  def int_ppc_altivec_vmulouh : ClangBuiltin<"__builtin_altivec_vmulouh">,
964
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
965
                            [IntrNoMem]>;
966
  def int_ppc_altivec_vmulouw : ClangBuiltin<"__builtin_altivec_vmulouw">,
967
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
968
                            [IntrNoMem]>;
969
  def int_ppc_altivec_vmuloud : PowerPC_Vec_QDD_Intrinsic<"vmuloud">;
970
 
971
  // Vector Sum Instructions.
972
  def int_ppc_altivec_vsumsws : ClangBuiltin<"__builtin_altivec_vsumsws">,
973
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
974
                            [IntrNoMem, IntrHasSideEffects]>;
975
  def int_ppc_altivec_vsum2sws : ClangBuiltin<"__builtin_altivec_vsum2sws">,
976
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
977
                            [IntrNoMem, IntrHasSideEffects]>;
978
  def int_ppc_altivec_vsum4sbs : ClangBuiltin<"__builtin_altivec_vsum4sbs">,
979
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
980
                            [IntrNoMem, IntrHasSideEffects]>;
981
  def int_ppc_altivec_vsum4shs : ClangBuiltin<"__builtin_altivec_vsum4shs">,
982
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v4i32_ty],
983
                            [IntrNoMem, IntrHasSideEffects]>;
984
  def int_ppc_altivec_vsum4ubs : ClangBuiltin<"__builtin_altivec_vsum4ubs">,
985
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
986
                            [IntrNoMem, IntrHasSideEffects]>;
987
 
988
  // Vector Sign Extension Instructions
989
  def int_ppc_altivec_vextsb2w : ClangBuiltin<"__builtin_altivec_vextsb2w">,
990
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
991
  def int_ppc_altivec_vextsb2d : ClangBuiltin<"__builtin_altivec_vextsb2d">,
992
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
993
  def int_ppc_altivec_vextsh2w : ClangBuiltin<"__builtin_altivec_vextsh2w">,
994
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
995
  def int_ppc_altivec_vextsh2d : ClangBuiltin<"__builtin_altivec_vextsh2d">,
996
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
997
  def int_ppc_altivec_vextsw2d : ClangBuiltin<"__builtin_altivec_vextsw2d">,
998
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
999
  def int_ppc_altivec_vextsd2q : ClangBuiltin<"__builtin_altivec_vextsd2q">,
1000
      DefaultAttrsIntrinsic<[llvm_v1i128_ty], [llvm_v2i64_ty], [IntrNoMem]>;
1001
 
1002
  // Other multiplies.
1003
  def int_ppc_altivec_vmladduhm : ClangBuiltin<"__builtin_altivec_vmladduhm">,
1004
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
1005
                             llvm_v8i16_ty], [IntrNoMem]>;
1006
 
1007
  // Packs.
1008
  def int_ppc_altivec_vpkpx : ClangBuiltin<"__builtin_altivec_vpkpx">,
1009
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1010
                            [IntrNoMem]>;
1011
  def int_ppc_altivec_vpkshss : ClangBuiltin<"__builtin_altivec_vpkshss">,
1012
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
1013
                            [IntrNoMem, IntrHasSideEffects]>;
1014
  def int_ppc_altivec_vpkshus : ClangBuiltin<"__builtin_altivec_vpkshus">,
1015
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
1016
                            [IntrNoMem, IntrHasSideEffects]>;
1017
  def int_ppc_altivec_vpkswss : ClangBuiltin<"__builtin_altivec_vpkswss">,
1018
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1019
                            [IntrNoMem, IntrHasSideEffects]>;
1020
  def int_ppc_altivec_vpkswus : ClangBuiltin<"__builtin_altivec_vpkswus">,
1021
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1022
                            [IntrNoMem, IntrHasSideEffects]>;
1023
  def int_ppc_altivec_vpksdss : ClangBuiltin<"__builtin_altivec_vpksdss">,
1024
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1025
                            [IntrNoMem, IntrHasSideEffects]>;
1026
  def int_ppc_altivec_vpksdus : ClangBuiltin<"__builtin_altivec_vpksdus">,
1027
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1028
                            [IntrNoMem, IntrHasSideEffects]>;
1029
  // vpkuhum is lowered to a shuffle.
1030
  def int_ppc_altivec_vpkuhus : ClangBuiltin<"__builtin_altivec_vpkuhus">,
1031
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
1032
                            [IntrNoMem, IntrHasSideEffects]>;
1033
  // vpkuwum is lowered to a shuffle.
1034
  def int_ppc_altivec_vpkuwus : ClangBuiltin<"__builtin_altivec_vpkuwus">,
1035
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1036
                            [IntrNoMem, IntrHasSideEffects]>;
1037
  // vpkudum is lowered to a shuffle.
1038
  def int_ppc_altivec_vpkudus : ClangBuiltin<"__builtin_altivec_vpkudus">,
1039
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1040
                            [IntrNoMem, IntrHasSideEffects]>;
1041
 
1042
  // Unpacks.
1043
  def int_ppc_altivec_vupkhpx : ClangBuiltin<"__builtin_altivec_vupkhpx">,
1044
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1045
  def int_ppc_altivec_vupkhsb : ClangBuiltin<"__builtin_altivec_vupkhsb">,
1046
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1047
  def int_ppc_altivec_vupkhsh : ClangBuiltin<"__builtin_altivec_vupkhsh">,
1048
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1049
  def int_ppc_altivec_vupkhsw : ClangBuiltin<"__builtin_altivec_vupkhsw">,
1050
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
1051
  def int_ppc_altivec_vupklpx : ClangBuiltin<"__builtin_altivec_vupklpx">,
1052
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1053
  def int_ppc_altivec_vupklsb : ClangBuiltin<"__builtin_altivec_vupklsb">,
1054
      DefaultAttrsIntrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1055
  def int_ppc_altivec_vupklsh : ClangBuiltin<"__builtin_altivec_vupklsh">,
1056
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1057
  def int_ppc_altivec_vupklsw : ClangBuiltin<"__builtin_altivec_vupklsw">,
1058
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
1059
 
1060
 
1061
  // FP <-> integer conversion.
1062
  def int_ppc_altivec_vcfsx : ClangBuiltin<"__builtin_altivec_vcfsx">,
1063
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
1064
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1065
  def int_ppc_altivec_vcfux : ClangBuiltin<"__builtin_altivec_vcfux">,
1066
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
1067
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1068
  def int_ppc_altivec_vctsxs : ClangBuiltin<"__builtin_altivec_vctsxs">,
1069
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
1070
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1071
  def int_ppc_altivec_vctuxs : ClangBuiltin<"__builtin_altivec_vctuxs">,
1072
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
1073
                            [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1074
 
1075
  def int_ppc_altivec_vrfim : ClangBuiltin<"__builtin_altivec_vrfim">,
1076
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1077
  def int_ppc_altivec_vrfin : ClangBuiltin<"__builtin_altivec_vrfin">,
1078
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1079
  def int_ppc_altivec_vrfip : ClangBuiltin<"__builtin_altivec_vrfip">,
1080
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1081
  def int_ppc_altivec_vrfiz : ClangBuiltin<"__builtin_altivec_vrfiz">,
1082
      DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1083
 
1084
  // Add Extended Quadword
1085
  def int_ppc_altivec_vaddeuqm : ClangBuiltin<"__builtin_altivec_vaddeuqm">,
1086
      DefaultAttrsIntrinsic<[llvm_v1i128_ty],
1087
                            [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
1088
                            [IntrNoMem]>;
1089
  def int_ppc_altivec_vaddecuq : ClangBuiltin<"__builtin_altivec_vaddecuq">,
1090
      DefaultAttrsIntrinsic<[llvm_v1i128_ty],
1091
                            [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
1092
                            [IntrNoMem]>;
1093
 
1094
  // Sub Extended Quadword
1095
  def int_ppc_altivec_vsubeuqm : ClangBuiltin<"__builtin_altivec_vsubeuqm">,
1096
      DefaultAttrsIntrinsic<[llvm_v1i128_ty],
1097
                            [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
1098
                            [IntrNoMem]>;
1099
  def int_ppc_altivec_vsubecuq : ClangBuiltin<"__builtin_altivec_vsubecuq">,
1100
      DefaultAttrsIntrinsic<[llvm_v1i128_ty],
1101
                            [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
1102
                            [IntrNoMem]>;
1103
 
1104
  // P10 Vector Count Leading / Trailing Zeroes under bit Mask Builtins.
1105
  def int_ppc_altivec_vclzdm : ClangBuiltin<"__builtin_altivec_vclzdm">,
1106
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1107
                            [IntrNoMem]>;
1108
  def int_ppc_altivec_vctzdm : ClangBuiltin<"__builtin_altivec_vctzdm">,
1109
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1110
                            [IntrNoMem]>;
1111
}
1112
 
1113
def int_ppc_altivec_vsl   : PowerPC_Vec_WWW_Intrinsic<"vsl">;
1114
def int_ppc_altivec_vslo  : PowerPC_Vec_WWW_Intrinsic<"vslo">;
1115
 
1116
def int_ppc_altivec_vslb  : PowerPC_Vec_BBB_Intrinsic<"vslb">;
1117
def int_ppc_altivec_vslv  : PowerPC_Vec_BBB_Intrinsic<"vslv">;
1118
def int_ppc_altivec_vsrv  : PowerPC_Vec_BBB_Intrinsic<"vsrv">;
1119
def int_ppc_altivec_vslh  : PowerPC_Vec_HHH_Intrinsic<"vslh">;
1120
def int_ppc_altivec_vslw  : PowerPC_Vec_WWW_Intrinsic<"vslw">;
1121
 
1122
// Right Shifts.
1123
def int_ppc_altivec_vsr   : PowerPC_Vec_WWW_Intrinsic<"vsr">;
1124
def int_ppc_altivec_vsro  : PowerPC_Vec_WWW_Intrinsic<"vsro">;
1125
 
1126
def int_ppc_altivec_vsrb  : PowerPC_Vec_BBB_Intrinsic<"vsrb">;
1127
def int_ppc_altivec_vsrh  : PowerPC_Vec_HHH_Intrinsic<"vsrh">;
1128
def int_ppc_altivec_vsrw  : PowerPC_Vec_WWW_Intrinsic<"vsrw">;
1129
def int_ppc_altivec_vsrab : PowerPC_Vec_BBB_Intrinsic<"vsrab">;
1130
def int_ppc_altivec_vsrah : PowerPC_Vec_HHH_Intrinsic<"vsrah">;
1131
def int_ppc_altivec_vsraw : PowerPC_Vec_WWW_Intrinsic<"vsraw">;
1132
 
1133
// Rotates.
1134
def int_ppc_altivec_vrlb  : PowerPC_Vec_BBB_Intrinsic<"vrlb">;
1135
def int_ppc_altivec_vrlh  : PowerPC_Vec_HHH_Intrinsic<"vrlh">;
1136
def int_ppc_altivec_vrlw  : PowerPC_Vec_WWW_Intrinsic<"vrlw">;
1137
def int_ppc_altivec_vrld  : PowerPC_Vec_DDD_Intrinsic<"vrld">;
1138
 
1139
let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
1140
  // Miscellaneous.
1141
  def int_ppc_altivec_lvsl :
1142
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
1143
  def int_ppc_altivec_lvsr :
1144
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
1145
 
1146
  def int_ppc_altivec_vperm : ClangBuiltin<"__builtin_altivec_vperm_4si">,
1147
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
1148
                             llvm_v4i32_ty, llvm_v16i8_ty], [IntrNoMem]>;
1149
  def int_ppc_altivec_vsel : ClangBuiltin<"__builtin_altivec_vsel_4si">,
1150
      DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
1151
                             llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
1152
  def int_ppc_altivec_vgbbd : ClangBuiltin<"__builtin_altivec_vgbbd">,
1153
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1154
  def int_ppc_altivec_vbpermq : ClangBuiltin<"__builtin_altivec_vbpermq">,
1155
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
1156
                            [IntrNoMem]>;
1157
  def int_ppc_altivec_vbpermd : ClangBuiltin<"__builtin_altivec_vbpermd">,
1158
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v16i8_ty],
1159
                            [IntrNoMem]>;
1160
}
1161
 
1162
def int_ppc_altivec_vexptefp  : PowerPC_Vec_FF_Intrinsic<"vexptefp">;
1163
def int_ppc_altivec_vlogefp   : PowerPC_Vec_FF_Intrinsic<"vlogefp">;
1164
def int_ppc_altivec_vrefp     : PowerPC_Vec_FF_Intrinsic<"vrefp">;
1165
def int_ppc_altivec_vrsqrtefp : PowerPC_Vec_FF_Intrinsic<"vrsqrtefp">;
1166
 
1167
// Power8 Intrinsics
1168
// Crypto
1169
let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
1170
  def int_ppc_altivec_crypto_vsbox :
1171
      ClangBuiltin<"__builtin_altivec_crypto_vsbox">,
1172
      DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
1173
  def int_ppc_altivec_crypto_vpermxor :
1174
      ClangBuiltin<"__builtin_altivec_crypto_vpermxor">,
1175
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
1176
                             llvm_v16i8_ty], [IntrNoMem]>;
1177
  def int_ppc_altivec_crypto_vpermxor_be :
1178
      ClangBuiltin<"__builtin_altivec_crypto_vpermxor_be">,
1179
      DefaultAttrsIntrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
1180
                             llvm_v16i8_ty], [IntrNoMem]>;
1181
 
1182
def int_ppc_altivec_crypto_vshasigmad :
1183
    ClangBuiltin<"__builtin_altivec_crypto_vshasigmad">,
1184
    DefaultAttrsIntrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i32_ty,
1185
                           llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>,
1186
                           ImmArg<ArgIndex<2>>]>;
1187
def int_ppc_altivec_crypto_vshasigmaw :
1188
    ClangBuiltin<"__builtin_altivec_crypto_vshasigmaw">,
1189
    DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_i32_ty,
1190
                           llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>,
1191
                           ImmArg<ArgIndex<2>>]>;
1192
}
1193
def int_ppc_altivec_crypto_vcipher :
1194
            PowerPC_Vec_DDD_Intrinsic<"crypto_vcipher">;
1195
def int_ppc_altivec_crypto_vcipherlast :
1196
            PowerPC_Vec_DDD_Intrinsic<"crypto_vcipherlast">;
1197
def int_ppc_altivec_crypto_vncipher :
1198
            PowerPC_Vec_DDD_Intrinsic<"crypto_vncipher">;
1199
def int_ppc_altivec_crypto_vncipherlast :
1200
            PowerPC_Vec_DDD_Intrinsic<"crypto_vncipherlast">;
1201
def int_ppc_altivec_crypto_vpmsumb :
1202
            PowerPC_Vec_BBB_Intrinsic<"crypto_vpmsumb">;
1203
def int_ppc_altivec_crypto_vpmsumh :
1204
            PowerPC_Vec_HHH_Intrinsic<"crypto_vpmsumh">;
1205
def int_ppc_altivec_crypto_vpmsumw :
1206
            PowerPC_Vec_WWW_Intrinsic<"crypto_vpmsumw">;
1207
def int_ppc_altivec_crypto_vpmsumd :
1208
            PowerPC_Vec_DDD_Intrinsic<"crypto_vpmsumd">;
1209
 
1210
// Absolute Difference intrinsics
1211
def int_ppc_altivec_vabsdub : PowerPC_Vec_BBB_Intrinsic<"vabsdub">;
1212
def int_ppc_altivec_vabsduh : PowerPC_Vec_HHH_Intrinsic<"vabsduh">;
1213
def int_ppc_altivec_vabsduw : PowerPC_Vec_WWW_Intrinsic<"vabsduw">;
1214
 
1215
// Vector rotates
1216
def int_ppc_altivec_vrlwnm :
1217
      PowerPC_Vec_Intrinsic<"vrlwnm", [llvm_v4i32_ty],
1218
                            [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
1219
def int_ppc_altivec_vrlwmi :
1220
      PowerPC_Vec_Intrinsic<"vrlwmi", [llvm_v4i32_ty],
1221
                            [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
1222
                            [IntrNoMem]>;
1223
def int_ppc_altivec_vrldnm :
1224
      PowerPC_Vec_Intrinsic<"vrldnm", [llvm_v2i64_ty],
1225
                            [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>;
1226
def int_ppc_altivec_vrldmi :
1227
      PowerPC_Vec_Intrinsic<"vrldmi", [llvm_v2i64_ty],
1228
                            [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
1229
                            [IntrNoMem]>;
1230
 
1231
def int_ppc_altivec_vrlqnm :
1232
      PowerPC_Vec_Intrinsic<"vrlqnm", [llvm_v1i128_ty],
1233
                           [llvm_v1i128_ty, llvm_v1i128_ty],
1234
                            [IntrNoMem]>;
1235
def int_ppc_altivec_vrlqmi :
1236
      PowerPC_Vec_Intrinsic<"vrlqmi", [llvm_v1i128_ty],
1237
                            [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
1238
                            [IntrNoMem]>;
1239
 
1240
// Vector Divide Extended Intrinsics.
1241
def int_ppc_altivec_vdivesw : PowerPC_Vec_WWW_Intrinsic<"vdivesw">;
1242
def int_ppc_altivec_vdiveuw : PowerPC_Vec_WWW_Intrinsic<"vdiveuw">;
1243
def int_ppc_altivec_vdivesd : PowerPC_Vec_DDD_Intrinsic<"vdivesd">;
1244
def int_ppc_altivec_vdiveud : PowerPC_Vec_DDD_Intrinsic<"vdiveud">;
1245
def int_ppc_altivec_vdivesq : PowerPC_Vec_QQQ_Intrinsic<"vdivesq">;
1246
def int_ppc_altivec_vdiveuq : PowerPC_Vec_QQQ_Intrinsic<"vdiveuq">;
1247
 
1248
// Vector Multiply High Intrinsics.
1249
def int_ppc_altivec_vmulhsw : PowerPC_Vec_WWW_Intrinsic<"vmulhsw">;
1250
def int_ppc_altivec_vmulhuw : PowerPC_Vec_WWW_Intrinsic<"vmulhuw">;
1251
def int_ppc_altivec_vmulhsd : PowerPC_Vec_DDD_Intrinsic<"vmulhsd">;
1252
def int_ppc_altivec_vmulhud : PowerPC_Vec_DDD_Intrinsic<"vmulhud">;
1253
 
1254
//===----------------------------------------------------------------------===//
1255
// PowerPC VSX Intrinsic Definitions.
1256
 
1257
let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
1258
 
1259
// Vector load.
1260
def int_ppc_vsx_lxvw4x :
1261
    DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
1262
                          [IntrReadMem, IntrArgMemOnly]>;
1263
def int_ppc_vsx_lxvd2x :
1264
    DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_ptr_ty],
1265
                          [IntrReadMem, IntrArgMemOnly]>;
1266
def int_ppc_vsx_lxvw4x_be :
1267
    DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty],
1268
                          [IntrReadMem, IntrArgMemOnly]>;
1269
def int_ppc_vsx_lxvd2x_be :
1270
    DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_ptr_ty],
1271
                          [IntrReadMem, IntrArgMemOnly]>;
1272
def int_ppc_vsx_lxvl :
1273
    DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_i64_ty],
1274
                          [IntrReadMem, IntrArgMemOnly]>;
1275
def int_ppc_vsx_lxvll :
1276
    DefaultAttrsIntrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_i64_ty],
1277
                          [IntrReadMem, IntrArgMemOnly]>;
1278
def int_ppc_vsx_lxvp :
1279
    DefaultAttrsIntrinsic<[llvm_v256i1_ty], [llvm_ptr_ty],
1280
                          [IntrReadMem, IntrArgMemOnly]>;
1281
 
1282
// Vector store.
1283
def int_ppc_vsx_stxvw4x : Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
1284
                                    [IntrWriteMem, IntrArgMemOnly]>;
1285
def int_ppc_vsx_stxvd2x : Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty],
1286
                                    [IntrWriteMem, IntrArgMemOnly]>;
1287
def int_ppc_vsx_stxvw4x_be : Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
1288
                                       [IntrWriteMem, IntrArgMemOnly]>;
1289
def int_ppc_vsx_stxvd2x_be : Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty],
1290
                                       [IntrWriteMem, IntrArgMemOnly]>;
1291
def int_ppc_vsx_stxvl :
1292
      Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty, llvm_i64_ty],
1293
      [IntrWriteMem, IntrArgMemOnly]>;
1294
def int_ppc_vsx_stxvll :
1295
      Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty, llvm_i64_ty],
1296
      [IntrWriteMem, IntrArgMemOnly]>;
1297
def int_ppc_vsx_stxvp :
1298
      Intrinsic<[], [llvm_v256i1_ty, llvm_ptr_ty], [IntrWriteMem,
1299
      IntrArgMemOnly]>;
1300
// Vector and scalar maximum.
1301
def int_ppc_vsx_xvmaxdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmaxdp">;
1302
def int_ppc_vsx_xvmaxsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvmaxsp">;
1303
def int_ppc_vsx_xsmaxdp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmaxdp">;
1304
 
1305
// Vector and scalar minimum.
1306
def int_ppc_vsx_xvmindp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmindp">;
1307
def int_ppc_vsx_xvminsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvminsp">;
1308
def int_ppc_vsx_xsmindp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmindp">;
1309
 
1310
// Vector divide.
1311
def int_ppc_vsx_xvdivdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvdivdp">;
1312
def int_ppc_vsx_xvdivsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvdivsp">;
1313
 
1314
// Vector round-to-infinity (ceil)
1315
def int_ppc_vsx_xvrspip :
1316
    DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1317
def int_ppc_vsx_xvrdpip :
1318
    DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
1319
 
1320
// Vector reciprocal estimate
1321
def int_ppc_vsx_xvresp : ClangBuiltin<"__builtin_vsx_xvresp">,
1322
    DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1323
def int_ppc_vsx_xvredp : ClangBuiltin<"__builtin_vsx_xvredp">,
1324
    DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
1325
 
1326
// Vector rsqrte
1327
def int_ppc_vsx_xvrsqrtesp : ClangBuiltin<"__builtin_vsx_xvrsqrtesp">,
1328
    DefaultAttrsIntrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1329
def int_ppc_vsx_xvrsqrtedp : ClangBuiltin<"__builtin_vsx_xvrsqrtedp">,
1330
    DefaultAttrsIntrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
1331
 
1332
// Vector compare
1333
def int_ppc_vsx_xvcmpeqdp :
1334
      PowerPC_VSX_Intrinsic<"xvcmpeqdp", [llvm_v2i64_ty],
1335
                            [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
1336
def int_ppc_vsx_xvcmpeqdp_p : ClangBuiltin<"__builtin_vsx_xvcmpeqdp_p">,
1337
    DefaultAttrsIntrinsic<[llvm_i32_ty],
1338
                          [llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
1339
                          [IntrNoMem]>;
1340
def int_ppc_vsx_xvcmpeqsp :
1341
      PowerPC_VSX_Intrinsic<"xvcmpeqsp", [llvm_v4i32_ty],
1342
                            [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
1343
def int_ppc_vsx_xvcmpeqsp_p : ClangBuiltin<"__builtin_vsx_xvcmpeqsp_p">,
1344
    DefaultAttrsIntrinsic<[llvm_i32_ty],
1345
                          [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
1346
                          [IntrNoMem]>;
1347
def int_ppc_vsx_xvcmpgedp :
1348
      PowerPC_VSX_Intrinsic<"xvcmpgedp", [llvm_v2i64_ty],
1349
                            [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
1350
def int_ppc_vsx_xvcmpgedp_p : ClangBuiltin<"__builtin_vsx_xvcmpgedp_p">,
1351
    DefaultAttrsIntrinsic<[llvm_i32_ty],
1352
                          [llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
1353
                          [IntrNoMem]>;
1354
def int_ppc_vsx_xvcmpgesp :
1355
      PowerPC_VSX_Intrinsic<"xvcmpgesp", [llvm_v4i32_ty],
1356
                            [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
1357
def int_ppc_vsx_xvcmpgesp_p : ClangBuiltin<"__builtin_vsx_xvcmpgesp_p">,
1358
    DefaultAttrsIntrinsic<[llvm_i32_ty],
1359
                          [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
1360
                          [IntrNoMem]>;
1361
def int_ppc_vsx_xvcmpgtdp :
1362
      PowerPC_VSX_Intrinsic<"xvcmpgtdp", [llvm_v2i64_ty],
1363
                            [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
1364
def int_ppc_vsx_xvcmpgtdp_p : ClangBuiltin<"__builtin_vsx_xvcmpgtdp_p">,
1365
    DefaultAttrsIntrinsic<[llvm_i32_ty],
1366
                          [llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
1367
                          [IntrNoMem]>;
1368
def int_ppc_vsx_xvcmpgtsp :
1369
      PowerPC_VSX_Intrinsic<"xvcmpgtsp", [llvm_v4i32_ty],
1370
                            [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
1371
def int_ppc_vsx_xvcmpgtsp_p : ClangBuiltin<"__builtin_vsx_xvcmpgtsp_p">,
1372
    DefaultAttrsIntrinsic<[llvm_i32_ty],
1373
                          [llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
1374
                          [IntrNoMem]>;
1375
def int_ppc_vsx_xxleqv :
1376
      PowerPC_VSX_Intrinsic<"xxleqv", [llvm_v4i32_ty],
1377
                            [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
1378
def int_ppc_vsx_xviexpdp :
1379
      PowerPC_VSX_Intrinsic<"xviexpdp",[llvm_v2f64_ty],
1380
                            [llvm_v2i64_ty, llvm_v2i64_ty],[IntrNoMem]>;
1381
def int_ppc_vsx_xviexpsp :
1382
      PowerPC_VSX_Intrinsic<"xviexpsp",[llvm_v4f32_ty],
1383
                            [llvm_v4i32_ty, llvm_v4i32_ty],[IntrNoMem]>;
1384
def int_ppc_vsx_xvcvdpsxws :
1385
      PowerPC_VSX_Intrinsic<"xvcvdpsxws", [llvm_v4i32_ty],
1386
                            [llvm_v2f64_ty], [IntrNoMem]>;
1387
def int_ppc_vsx_xvcvdpuxws :
1388
      PowerPC_VSX_Intrinsic<"xvcvdpuxws", [llvm_v4i32_ty],
1389
                            [llvm_v2f64_ty], [IntrNoMem]>;
1390
def int_ppc_vsx_xvcvspsxds :
1391
      PowerPC_VSX_Intrinsic<"xvcvspsxds", [llvm_v2i64_ty],
1392
                            [llvm_v4f32_ty], [IntrNoMem]>;
1393
def int_ppc_vsx_xvcvspuxds :
1394
      PowerPC_VSX_Intrinsic<"xvcvspuxds", [llvm_v2i64_ty],
1395
                            [llvm_v4f32_ty], [IntrNoMem]>;
1396
def int_ppc_vsx_xvcvsxwdp :
1397
      PowerPC_VSX_Intrinsic<"xvcvsxwdp", [llvm_v2f64_ty],
1398
                            [llvm_v4i32_ty], [IntrNoMem]>;
1399
def int_ppc_vsx_xvcvuxwdp :
1400
      PowerPC_VSX_Intrinsic<"xvcvuxwdp", [llvm_v2f64_ty],
1401
                            [llvm_v4i32_ty], [IntrNoMem]>;
1402
def int_ppc_vsx_xvcvspdp :
1403
      PowerPC_VSX_Intrinsic<"xvcvspdp", [llvm_v2f64_ty],
1404
                            [llvm_v4f32_ty], [IntrNoMem]>;
1405
def int_ppc_vsx_xvcvsxdsp :
1406
      PowerPC_VSX_Intrinsic<"xvcvsxdsp", [llvm_v4f32_ty],
1407
                            [llvm_v2i64_ty], [IntrNoMem]>;
1408
def int_ppc_vsx_xvcvuxdsp :
1409
      PowerPC_VSX_Intrinsic<"xvcvuxdsp", [llvm_v4f32_ty],
1410
                            [llvm_v2i64_ty], [IntrNoMem]>;
1411
def int_ppc_vsx_xvcvdpsp :
1412
      PowerPC_VSX_Intrinsic<"xvcvdpsp", [llvm_v4f32_ty],
1413
                            [llvm_v2f64_ty], [IntrNoMem]>;
1414
def int_ppc_vsx_xvcvsphp :
1415
      PowerPC_VSX_Intrinsic<"xvcvsphp", [llvm_v4f32_ty],
1416
                            [llvm_v4f32_ty], [IntrNoMem]>;
1417
def int_ppc_vsx_xvxexpdp :
1418
      PowerPC_VSX_Intrinsic<"xvxexpdp", [llvm_v2i64_ty],
1419
                            [llvm_v2f64_ty], [IntrNoMem]>;
1420
def int_ppc_vsx_xvxexpsp :
1421
      PowerPC_VSX_Intrinsic<"xvxexpsp", [llvm_v4i32_ty],
1422
                            [llvm_v4f32_ty], [IntrNoMem]>;
1423
def int_ppc_vsx_xvxsigdp :
1424
      PowerPC_VSX_Intrinsic<"xvxsigdp", [llvm_v2i64_ty],
1425
                            [llvm_v2f64_ty], [IntrNoMem]>;
1426
def int_ppc_vsx_xvxsigsp :
1427
      PowerPC_VSX_Intrinsic<"xvxsigsp", [llvm_v4i32_ty],
1428
                            [llvm_v4f32_ty], [IntrNoMem]>;
1429
def int_ppc_vsx_xvtstdcdp :
1430
      PowerPC_VSX_Intrinsic<"xvtstdcdp", [llvm_v2i64_ty],
1431
                            [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1432
def int_ppc_vsx_xvtstdcsp :
1433
      PowerPC_VSX_Intrinsic<"xvtstdcsp", [llvm_v4i32_ty],
1434
                            [llvm_v4f32_ty,llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1435
def int_ppc_vsx_xvcvhpsp :
1436
      PowerPC_VSX_Intrinsic<"xvcvhpsp", [llvm_v4f32_ty],
1437
                            [llvm_v8i16_ty],[IntrNoMem]>;
1438
def int_ppc_vsx_xvcvspbf16 :
1439
      PowerPC_VSX_Intrinsic<"xvcvspbf16", [llvm_v16i8_ty],
1440
                            [llvm_v16i8_ty], [IntrNoMem]>;
1441
def int_ppc_vsx_xvcvbf16spn :
1442
      PowerPC_VSX_Intrinsic<"xvcvbf16spn", [llvm_v16i8_ty],
1443
                            [llvm_v16i8_ty], [IntrNoMem]>;
1444
def int_ppc_vsx_xxextractuw :
1445
      PowerPC_VSX_Intrinsic<"xxextractuw",[llvm_v2i64_ty],
1446
                            [llvm_v2i64_ty,llvm_i32_ty], [IntrNoMem]>;
1447
def int_ppc_vsx_xxinsertw :
1448
      PowerPC_VSX_Intrinsic<"xxinsertw",[llvm_v4i32_ty],
1449
                            [llvm_v4i32_ty,llvm_v2i64_ty,llvm_i32_ty],
1450
                            [IntrNoMem]>;
1451
def int_ppc_vsx_xvtlsbb :
1452
      PowerPC_VSX_Intrinsic<"xvtlsbb", [llvm_i32_ty],
1453
                            [llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
1454
def int_ppc_vsx_xvtdivdp :
1455
      PowerPC_VSX_Intrinsic<"xvtdivdp", [llvm_i32_ty],
1456
                            [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
1457
def int_ppc_vsx_xvtdivsp :
1458
      PowerPC_VSX_Intrinsic<"xvtdivsp", [llvm_i32_ty],
1459
                            [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
1460
def int_ppc_vsx_xvtsqrtdp :
1461
      PowerPC_VSX_Intrinsic<"xvtsqrtdp", [llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
1462
def int_ppc_vsx_xvtsqrtsp :
1463
      PowerPC_VSX_Intrinsic<"xvtsqrtsp", [llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1464
def int_ppc_vsx_xxeval :
1465
      PowerPC_VSX_Intrinsic<"xxeval", [llvm_v2i64_ty],
1466
                           [llvm_v2i64_ty, llvm_v2i64_ty,
1467
                            llvm_v2i64_ty, llvm_i32_ty],
1468
                           [IntrNoMem, ImmArg<ArgIndex<3>>]>;
1469
def int_ppc_vsx_xxgenpcvbm :
1470
      PowerPC_VSX_Intrinsic<"xxgenpcvbm", [llvm_v16i8_ty],
1471
                            [llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
1472
def int_ppc_vsx_xxgenpcvhm :
1473
      PowerPC_VSX_Intrinsic<"xxgenpcvhm", [llvm_v8i16_ty],
1474
                            [llvm_v8i16_ty, llvm_i32_ty], [IntrNoMem]>;
1475
def int_ppc_vsx_xxgenpcvwm :
1476
      PowerPC_VSX_Intrinsic<"xxgenpcvwm", [llvm_v4i32_ty],
1477
                            [llvm_v4i32_ty, llvm_i32_ty], [IntrNoMem]>;
1478
def int_ppc_vsx_xxgenpcvdm :
1479
      PowerPC_VSX_Intrinsic<"xxgenpcvdm", [llvm_v2i64_ty],
1480
                            [llvm_v2i64_ty, llvm_i32_ty], [IntrNoMem]>;
1481
 
1482
// P10 VSX Vector permute extended.
1483
def int_ppc_vsx_xxpermx : 
1484
    ClangBuiltin<"__builtin_vsx_xxpermx">,
1485
    DefaultAttrsIntrinsic<[llvm_v16i8_ty],
1486
                          [llvm_v16i8_ty,llvm_v16i8_ty,llvm_v16i8_ty,
1487
                           llvm_i32_ty],
1488
                          [IntrNoMem, ImmArg<ArgIndex<3>>]>;
1489
// P10 VSX Vector Blend Variable.
1490
def int_ppc_vsx_xxblendvb: ClangBuiltin<"__builtin_vsx_xxblendvb">,
1491
    DefaultAttrsIntrinsic<[llvm_v16i8_ty],
1492
                          [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
1493
                          [IntrNoMem]>;
1494
def int_ppc_vsx_xxblendvh: ClangBuiltin<"__builtin_vsx_xxblendvh">,
1495
    DefaultAttrsIntrinsic<[llvm_v8i16_ty],
1496
                          [llvm_v8i16_ty, llvm_v8i16_ty,llvm_v8i16_ty],
1497
                          [IntrNoMem]>;
1498
def int_ppc_vsx_xxblendvw: ClangBuiltin<"__builtin_vsx_xxblendvw">,
1499
    DefaultAttrsIntrinsic<[llvm_v4i32_ty],
1500
                          [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
1501
                          [IntrNoMem]>;
1502
def int_ppc_vsx_xxblendvd: ClangBuiltin<"__builtin_vsx_xxblendvd">,
1503
    DefaultAttrsIntrinsic<[llvm_v2i64_ty],
1504
                          [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
1505
                          [IntrNoMem]>;
1506
}
1507
 
1508
//===----------------------------------------------------------------------===//
1509
// PowerPC HTM Intrinsic Definitions.
1510
 
1511
let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
1512
 
1513
def int_ppc_tbegin : ClangBuiltin<"__builtin_tbegin">,
1514
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
1515
def int_ppc_tend : ClangBuiltin<"__builtin_tend">,
1516
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
1517
 
1518
def int_ppc_tabort : ClangBuiltin<"__builtin_tabort">,
1519
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1520
def int_ppc_tabortwc : ClangBuiltin<"__builtin_tabortwc">,
1521
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1522
def int_ppc_tabortwci : ClangBuiltin<"__builtin_tabortwci">,
1523
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1524
def int_ppc_tabortdc : ClangBuiltin<"__builtin_tabortdc">,
1525
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1526
def int_ppc_tabortdci : ClangBuiltin<"__builtin_tabortdci">,
1527
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1528
 
1529
def int_ppc_tcheck : ClangBuiltin<"__builtin_tcheck">,
1530
      Intrinsic<[llvm_i32_ty], [], []>;
1531
def int_ppc_treclaim : ClangBuiltin<"__builtin_treclaim">,
1532
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1533
def int_ppc_trechkpt : ClangBuiltin<"__builtin_trechkpt">,
1534
      Intrinsic<[llvm_i32_ty], [], []>;
1535
def int_ppc_tsr : ClangBuiltin<"__builtin_tsr">,
1536
      Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1537
 
1538
def int_ppc_get_texasr : ClangBuiltin<"__builtin_get_texasr">,
1539
      Intrinsic<[llvm_i64_ty], [], []>;
1540
def int_ppc_get_texasru : ClangBuiltin<"__builtin_get_texasru">,
1541
      Intrinsic<[llvm_i64_ty], [], []>;
1542
def int_ppc_get_tfhar : ClangBuiltin<"__builtin_get_tfhar">,
1543
      Intrinsic<[llvm_i64_ty], [], []>;
1544
def int_ppc_get_tfiar : ClangBuiltin<"__builtin_get_tfiar">,
1545
      Intrinsic<[llvm_i64_ty], [], []>;
1546
 
1547
def int_ppc_set_texasr : ClangBuiltin<"__builtin_set_texasr">,
1548
      Intrinsic<[], [llvm_i64_ty], []>;
1549
def int_ppc_set_texasru : ClangBuiltin<"__builtin_set_texasru">,
1550
      Intrinsic<[], [llvm_i64_ty], []>;
1551
def int_ppc_set_tfhar : ClangBuiltin<"__builtin_set_tfhar">,
1552
      Intrinsic<[], [llvm_i64_ty], []>;
1553
def int_ppc_set_tfiar : ClangBuiltin<"__builtin_set_tfiar">,
1554
      Intrinsic<[], [llvm_i64_ty], []>;
1555
 
1556
// Extended mnemonics
1557
def int_ppc_tendall : ClangBuiltin<"__builtin_tendall">,
1558
      Intrinsic<[llvm_i32_ty], [], []>;
1559
def int_ppc_tresume : ClangBuiltin<"__builtin_tresume">,
1560
      Intrinsic<[llvm_i32_ty], [], []>;
1561
def int_ppc_tsuspend : ClangBuiltin<"__builtin_tsuspend">,
1562
      Intrinsic<[llvm_i32_ty], [], []>;
1563
 
1564
def int_ppc_ttest : ClangBuiltin<"__builtin_ttest">,
1565
      Intrinsic<[llvm_i64_ty], [], []>;
1566
 
1567
// We currently use llvm.ppc.cfence in the context of atomic load which
1568
// in LLVM IR requires its type to be one of integer, pointer and
1569
// float point type. So llvm_any_ty here refers to type mentioned above.
1570
// Backend is supposed to lower these types to appropriate MVTs.
1571
def int_ppc_cfence : Intrinsic<[], [llvm_any_ty], []>;
1572
 
1573
// PowerPC set FPSCR Intrinsic Definitions.
1574
def int_ppc_setrnd : ClangBuiltin<"__builtin_setrnd">,
1575
      Intrinsic<[llvm_double_ty], [llvm_i32_ty], []>;
1576
}
1577
 
1578
let TargetPrefix = "ppc" in {
1579
  def int_ppc_vsx_assemble_pair :
1580
      DefaultAttrsIntrinsic<[llvm_v256i1_ty],
1581
                            [llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
1582
 
1583
  def int_ppc_vsx_disassemble_pair :
1584
      DefaultAttrsIntrinsic<[llvm_v16i8_ty, llvm_v16i8_ty],
1585
                            [llvm_v256i1_ty], [IntrNoMem]>;
1586
 
1587
  def int_ppc_mma_assemble_acc :
1588
      DefaultAttrsIntrinsic<[llvm_v512i1_ty],
1589
                            [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty,
1590
                             llvm_v16i8_ty], [IntrNoMem]>;
1591
 
1592
  def int_ppc_mma_disassemble_acc :
1593
      DefaultAttrsIntrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty,
1594
                             llvm_v16i8_ty], [llvm_v512i1_ty], [IntrNoMem]>;
1595
 
1596
  def int_ppc_mma_xxmtacc :
1597
      DefaultAttrsIntrinsic<[llvm_v512i1_ty], [llvm_v512i1_ty], [IntrNoMem]>;
1598
 
1599
  def int_ppc_mma_xxmfacc :
1600
      DefaultAttrsIntrinsic<[llvm_v512i1_ty], [llvm_v512i1_ty], [IntrNoMem]>;
1601
 
1602
  def int_ppc_mma_xxsetaccz :
1603
      DefaultAttrsIntrinsic<[llvm_v512i1_ty], [], [IntrNoMem]>;
1604
 
1605
  // MMA Reduced-Precision: Outer Product Intrinsic Definitions.
1606
  defm int_ppc_mma_xvi4ger8 :
1607
        PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1608
  defm int_ppc_mma_pmxvi4ger8 :
1609
        PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
1610
                                      llvm_i32_ty, llvm_i32_ty]>;
1611
 
1612
  defm int_ppc_mma_xvi8ger4 :
1613
       PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1614
  defm int_ppc_mma_pmxvi8ger4 :
1615
       PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
1616
                                     llvm_i32_ty, llvm_i32_ty]>;
1617
 
1618
  defm int_ppc_mma_xvi16ger2s :
1619
       PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1620
  defm int_ppc_mma_pmxvi16ger2s :
1621
       PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
1622
                                     llvm_i32_ty, llvm_i32_ty]>;
1623
 
1624
  defm int_ppc_mma_xvf16ger2 :
1625
       PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1626
  defm int_ppc_mma_pmxvf16ger2 :
1627
       PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
1628
                                  llvm_i32_ty, llvm_i32_ty]>;
1629
  defm int_ppc_mma_xvf32ger :
1630
       PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1631
  defm int_ppc_mma_pmxvf32ger :
1632
       PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
1633
                                  llvm_i32_ty]>;
1634
  defm int_ppc_mma_xvf64ger :
1635
       PowerPC_MMA_ACC_Intrinsic<[llvm_v256i1_ty, llvm_v16i8_ty]>;
1636
  defm int_ppc_mma_pmxvf64ger :
1637
       PowerPC_MMA_ACC_Intrinsic<[llvm_v256i1_ty, llvm_v16i8_ty, llvm_i32_ty,
1638
                                  llvm_i32_ty]>;
1639
 
1640
  // MMA Reduced-Precision: bfloat16 Outer Product Intrinsic Definitions.
1641
  defm int_ppc_mma_xvbf16ger2 :
1642
         PowerPC_MMA_ACC_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1643
  defm int_ppc_mma_pmxvbf16ger2 :
1644
         PowerPC_MMA_ACC_Intrinsic<
1645
           [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
1646
 
1647
  // MMA Reduced-Precision: Missing Integer-based Outer Product Operations.
1648
  defm int_ppc_mma_xvi16ger2 :
1649
         PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty]>;
1650
  defm int_ppc_mma_pmxvi16ger2 :
1651
         PowerPC_MMA_ACC_PP_Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty,
1652
                                       llvm_i32_ty, llvm_i32_ty]>;
1653
  def int_ppc_mma_xvi8ger4spp :
1654
      DefaultAttrsIntrinsic<[llvm_v512i1_ty],
1655
                            [llvm_v512i1_ty, llvm_v16i8_ty, llvm_v16i8_ty],
1656
                            [IntrNoMem]>;
1657
  def int_ppc_mma_pmxvi8ger4spp :
1658
      DefaultAttrsIntrinsic<[llvm_v512i1_ty],
1659
                            [llvm_v512i1_ty, llvm_v16i8_ty, llvm_v16i8_ty,
1660
                             llvm_i32_ty, llvm_i32_ty, llvm_i32_ty],
1661
                            [IntrNoMem]>;
1662
}
1663
 
1664
// XL Compat intrinsics.
1665
let TargetPrefix = "ppc" in {
1666
  def int_ppc_dcbfl : ClangBuiltin<"__builtin_ppc_dcbfl">,
1667
                      Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
1668
  def int_ppc_dcbflp : ClangBuiltin<"__builtin_ppc_dcbflp">,
1669
                       Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
1670
  def int_ppc_dcbst : ClangBuiltin<"__builtin_ppc_dcbst">,
1671
                      Intrinsic<[], [llvm_ptr_ty], []>;
1672
  def int_ppc_dcbt  : ClangBuiltin<"__builtin_ppc_dcbt">,
1673
                      Intrinsic<[], [llvm_ptr_ty],
1674
    [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
1675
  def int_ppc_dcbtst : ClangBuiltin<"__builtin_ppc_dcbtst">,
1676
                       Intrinsic<[], [llvm_ptr_ty],
1677
    [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
1678
  def int_ppc_dcbz  : ClangBuiltin<"__builtin_ppc_dcbz">,
1679
                      Intrinsic<[], [llvm_ptr_ty], []>;
1680
  def int_ppc_icbt : ClangBuiltin<"__builtin_ppc_icbt">,
1681
                     Intrinsic<[], [llvm_ptr_ty], []>;
1682
 
1683
  // Population Count in each Byte.
1684
  def int_ppc_popcntb :
1685
      DefaultAttrsIntrinsic<[llvm_anyint_ty], [llvm_anyint_ty], [IntrNoMem]>;
1686
 
1687
  // sync instruction (i.e. sync 0, a.k.a hwsync)
1688
  def int_ppc_sync : ClangBuiltin<"__builtin_ppc_sync">,
1689
                     Intrinsic<[], [], []>;
1690
  def int_ppc_iospace_sync : ClangBuiltin<"__builtin_ppc_iospace_sync">,
1691
                             Intrinsic<[], [], []>;
1692
  // isync instruction
1693
  def int_ppc_isync : ClangBuiltin<"__builtin_ppc_isync">,
1694
                      Intrinsic<[], [], []>;
1695
  // lwsync is sync 1
1696
  def int_ppc_lwsync : ClangBuiltin<"__builtin_ppc_lwsync">,
1697
                       Intrinsic<[], [], []>;
1698
  def int_ppc_iospace_lwsync : ClangBuiltin<"__builtin_ppc_iospace_lwsync">,
1699
                               Intrinsic<[], [], []>;
1700
  // eieio instruction
1701
  def int_ppc_eieio : ClangBuiltin<"__builtin_ppc_eieio">,
1702
                      Intrinsic<[],[],[]>;
1703
  def int_ppc_iospace_eieio : ClangBuiltin<"__builtin_ppc_iospace_eieio">,
1704
                              Intrinsic<[],[],[]>;
1705
  def int_ppc_stdcx :
1706
    ClangBuiltin<"__builtin_ppc_stdcx">,
1707
    Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i64_ty],
1708
              [IntrWriteMem, IntrArgMemOnly, IntrNoDuplicate]>;
1709
  def int_ppc_stwcx :
1710
    ClangBuiltin<"__builtin_ppc_stwcx">,
1711
    Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
1712
              [IntrWriteMem, IntrArgMemOnly]>;
1713
  def int_ppc_sthcx :
1714
    Intrinsic<[llvm_i32_ty], [ llvm_ptr_ty, llvm_i32_ty ],
1715
              [IntrWriteMem, IntrArgMemOnly, IntrNoDuplicate]>;
1716
  def int_ppc_stbcx :
1717
    ClangBuiltin<"__builtin_ppc_stbcx">,
1718
    Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty],
1719
              [IntrWriteMem, IntrArgMemOnly, IntrNoDuplicate]>;
1720
  def int_ppc_dcbtstt : ClangBuiltin<"__builtin_ppc_dcbtstt">,
1721
                        Intrinsic<[], [llvm_ptr_ty],
1722
                                  [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
1723
  def int_ppc_dcbtt : ClangBuiltin<"__builtin_ppc_dcbtt">,
1724
                      Intrinsic<[], [llvm_ptr_ty],
1725
                                [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
1726
  def int_ppc_mftbu : ClangBuiltin<"__builtin_ppc_mftbu">,
1727
      DefaultAttrsIntrinsic<[llvm_i32_ty], [], [IntrNoMem]>;
1728
  def int_ppc_mfmsr : ClangBuiltin<"__builtin_ppc_mfmsr">,
1729
      DefaultAttrsIntrinsic<[llvm_i32_ty], [], [IntrNoMem]>;
1730
  def int_ppc_mfspr
1731
      : Intrinsic<[llvm_anyint_ty], [llvm_i32_ty], [ImmArg<ArgIndex<0>>]>;
1732
  def int_ppc_mtmsr
1733
      : ClangBuiltin<"__builtin_ppc_mtmsr">, Intrinsic<[], [llvm_i32_ty], []>;
1734
  def int_ppc_mtspr
1735
      : Intrinsic<[], [llvm_i32_ty, llvm_anyint_ty], [ImmArg<ArgIndex<0>>]>;
1736
  def int_ppc_stfiw : ClangBuiltin<"__builtin_ppc_stfiw">,
1737
                      Intrinsic<[], [llvm_ptr_ty, llvm_double_ty],
1738
                                [IntrWriteMem]>;
1739
  // compare
1740
  def int_ppc_cmpeqb
1741
      : ClangBuiltin<"__builtin_ppc_cmpeqb">,
1742
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
1743
                              [IntrNoMem]>;
1744
  def int_ppc_cmprb
1745
      : ClangBuiltin<"__builtin_ppc_cmprb">,
1746
        DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty,
1747
                              llvm_i32_ty], [IntrNoMem, ImmArg<ArgIndex<0>>]>;
1748
  def int_ppc_setb
1749
      : ClangBuiltin<"__builtin_ppc_setb">,
1750
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
1751
                              [IntrNoMem]>;
1752
  def int_ppc_cmpb
1753
      : DefaultAttrsIntrinsic<[llvm_anyint_ty],
1754
                              [llvm_anyint_ty, llvm_anyint_ty], [IntrNoMem]>;
1755
  // multiply
1756
  def int_ppc_mulhd
1757
      : ClangBuiltin<"__builtin_ppc_mulhd">,
1758
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
1759
                              [IntrNoMem]>;
1760
  def int_ppc_mulhdu
1761
      : ClangBuiltin<"__builtin_ppc_mulhdu">,
1762
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
1763
                              [IntrNoMem]>;
1764
  def int_ppc_mulhw
1765
      : ClangBuiltin<"__builtin_ppc_mulhw">,
1766
        DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
1767
                              [IntrNoMem]>;
1768
  def int_ppc_mulhwu
1769
      : ClangBuiltin<"__builtin_ppc_mulhwu">,
1770
        DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
1771
                              [IntrNoMem]>;
1772
  def int_ppc_maddhd
1773
      : ClangBuiltin<"__builtin_ppc_maddhd">,
1774
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty,
1775
                               llvm_i64_ty], [IntrNoMem]>;
1776
  def int_ppc_maddhdu
1777
      : ClangBuiltin<"__builtin_ppc_maddhdu">,
1778
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty,
1779
                               llvm_i64_ty], [IntrNoMem]>;
1780
  def int_ppc_maddld
1781
      : ClangBuiltin<"__builtin_ppc_maddld">,
1782
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty,
1783
                               llvm_i64_ty], [IntrNoMem]>;
1784
  // load
1785
  def int_ppc_load2r
1786
      : DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_ptr_ty],
1787
                              [IntrReadMem, IntrArgMemOnly]>;
1788
  def int_ppc_load4r
1789
      : ClangBuiltin<"__builtin_ppc_load4r">,
1790
        DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_ptr_ty],
1791
                              [IntrReadMem, IntrArgMemOnly]>;
1792
  def int_ppc_load8r
1793
      : ClangBuiltin<"__builtin_ppc_load8r">,
1794
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_ptr_ty],
1795
                              [IntrReadMem, IntrArgMemOnly]>;
1796
  // store
1797
  def int_ppc_store2r
1798
      : ClangBuiltin<"__builtin_ppc_store2r">,
1799
        Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], [IntrWriteMem]>;
1800
  def int_ppc_store4r
1801
      : ClangBuiltin<"__builtin_ppc_store4r">,
1802
        Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], [IntrWriteMem]>;
1803
  def int_ppc_store8r
1804
      : ClangBuiltin<"__builtin_ppc_store8r">,
1805
        Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty], [IntrWriteMem]>;
1806
  def int_ppc_insert_exp
1807
      : ClangBuiltin<"__builtin_ppc_insert_exp">,
1808
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty, llvm_i64_ty],
1809
                              [IntrNoMem]>;
1810
  def int_ppc_extract_exp
1811
      : ClangBuiltin<"__builtin_ppc_extract_exp">,
1812
        DefaultAttrsIntrinsic<[llvm_i32_ty], [llvm_double_ty], [IntrNoMem]>;
1813
  def int_ppc_extract_sig
1814
      : ClangBuiltin<"__builtin_ppc_extract_sig">,
1815
        DefaultAttrsIntrinsic<[llvm_i64_ty], [llvm_double_ty], [IntrNoMem]>;
1816
  def int_ppc_mtfsb0
1817
      : ClangBuiltin<"__builtin_ppc_mtfsb0">,
1818
        DefaultAttrsIntrinsic<[], [llvm_i32_ty],
1819
                              [IntrNoMem, IntrHasSideEffects,
1820
                               ImmArg<ArgIndex<0>>]>;
1821
  def int_ppc_mtfsb1
1822
      : ClangBuiltin<"__builtin_ppc_mtfsb1">,
1823
        DefaultAttrsIntrinsic<[], [llvm_i32_ty],
1824
                              [IntrNoMem, IntrHasSideEffects,
1825
                               ImmArg<ArgIndex<0>>]>;
1826
  def int_ppc_mtfsf :
1827
        DefaultAttrsIntrinsic<[], [llvm_i32_ty, llvm_double_ty],
1828
                              [IntrNoMem, IntrHasSideEffects,
1829
                               ImmArg<ArgIndex<0>>]>;
1830
  def int_ppc_mtfsfi
1831
      : ClangBuiltin<"__builtin_ppc_mtfsfi">,
1832
        DefaultAttrsIntrinsic<[], [llvm_i32_ty, llvm_i32_ty],
1833
                              [IntrNoMem, IntrHasSideEffects,
1834
                               ImmArg<ArgIndex<0>>,ImmArg<ArgIndex<1>>]>;
1835
  def int_ppc_fmsub
1836
      : ClangBuiltin<"__builtin_ppc_fmsub">,
1837
        DefaultAttrsIntrinsic<[llvm_double_ty],
1838
                              [llvm_double_ty, llvm_double_ty, llvm_double_ty],
1839
                              [IntrNoMem]>;
1840
  def int_ppc_fmsubs
1841
      : ClangBuiltin<"__builtin_ppc_fmsubs">,
1842
        DefaultAttrsIntrinsic<[llvm_float_ty],
1843
                              [llvm_float_ty, llvm_float_ty, llvm_float_ty],
1844
                              [IntrNoMem]>;
1845
  def int_ppc_fnmadd
1846
      : ClangBuiltin<"__builtin_ppc_fnmadd">,
1847
        DefaultAttrsIntrinsic<[llvm_double_ty],
1848
                              [llvm_double_ty, llvm_double_ty, llvm_double_ty],
1849
                              [IntrNoMem]>;
1850
  def int_ppc_fnmadds
1851
      : ClangBuiltin<"__builtin_ppc_fnmadds">,
1852
        DefaultAttrsIntrinsic<[llvm_float_ty],
1853
                              [llvm_float_ty, llvm_float_ty, llvm_float_ty],
1854
                              [IntrNoMem]>;
1855
  def int_ppc_fnmsub
1856
      : DefaultAttrsIntrinsic<[llvm_anyfloat_ty],
1857
                              [LLVMMatchType<0>, LLVMMatchType<0>,
1858
                               LLVMMatchType<0>],
1859
                              [IntrNoMem]>;
1860
  def int_ppc_fre
1861
      : ClangBuiltin<"__builtin_ppc_fre">,
1862
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
1863
  def int_ppc_fres
1864
      : ClangBuiltin<"__builtin_ppc_fres">,
1865
        DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
1866
  def int_ppc_addex
1867
      : ClangBuiltin<"__builtin_ppc_addex">,
1868
        Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty, llvm_i32_ty],
1869
                  [IntrNoMem, IntrHasSideEffects, ImmArg<ArgIndex<2>>]>;
1870
  def int_ppc_fsel : ClangBuiltin<"__builtin_ppc_fsel">,
1871
      DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty, llvm_double_ty, 
1872
                             llvm_double_ty], [IntrNoMem]>;
1873
  def int_ppc_fsels : ClangBuiltin<"__builtin_ppc_fsels">,
1874
      DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty, llvm_float_ty,
1875
                             llvm_float_ty], [IntrNoMem]>;
1876
  def int_ppc_frsqrte : ClangBuiltin<"__builtin_ppc_frsqrte">,
1877
      DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
1878
  def int_ppc_frsqrtes : ClangBuiltin<"__builtin_ppc_frsqrtes">,
1879
      DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
1880
  def int_ppc_compare_exp_uo : ClangBuiltin<"__builtin_ppc_compare_exp_uo">,
1881
      DefaultAttrsIntrinsic<[llvm_i32_ty],
1882
                            [llvm_double_ty, llvm_double_ty],
1883
                            [IntrNoMem]>;
1884
  def int_ppc_compare_exp_lt : ClangBuiltin<"__builtin_ppc_compare_exp_lt">,
1885
      DefaultAttrsIntrinsic<[llvm_i32_ty], 
1886
                            [llvm_double_ty, llvm_double_ty],
1887
                            [IntrNoMem]>;
1888
  def int_ppc_compare_exp_gt : ClangBuiltin<"__builtin_ppc_compare_exp_gt">,
1889
      DefaultAttrsIntrinsic<[llvm_i32_ty],
1890
                            [llvm_double_ty, llvm_double_ty],
1891
                            [IntrNoMem]>;
1892
  def int_ppc_compare_exp_eq : ClangBuiltin<"__builtin_ppc_compare_exp_eq">,
1893
      DefaultAttrsIntrinsic<[llvm_i32_ty], 
1894
                            [llvm_double_ty, llvm_double_ty],
1895
                            [IntrNoMem]>;
1896
  def int_ppc_test_data_class : Intrinsic<[llvm_i32_ty],
1897
                                          [llvm_anyfloat_ty, llvm_i32_ty],
1898
                                          [IntrNoMem, ImmArg<ArgIndex<1>>]>;
1899
  def int_ppc_fnabs
1900
      : ClangBuiltin<"__builtin_ppc_fnabs">,
1901
        DefaultAttrsIntrinsic<[llvm_double_ty], [llvm_double_ty], [IntrNoMem]>;
1902
  def int_ppc_fnabss
1903
      : ClangBuiltin<"__builtin_ppc_fnabss">,
1904
        DefaultAttrsIntrinsic<[llvm_float_ty], [llvm_float_ty], [IntrNoMem]>;
1905
 
1906
  def int_ppc_convert_f128_to_ppcf128
1907
      : DefaultAttrsIntrinsic<[llvm_ppcf128_ty], [llvm_f128_ty], [IntrNoMem]>;
1908
  def int_ppc_convert_ppcf128_to_f128
1909
      : DefaultAttrsIntrinsic<[llvm_f128_ty], [llvm_ppcf128_ty], [IntrNoMem]>;
1910
}
1911
 
1912
//===----------------------------------------------------------------------===//
1913
// PowerPC Atomic Intrinsic Definitions.
1914
let TargetPrefix = "ppc" in {
1915
  class AtomicRMW128Intrinsic
1916
    : Intrinsic<[llvm_i64_ty, llvm_i64_ty],
1917
                [llvm_ptr_ty, llvm_i64_ty, llvm_i64_ty],
1918
                [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
1919
  def int_ppc_atomicrmw_xchg_i128 : AtomicRMW128Intrinsic;
1920
  def int_ppc_atomicrmw_add_i128  : AtomicRMW128Intrinsic;
1921
  def int_ppc_atomicrmw_sub_i128  : AtomicRMW128Intrinsic;
1922
  def int_ppc_atomicrmw_and_i128  : AtomicRMW128Intrinsic;
1923
  def int_ppc_atomicrmw_or_i128   : AtomicRMW128Intrinsic;
1924
  def int_ppc_atomicrmw_xor_i128  : AtomicRMW128Intrinsic;
1925
  def int_ppc_atomicrmw_nand_i128 : AtomicRMW128Intrinsic;
1926
  def int_ppc_cmpxchg_i128 : Intrinsic<[llvm_i64_ty, llvm_i64_ty],
1927
                                       [llvm_ptr_ty,
1928
                                        llvm_i64_ty, llvm_i64_ty,
1929
                                        llvm_i64_ty, llvm_i64_ty],
1930
                                       [IntrArgMemOnly, NoCapture<ArgIndex<0>>]>;
1931
  def int_ppc_atomic_load_i128 :
1932
    Intrinsic<[llvm_i64_ty, llvm_i64_ty],
1933
              [llvm_ptr_ty],
1934
              [IntrArgMemOnly, IntrReadMem, NoCapture<ArgIndex<0>>]>;
1935
  def int_ppc_atomic_store_i128 :
1936
    Intrinsic<[], [llvm_i64_ty, llvm_i64_ty, llvm_ptr_ty],
1937
              [IntrArgMemOnly, IntrWriteMem, NoCapture<ArgIndex<2>>]>;
1938
}