Add LLVM support for PPC cryptography builtins
[oota-llvm.git] / include / llvm / IR / IntrinsicsPowerPC.td
1 //===- IntrinsicsPowerPC.td - Defines PowerPC intrinsics ---*- tablegen -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines all of the PowerPC-specific intrinsics.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // Definitions for all PowerPC intrinsics.
16 //
17
18 // Non-altivec intrinsics.
19 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
20   // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions.
21   def int_ppc_dcba  : Intrinsic<[], [llvm_ptr_ty], []>;
22   def int_ppc_dcbf  : 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     [IntrReadWriteArgMem, NoCapture<0>]>;
27   def int_ppc_dcbtst: Intrinsic<[], [llvm_ptr_ty], []>;
28   def int_ppc_dcbz  : Intrinsic<[], [llvm_ptr_ty], []>;
29   def int_ppc_dcbzl : Intrinsic<[], [llvm_ptr_ty], []>;
30
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<[], [], []>;
35
36   // Intrinsics used to generate ctr-based loops. These should only be
37   // generated by the PowerPC backend!
38   def int_ppc_mtctr : Intrinsic<[], [llvm_anyint_ty], []>;
39   def int_ppc_is_decremented_ctr_nonzero : Intrinsic<[llvm_i1_ty], [], []>;
40 }
41
42
43 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
44   /// PowerPC_Vec_Intrinsic - Base class for all altivec intrinsics.
45   class PowerPC_Vec_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
46                               list<LLVMType> param_types,
47                               list<IntrinsicProperty> properties>
48     : GCCBuiltin<!strconcat("__builtin_altivec_", GCCIntSuffix)>,
49       Intrinsic<ret_types, param_types, properties>;
50
51   /// PowerPC_VSX_Intrinsic - Base class for all VSX intrinsics.
52   class PowerPC_VSX_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
53                               list<LLVMType> param_types,
54                               list<IntrinsicProperty> properties>
55     : GCCBuiltin<!strconcat("__builtin_vsx_", GCCIntSuffix)>,
56       Intrinsic<ret_types, param_types, properties>;
57 }
58
59 //===----------------------------------------------------------------------===//
60 // PowerPC Altivec Intrinsic Class Definitions.
61 //
62
63 /// PowerPC_Vec_FF_Intrinsic - A PowerPC intrinsic that takes one v4f32
64 /// vector and returns one.  These intrinsics have no side effects.
65 class PowerPC_Vec_FF_Intrinsic<string GCCIntSuffix>
66   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
67                           [llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
68
69 /// PowerPC_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
70 /// vectors and returns one.  These intrinsics have no side effects.
71 class PowerPC_Vec_FFF_Intrinsic<string GCCIntSuffix>
72   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
73                           [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
74                           [IntrNoMem]>;
75
76 /// PowerPC_Vec_BBB_Intrinsic - A PowerPC intrinsic that takes two v16i8
77 /// vectors and returns one.  These intrinsics have no side effects.
78 class PowerPC_Vec_BBB_Intrinsic<string GCCIntSuffix> 
79   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
80                           [llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
81                           [IntrNoMem]>;
82
83 /// PowerPC_Vec_HHH_Intrinsic - A PowerPC intrinsic that takes two v8i16
84 /// vectors and returns one.  These intrinsics have no side effects.
85 class PowerPC_Vec_HHH_Intrinsic<string GCCIntSuffix> 
86   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
87                           [llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
88                           [IntrNoMem]>;
89
90 /// PowerPC_Vec_WWW_Intrinsic - A PowerPC intrinsic that takes two v4i32
91 /// vectors and returns one.  These intrinsics have no side effects.
92 class PowerPC_Vec_WWW_Intrinsic<string GCCIntSuffix> 
93   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
94                           [llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
95                           [IntrNoMem]>;
96
97 /// PowerPC_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2i64
98 /// vectors and returns one.  These intrinsics have no side effects.
99 class PowerPC_Vec_DDD_Intrinsic<string GCCIntSuffix>
100   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
101                           [llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
102                           [IntrNoMem]>;
103
104 //===----------------------------------------------------------------------===//
105 // PowerPC VSX Intrinsic Class Definitions.
106 //
107
108 /// PowerPC_VSX_Vec_DDD_Intrinsic - A PowerPC intrinsic that takes two v2f64
109 /// vectors and returns one.  These intrinsics have no side effects.
110 class PowerPC_VSX_Vec_DDD_Intrinsic<string GCCIntSuffix>
111   : PowerPC_VSX_Intrinsic<GCCIntSuffix,
112                           [llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty],
113                           [IntrNoMem]>;
114
115 /// PowerPC_VSX_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
116 /// vectors and returns one.  These intrinsics have no side effects.
117 class PowerPC_VSX_Vec_FFF_Intrinsic<string GCCIntSuffix>
118   : PowerPC_VSX_Intrinsic<GCCIntSuffix,
119                           [llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
120                           [IntrNoMem]>;
121
122 /// PowerPC_VSX_Sca_DDD_Intrinsic - A PowerPC intrinsic that takes two f64
123 /// scalars and returns one.  These intrinsics have no side effects.
124 class PowerPC_VSX_Sca_DDD_Intrinsic<string GCCIntSuffix>
125   : PowerPC_VSX_Intrinsic<GCCIntSuffix,
126                           [llvm_double_ty], [llvm_double_ty, llvm_double_ty],
127                           [IntrNoMem]>;
128
129 //===----------------------------------------------------------------------===//
130 // PowerPC Altivec Intrinsic Definitions.
131
132 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
133   // Data Stream Control.
134   def int_ppc_altivec_dss : GCCBuiltin<"__builtin_altivec_dss">,
135               Intrinsic<[], [llvm_i32_ty], []>;
136   def int_ppc_altivec_dssall : GCCBuiltin<"__builtin_altivec_dssall">,
137               Intrinsic<[], [], []>;
138   def int_ppc_altivec_dst : GCCBuiltin<"__builtin_altivec_dst">,
139               Intrinsic<[],
140                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
141                         []>;
142   def int_ppc_altivec_dstt : GCCBuiltin<"__builtin_altivec_dstt">,
143               Intrinsic<[],
144                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
145                         []>;
146   def int_ppc_altivec_dstst : GCCBuiltin<"__builtin_altivec_dstst">,
147               Intrinsic<[],
148                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
149                         []>;
150   def int_ppc_altivec_dststt : GCCBuiltin<"__builtin_altivec_dststt">,
151               Intrinsic<[],
152                         [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty],
153                         []>;
154
155   // VSCR access.
156   def int_ppc_altivec_mfvscr : GCCBuiltin<"__builtin_altivec_mfvscr">,
157               Intrinsic<[llvm_v8i16_ty], [], [IntrReadMem]>;
158   def int_ppc_altivec_mtvscr : GCCBuiltin<"__builtin_altivec_mtvscr">,
159               Intrinsic<[], [llvm_v4i32_ty], []>;
160
161
162   // Loads.  These don't map directly to GCC builtins because they represent the
163   // source address with a single pointer.
164   def int_ppc_altivec_lvx :
165               Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
166   def int_ppc_altivec_lvxl :
167               Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
168   def int_ppc_altivec_lvebx :
169               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
170   def int_ppc_altivec_lvehx :
171               Intrinsic<[llvm_v8i16_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
172   def int_ppc_altivec_lvewx :
173               Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
174
175   // Stores.  These don't map directly to GCC builtins because they represent the
176   // source address with a single pointer.
177   def int_ppc_altivec_stvx :
178               Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
179                         [IntrReadWriteArgMem]>;
180   def int_ppc_altivec_stvxl :
181               Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
182                         [IntrReadWriteArgMem]>;
183   def int_ppc_altivec_stvebx :
184               Intrinsic<[], [llvm_v16i8_ty, llvm_ptr_ty],
185                         [IntrReadWriteArgMem]>;
186   def int_ppc_altivec_stvehx :
187               Intrinsic<[], [llvm_v8i16_ty, llvm_ptr_ty],
188                         [IntrReadWriteArgMem]>;
189   def int_ppc_altivec_stvewx :
190               Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty],
191                         [IntrReadWriteArgMem]>;
192
193   // Comparisons setting a vector.
194   def int_ppc_altivec_vcmpbfp : GCCBuiltin<"__builtin_altivec_vcmpbfp">,
195               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
196                         [IntrNoMem]>;
197   def int_ppc_altivec_vcmpeqfp : GCCBuiltin<"__builtin_altivec_vcmpeqfp">,
198               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
199                         [IntrNoMem]>;
200   def int_ppc_altivec_vcmpgefp : GCCBuiltin<"__builtin_altivec_vcmpgefp">,
201               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
202                         [IntrNoMem]>;
203   def int_ppc_altivec_vcmpgtfp : GCCBuiltin<"__builtin_altivec_vcmpgtfp">,
204               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
205                         [IntrNoMem]>;
206
207   def int_ppc_altivec_vcmpequd : GCCBuiltin<"__builtin_altivec_vcmpequd">,
208               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
209                         [IntrNoMem]>;
210   def int_ppc_altivec_vcmpgtsd : GCCBuiltin<"__builtin_altivec_vcmpgtsd">,
211               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
212                         [IntrNoMem]>;
213   def int_ppc_altivec_vcmpgtud : GCCBuiltin<"__builtin_altivec_vcmpgtud">,
214               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
215                         [IntrNoMem]>;
216                                                 
217   def int_ppc_altivec_vcmpequw : GCCBuiltin<"__builtin_altivec_vcmpequw">,
218               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
219                         [IntrNoMem]>;
220   def int_ppc_altivec_vcmpgtsw : GCCBuiltin<"__builtin_altivec_vcmpgtsw">,
221               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
222                         [IntrNoMem]>;
223   def int_ppc_altivec_vcmpgtuw : GCCBuiltin<"__builtin_altivec_vcmpgtuw">,
224               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
225                         [IntrNoMem]>;
226                         
227   def int_ppc_altivec_vcmpequh : GCCBuiltin<"__builtin_altivec_vcmpequh">,
228               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
229                         [IntrNoMem]>;
230   def int_ppc_altivec_vcmpgtsh : GCCBuiltin<"__builtin_altivec_vcmpgtsh">,
231               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
232                         [IntrNoMem]>;
233   def int_ppc_altivec_vcmpgtuh : GCCBuiltin<"__builtin_altivec_vcmpgtuh">,
234               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
235                         [IntrNoMem]>;
236
237   def int_ppc_altivec_vcmpequb : GCCBuiltin<"__builtin_altivec_vcmpequb">,
238               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
239                         [IntrNoMem]>;
240   def int_ppc_altivec_vcmpgtsb : GCCBuiltin<"__builtin_altivec_vcmpgtsb">,
241               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
242                         [IntrNoMem]>;
243   def int_ppc_altivec_vcmpgtub : GCCBuiltin<"__builtin_altivec_vcmpgtub">,
244               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
245                         [IntrNoMem]>;
246
247   // Predicate Comparisons.  The first operand specifies interpretation of CR6.
248   def int_ppc_altivec_vcmpbfp_p : GCCBuiltin<"__builtin_altivec_vcmpbfp_p">,
249               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
250                         [IntrNoMem]>;
251   def int_ppc_altivec_vcmpeqfp_p : GCCBuiltin<"__builtin_altivec_vcmpeqfp_p">,
252               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
253                         [IntrNoMem]>;
254   def int_ppc_altivec_vcmpgefp_p : GCCBuiltin<"__builtin_altivec_vcmpgefp_p">,
255               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
256                         [IntrNoMem]>;
257   def int_ppc_altivec_vcmpgtfp_p : GCCBuiltin<"__builtin_altivec_vcmpgtfp_p">,
258               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4f32_ty,llvm_v4f32_ty],
259                         [IntrNoMem]>;
260
261   def int_ppc_altivec_vcmpequd_p : GCCBuiltin<"__builtin_altivec_vcmpequd_p">,
262               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
263                         [IntrNoMem]>;
264   def int_ppc_altivec_vcmpgtsd_p : GCCBuiltin<"__builtin_altivec_vcmpgtsd_p">,
265               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
266                         [IntrNoMem]>;
267   def int_ppc_altivec_vcmpgtud_p : GCCBuiltin<"__builtin_altivec_vcmpgtud_p">,
268               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v2i64_ty,llvm_v2i64_ty],
269                         [IntrNoMem]>;
270
271   def int_ppc_altivec_vcmpequw_p : GCCBuiltin<"__builtin_altivec_vcmpequw_p">,
272               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
273                         [IntrNoMem]>;
274   def int_ppc_altivec_vcmpgtsw_p : GCCBuiltin<"__builtin_altivec_vcmpgtsw_p">,
275               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
276                         [IntrNoMem]>;
277   def int_ppc_altivec_vcmpgtuw_p : GCCBuiltin<"__builtin_altivec_vcmpgtuw_p">,
278               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v4i32_ty,llvm_v4i32_ty],
279                         [IntrNoMem]>;
280                         
281   def int_ppc_altivec_vcmpequh_p : GCCBuiltin<"__builtin_altivec_vcmpequh_p">,
282               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
283                         [IntrNoMem]>;
284   def int_ppc_altivec_vcmpgtsh_p : GCCBuiltin<"__builtin_altivec_vcmpgtsh_p">,
285               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
286                         [IntrNoMem]>;
287   def int_ppc_altivec_vcmpgtuh_p : GCCBuiltin<"__builtin_altivec_vcmpgtuh_p">,
288               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v8i16_ty,llvm_v8i16_ty],
289                         [IntrNoMem]>;
290
291   def int_ppc_altivec_vcmpequb_p : GCCBuiltin<"__builtin_altivec_vcmpequb_p">,
292               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
293                         [IntrNoMem]>;
294   def int_ppc_altivec_vcmpgtsb_p : GCCBuiltin<"__builtin_altivec_vcmpgtsb_p">,
295               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
296                         [IntrNoMem]>;
297   def int_ppc_altivec_vcmpgtub_p : GCCBuiltin<"__builtin_altivec_vcmpgtub_p">,
298               Intrinsic<[llvm_i32_ty],[llvm_i32_ty,llvm_v16i8_ty,llvm_v16i8_ty],
299                         [IntrNoMem]>;
300 }
301
302 // Vector average.
303 def int_ppc_altivec_vavgsb : PowerPC_Vec_BBB_Intrinsic<"vavgsb">;
304 def int_ppc_altivec_vavgsh : PowerPC_Vec_HHH_Intrinsic<"vavgsh">;
305 def int_ppc_altivec_vavgsw : PowerPC_Vec_WWW_Intrinsic<"vavgsw">;
306 def int_ppc_altivec_vavgub : PowerPC_Vec_BBB_Intrinsic<"vavgub">;
307 def int_ppc_altivec_vavguh : PowerPC_Vec_HHH_Intrinsic<"vavguh">;
308 def int_ppc_altivec_vavguw : PowerPC_Vec_WWW_Intrinsic<"vavguw">;
309
310 // Vector maximum.
311 def int_ppc_altivec_vmaxfp : PowerPC_Vec_FFF_Intrinsic<"vmaxfp">;
312 def int_ppc_altivec_vmaxsb : PowerPC_Vec_BBB_Intrinsic<"vmaxsb">;
313 def int_ppc_altivec_vmaxsh : PowerPC_Vec_HHH_Intrinsic<"vmaxsh">;
314 def int_ppc_altivec_vmaxsw : PowerPC_Vec_WWW_Intrinsic<"vmaxsw">;
315 def int_ppc_altivec_vmaxsd : PowerPC_Vec_DDD_Intrinsic<"vmaxsd">;
316 def int_ppc_altivec_vmaxub : PowerPC_Vec_BBB_Intrinsic<"vmaxub">;
317 def int_ppc_altivec_vmaxuh : PowerPC_Vec_HHH_Intrinsic<"vmaxuh">;
318 def int_ppc_altivec_vmaxuw : PowerPC_Vec_WWW_Intrinsic<"vmaxuw">;
319 def int_ppc_altivec_vmaxud : PowerPC_Vec_DDD_Intrinsic<"vmaxud">;
320
321 // Vector minimum.
322 def int_ppc_altivec_vminfp : PowerPC_Vec_FFF_Intrinsic<"vminfp">;
323 def int_ppc_altivec_vminsb : PowerPC_Vec_BBB_Intrinsic<"vminsb">;
324 def int_ppc_altivec_vminsh : PowerPC_Vec_HHH_Intrinsic<"vminsh">;
325 def int_ppc_altivec_vminsw : PowerPC_Vec_WWW_Intrinsic<"vminsw">;
326 def int_ppc_altivec_vminsd : PowerPC_Vec_DDD_Intrinsic<"vminsd">;
327 def int_ppc_altivec_vminub : PowerPC_Vec_BBB_Intrinsic<"vminub">;
328 def int_ppc_altivec_vminuh : PowerPC_Vec_HHH_Intrinsic<"vminuh">;
329 def int_ppc_altivec_vminuw : PowerPC_Vec_WWW_Intrinsic<"vminuw">;
330 def int_ppc_altivec_vminud : PowerPC_Vec_DDD_Intrinsic<"vminud">;
331
332 // Saturating adds.
333 def int_ppc_altivec_vaddubs : PowerPC_Vec_BBB_Intrinsic<"vaddubs">;
334 def int_ppc_altivec_vaddsbs : PowerPC_Vec_BBB_Intrinsic<"vaddsbs">;
335 def int_ppc_altivec_vadduhs : PowerPC_Vec_HHH_Intrinsic<"vadduhs">;
336 def int_ppc_altivec_vaddshs : PowerPC_Vec_HHH_Intrinsic<"vaddshs">;
337 def int_ppc_altivec_vadduws : PowerPC_Vec_WWW_Intrinsic<"vadduws">;
338 def int_ppc_altivec_vaddsws : PowerPC_Vec_WWW_Intrinsic<"vaddsws">;
339 def int_ppc_altivec_vaddcuw : PowerPC_Vec_WWW_Intrinsic<"vaddcuw">;
340
341 // Saturating subs.
342 def int_ppc_altivec_vsububs : PowerPC_Vec_BBB_Intrinsic<"vsububs">;
343 def int_ppc_altivec_vsubsbs : PowerPC_Vec_BBB_Intrinsic<"vsubsbs">;
344 def int_ppc_altivec_vsubuhs : PowerPC_Vec_HHH_Intrinsic<"vsubuhs">;
345 def int_ppc_altivec_vsubshs : PowerPC_Vec_HHH_Intrinsic<"vsubshs">;
346 def int_ppc_altivec_vsubuws : PowerPC_Vec_WWW_Intrinsic<"vsubuws">;
347 def int_ppc_altivec_vsubsws : PowerPC_Vec_WWW_Intrinsic<"vsubsws">;
348 def int_ppc_altivec_vsubcuw : PowerPC_Vec_WWW_Intrinsic<"vsubcuw">;
349
350 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
351   // Saturating multiply-adds.
352   def int_ppc_altivec_vmhaddshs : GCCBuiltin<"__builtin_altivec_vmhaddshs">,
353               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
354                          llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
355   def int_ppc_altivec_vmhraddshs : GCCBuiltin<"__builtin_altivec_vmhraddshs">,
356               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
357                          llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
358
359   def int_ppc_altivec_vmaddfp : GCCBuiltin<"__builtin_altivec_vmaddfp">,
360               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
361                          llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
362   def int_ppc_altivec_vnmsubfp : GCCBuiltin<"__builtin_altivec_vnmsubfp">,
363               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
364                          llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
365
366   // Vector Multiply Sum Intructions.
367   def int_ppc_altivec_vmsummbm : GCCBuiltin<"__builtin_altivec_vmsummbm">,
368             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
369                        llvm_v4i32_ty], [IntrNoMem]>;
370   def int_ppc_altivec_vmsumshm : GCCBuiltin<"__builtin_altivec_vmsumshm">,
371             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
372                        llvm_v4i32_ty], [IntrNoMem]>;
373   def int_ppc_altivec_vmsumshs : GCCBuiltin<"__builtin_altivec_vmsumshs">,
374             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
375                        llvm_v4i32_ty], [IntrNoMem]>;
376   def int_ppc_altivec_vmsumubm : GCCBuiltin<"__builtin_altivec_vmsumubm">,
377             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v16i8_ty, 
378                        llvm_v4i32_ty], [IntrNoMem]>;
379   def int_ppc_altivec_vmsumuhm : GCCBuiltin<"__builtin_altivec_vmsumuhm">,
380             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
381                        llvm_v4i32_ty], [IntrNoMem]>;
382   def int_ppc_altivec_vmsumuhs : GCCBuiltin<"__builtin_altivec_vmsumuhs">,
383             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
384                        llvm_v4i32_ty], [IntrNoMem]>;
385
386   // Vector Multiply Intructions.
387   def int_ppc_altivec_vmulesb : GCCBuiltin<"__builtin_altivec_vmulesb">,
388           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
389                     [IntrNoMem]>;
390   def int_ppc_altivec_vmulesh : GCCBuiltin<"__builtin_altivec_vmulesh">,
391           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
392                     [IntrNoMem]>;
393   def int_ppc_altivec_vmulesw : GCCBuiltin<"__builtin_altivec_vmulesw">,
394           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
395                     [IntrNoMem]>;
396   def int_ppc_altivec_vmuleub : GCCBuiltin<"__builtin_altivec_vmuleub">,
397           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
398                     [IntrNoMem]>;
399   def int_ppc_altivec_vmuleuh : GCCBuiltin<"__builtin_altivec_vmuleuh">,
400           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
401                     [IntrNoMem]>;
402   def int_ppc_altivec_vmuleuw : GCCBuiltin<"__builtin_altivec_vmuleuw">,
403           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
404                     [IntrNoMem]>;
405
406   def int_ppc_altivec_vmulosb : GCCBuiltin<"__builtin_altivec_vmulosb">,
407           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
408                     [IntrNoMem]>;
409   def int_ppc_altivec_vmulosh : GCCBuiltin<"__builtin_altivec_vmulosh">,
410           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
411                     [IntrNoMem]>;
412   def int_ppc_altivec_vmulosw : GCCBuiltin<"__builtin_altivec_vmulosw">,
413           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
414                     [IntrNoMem]>;
415   def int_ppc_altivec_vmuloub : GCCBuiltin<"__builtin_altivec_vmuloub">,
416           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
417                     [IntrNoMem]>;
418   def int_ppc_altivec_vmulouh : GCCBuiltin<"__builtin_altivec_vmulouh">,
419           Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
420                     [IntrNoMem]>;
421   def int_ppc_altivec_vmulouw : GCCBuiltin<"__builtin_altivec_vmulouw">,
422           Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
423                     [IntrNoMem]>;
424   def int_ppc_altivec_vmuluwm : GCCBuiltin<"__builtin_altivec_vmuluwm">,
425           Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
426                     [IntrNoMem]>;
427
428   // Vector Sum Intructions.
429   def int_ppc_altivec_vsumsws : GCCBuiltin<"__builtin_altivec_vsumsws">,
430             Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
431                       [IntrNoMem]>;
432   def int_ppc_altivec_vsum2sws : GCCBuiltin<"__builtin_altivec_vsum2sws">,
433             Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
434                       [IntrNoMem]>;
435   def int_ppc_altivec_vsum4sbs : GCCBuiltin<"__builtin_altivec_vsum4sbs">,
436             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
437                       [IntrNoMem]>;
438   def int_ppc_altivec_vsum4shs : GCCBuiltin<"__builtin_altivec_vsum4shs">,
439             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty, llvm_v4i32_ty],
440                       [IntrNoMem]>;
441   def int_ppc_altivec_vsum4ubs : GCCBuiltin<"__builtin_altivec_vsum4ubs">,
442             Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty, llvm_v4i32_ty],
443                       [IntrNoMem]>;
444
445   // Other multiplies.
446   def int_ppc_altivec_vmladduhm : GCCBuiltin<"__builtin_altivec_vmladduhm">,
447             Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
448                        llvm_v8i16_ty], [IntrNoMem]>;
449
450   // Packs.
451   def int_ppc_altivec_vpkpx : GCCBuiltin<"__builtin_altivec_vpkpx">,
452             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
453                       [IntrNoMem]>;
454   def int_ppc_altivec_vpkshss : GCCBuiltin<"__builtin_altivec_vpkshss">,
455             Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
456                       [IntrNoMem]>;
457   def int_ppc_altivec_vpkshus : GCCBuiltin<"__builtin_altivec_vpkshus">,
458             Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
459                       [IntrNoMem]>;
460   def int_ppc_altivec_vpkswss : GCCBuiltin<"__builtin_altivec_vpkswss">,
461             Intrinsic<[llvm_v16i8_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
462                       [IntrNoMem]>;
463   def int_ppc_altivec_vpkswus : GCCBuiltin<"__builtin_altivec_vpkswus">,
464             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
465                       [IntrNoMem]>;
466   // vpkuhum is lowered to a shuffle.
467   def int_ppc_altivec_vpkuhus : GCCBuiltin<"__builtin_altivec_vpkuhus">,
468             Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
469                       [IntrNoMem]>;
470   // vpkuwum is lowered to a shuffle.
471   def int_ppc_altivec_vpkuwus : GCCBuiltin<"__builtin_altivec_vpkuwus">,
472             Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
473                       [IntrNoMem]>;
474
475   // Unpacks.
476   def int_ppc_altivec_vupkhpx : GCCBuiltin<"__builtin_altivec_vupkhpx">,
477             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
478   def int_ppc_altivec_vupkhsb : GCCBuiltin<"__builtin_altivec_vupkhsb">,
479             Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
480   def int_ppc_altivec_vupkhsh : GCCBuiltin<"__builtin_altivec_vupkhsh">,
481             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
482   def int_ppc_altivec_vupklpx : GCCBuiltin<"__builtin_altivec_vupklpx">,
483             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
484   def int_ppc_altivec_vupklsb : GCCBuiltin<"__builtin_altivec_vupklsb">,
485             Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
486   def int_ppc_altivec_vupklsh : GCCBuiltin<"__builtin_altivec_vupklsh">,
487             Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
488
489
490   // FP <-> integer conversion.
491   def int_ppc_altivec_vcfsx : GCCBuiltin<"__builtin_altivec_vcfsx">,
492               Intrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
493                         [IntrNoMem]>;
494   def int_ppc_altivec_vcfux : GCCBuiltin<"__builtin_altivec_vcfux">,
495               Intrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty, llvm_i32_ty],
496                         [IntrNoMem]>;
497   def int_ppc_altivec_vctsxs : GCCBuiltin<"__builtin_altivec_vctsxs">,
498               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
499                         [IntrNoMem]>;
500   def int_ppc_altivec_vctuxs : GCCBuiltin<"__builtin_altivec_vctuxs">,
501               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
502                         [IntrNoMem]>;
503
504   def int_ppc_altivec_vrfim : GCCBuiltin<"__builtin_altivec_vrfim">,
505               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
506   def int_ppc_altivec_vrfin : GCCBuiltin<"__builtin_altivec_vrfin">,
507               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
508   def int_ppc_altivec_vrfip : GCCBuiltin<"__builtin_altivec_vrfip">,
509               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
510   def int_ppc_altivec_vrfiz : GCCBuiltin<"__builtin_altivec_vrfiz">,
511               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
512 }
513
514 def int_ppc_altivec_vsl   : PowerPC_Vec_WWW_Intrinsic<"vsl">;
515 def int_ppc_altivec_vslo  : PowerPC_Vec_WWW_Intrinsic<"vslo">;
516
517 def int_ppc_altivec_vslb  : PowerPC_Vec_BBB_Intrinsic<"vslb">;
518 def int_ppc_altivec_vslh  : PowerPC_Vec_HHH_Intrinsic<"vslh">;
519 def int_ppc_altivec_vslw  : PowerPC_Vec_WWW_Intrinsic<"vslw">;
520 def int_ppc_altivec_vsld  : PowerPC_Vec_DDD_Intrinsic<"vsld">;
521
522 // Right Shifts.
523 def int_ppc_altivec_vsr   : PowerPC_Vec_WWW_Intrinsic<"vsr">;
524 def int_ppc_altivec_vsro  : PowerPC_Vec_WWW_Intrinsic<"vsro">;
525   
526 def int_ppc_altivec_vsrb  : PowerPC_Vec_BBB_Intrinsic<"vsrb">;
527 def int_ppc_altivec_vsrh  : PowerPC_Vec_HHH_Intrinsic<"vsrh">;
528 def int_ppc_altivec_vsrw  : PowerPC_Vec_WWW_Intrinsic<"vsrw">;
529 def int_ppc_altivec_vsrd  : PowerPC_Vec_DDD_Intrinsic<"vsrd">;
530 def int_ppc_altivec_vsrab : PowerPC_Vec_BBB_Intrinsic<"vsrab">;
531 def int_ppc_altivec_vsrah : PowerPC_Vec_HHH_Intrinsic<"vsrah">;
532 def int_ppc_altivec_vsraw : PowerPC_Vec_WWW_Intrinsic<"vsraw">;
533 def int_ppc_altivec_vsrad : PowerPC_Vec_DDD_Intrinsic<"vsrad">;
534
535 // Rotates.
536 def int_ppc_altivec_vrlb  : PowerPC_Vec_BBB_Intrinsic<"vrlb">;
537 def int_ppc_altivec_vrlh  : PowerPC_Vec_HHH_Intrinsic<"vrlh">;
538 def int_ppc_altivec_vrlw  : PowerPC_Vec_WWW_Intrinsic<"vrlw">;
539 def int_ppc_altivec_vrld  : PowerPC_Vec_DDD_Intrinsic<"vrld">;
540
541 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
542   // Miscellaneous.
543   def int_ppc_altivec_lvsl :
544               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
545   def int_ppc_altivec_lvsr :
546               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrNoMem]>;
547
548   def int_ppc_altivec_vperm : GCCBuiltin<"__builtin_altivec_vperm_4si">,
549               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, 
550                          llvm_v4i32_ty, llvm_v16i8_ty], [IntrNoMem]>;
551   def int_ppc_altivec_vsel : GCCBuiltin<"__builtin_altivec_vsel_4si">,
552               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, 
553                          llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
554 }
555
556 def int_ppc_altivec_vexptefp  : PowerPC_Vec_FF_Intrinsic<"vexptefp">;
557 def int_ppc_altivec_vlogefp   : PowerPC_Vec_FF_Intrinsic<"vlogefp">;
558 def int_ppc_altivec_vrefp     : PowerPC_Vec_FF_Intrinsic<"vrefp">;
559 def int_ppc_altivec_vrsqrtefp : PowerPC_Vec_FF_Intrinsic<"vrsqrtefp">;
560
561 // Power8 Intrinsics
562 // Crypto
563 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
564   def int_ppc_altivec_crypto_vsbox :
565               GCCBuiltin<"__builtin_altivec_crypto_vsbox">,
566               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
567   def int_ppc_altivec_crypto_vpermxor :
568               GCCBuiltin<"__builtin_altivec_crypto_vpermxor">,
569               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
570                          llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
571
572 // These need diagnostics for invalid arguments so don't inherit from GCCBuiltin
573 def int_ppc_altivec_crypto_vshasigmad :
574             Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
575                        llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
576 def int_ppc_altivec_crypto_vshasigmaw :
577             Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
578                        llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
579 }
580 def int_ppc_altivec_crypto_vcipher :
581             PowerPC_Vec_DDD_Intrinsic<"crypto_vcipher">;
582 def int_ppc_altivec_crypto_vcipherlast :
583             PowerPC_Vec_DDD_Intrinsic<"crypto_vcipherlast">;
584 def int_ppc_altivec_crypto_vncipher :
585             PowerPC_Vec_DDD_Intrinsic<"crypto_vncipher">;
586 def int_ppc_altivec_crypto_vncipherlast :
587             PowerPC_Vec_DDD_Intrinsic<"crypto_vncipherlast">;
588 def int_ppc_altivec_crypto_vpmsumb :
589             PowerPC_Vec_BBB_Intrinsic<"crypto_vpmsumb">;
590 def int_ppc_altivec_crypto_vpmsumh :
591             PowerPC_Vec_HHH_Intrinsic<"crypto_vpmsumh">;
592 def int_ppc_altivec_crypto_vpmsumw :
593             PowerPC_Vec_WWW_Intrinsic<"crypto_vpmsumw">;
594 def int_ppc_altivec_crypto_vpmsumd :
595             PowerPC_Vec_DDD_Intrinsic<"crypto_vpmsumd">;
596
597 //===----------------------------------------------------------------------===//
598 // PowerPC VSX Intrinsic Definitions.
599
600 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
601
602 // Vector load.
603 def int_ppc_vsx_lxvw4x :
604       Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
605 def int_ppc_vsx_lxvd2x :
606       Intrinsic<[llvm_v2f64_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
607
608 // Vector store.
609 def int_ppc_vsx_stxvw4x :
610       Intrinsic<[], [llvm_v4i32_ty, llvm_ptr_ty], [IntrReadWriteArgMem]>;
611 def int_ppc_vsx_stxvd2x :
612       Intrinsic<[], [llvm_v2f64_ty, llvm_ptr_ty], [IntrReadWriteArgMem]>;
613
614 // Vector and scalar maximum.
615 def int_ppc_vsx_xvmaxdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmaxdp">;
616 def int_ppc_vsx_xvmaxsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvmaxsp">;
617 def int_ppc_vsx_xsmaxdp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmaxdp">;
618
619 // Vector and scalar minimum.
620 def int_ppc_vsx_xvmindp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvmindp">;
621 def int_ppc_vsx_xvminsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvminsp">;
622 def int_ppc_vsx_xsmindp : PowerPC_VSX_Sca_DDD_Intrinsic<"xsmindp">;
623
624 // Vector divide.
625 def int_ppc_vsx_xvdivdp : PowerPC_VSX_Vec_DDD_Intrinsic<"xvdivdp">;
626 def int_ppc_vsx_xvdivsp : PowerPC_VSX_Vec_FFF_Intrinsic<"xvdivsp">;
627 }
628
629 //===----------------------------------------------------------------------===//
630 // PowerPC QPX Intrinsics.
631 //
632
633 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
634   /// PowerPC_QPX_Intrinsic - Base class for all QPX intrinsics.
635   class PowerPC_QPX_Intrinsic<string GCCIntSuffix, list<LLVMType> ret_types,
636                               list<LLVMType> param_types,
637                               list<IntrinsicProperty> properties>
638     : GCCBuiltin<!strconcat("__builtin_qpx_", GCCIntSuffix)>,
639       Intrinsic<ret_types, param_types, properties>;
640 }
641
642 //===----------------------------------------------------------------------===//
643 // PowerPC QPX Intrinsic Class Definitions.
644 //
645
646 /// PowerPC_QPX_FF_Intrinsic - A PowerPC intrinsic that takes one v4f64
647 /// vector and returns one.  These intrinsics have no side effects.
648 class PowerPC_QPX_FF_Intrinsic<string GCCIntSuffix>
649   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
650                           [llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
651
652 /// PowerPC_QPX_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f64
653 /// vectors and returns one.  These intrinsics have no side effects.
654 class PowerPC_QPX_FFF_Intrinsic<string GCCIntSuffix>
655   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
656                           [llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty],
657                           [IntrNoMem]>;
658
659 /// PowerPC_QPX_FFFF_Intrinsic - A PowerPC intrinsic that takes three v4f64
660 /// vectors and returns one.  These intrinsics have no side effects.
661 class PowerPC_QPX_FFFF_Intrinsic<string GCCIntSuffix>
662   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
663                           [llvm_v4f64_ty],
664                           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
665                           [IntrNoMem]>;
666
667 /// PowerPC_QPX_Load_Intrinsic - A PowerPC intrinsic that takes a pointer
668 /// and returns a v4f64.
669 class PowerPC_QPX_Load_Intrinsic<string GCCIntSuffix>
670   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
671                           [llvm_v4f64_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
672
673 /// PowerPC_QPX_LoadPerm_Intrinsic - A PowerPC intrinsic that takes a pointer
674 /// and returns a v4f64 permutation.
675 class PowerPC_QPX_LoadPerm_Intrinsic<string GCCIntSuffix>
676   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
677                           [llvm_v4f64_ty], [llvm_ptr_ty], [IntrNoMem]>;
678
679 /// PowerPC_QPX_Store_Intrinsic - A PowerPC intrinsic that takes a pointer
680 /// and stores a v4f64.
681 class PowerPC_QPX_Store_Intrinsic<string GCCIntSuffix>
682   : PowerPC_QPX_Intrinsic<GCCIntSuffix,
683                           [], [llvm_v4f64_ty, llvm_ptr_ty],
684                           [IntrReadWriteArgMem]>;
685
686 //===----------------------------------------------------------------------===//
687 // PowerPC QPX Intrinsic Definitions.
688
689 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
690   // Add Instructions
691   def int_ppc_qpx_qvfadd : PowerPC_QPX_FFF_Intrinsic<"qvfadd">;
692   def int_ppc_qpx_qvfadds : PowerPC_QPX_FFF_Intrinsic<"qvfadds">;
693   def int_ppc_qpx_qvfsub : PowerPC_QPX_FFF_Intrinsic<"qvfsub">;
694   def int_ppc_qpx_qvfsubs : PowerPC_QPX_FFF_Intrinsic<"qvfsubs">;
695
696   // Estimate Instructions
697   def int_ppc_qpx_qvfre : PowerPC_QPX_FF_Intrinsic<"qvfre">;
698   def int_ppc_qpx_qvfres : PowerPC_QPX_FF_Intrinsic<"qvfres">;
699   def int_ppc_qpx_qvfrsqrte : PowerPC_QPX_FF_Intrinsic<"qvfrsqrte">;
700   def int_ppc_qpx_qvfrsqrtes : PowerPC_QPX_FF_Intrinsic<"qvfrsqrtes">;
701
702   // Multiply Instructions
703   def int_ppc_qpx_qvfmul : PowerPC_QPX_FFF_Intrinsic<"qvfmul">;
704   def int_ppc_qpx_qvfmuls : PowerPC_QPX_FFF_Intrinsic<"qvfmuls">;
705   def int_ppc_qpx_qvfxmul : PowerPC_QPX_FFF_Intrinsic<"qvfxmul">;
706   def int_ppc_qpx_qvfxmuls : PowerPC_QPX_FFF_Intrinsic<"qvfxmuls">;
707
708   // Multiply-add instructions
709   def int_ppc_qpx_qvfmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfmadd">;
710   def int_ppc_qpx_qvfmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfmadds">;
711   def int_ppc_qpx_qvfnmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfnmadd">;
712   def int_ppc_qpx_qvfnmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfnmadds">;
713   def int_ppc_qpx_qvfmsub : PowerPC_QPX_FFFF_Intrinsic<"qvfmsub">;
714   def int_ppc_qpx_qvfmsubs : PowerPC_QPX_FFFF_Intrinsic<"qvfmsubs">;
715   def int_ppc_qpx_qvfnmsub : PowerPC_QPX_FFFF_Intrinsic<"qvfnmsub">;
716   def int_ppc_qpx_qvfnmsubs : PowerPC_QPX_FFFF_Intrinsic<"qvfnmsubs">;
717   def int_ppc_qpx_qvfxmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxmadd">;
718   def int_ppc_qpx_qvfxmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxmadds">;
719   def int_ppc_qpx_qvfxxnpmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxxnpmadd">;
720   def int_ppc_qpx_qvfxxnpmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxxnpmadds">;
721   def int_ppc_qpx_qvfxxcpnmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxxcpnmadd">;
722   def int_ppc_qpx_qvfxxcpnmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxxcpnmadds">;
723   def int_ppc_qpx_qvfxxmadd : PowerPC_QPX_FFFF_Intrinsic<"qvfxxmadd">;
724   def int_ppc_qpx_qvfxxmadds : PowerPC_QPX_FFFF_Intrinsic<"qvfxxmadds">;
725
726   // Select Instruction
727   def int_ppc_qpx_qvfsel : PowerPC_QPX_FFFF_Intrinsic<"qvfsel">;
728
729   // Permute Instruction
730   def int_ppc_qpx_qvfperm : PowerPC_QPX_FFFF_Intrinsic<"qvfperm">;
731
732   // Convert and Round Instructions
733   def int_ppc_qpx_qvfctid : PowerPC_QPX_FF_Intrinsic<"qvfctid">;
734   def int_ppc_qpx_qvfctidu : PowerPC_QPX_FF_Intrinsic<"qvfctidu">;
735   def int_ppc_qpx_qvfctidz : PowerPC_QPX_FF_Intrinsic<"qvfctidz">;
736   def int_ppc_qpx_qvfctiduz : PowerPC_QPX_FF_Intrinsic<"qvfctiduz">;
737   def int_ppc_qpx_qvfctiw : PowerPC_QPX_FF_Intrinsic<"qvfctiw">;
738   def int_ppc_qpx_qvfctiwu : PowerPC_QPX_FF_Intrinsic<"qvfctiwu">;
739   def int_ppc_qpx_qvfctiwz : PowerPC_QPX_FF_Intrinsic<"qvfctiwz">;
740   def int_ppc_qpx_qvfctiwuz : PowerPC_QPX_FF_Intrinsic<"qvfctiwuz">;
741   def int_ppc_qpx_qvfcfid : PowerPC_QPX_FF_Intrinsic<"qvfcfid">;
742   def int_ppc_qpx_qvfcfidu : PowerPC_QPX_FF_Intrinsic<"qvfcfidu">;
743   def int_ppc_qpx_qvfcfids : PowerPC_QPX_FF_Intrinsic<"qvfcfids">;
744   def int_ppc_qpx_qvfcfidus : PowerPC_QPX_FF_Intrinsic<"qvfcfidus">;
745   def int_ppc_qpx_qvfrsp : PowerPC_QPX_FF_Intrinsic<"qvfrsp">;
746   def int_ppc_qpx_qvfriz : PowerPC_QPX_FF_Intrinsic<"qvfriz">;
747   def int_ppc_qpx_qvfrin : PowerPC_QPX_FF_Intrinsic<"qvfrin">;
748   def int_ppc_qpx_qvfrip : PowerPC_QPX_FF_Intrinsic<"qvfrip">;
749   def int_ppc_qpx_qvfrim : PowerPC_QPX_FF_Intrinsic<"qvfrim">;
750
751   // Move Instructions
752   def int_ppc_qpx_qvfneg : PowerPC_QPX_FF_Intrinsic<"qvfneg">;
753   def int_ppc_qpx_qvfabs : PowerPC_QPX_FF_Intrinsic<"qvfabs">;
754   def int_ppc_qpx_qvfnabs : PowerPC_QPX_FF_Intrinsic<"qvfnabs">;
755   def int_ppc_qpx_qvfcpsgn : PowerPC_QPX_FFF_Intrinsic<"qvfcpsgn">;
756
757   // Compare Instructions
758   def int_ppc_qpx_qvftstnan : PowerPC_QPX_FFF_Intrinsic<"qvftstnan">;
759   def int_ppc_qpx_qvfcmplt : PowerPC_QPX_FFF_Intrinsic<"qvfcmplt">;
760   def int_ppc_qpx_qvfcmpgt : PowerPC_QPX_FFF_Intrinsic<"qvfcmpgt">;
761   def int_ppc_qpx_qvfcmpeq : PowerPC_QPX_FFF_Intrinsic<"qvfcmpeq">;
762
763   // Load instructions
764   def int_ppc_qpx_qvlfd : PowerPC_QPX_Load_Intrinsic<"qvlfd">;
765   def int_ppc_qpx_qvlfda : PowerPC_QPX_Load_Intrinsic<"qvlfda">;
766   def int_ppc_qpx_qvlfs : PowerPC_QPX_Load_Intrinsic<"qvlfs">;
767   def int_ppc_qpx_qvlfsa : PowerPC_QPX_Load_Intrinsic<"qvlfsa">;
768
769   def int_ppc_qpx_qvlfcda : PowerPC_QPX_Load_Intrinsic<"qvlfcda">;
770   def int_ppc_qpx_qvlfcd : PowerPC_QPX_Load_Intrinsic<"qvlfcd">;
771   def int_ppc_qpx_qvlfcsa : PowerPC_QPX_Load_Intrinsic<"qvlfcsa">;
772   def int_ppc_qpx_qvlfcs : PowerPC_QPX_Load_Intrinsic<"qvlfcs">;
773   def int_ppc_qpx_qvlfiwaa : PowerPC_QPX_Load_Intrinsic<"qvlfiwaa">;
774   def int_ppc_qpx_qvlfiwa : PowerPC_QPX_Load_Intrinsic<"qvlfiwa">;
775   def int_ppc_qpx_qvlfiwza : PowerPC_QPX_Load_Intrinsic<"qvlfiwza">;
776   def int_ppc_qpx_qvlfiwz : PowerPC_QPX_Load_Intrinsic<"qvlfiwz">;
777
778   def int_ppc_qpx_qvlpcld : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcld">;
779   def int_ppc_qpx_qvlpcls : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcls">;
780   def int_ppc_qpx_qvlpcrd : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcrd">;
781   def int_ppc_qpx_qvlpcrs : PowerPC_QPX_LoadPerm_Intrinsic<"qvlpcrs">;
782
783   // Store instructions
784   def int_ppc_qpx_qvstfd : PowerPC_QPX_Store_Intrinsic<"qvstfd">;
785   def int_ppc_qpx_qvstfda : PowerPC_QPX_Store_Intrinsic<"qvstfda">;
786   def int_ppc_qpx_qvstfs : PowerPC_QPX_Store_Intrinsic<"qvstfs">;
787   def int_ppc_qpx_qvstfsa : PowerPC_QPX_Store_Intrinsic<"qvstfsa">;
788
789   def int_ppc_qpx_qvstfcda : PowerPC_QPX_Store_Intrinsic<"qvstfcda">;
790   def int_ppc_qpx_qvstfcd : PowerPC_QPX_Store_Intrinsic<"qvstfcd">;
791   def int_ppc_qpx_qvstfcsa : PowerPC_QPX_Store_Intrinsic<"qvstfcsa">;
792   def int_ppc_qpx_qvstfcs : PowerPC_QPX_Store_Intrinsic<"qvstfcs">;
793   def int_ppc_qpx_qvstfiwa : PowerPC_QPX_Store_Intrinsic<"qvstfiwa">;
794   def int_ppc_qpx_qvstfiw : PowerPC_QPX_Store_Intrinsic<"qvstfiw">;
795
796   // Logical and permutation formation
797   def int_ppc_qpx_qvflogical : PowerPC_QPX_Intrinsic<"qvflogical",
798                           [llvm_v4f64_ty],
799                           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_i32_ty],
800                           [IntrNoMem]>;
801   def int_ppc_qpx_qvgpci : PowerPC_QPX_Intrinsic<"qvgpci",
802                           [llvm_v4f64_ty], [llvm_i32_ty], [IntrNoMem]>;
803 }
804