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