Recommit [NFC] Better encapsulation of llvm::Optional Storage
[llvm-complete.git] / include / llvm / IR / IntrinsicsPowerPC.td
blobe6b08842015e1171eba9f3c4da0b59eca05bc014
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.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 // Definitions for all PowerPC intrinsics.
17 // Non-altivec intrinsics.
18 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
19   // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions.
20   def int_ppc_dcba  : Intrinsic<[], [llvm_ptr_ty], []>;
21   def int_ppc_dcbf  : Intrinsic<[], [llvm_ptr_ty], []>;
22   def int_ppc_dcbi  : Intrinsic<[], [llvm_ptr_ty], []>;
23   def int_ppc_dcbst : Intrinsic<[], [llvm_ptr_ty], []>;
24   def int_ppc_dcbt  : Intrinsic<[], [llvm_ptr_ty],
25     [IntrArgMemOnly, NoCapture<0>]>;
26   def int_ppc_dcbtst: Intrinsic<[], [llvm_ptr_ty],
27     [IntrArgMemOnly, NoCapture<0>]>;
28   def int_ppc_dcbz  : Intrinsic<[], [llvm_ptr_ty], []>;
29   def int_ppc_dcbzl : Intrinsic<[], [llvm_ptr_ty], []>;
31   // sync instruction (i.e. sync 0, a.k.a hwsync)
32   def int_ppc_sync : Intrinsic<[], [], []>;
33   // lwsync is sync 1
34   def int_ppc_lwsync : Intrinsic<[], [], []>;
36   // Intrinsics used to generate ctr-based loops. These should only be
37   // generated by the PowerPC backend!
38   // The branch intrinsic is marked as NoDuplicate because loop rotation will
39   // attempt to duplicate it forming loops where a block reachable from one
40   // instance of it can contain another.
41   def int_ppc_mtctr : Intrinsic<[], [llvm_anyint_ty], []>;
42   def int_ppc_is_decremented_ctr_nonzero :
43     Intrinsic<[llvm_i1_ty], [], [IntrNoDuplicate]>;
45   // Intrinsics for [double]word extended forms of divide instructions
46   def int_ppc_divwe : GCCBuiltin<"__builtin_divwe">,
47                       Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
48                                 [IntrNoMem]>;
49   def int_ppc_divweu : GCCBuiltin<"__builtin_divweu">,
50                        Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
51                                  [IntrNoMem]>;
52   def int_ppc_divde : GCCBuiltin<"__builtin_divde">,
53                       Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
54                                 [IntrNoMem]>;
55   def int_ppc_divdeu : GCCBuiltin<"__builtin_divdeu">,
56                        Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
57                                  [IntrNoMem]>;
59   // Bit permute doubleword
60   def int_ppc_bpermd : GCCBuiltin<"__builtin_bpermd">,
61                        Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
62                                  [IntrNoMem]>;
64   def int_ppc_truncf128_round_to_odd
65       : GCCBuiltin<"__builtin_truncf128_round_to_odd">,
66         Intrinsic <[llvm_double_ty], [llvm_f128_ty], [IntrNoMem]>;
67   def int_ppc_sqrtf128_round_to_odd
68       : GCCBuiltin<"__builtin_sqrtf128_round_to_odd">,
69         Intrinsic <[llvm_f128_ty], [llvm_f128_ty], [IntrNoMem]>;
70   def int_ppc_addf128_round_to_odd
71       : GCCBuiltin<"__builtin_addf128_round_to_odd">,
72         Intrinsic <[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty], [IntrNoMem]>;
73   def int_ppc_subf128_round_to_odd
74       : GCCBuiltin<"__builtin_subf128_round_to_odd">,
75         Intrinsic <[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty], [IntrNoMem]>;
76   def int_ppc_mulf128_round_to_odd
77       : GCCBuiltin<"__builtin_mulf128_round_to_odd">,
78         Intrinsic <[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty], [IntrNoMem]>;
79   def int_ppc_divf128_round_to_odd
80       : GCCBuiltin<"__builtin_divf128_round_to_odd">,
81         Intrinsic <[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty], [IntrNoMem]>;
82   def int_ppc_fmaf128_round_to_odd
83       : GCCBuiltin<"__builtin_fmaf128_round_to_odd">,
84         Intrinsic <[llvm_f128_ty], [llvm_f128_ty,llvm_f128_ty,llvm_f128_ty], [IntrNoMem]>;
85   def int_ppc_scalar_extract_expq
86       : GCCBuiltin<"__builtin_vsx_scalar_extract_expq">,
87         Intrinsic <[llvm_i64_ty], [llvm_f128_ty], [IntrNoMem]>;
88   def int_ppc_scalar_insert_exp_qp
89       : GCCBuiltin<"__builtin_vsx_scalar_insert_exp_qp">,
90         Intrinsic <[llvm_f128_ty], [llvm_f128_ty, llvm_i64_ty], [IntrNoMem]>;
95 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
96   /// PowerPC_Vec_Intrinsic - Base class for all altivec intrinsics.
97   class PowerPC_Vec_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
98                               list<LLVMType> param_types,
99                               list<IntrinsicProperty> properties>
100     : GCCBuiltin<!strconcat("__builtin_altivec_", GCCIntSuffix)>,
101       Intrinsic<ret_types, param_types, properties>;
103   /// PowerPC_VSX_Intrinsic - Base class for all VSX intrinsics.
104   class PowerPC_VSX_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
105                               list<LLVMType> param_types,
106                               list<IntrinsicProperty> properties>
107     : GCCBuiltin<!strconcat("__builtin_vsx_", GCCIntSuffix)>,
108       Intrinsic<ret_types, param_types, properties>;
111 //===----------------------------------------------------------------------===//
112 // PowerPC Altivec Intrinsic Class Definitions.
115 /// PowerPC_Vec_FF_Intrinsic - A PowerPC intrinsic that takes one v4f32
116 /// vector and returns one.  These intrinsics have no side effects.
117 class PowerPC_Vec_FF_Intrinsic<string GCCIntSuffix>
118   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
119                           [llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
121 /// PowerPC_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
122 /// vectors and returns one.  These intrinsics have no side effects.
123 class PowerPC_Vec_FFF_Intrinsic<string GCCIntSuffix>
124   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
125                           [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
126                           [IntrNoMem]>;
128 /// PowerPC_Vec_BBB_Intrinsic - A PowerPC intrinsic that takes two v16i8
129 /// vectors and returns one.  These intrinsics have no side effects.
130 class PowerPC_Vec_BBB_Intrinsic<string GCCIntSuffix>
131   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
132                           [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
133                           [IntrNoMem]>;
135 /// PowerPC_Vec_HHH_Intrinsic - A PowerPC intrinsic that takes two v8i16
136 /// vectors and returns one.  These intrinsics have no side effects.
137 class PowerPC_Vec_HHH_Intrinsic<string GCCIntSuffix>
138   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
139                           [llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
140                           [IntrNoMem]>;
142 /// PowerPC_Vec_WWW_Intrinsic - A PowerPC intrinsic that takes two v4i32
143 /// vectors and returns one.  These intrinsics have no side effects.
144 class PowerPC_Vec_WWW_Intrinsic<string GCCIntSuffix>
145   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
146                           [llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
147                           [IntrNoMem]>;
149 /// PowerPC_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2i64
150 /// vectors and returns one.  These intrinsics have no side effects.
151 class PowerPC_Vec_DDD_Intrinsic<string GCCIntSuffix>
152   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
153                           [llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
154                           [IntrNoMem]>;
156 /// PowerPC_Vec_QQQ_Intrinsic - A PowerPC intrinsic that takes two v1i128
157 /// vectors and returns one. These intrinsics have no side effects.
158 class PowerPC_Vec_QQQ_Intrinsic<string GCCIntSuffix>
159   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
160                          [llvm_v1i128_ty], [llvm_v1i128_ty, llvm_v1i128_ty],
161                          [IntrNoMem]>;
163 //===----------------------------------------------------------------------===//
164 // PowerPC VSX Intrinsic Class Definitions.
167 /// PowerPC_VSX_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2f64
168 /// vectors and returns one.  These intrinsics have no side effects.
169 class PowerPC_VSX_Vec_DDD_Intrinsic<string GCCIntSuffix>
170   : PowerPC_VSX_Intrinsic<GCCIntSuffix,
171                           [llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty],
172                           [IntrNoMem]>;
174 /// PowerPC_VSX_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
175 /// vectors and returns one.  These intrinsics have no side effects.
176 class PowerPC_VSX_Vec_FFF_Intrinsic<string GCCIntSuffix>
177   : PowerPC_VSX_Intrinsic<GCCIntSuffix,
178                           [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
179                           [IntrNoMem]>;
181 /// PowerPC_VSX_Sca_DDD_Intrinsic - A PowerPC intrinsic that takes two f64
182 /// scalars and returns one.  These intrinsics have no side effects.
183 class PowerPC_VSX_Sca_DDD_Intrinsic<string GCCIntSuffix>
184   : PowerPC_VSX_Intrinsic<GCCIntSuffix,
185                           [llvm_double_ty], [llvm_double_ty, llvm_double_ty],
186                           [IntrNoMem]>;
188 //===----------------------------------------------------------------------===//
189 // PowerPC Altivec Intrinsic Definitions.
191 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
192   // Data Stream Control.
193   def int_ppc_altivec_dss : GCCBuiltin<"__builtin_altivec_dss">,
194               Intrinsic<[], [llvm_i32_ty], []>;
195   def int_ppc_altivec_dssall : GCCBuiltin<"__builtin_altivec_dssall">,
196               Intrinsic<[], [], []>;
197   def int_ppc_altivec_dst : GCCBuiltin<"__builtin_altivec_dst">,
198               Intrinsic<[],
199                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
200                         []>;
201   def int_ppc_altivec_dstt : GCCBuiltin<"__builtin_altivec_dstt">,
202               Intrinsic<[],
203                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
204                         []>;
205   def int_ppc_altivec_dstst : GCCBuiltin<"__builtin_altivec_dstst">,
206               Intrinsic<[],
207                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
208                         []>;
209   def int_ppc_altivec_dststt : GCCBuiltin<"__builtin_altivec_dststt">,
210               Intrinsic<[],
211                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
212                         []>;
214   // VSCR access.
215   def int_ppc_altivec_mfvscr : GCCBuiltin<"__builtin_altivec_mfvscr">,
216               Intrinsic<[llvm_v8i16_ty], [], [IntrReadMem]>;
217   def int_ppc_altivec_mtvscr : GCCBuiltin<"__builtin_altivec_mtvscr">,
218               Intrinsic<[], [llvm_v4i32_ty], []>;
221   // Loads.  These don't map directly to GCC builtins because they represent the
222   // source address with a single pointer.
223   def int_ppc_altivec_lvx :
224               Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
225   def int_ppc_altivec_lvxl :
226               Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
227   def int_ppc_altivec_lvebx :
228               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
229   def int_ppc_altivec_lvehx :
230               Intrinsic<[llvm_v8i16_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
231   def int_ppc_altivec_lvewx :
232               Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
234   // Stores.  These don't map directly to GCC builtins because they represent the
235   // source address with a single pointer.
236   def int_ppc_altivec_stvx :
237               Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
238                         [IntrWriteMem, IntrArgMemOnly]>;
239   def int_ppc_altivec_stvxl :
240               Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
241                         [IntrWriteMem, IntrArgMemOnly]>;
242   def int_ppc_altivec_stvebx :
243               Intrinsic<[], [llvm_v16i8_ty, llvm_ptr_ty],
244                         [IntrWriteMem, IntrArgMemOnly]>;
245   def int_ppc_altivec_stvehx :
246               Intrinsic<[], [llvm_v8i16_ty, llvm_ptr_ty],
247                         [IntrWriteMem, IntrArgMemOnly]>;
248   def int_ppc_altivec_stvewx :
249               Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
250                         [IntrWriteMem, IntrArgMemOnly]>;
252   // Comparisons setting a vector.
253   def int_ppc_altivec_vcmpbfp : GCCBuiltin<"__builtin_altivec_vcmpbfp">,
254               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
255                         [IntrNoMem]>;
256   def int_ppc_altivec_vcmpeqfp : GCCBuiltin<"__builtin_altivec_vcmpeqfp">,
257               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
258                         [IntrNoMem]>;
259   def int_ppc_altivec_vcmpgefp : GCCBuiltin<"__builtin_altivec_vcmpgefp">,
260               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
261                         [IntrNoMem]>;
262   def int_ppc_altivec_vcmpgtfp : GCCBuiltin<"__builtin_altivec_vcmpgtfp">,
263               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
264                         [IntrNoMem]>;
266   def int_ppc_altivec_vcmpequd : GCCBuiltin<"__builtin_altivec_vcmpequd">,
267               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
268                         [IntrNoMem]>;
269   def int_ppc_altivec_vcmpgtsd : GCCBuiltin<"__builtin_altivec_vcmpgtsd">,
270               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
271                         [IntrNoMem]>;
272   def int_ppc_altivec_vcmpgtud : GCCBuiltin<"__builtin_altivec_vcmpgtud">,
273               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
274                         [IntrNoMem]>;
276   def int_ppc_altivec_vcmpequw : GCCBuiltin<"__builtin_altivec_vcmpequw">,
277               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
278                         [IntrNoMem]>;
279   def int_ppc_altivec_vcmpgtsw : GCCBuiltin<"__builtin_altivec_vcmpgtsw">,
280               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
281                         [IntrNoMem]>;
282   def int_ppc_altivec_vcmpgtuw : GCCBuiltin<"__builtin_altivec_vcmpgtuw">,
283               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
284                         [IntrNoMem]>;
285   def int_ppc_altivec_vcmpnew : GCCBuiltin<"__builtin_altivec_vcmpnew">,
286               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
287                         [IntrNoMem]>;
288   def int_ppc_altivec_vcmpnezw : GCCBuiltin<"__builtin_altivec_vcmpnezw">,
289               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
290                         [IntrNoMem]>;
292   def int_ppc_altivec_vcmpequh : GCCBuiltin<"__builtin_altivec_vcmpequh">,
293               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
294                         [IntrNoMem]>;
295   def int_ppc_altivec_vcmpgtsh : GCCBuiltin<"__builtin_altivec_vcmpgtsh">,
296               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
297                         [IntrNoMem]>;
298   def int_ppc_altivec_vcmpgtuh : GCCBuiltin<"__builtin_altivec_vcmpgtuh">,
299               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
300                         [IntrNoMem]>;
301   def int_ppc_altivec_vcmpneh : GCCBuiltin<"__builtin_altivec_vcmpneh">,
302               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
303                         [IntrNoMem]>;
304   def int_ppc_altivec_vcmpnezh : GCCBuiltin<"__builtin_altivec_vcmpnezh">,
305               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
306                         [IntrNoMem]>;
308   def int_ppc_altivec_vcmpequb : GCCBuiltin<"__builtin_altivec_vcmpequb">,
309               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
310                         [IntrNoMem]>;
311   def int_ppc_altivec_vcmpgtsb : GCCBuiltin<"__builtin_altivec_vcmpgtsb">,
312               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
313                         [IntrNoMem]>;
314   def int_ppc_altivec_vcmpgtub : GCCBuiltin<"__builtin_altivec_vcmpgtub">,
315               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
316                         [IntrNoMem]>;
317   def int_ppc_altivec_vcmpneb : GCCBuiltin<"__builtin_altivec_vcmpneb">,
318               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
319                         [IntrNoMem]>;
320   def int_ppc_altivec_vcmpnezb : GCCBuiltin<"__builtin_altivec_vcmpnezb">,
321               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
322                         [IntrNoMem]>;
324   // Predicate Comparisons.  The first operand specifies interpretation of CR6.
325   def int_ppc_altivec_vcmpbfp_p : GCCBuiltin<"__builtin_altivec_vcmpbfp_p">,
326               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
327                         [IntrNoMem]>;
328   def int_ppc_altivec_vcmpeqfp_p : GCCBuiltin<"__builtin_altivec_vcmpeqfp_p">,
329               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
330                         [IntrNoMem]>;
331   def int_ppc_altivec_vcmpgefp_p : GCCBuiltin<"__builtin_altivec_vcmpgefp_p">,
332               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
333                         [IntrNoMem]>;
334   def int_ppc_altivec_vcmpgtfp_p : GCCBuiltin<"__builtin_altivec_vcmpgtfp_p">,
335               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
336                         [IntrNoMem]>;
338   def int_ppc_altivec_vcmpequd_p : GCCBuiltin<"__builtin_altivec_vcmpequd_p">,
339               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
340                         [IntrNoMem]>;
341   def int_ppc_altivec_vcmpgtsd_p : GCCBuiltin<"__builtin_altivec_vcmpgtsd_p">,
342               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
343                         [IntrNoMem]>;
344   def int_ppc_altivec_vcmpgtud_p : GCCBuiltin<"__builtin_altivec_vcmpgtud_p">,
345               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
346                         [IntrNoMem]>;
348   def int_ppc_altivec_vcmpequw_p : GCCBuiltin<"__builtin_altivec_vcmpequw_p">,
349               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
350                         [IntrNoMem]>;
351   def int_ppc_altivec_vcmpgtsw_p : GCCBuiltin<"__builtin_altivec_vcmpgtsw_p">,
352               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
353                         [IntrNoMem]>;
354   def int_ppc_altivec_vcmpgtuw_p : GCCBuiltin<"__builtin_altivec_vcmpgtuw_p">,
355               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
356                         [IntrNoMem]>;
357   def int_ppc_altivec_vcmpnew_p : GCCBuiltin<"__builtin_altivec_vcmpnew_p">,
358               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
359                         [IntrNoMem]>;
360   def int_ppc_altivec_vcmpnezw_p : GCCBuiltin<"__builtin_altivec_vcmpnezw_p">,
361               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
362                         [IntrNoMem]>;
364   def int_ppc_altivec_vcmpequh_p : GCCBuiltin<"__builtin_altivec_vcmpequh_p">,
365               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
366                         [IntrNoMem]>;
367   def int_ppc_altivec_vcmpgtsh_p : GCCBuiltin<"__builtin_altivec_vcmpgtsh_p">,
368               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
369                         [IntrNoMem]>;
370   def int_ppc_altivec_vcmpgtuh_p : GCCBuiltin<"__builtin_altivec_vcmpgtuh_p">,
371               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
372                         [IntrNoMem]>;
373   def int_ppc_altivec_vcmpneh_p : GCCBuiltin<"__builtin_altivec_vcmpneh_p">,
374               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
375                         [IntrNoMem]>;
376   def int_ppc_altivec_vcmpnezh_p : GCCBuiltin<"__builtin_altivec_vcmpnezh_p">,
377               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
378                         [IntrNoMem]>;
380   def int_ppc_altivec_vcmpequb_p : GCCBuiltin<"__builtin_altivec_vcmpequb_p">,
381               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
382                         [IntrNoMem]>;
383   def int_ppc_altivec_vcmpgtsb_p : GCCBuiltin<"__builtin_altivec_vcmpgtsb_p">,
384               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
385                         [IntrNoMem]>;
386   def int_ppc_altivec_vcmpgtub_p : GCCBuiltin<"__builtin_altivec_vcmpgtub_p">,
387               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
388                         [IntrNoMem]>;
389   def int_ppc_altivec_vcmpneb_p : GCCBuiltin<"__builtin_altivec_vcmpneb_p">,
390               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
391                         [IntrNoMem]>;
392   def int_ppc_altivec_vcmpnezb_p : GCCBuiltin<"__builtin_altivec_vcmpnezb_p">,
393               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
394                         [IntrNoMem]>;
395   def int_ppc_altivec_vclzlsbb : GCCBuiltin<"__builtin_altivec_vclzlsbb">,
396               Intrinsic<[llvm_i32_ty],[llvm_v16i8_ty],[IntrNoMem]>;
397   def int_ppc_altivec_vctzlsbb : GCCBuiltin<"__builtin_altivec_vctzlsbb">,
398               Intrinsic<[llvm_i32_ty],[llvm_v16i8_ty],[IntrNoMem]>;
399   def int_ppc_altivec_vprtybw : GCCBuiltin<"__builtin_altivec_vprtybw">,
400               Intrinsic<[llvm_v4i32_ty],[llvm_v4i32_ty],[IntrNoMem]>;
401   def int_ppc_altivec_vprtybd : GCCBuiltin<"__builtin_altivec_vprtybd">,
402               Intrinsic<[llvm_v2i64_ty],[llvm_v2i64_ty],[IntrNoMem]>;
403   def int_ppc_altivec_vprtybq : GCCBuiltin<"__builtin_altivec_vprtybq">,
404               Intrinsic<[llvm_v1i128_ty],[llvm_v1i128_ty],[IntrNoMem]>;
408 // Vector average.
409 def int_ppc_altivec_vavgsb : PowerPC_Vec_BBB_Intrinsic<"vavgsb">;
410 def int_ppc_altivec_vavgsh : PowerPC_Vec_HHH_Intrinsic<"vavgsh">;
411 def int_ppc_altivec_vavgsw : PowerPC_Vec_WWW_Intrinsic<"vavgsw">;
412 def int_ppc_altivec_vavgub : PowerPC_Vec_BBB_Intrinsic<"vavgub">;
413 def int_ppc_altivec_vavguh : PowerPC_Vec_HHH_Intrinsic<"vavguh">;
414 def int_ppc_altivec_vavguw : PowerPC_Vec_WWW_Intrinsic<"vavguw">;
416 // Vector maximum.
417 def int_ppc_altivec_vmaxfp : PowerPC_Vec_FFF_Intrinsic<"vmaxfp">;
418 def int_ppc_altivec_vmaxsb : PowerPC_Vec_BBB_Intrinsic<"vmaxsb">;
419 def int_ppc_altivec_vmaxsh : PowerPC_Vec_HHH_Intrinsic<"vmaxsh">;
420 def int_ppc_altivec_vmaxsw : PowerPC_Vec_WWW_Intrinsic<"vmaxsw">;
421 def int_ppc_altivec_vmaxsd : PowerPC_Vec_DDD_Intrinsic<"vmaxsd">;
422 def int_ppc_altivec_vmaxub : PowerPC_Vec_BBB_Intrinsic<"vmaxub">;
423 def int_ppc_altivec_vmaxuh : PowerPC_Vec_HHH_Intrinsic<"vmaxuh">;
424 def int_ppc_altivec_vmaxuw : PowerPC_Vec_WWW_Intrinsic<"vmaxuw">;
425 def int_ppc_altivec_vmaxud : PowerPC_Vec_DDD_Intrinsic<"vmaxud">;
427 // Vector minimum.
428 def int_ppc_altivec_vminfp : PowerPC_Vec_FFF_Intrinsic<"vminfp">;
429 def int_ppc_altivec_vminsb : PowerPC_Vec_BBB_Intrinsic<"vminsb">;
430 def int_ppc_altivec_vminsh : PowerPC_Vec_HHH_Intrinsic<"vminsh">;
431 def int_ppc_altivec_vminsw : PowerPC_Vec_WWW_Intrinsic<"vminsw">;
432 def int_ppc_altivec_vminsd : PowerPC_Vec_DDD_Intrinsic<"vminsd">;
433 def int_ppc_altivec_vminub : PowerPC_Vec_BBB_Intrinsic<"vminub">;
434 def int_ppc_altivec_vminuh : PowerPC_Vec_HHH_Intrinsic<"vminuh">;
435 def int_ppc_altivec_vminuw : PowerPC_Vec_WWW_Intrinsic<"vminuw">;
436 def int_ppc_altivec_vminud : PowerPC_Vec_DDD_Intrinsic<"vminud">;
438 // Saturating adds.
439 def int_ppc_altivec_vaddubs : PowerPC_Vec_BBB_Intrinsic<"vaddubs">;
440 def int_ppc_altivec_vaddsbs : PowerPC_Vec_BBB_Intrinsic<"vaddsbs">;
441 def int_ppc_altivec_vadduhs : PowerPC_Vec_HHH_Intrinsic<"vadduhs">;
442 def int_ppc_altivec_vaddshs : PowerPC_Vec_HHH_Intrinsic<"vaddshs">;
443 def int_ppc_altivec_vadduws : PowerPC_Vec_WWW_Intrinsic<"vadduws">;
444 def int_ppc_altivec_vaddsws : PowerPC_Vec_WWW_Intrinsic<"vaddsws">;
445 def int_ppc_altivec_vaddcuw : PowerPC_Vec_WWW_Intrinsic<"vaddcuw">;
446 def int_ppc_altivec_vaddcuq : PowerPC_Vec_QQQ_Intrinsic<"vaddcuq">;
448 // Saturating subs.
449 def int_ppc_altivec_vsububs : PowerPC_Vec_BBB_Intrinsic<"vsububs">;
450 def int_ppc_altivec_vsubsbs : PowerPC_Vec_BBB_Intrinsic<"vsubsbs">;
451 def int_ppc_altivec_vsubuhs : PowerPC_Vec_HHH_Intrinsic<"vsubuhs">;
452 def int_ppc_altivec_vsubshs : PowerPC_Vec_HHH_Intrinsic<"vsubshs">;
453 def int_ppc_altivec_vsubuws : PowerPC_Vec_WWW_Intrinsic<"vsubuws">;
454 def int_ppc_altivec_vsubsws : PowerPC_Vec_WWW_Intrinsic<"vsubsws">;
455 def int_ppc_altivec_vsubcuw : PowerPC_Vec_WWW_Intrinsic<"vsubcuw">;
456 def int_ppc_altivec_vsubcuq : PowerPC_Vec_QQQ_Intrinsic<"vsubcuq">;
458 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
459   // Saturating multiply-adds.
460   def int_ppc_altivec_vmhaddshs : GCCBuiltin<"__builtin_altivec_vmhaddshs">,
461               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
462                          llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
463   def int_ppc_altivec_vmhraddshs : GCCBuiltin<"__builtin_altivec_vmhraddshs">,
464               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
465                          llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
467   def int_ppc_altivec_vmaddfp : GCCBuiltin<"__builtin_altivec_vmaddfp">,
468               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
469                          llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
470   def int_ppc_altivec_vnmsubfp : GCCBuiltin<"__builtin_altivec_vnmsubfp">,
471               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
472                          llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
474   // Vector Multiply Sum Intructions.
475   def int_ppc_altivec_vmsummbm : GCCBuiltin<"__builtin_altivec_vmsummbm">,
476             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
477                        llvm_v4i32_ty], [IntrNoMem]>;
478   def int_ppc_altivec_vmsumshm : GCCBuiltin<"__builtin_altivec_vmsumshm">,
479             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
480                        llvm_v4i32_ty], [IntrNoMem]>;
481   def int_ppc_altivec_vmsumshs : GCCBuiltin<"__builtin_altivec_vmsumshs">,
482             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
483                        llvm_v4i32_ty], [IntrNoMem]>;
484   def int_ppc_altivec_vmsumubm : GCCBuiltin<"__builtin_altivec_vmsumubm">,
485             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
486                        llvm_v4i32_ty], [IntrNoMem]>;
487   def int_ppc_altivec_vmsumuhm : GCCBuiltin<"__builtin_altivec_vmsumuhm">,
488             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
489                        llvm_v4i32_ty], [IntrNoMem]>;
490   def int_ppc_altivec_vmsumuhs : GCCBuiltin<"__builtin_altivec_vmsumuhs">,
491             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
492                        llvm_v4i32_ty], [IntrNoMem]>;
494   // Vector Multiply Intructions.
495   def int_ppc_altivec_vmulesb : GCCBuiltin<"__builtin_altivec_vmulesb">,
496           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
497                     [IntrNoMem]>;
498   def int_ppc_altivec_vmulesh : GCCBuiltin<"__builtin_altivec_vmulesh">,
499           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
500                     [IntrNoMem]>;
501   def int_ppc_altivec_vmulesw : GCCBuiltin<"__builtin_altivec_vmulesw">,
502           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
503                     [IntrNoMem]>;
504   def int_ppc_altivec_vmuleub : GCCBuiltin<"__builtin_altivec_vmuleub">,
505           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
506                     [IntrNoMem]>;
507   def int_ppc_altivec_vmuleuh : GCCBuiltin<"__builtin_altivec_vmuleuh">,
508           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
509                     [IntrNoMem]>;
510   def int_ppc_altivec_vmuleuw : GCCBuiltin<"__builtin_altivec_vmuleuw">,
511           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
512                     [IntrNoMem]>;
514   def int_ppc_altivec_vmulosb : GCCBuiltin<"__builtin_altivec_vmulosb">,
515           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
516                     [IntrNoMem]>;
517   def int_ppc_altivec_vmulosh : GCCBuiltin<"__builtin_altivec_vmulosh">,
518           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
519                     [IntrNoMem]>;
520   def int_ppc_altivec_vmulosw : GCCBuiltin<"__builtin_altivec_vmulosw">,
521           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
522                     [IntrNoMem]>;
523   def int_ppc_altivec_vmuloub : GCCBuiltin<"__builtin_altivec_vmuloub">,
524           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
525                     [IntrNoMem]>;
526   def int_ppc_altivec_vmulouh : GCCBuiltin<"__builtin_altivec_vmulouh">,
527           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
528                     [IntrNoMem]>;
529   def int_ppc_altivec_vmulouw : GCCBuiltin<"__builtin_altivec_vmulouw">,
530           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
531                     [IntrNoMem]>;
533   // Vector Sum Intructions.
534   def int_ppc_altivec_vsumsws : GCCBuiltin<"__builtin_altivec_vsumsws">,
535             Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
536                       [IntrNoMem]>;
537   def int_ppc_altivec_vsum2sws : GCCBuiltin<"__builtin_altivec_vsum2sws">,
538             Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
539                       [IntrNoMem]>;
540   def int_ppc_altivec_vsum4sbs : GCCBuiltin<"__builtin_altivec_vsum4sbs">,
541             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
542                       [IntrNoMem]>;
543   def int_ppc_altivec_vsum4shs : GCCBuiltin<"__builtin_altivec_vsum4shs">,
544             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v4i32_ty],
545                       [IntrNoMem]>;
546   def int_ppc_altivec_vsum4ubs : GCCBuiltin<"__builtin_altivec_vsum4ubs">,
547             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
548                       [IntrNoMem]>;
550   // Other multiplies.
551   def int_ppc_altivec_vmladduhm : GCCBuiltin<"__builtin_altivec_vmladduhm">,
552             Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
553                        llvm_v8i16_ty], [IntrNoMem]>;
555   // Packs.
556   def int_ppc_altivec_vpkpx : GCCBuiltin<"__builtin_altivec_vpkpx">,
557             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
558                       [IntrNoMem]>;
559   def int_ppc_altivec_vpkshss : GCCBuiltin<"__builtin_altivec_vpkshss">,
560             Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
561                       [IntrNoMem]>;
562   def int_ppc_altivec_vpkshus : GCCBuiltin<"__builtin_altivec_vpkshus">,
563             Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
564                       [IntrNoMem]>;
565   def int_ppc_altivec_vpkswss : GCCBuiltin<"__builtin_altivec_vpkswss">,
566             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
567                       [IntrNoMem]>;
568   def int_ppc_altivec_vpkswus : GCCBuiltin<"__builtin_altivec_vpkswus">,
569             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
570                       [IntrNoMem]>;
571   def int_ppc_altivec_vpksdss : GCCBuiltin<"__builtin_altivec_vpksdss">,
572             Intrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
573                       [IntrNoMem]>;
574   def int_ppc_altivec_vpksdus : GCCBuiltin<"__builtin_altivec_vpksdus">,
575             Intrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
576                       [IntrNoMem]>;
577   // vpkuhum is lowered to a shuffle.
578   def int_ppc_altivec_vpkuhus : GCCBuiltin<"__builtin_altivec_vpkuhus">,
579             Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
580                       [IntrNoMem]>;
581   // vpkuwum is lowered to a shuffle.
582   def int_ppc_altivec_vpkuwus : GCCBuiltin<"__builtin_altivec_vpkuwus">,
583             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
584                       [IntrNoMem]>;
585   // vpkudum is lowered to a shuffle.
586   def int_ppc_altivec_vpkudus : GCCBuiltin<"__builtin_altivec_vpkudus">,
587             Intrinsic<[llvm_v4i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
588                       [IntrNoMem]>;
590   // Unpacks.
591   def int_ppc_altivec_vupkhpx : GCCBuiltin<"__builtin_altivec_vupkhpx">,
592             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
593   def int_ppc_altivec_vupkhsb : GCCBuiltin<"__builtin_altivec_vupkhsb">,
594             Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
595   def int_ppc_altivec_vupkhsh : GCCBuiltin<"__builtin_altivec_vupkhsh">,
596             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
597   def int_ppc_altivec_vupkhsw : GCCBuiltin<"__builtin_altivec_vupkhsw">,
598             Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
599   def int_ppc_altivec_vupklpx : GCCBuiltin<"__builtin_altivec_vupklpx">,
600             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
601   def int_ppc_altivec_vupklsb : GCCBuiltin<"__builtin_altivec_vupklsb">,
602             Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
603   def int_ppc_altivec_vupklsh : GCCBuiltin<"__builtin_altivec_vupklsh">,
604             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
605   def int_ppc_altivec_vupklsw : GCCBuiltin<"__builtin_altivec_vupklsw">,
606             Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
609   // FP <-> integer conversion.
610   def int_ppc_altivec_vcfsx : GCCBuiltin<"__builtin_altivec_vcfsx">,
611               Intrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
612                         [IntrNoMem]>;
613   def int_ppc_altivec_vcfux : GCCBuiltin<"__builtin_altivec_vcfux">,
614               Intrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
615                         [IntrNoMem]>;
616   def int_ppc_altivec_vctsxs : GCCBuiltin<"__builtin_altivec_vctsxs">,
617               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
618                         [IntrNoMem]>;
619   def int_ppc_altivec_vctuxs : GCCBuiltin<"__builtin_altivec_vctuxs">,
620               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
621                         [IntrNoMem]>;
623   def int_ppc_altivec_vrfim : GCCBuiltin<"__builtin_altivec_vrfim">,
624               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
625   def int_ppc_altivec_vrfin : GCCBuiltin<"__builtin_altivec_vrfin">,
626               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
627   def int_ppc_altivec_vrfip : GCCBuiltin<"__builtin_altivec_vrfip">,
628               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
629   def int_ppc_altivec_vrfiz : GCCBuiltin<"__builtin_altivec_vrfiz">,
630               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
632   // Add Extended Quadword
633   def int_ppc_altivec_vaddeuqm : GCCBuiltin<"__builtin_altivec_vaddeuqm">,
634               Intrinsic<[llvm_v1i128_ty],
635                         [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
636                         [IntrNoMem]>;
637   def int_ppc_altivec_vaddecuq : GCCBuiltin<"__builtin_altivec_vaddecuq">,
638               Intrinsic<[llvm_v1i128_ty],
639                         [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
640                         [IntrNoMem]>;
642   // Sub Extended Quadword
643   def int_ppc_altivec_vsubeuqm : GCCBuiltin<"__builtin_altivec_vsubeuqm">,
644               Intrinsic<[llvm_v1i128_ty],
645                         [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
646                         [IntrNoMem]>;
647   def int_ppc_altivec_vsubecuq : GCCBuiltin<"__builtin_altivec_vsubecuq">,
648               Intrinsic<[llvm_v1i128_ty],
649                         [llvm_v1i128_ty, llvm_v1i128_ty, llvm_v1i128_ty],
650                         [IntrNoMem]>;
653 def int_ppc_altivec_vsl   : PowerPC_Vec_WWW_Intrinsic<"vsl">;
654 def int_ppc_altivec_vslo  : PowerPC_Vec_WWW_Intrinsic<"vslo">;
656 def int_ppc_altivec_vslb  : PowerPC_Vec_BBB_Intrinsic<"vslb">;
657 def int_ppc_altivec_vslv  : PowerPC_Vec_BBB_Intrinsic<"vslv">;
658 def int_ppc_altivec_vsrv  : PowerPC_Vec_BBB_Intrinsic<"vsrv">;
659 def int_ppc_altivec_vslh  : PowerPC_Vec_HHH_Intrinsic<"vslh">;
660 def int_ppc_altivec_vslw  : PowerPC_Vec_WWW_Intrinsic<"vslw">;
662 // Right Shifts.
663 def int_ppc_altivec_vsr   : PowerPC_Vec_WWW_Intrinsic<"vsr">;
664 def int_ppc_altivec_vsro  : PowerPC_Vec_WWW_Intrinsic<"vsro">;
666 def int_ppc_altivec_vsrb  : PowerPC_Vec_BBB_Intrinsic<"vsrb">;
667 def int_ppc_altivec_vsrh  : PowerPC_Vec_HHH_Intrinsic<"vsrh">;
668 def int_ppc_altivec_vsrw  : PowerPC_Vec_WWW_Intrinsic<"vsrw">;
669 def int_ppc_altivec_vsrab : PowerPC_Vec_BBB_Intrinsic<"vsrab">;
670 def int_ppc_altivec_vsrah : PowerPC_Vec_HHH_Intrinsic<"vsrah">;
671 def int_ppc_altivec_vsraw : PowerPC_Vec_WWW_Intrinsic<"vsraw">;
673 // Rotates.
674 def int_ppc_altivec_vrlb  : PowerPC_Vec_BBB_Intrinsic<"vrlb">;
675 def int_ppc_altivec_vrlh  : PowerPC_Vec_HHH_Intrinsic<"vrlh">;
676 def int_ppc_altivec_vrlw  : PowerPC_Vec_WWW_Intrinsic<"vrlw">;
677 def int_ppc_altivec_vrld  : PowerPC_Vec_DDD_Intrinsic<"vrld">;
679 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
680   // Miscellaneous.
681   def int_ppc_altivec_lvsl :
682               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
683   def int_ppc_altivec_lvsr :
684               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
686   def int_ppc_altivec_vperm : GCCBuiltin<"__builtin_altivec_vperm_4si">,
687               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
688                          llvm_v4i32_ty, llvm_v16i8_ty], [IntrNoMem]>;
689   def int_ppc_altivec_vsel : GCCBuiltin<"__builtin_altivec_vsel_4si">,
690               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
691                          llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
692   def int_ppc_altivec_vgbbd : GCCBuiltin<"__builtin_altivec_vgbbd">,
693               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
694   def int_ppc_altivec_vbpermq : GCCBuiltin<"__builtin_altivec_vbpermq">,
695               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
696                         [IntrNoMem]>;
699 def int_ppc_altivec_vexptefp  : PowerPC_Vec_FF_Intrinsic<"vexptefp">;
700 def int_ppc_altivec_vlogefp   : PowerPC_Vec_FF_Intrinsic<"vlogefp">;
701 def int_ppc_altivec_vrefp     : PowerPC_Vec_FF_Intrinsic<"vrefp">;
702 def int_ppc_altivec_vrsqrtefp : PowerPC_Vec_FF_Intrinsic<"vrsqrtefp">;
704 // Power8 Intrinsics
705 // Crypto
706 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
707   def int_ppc_altivec_crypto_vsbox :
708               GCCBuiltin<"__builtin_altivec_crypto_vsbox">,
709               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
710   def int_ppc_altivec_crypto_vpermxor :
711               GCCBuiltin<"__builtin_altivec_crypto_vpermxor">,
712               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
713                          llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
715 def int_ppc_altivec_crypto_vshasigmad :
716             GCCBuiltin<"__builtin_altivec_crypto_vshasigmad">,
717             Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
718                        llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
719 def int_ppc_altivec_crypto_vshasigmaw :
720             GCCBuiltin<"__builtin_altivec_crypto_vshasigmaw">,
721             Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
722                        llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
724 def int_ppc_altivec_crypto_vcipher :
725             PowerPC_Vec_DDD_Intrinsic<"crypto_vcipher">;
726 def int_ppc_altivec_crypto_vcipherlast :
727             PowerPC_Vec_DDD_Intrinsic<"crypto_vcipherlast">;
728 def int_ppc_altivec_crypto_vncipher :
729             PowerPC_Vec_DDD_Intrinsic<"crypto_vncipher">;
730 def int_ppc_altivec_crypto_vncipherlast :
731             PowerPC_Vec_DDD_Intrinsic<"crypto_vncipherlast">;
732 def int_ppc_altivec_crypto_vpmsumb :
733             PowerPC_Vec_BBB_Intrinsic<"crypto_vpmsumb">;
734 def int_ppc_altivec_crypto_vpmsumh :
735             PowerPC_Vec_HHH_Intrinsic<"crypto_vpmsumh">;
736 def int_ppc_altivec_crypto_vpmsumw :
737             PowerPC_Vec_WWW_Intrinsic<"crypto_vpmsumw">;
738 def int_ppc_altivec_crypto_vpmsumd :
739             PowerPC_Vec_DDD_Intrinsic<"crypto_vpmsumd">;
741 // Absolute Difference intrinsics
742 def int_ppc_altivec_vabsdub : PowerPC_Vec_BBB_Intrinsic<"vabsdub">;
743 def int_ppc_altivec_vabsduh : PowerPC_Vec_HHH_Intrinsic<"vabsduh">;
744 def int_ppc_altivec_vabsduw : PowerPC_Vec_WWW_Intrinsic<"vabsduw">;
746 // Vector rotates
747 def int_ppc_altivec_vrlwnm :
748       PowerPC_Vec_Intrinsic<"vrlwnm", [llvm_v4i32_ty],
749                             [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
750 def int_ppc_altivec_vrlwmi :
751       PowerPC_Vec_Intrinsic<"vrlwmi", [llvm_v4i32_ty],
752                             [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
753                             [IntrNoMem]>;
754 def int_ppc_altivec_vrldnm :
755       PowerPC_Vec_Intrinsic<"vrldnm", [llvm_v2i64_ty],
756                             [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>;
757 def int_ppc_altivec_vrldmi :
758       PowerPC_Vec_Intrinsic<"vrldmi", [llvm_v2i64_ty],
759                             [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
760                             [IntrNoMem]>;
762 //===----------------------------------------------------------------------===//
763 // PowerPC VSX Intrinsic Definitions.
765 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
767 // Vector load.
768 def int_ppc_vsx_lxvw4x :
769       Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
770 def int_ppc_vsx_lxvd2x :
771       Intrinsic<[llvm_v2f64_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
772 def int_ppc_vsx_lxvw4x_be :
773       Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
774 def int_ppc_vsx_lxvd2x_be :
775       Intrinsic<[llvm_v2f64_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
776 def int_ppc_vsx_lxvl :
777       Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem,
778       IntrArgMemOnly]>;
779 def int_ppc_vsx_lxvll :
780       Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_i64_ty], [IntrReadMem,
781       IntrArgMemOnly]>;
782 def int_ppc_vsx_stxvl :
783       Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty, llvm_i64_ty],
784       [IntrWriteMem, IntrArgMemOnly]>;
785 def int_ppc_vsx_stxvll :
786       Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty, llvm_i64_ty],
787       [IntrWriteMem, IntrArgMemOnly]>;
789 // Vector store.
790 def int_ppc_vsx_stxvw4x : Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
791                                     [IntrWriteMem, IntrArgMemOnly]>;
792 def int_ppc_vsx_stxvd2x : Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty],
793                                     [IntrWriteMem, IntrArgMemOnly]>;
794 def int_ppc_vsx_stxvw4x_be : Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
795                                        [IntrWriteMem, IntrArgMemOnly]>;
796 def int_ppc_vsx_stxvd2x_be : Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty],
797                                        [IntrWriteMem, IntrArgMemOnly]>;
798 // Vector and scalar maximum.
799 def int_ppc_vsx_xvmaxdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmaxdp">;
800 def int_ppc_vsx_xvmaxsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvmaxsp">;
801 def int_ppc_vsx_xsmaxdp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmaxdp">;
803 // Vector and scalar minimum.
804 def int_ppc_vsx_xvmindp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmindp">;
805 def int_ppc_vsx_xvminsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvminsp">;
806 def int_ppc_vsx_xsmindp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmindp">;
808 // Vector divide.
809 def int_ppc_vsx_xvdivdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvdivdp">;
810 def int_ppc_vsx_xvdivsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvdivsp">;
812 // Vector round-to-infinity (ceil)
813 def int_ppc_vsx_xvrspip :
814       Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
815 def int_ppc_vsx_xvrdpip :
816       Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
818 // Vector reciprocal estimate
819 def int_ppc_vsx_xvresp : GCCBuiltin<"__builtin_vsx_xvresp">,
820       Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
821 def int_ppc_vsx_xvredp : GCCBuiltin<"__builtin_vsx_xvredp">,
822       Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
824 // Vector rsqrte
825 def int_ppc_vsx_xvrsqrtesp : GCCBuiltin<"__builtin_vsx_xvrsqrtesp">,
826       Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
827 def int_ppc_vsx_xvrsqrtedp : GCCBuiltin<"__builtin_vsx_xvrsqrtedp">,
828       Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
830 // Vector compare
831 def int_ppc_vsx_xvcmpeqdp :
832       PowerPC_VSX_Intrinsic<"xvcmpeqdp", [llvm_v2i64_ty],
833                             [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
834 def int_ppc_vsx_xvcmpeqdp_p : GCCBuiltin<"__builtin_vsx_xvcmpeqdp_p">,
835               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
836                         [IntrNoMem]>;
837 def int_ppc_vsx_xvcmpeqsp :
838       PowerPC_VSX_Intrinsic<"xvcmpeqsp", [llvm_v4i32_ty],
839                             [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
840 def int_ppc_vsx_xvcmpeqsp_p : GCCBuiltin<"__builtin_vsx_xvcmpeqsp_p">,
841               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
842                         [IntrNoMem]>;
843 def int_ppc_vsx_xvcmpgedp :
844       PowerPC_VSX_Intrinsic<"xvcmpgedp", [llvm_v2i64_ty],
845                             [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
846 def int_ppc_vsx_xvcmpgedp_p : GCCBuiltin<"__builtin_vsx_xvcmpgedp_p">,
847               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
848                         [IntrNoMem]>;
849 def int_ppc_vsx_xvcmpgesp :
850       PowerPC_VSX_Intrinsic<"xvcmpgesp", [llvm_v4i32_ty],
851                             [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
852 def int_ppc_vsx_xvcmpgesp_p : GCCBuiltin<"__builtin_vsx_xvcmpgesp_p">,
853               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
854                         [IntrNoMem]>;
855 def int_ppc_vsx_xvcmpgtdp :
856       PowerPC_VSX_Intrinsic<"xvcmpgtdp", [llvm_v2i64_ty],
857                             [llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>;
858 def int_ppc_vsx_xvcmpgtdp_p : GCCBuiltin<"__builtin_vsx_xvcmpgtdp_p">,
859               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2f64_ty,llvm_v2f64_ty],
860                         [IntrNoMem]>;
861 def int_ppc_vsx_xvcmpgtsp :
862       PowerPC_VSX_Intrinsic<"xvcmpgtsp", [llvm_v4i32_ty],
863                             [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
864 def int_ppc_vsx_xvcmpgtsp_p : GCCBuiltin<"__builtin_vsx_xvcmpgtsp_p">,
865               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
866                         [IntrNoMem]>;
867 def int_ppc_vsx_xxleqv :
868       PowerPC_VSX_Intrinsic<"xxleqv", [llvm_v4i32_ty],
869                             [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
870 def int_ppc_vsx_xviexpdp :
871       PowerPC_VSX_Intrinsic<"xviexpdp",[llvm_v2f64_ty],
872                             [llvm_v2i64_ty, llvm_v2i64_ty],[IntrNoMem]>;
873 def int_ppc_vsx_xviexpsp :
874       PowerPC_VSX_Intrinsic<"xviexpsp",[llvm_v4f32_ty],
875                             [llvm_v4i32_ty, llvm_v4i32_ty],[IntrNoMem]>;
876 def int_ppc_vsx_xvcvdpsxws :
877       PowerPC_VSX_Intrinsic<"xvcvdpsxws", [llvm_v4i32_ty],
878                             [llvm_v2f64_ty], [IntrNoMem]>;
879 def int_ppc_vsx_xvcvdpuxws :
880       PowerPC_VSX_Intrinsic<"xvcvdpuxws", [llvm_v4i32_ty],
881                             [llvm_v2f64_ty], [IntrNoMem]>;
882 def int_ppc_vsx_xvcvsxwdp :
883       PowerPC_VSX_Intrinsic<"xvcvsxwdp", [llvm_v2f64_ty],
884                             [llvm_v4i32_ty], [IntrNoMem]>;
885 def int_ppc_vsx_xvcvuxwdp :
886       PowerPC_VSX_Intrinsic<"xvcvuxwdp", [llvm_v2f64_ty],
887                             [llvm_v4i32_ty], [IntrNoMem]>;
888 def int_ppc_vsx_xvcvspdp :
889       PowerPC_VSX_Intrinsic<"xvcvspdp", [llvm_v2f64_ty],
890                             [llvm_v4f32_ty], [IntrNoMem]>;
891 def int_ppc_vsx_xvcvsxdsp :
892       PowerPC_VSX_Intrinsic<"xvcvsxdsp", [llvm_v4f32_ty],
893                             [llvm_v2i64_ty], [IntrNoMem]>;
894 def int_ppc_vsx_xvcvuxdsp :
895       PowerPC_VSX_Intrinsic<"xvcvuxdsp", [llvm_v4f32_ty],
896                             [llvm_v2i64_ty], [IntrNoMem]>;
897 def int_ppc_vsx_xvcvdpsp :
898       PowerPC_VSX_Intrinsic<"xvcvdpsp", [llvm_v4f32_ty],
899                             [llvm_v2f64_ty], [IntrNoMem]>;
900 def int_ppc_vsx_xvcvsphp :
901       PowerPC_VSX_Intrinsic<"xvcvsphp", [llvm_v4f32_ty],
902                             [llvm_v4f32_ty], [IntrNoMem]>;
903 def int_ppc_vsx_xvxexpdp :
904       PowerPC_VSX_Intrinsic<"xvxexpdp", [llvm_v2i64_ty],
905                             [llvm_v2f64_ty], [IntrNoMem]>;
906 def int_ppc_vsx_xvxexpsp :
907       PowerPC_VSX_Intrinsic<"xvxexpsp", [llvm_v4i32_ty],
908                             [llvm_v4f32_ty], [IntrNoMem]>;
909 def int_ppc_vsx_xvxsigdp :
910       PowerPC_VSX_Intrinsic<"xvxsigdp", [llvm_v2i64_ty],
911                             [llvm_v2f64_ty], [IntrNoMem]>;
912 def int_ppc_vsx_xvxsigsp :
913       PowerPC_VSX_Intrinsic<"xvxsigsp", [llvm_v4i32_ty],
914                             [llvm_v4f32_ty], [IntrNoMem]>;
915 def int_ppc_vsx_xvtstdcdp :
916       PowerPC_VSX_Intrinsic<"xvtstdcdp", [llvm_v2i64_ty],
917                             [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
918 def int_ppc_vsx_xvtstdcsp :
919       PowerPC_VSX_Intrinsic<"xvtstdcsp", [llvm_v4i32_ty],
920                             [llvm_v4f32_ty,llvm_i32_ty], [IntrNoMem]>;
921 def int_ppc_vsx_xvcvhpsp :
922       PowerPC_VSX_Intrinsic<"xvcvhpsp", [llvm_v4f32_ty],
923                             [llvm_v8i16_ty],[IntrNoMem]>;
924 def int_ppc_vsx_xxextractuw :
925       PowerPC_VSX_Intrinsic<"xxextractuw",[llvm_v2i64_ty],
926                             [llvm_v2i64_ty,llvm_i32_ty], [IntrNoMem]>;
927 def int_ppc_vsx_xxinsertw :
928       PowerPC_VSX_Intrinsic<"xxinsertw",[llvm_v4i32_ty],
929                             [llvm_v4i32_ty,llvm_v2i64_ty,llvm_i32_ty],
930                             [IntrNoMem]>;
933 //===----------------------------------------------------------------------===//
934 // PowerPC QPX Intrinsics.
937 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
938   /// PowerPC_QPX_Intrinsic - Base class for all QPX intrinsics.
939   class PowerPC_QPX_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
940                               list<LLVMType> param_types,
941                               list<IntrinsicProperty> properties>
942     : GCCBuiltin<!strconcat("__builtin_qpx_", GCCIntSuffix)>,
943       Intrinsic<ret_types, param_types, properties>;
946 //===----------------------------------------------------------------------===//
947 // PowerPC QPX Intrinsic Class Definitions.
950 /// PowerPC_QPX_FF_Intrinsic - A PowerPC intrinsic that takes one v4f64
951 /// vector and returns one.  These intrinsics have no side effects.
952 class PowerPC_QPX_FF_Intrinsic<string GCCIntSuffix>
953   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
954                           [llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
956 /// PowerPC_QPX_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f64
957 /// vectors and returns one.  These intrinsics have no side effects.
958 class PowerPC_QPX_FFF_Intrinsic<string GCCIntSuffix>
959   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
960                           [llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty],
961                           [IntrNoMem]>;
963 /// PowerPC_QPX_FFFF_Intrinsic - A PowerPC intrinsic that takes three v4f64
964 /// vectors and returns one.  These intrinsics have no side effects.
965 class PowerPC_QPX_FFFF_Intrinsic<string GCCIntSuffix>
966   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
967                           [llvm_v4f64_ty],
968                           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
969                           [IntrNoMem]>;
971 /// PowerPC_QPX_Load_Intrinsic - A PowerPC intrinsic that takes a pointer
972 /// and returns a v4f64.
973 class PowerPC_QPX_Load_Intrinsic<string GCCIntSuffix>
974   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
975                           [llvm_v4f64_ty], [llvm_ptr_ty], [IntrReadMem, IntrArgMemOnly]>;
977 /// PowerPC_QPX_LoadPerm_Intrinsic - A PowerPC intrinsic that takes a pointer
978 /// and returns a v4f64 permutation.
979 class PowerPC_QPX_LoadPerm_Intrinsic<string GCCIntSuffix>
980   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
981                           [llvm_v4f64_ty], [llvm_ptr_ty], [IntrNoMem]>;
983 /// PowerPC_QPX_Store_Intrinsic - A PowerPC intrinsic that takes a pointer
984 /// and stores a v4f64.
985 class PowerPC_QPX_Store_Intrinsic<string GCCIntSuffix>
986   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
987                           [], [llvm_v4f64_ty, llvm_ptr_ty],
988                           [IntrWriteMem, IntrArgMemOnly]>;
990 //===----------------------------------------------------------------------===//
991 // PowerPC QPX Intrinsic Definitions.
993 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
994   // Add Instructions
995   def int_ppc_qpx_qvfadd : PowerPC_QPX_FFF_Intrinsic<"qvfadd">;
996   def int_ppc_qpx_qvfadds : PowerPC_QPX_FFF_Intrinsic<"qvfadds">;
997   def int_ppc_qpx_qvfsub : PowerPC_QPX_FFF_Intrinsic<"qvfsub">;
998   def int_ppc_qpx_qvfsubs : PowerPC_QPX_FFF_Intrinsic<"qvfsubs">;
1000   // Estimate Instructions
1001   def int_ppc_qpx_qvfre : PowerPC_QPX_FF_Intrinsic<"qvfre">;
1002   def int_ppc_qpx_qvfres : PowerPC_QPX_FF_Intrinsic<"qvfres">;
1003   def int_ppc_qpx_qvfrsqrte : PowerPC_QPX_FF_Intrinsic<"qvfrsqrte">;
1004   def int_ppc_qpx_qvfrsqrtes : PowerPC_QPX_FF_Intrinsic<"qvfrsqrtes">;
1006   // Multiply Instructions
1007   def int_ppc_qpx_qvfmul : PowerPC_QPX_FFF_Intrinsic<"qvfmul">;
1008   def int_ppc_qpx_qvfmuls : PowerPC_QPX_FFF_Intrinsic<"qvfmuls">;
1009   def int_ppc_qpx_qvfxmul : PowerPC_QPX_FFF_Intrinsic<"qvfxmul">;
1010   def int_ppc_qpx_qvfxmuls : PowerPC_QPX_FFF_Intrinsic<"qvfxmuls">;
1012   // Multiply-add instructions
1013   def int_ppc_qpx_qvfmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfmadd">;
1014   def int_ppc_qpx_qvfmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfmadds">;
1015   def int_ppc_qpx_qvfnmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfnmadd">;
1016   def int_ppc_qpx_qvfnmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfnmadds">;
1017   def int_ppc_qpx_qvfmsub : PowerPC_QPX_FFFF_Intrinsic<"qvfmsub">;
1018   def int_ppc_qpx_qvfmsubs : PowerPC_QPX_FFFF_Intrinsic<"qvfmsubs">;
1019   def int_ppc_qpx_qvfnmsub : PowerPC_QPX_FFFF_Intrinsic<"qvfnmsub">;
1020   def int_ppc_qpx_qvfnmsubs : PowerPC_QPX_FFFF_Intrinsic<"qvfnmsubs">;
1021   def int_ppc_qpx_qvfxmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxmadd">;
1022   def int_ppc_qpx_qvfxmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxmadds">;
1023   def int_ppc_qpx_qvfxxnpmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxxnpmadd">;
1024   def int_ppc_qpx_qvfxxnpmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxxnpmadds">;
1025   def int_ppc_qpx_qvfxxcpnmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxxcpnmadd">;
1026   def int_ppc_qpx_qvfxxcpnmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxxcpnmadds">;
1027   def int_ppc_qpx_qvfxxmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxxmadd">;
1028   def int_ppc_qpx_qvfxxmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxxmadds">;
1030   // Select Instruction
1031   def int_ppc_qpx_qvfsel : PowerPC_QPX_FFFF_Intrinsic<"qvfsel">;
1033   // Permute Instruction
1034   def int_ppc_qpx_qvfperm : PowerPC_QPX_FFFF_Intrinsic<"qvfperm">;
1036   // Convert and Round Instructions
1037   def int_ppc_qpx_qvfctid : PowerPC_QPX_FF_Intrinsic<"qvfctid">;
1038   def int_ppc_qpx_qvfctidu : PowerPC_QPX_FF_Intrinsic<"qvfctidu">;
1039   def int_ppc_qpx_qvfctidz : PowerPC_QPX_FF_Intrinsic<"qvfctidz">;
1040   def int_ppc_qpx_qvfctiduz : PowerPC_QPX_FF_Intrinsic<"qvfctiduz">;
1041   def int_ppc_qpx_qvfctiw : PowerPC_QPX_FF_Intrinsic<"qvfctiw">;
1042   def int_ppc_qpx_qvfctiwu : PowerPC_QPX_FF_Intrinsic<"qvfctiwu">;
1043   def int_ppc_qpx_qvfctiwz : PowerPC_QPX_FF_Intrinsic<"qvfctiwz">;
1044   def int_ppc_qpx_qvfctiwuz : PowerPC_QPX_FF_Intrinsic<"qvfctiwuz">;
1045   def int_ppc_qpx_qvfcfid : PowerPC_QPX_FF_Intrinsic<"qvfcfid">;
1046   def int_ppc_qpx_qvfcfidu : PowerPC_QPX_FF_Intrinsic<"qvfcfidu">;
1047   def int_ppc_qpx_qvfcfids : PowerPC_QPX_FF_Intrinsic<"qvfcfids">;
1048   def int_ppc_qpx_qvfcfidus : PowerPC_QPX_FF_Intrinsic<"qvfcfidus">;
1049   def int_ppc_qpx_qvfrsp : PowerPC_QPX_FF_Intrinsic<"qvfrsp">;
1050   def int_ppc_qpx_qvfriz : PowerPC_QPX_FF_Intrinsic<"qvfriz">;
1051   def int_ppc_qpx_qvfrin : PowerPC_QPX_FF_Intrinsic<"qvfrin">;
1052   def int_ppc_qpx_qvfrip : PowerPC_QPX_FF_Intrinsic<"qvfrip">;
1053   def int_ppc_qpx_qvfrim : PowerPC_QPX_FF_Intrinsic<"qvfrim">;
1055   // Move Instructions
1056   def int_ppc_qpx_qvfneg : PowerPC_QPX_FF_Intrinsic<"qvfneg">;
1057   def int_ppc_qpx_qvfabs : PowerPC_QPX_FF_Intrinsic<"qvfabs">;
1058   def int_ppc_qpx_qvfnabs : PowerPC_QPX_FF_Intrinsic<"qvfnabs">;
1059   def int_ppc_qpx_qvfcpsgn : PowerPC_QPX_FFF_Intrinsic<"qvfcpsgn">;
1061   // Compare Instructions
1062   def int_ppc_qpx_qvftstnan : PowerPC_QPX_FFF_Intrinsic<"qvftstnan">;
1063   def int_ppc_qpx_qvfcmplt : PowerPC_QPX_FFF_Intrinsic<"qvfcmplt">;
1064   def int_ppc_qpx_qvfcmpgt : PowerPC_QPX_FFF_Intrinsic<"qvfcmpgt">;
1065   def int_ppc_qpx_qvfcmpeq : PowerPC_QPX_FFF_Intrinsic<"qvfcmpeq">;
1067   // Load instructions
1068   def int_ppc_qpx_qvlfd : PowerPC_QPX_Load_Intrinsic<"qvlfd">;
1069   def int_ppc_qpx_qvlfda : PowerPC_QPX_Load_Intrinsic<"qvlfda">;
1070   def int_ppc_qpx_qvlfs : PowerPC_QPX_Load_Intrinsic<"qvlfs">;
1071   def int_ppc_qpx_qvlfsa : PowerPC_QPX_Load_Intrinsic<"qvlfsa">;
1073   def int_ppc_qpx_qvlfcda : PowerPC_QPX_Load_Intrinsic<"qvlfcda">;
1074   def int_ppc_qpx_qvlfcd : PowerPC_QPX_Load_Intrinsic<"qvlfcd">;
1075   def int_ppc_qpx_qvlfcsa : PowerPC_QPX_Load_Intrinsic<"qvlfcsa">;
1076   def int_ppc_qpx_qvlfcs : PowerPC_QPX_Load_Intrinsic<"qvlfcs">;
1077   def int_ppc_qpx_qvlfiwaa : PowerPC_QPX_Load_Intrinsic<"qvlfiwaa">;
1078   def int_ppc_qpx_qvlfiwa : PowerPC_QPX_Load_Intrinsic<"qvlfiwa">;
1079   def int_ppc_qpx_qvlfiwza : PowerPC_QPX_Load_Intrinsic<"qvlfiwza">;
1080   def int_ppc_qpx_qvlfiwz : PowerPC_QPX_Load_Intrinsic<"qvlfiwz">;
1082   def int_ppc_qpx_qvlpcld : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcld">;
1083   def int_ppc_qpx_qvlpcls : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcls">;
1084   def int_ppc_qpx_qvlpcrd : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcrd">;
1085   def int_ppc_qpx_qvlpcrs : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcrs">;
1087   // Store instructions
1088   def int_ppc_qpx_qvstfd : PowerPC_QPX_Store_Intrinsic<"qvstfd">;
1089   def int_ppc_qpx_qvstfda : PowerPC_QPX_Store_Intrinsic<"qvstfda">;
1090   def int_ppc_qpx_qvstfs : PowerPC_QPX_Store_Intrinsic<"qvstfs">;
1091   def int_ppc_qpx_qvstfsa : PowerPC_QPX_Store_Intrinsic<"qvstfsa">;
1093   def int_ppc_qpx_qvstfcda : PowerPC_QPX_Store_Intrinsic<"qvstfcda">;
1094   def int_ppc_qpx_qvstfcd : PowerPC_QPX_Store_Intrinsic<"qvstfcd">;
1095   def int_ppc_qpx_qvstfcsa : PowerPC_QPX_Store_Intrinsic<"qvstfcsa">;
1096   def int_ppc_qpx_qvstfcs : PowerPC_QPX_Store_Intrinsic<"qvstfcs">;
1097   def int_ppc_qpx_qvstfiwa : PowerPC_QPX_Store_Intrinsic<"qvstfiwa">;
1098   def int_ppc_qpx_qvstfiw : PowerPC_QPX_Store_Intrinsic<"qvstfiw">;
1100   // Logical and permutation formation
1101   def int_ppc_qpx_qvflogical : PowerPC_QPX_Intrinsic<"qvflogical",
1102                           [llvm_v4f64_ty],
1103                           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_i32_ty],
1104                           [IntrNoMem]>;
1105   def int_ppc_qpx_qvgpci : PowerPC_QPX_Intrinsic<"qvgpci",
1106                           [llvm_v4f64_ty], [llvm_i32_ty], [IntrNoMem]>;
1109 //===----------------------------------------------------------------------===//
1110 // PowerPC HTM Intrinsic Definitions.
1112 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
1114 def int_ppc_tbegin : GCCBuiltin<"__builtin_tbegin">,
1115       Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1116 def int_ppc_tend : GCCBuiltin<"__builtin_tend">,
1117       Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1119 def int_ppc_tabort : GCCBuiltin<"__builtin_tabort">,
1120       Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1121 def int_ppc_tabortwc : GCCBuiltin<"__builtin_tabortwc">,
1122       Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1123 def int_ppc_tabortwci : GCCBuiltin<"__builtin_tabortwci">,
1124       Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1125 def int_ppc_tabortdc : GCCBuiltin<"__builtin_tabortdc">,
1126       Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1127 def int_ppc_tabortdci : GCCBuiltin<"__builtin_tabortdci">,
1128       Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
1130 def int_ppc_tcheck : GCCBuiltin<"__builtin_tcheck">,
1131       Intrinsic<[llvm_i32_ty], [], []>;
1132 def int_ppc_treclaim : GCCBuiltin<"__builtin_treclaim">,
1133       Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1134 def int_ppc_trechkpt : GCCBuiltin<"__builtin_trechkpt">,
1135       Intrinsic<[llvm_i32_ty], [], []>;
1136 def int_ppc_tsr : GCCBuiltin<"__builtin_tsr">,
1137       Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
1139 def int_ppc_get_texasr : GCCBuiltin<"__builtin_get_texasr">,
1140       Intrinsic<[llvm_i64_ty], [], []>;
1141 def int_ppc_get_texasru : GCCBuiltin<"__builtin_get_texasru">,
1142       Intrinsic<[llvm_i64_ty], [], []>;
1143 def int_ppc_get_tfhar : GCCBuiltin<"__builtin_get_tfhar">,
1144       Intrinsic<[llvm_i64_ty], [], []>;
1145 def int_ppc_get_tfiar : GCCBuiltin<"__builtin_get_tfiar">,
1146       Intrinsic<[llvm_i64_ty], [], []>;
1148 def int_ppc_set_texasr : GCCBuiltin<"__builtin_set_texasr">,
1149       Intrinsic<[], [llvm_i64_ty], []>;
1150 def int_ppc_set_texasru : GCCBuiltin<"__builtin_set_texasru">,
1151       Intrinsic<[], [llvm_i64_ty], []>;
1152 def int_ppc_set_tfhar : GCCBuiltin<"__builtin_set_tfhar">,
1153       Intrinsic<[], [llvm_i64_ty], []>;
1154 def int_ppc_set_tfiar : GCCBuiltin<"__builtin_set_tfiar">,
1155       Intrinsic<[], [llvm_i64_ty], []>;
1157 // Extended mnemonics
1158 def int_ppc_tendall : GCCBuiltin<"__builtin_tendall">,
1159       Intrinsic<[llvm_i32_ty], [], []>;
1160 def int_ppc_tresume : GCCBuiltin<"__builtin_tresume">,
1161       Intrinsic<[llvm_i32_ty], [], []>;
1162 def int_ppc_tsuspend : GCCBuiltin<"__builtin_tsuspend">,
1163       Intrinsic<[llvm_i32_ty], [], []>;
1165 def int_ppc_ttest : GCCBuiltin<"__builtin_ttest">,
1166       Intrinsic<[llvm_i64_ty], [], []>;
1168 def int_ppc_cfence : Intrinsic<[], [llvm_anyint_ty], []>;