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