For PR950:
[oota-llvm.git] / include / llvm / IntrinsicsPowerPC.td
1 //===- IntrinsicsPowerPC.td - Defines PowerPC intrinsics ---*- tablegen -*-===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Chris Lattner and is distributed under the
6 // University of Illinois Open Source 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_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
22   def int_ppc_dcbf  : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
23   def int_ppc_dcbi  : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
24   def int_ppc_dcbst : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
25   def int_ppc_dcbt  : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
26   def int_ppc_dcbtst: Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
27   def int_ppc_dcbz  : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
28   def int_ppc_dcbzl : Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
29 }
30
31
32 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
33   /// PowerPC_Vec_Intrinsic - Base class for all altivec intrinsics.
34   class PowerPC_Vec_Intrinsic<string GCCIntSuffix, list<LLVMType> types,
35                               list<IntrinsicProperty> properties>
36     : GCCBuiltin<!strconcat("__builtin_altivec_", GCCIntSuffix)>,
37       Intrinsic<types, properties>;
38 }
39
40 //===----------------------------------------------------------------------===//
41 // PowerPC Altivec Intrinsic Class Definitions.
42 //
43
44 /// PowerPC_Vec_FF_Intrinsic - A PowerPC intrinsic that takes one v4f32
45 /// vector and returns one.  These intrinsics have no side effects.
46 class PowerPC_Vec_FF_Intrinsic<string GCCIntSuffix>
47   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
48                           [llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
49
50 /// PowerPC_Vec_FFF_Intrinsic - A PowerPC intrinsic that takes two v4f32
51 /// vectors and returns one.  These intrinsics have no side effects.
52 class PowerPC_Vec_FFF_Intrinsic<string GCCIntSuffix>
53   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
54                           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
55                           [IntrNoMem]>;
56
57 /// PowerPC_Vec_BBB_Intrinsic - A PowerPC intrinsic that takes two v16f8
58 /// vectors and returns one.  These intrinsics have no side effects.
59 class PowerPC_Vec_BBB_Intrinsic<string GCCIntSuffix> 
60   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
61                           [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
62                           [IntrNoMem]>;
63
64 /// PowerPC_Vec_HHH_Intrinsic - A PowerPC intrinsic that takes two v8i16
65 /// vectors and returns one.  These intrinsics have no side effects.
66 class PowerPC_Vec_HHH_Intrinsic<string GCCIntSuffix> 
67   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
68                           [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
69                           [IntrNoMem]>;
70
71 /// PowerPC_Vec_WWW_Intrinsic - A PowerPC intrinsic that takes two v4i32
72 /// vectors and returns one.  These intrinsics have no side effects.
73 class PowerPC_Vec_WWW_Intrinsic<string GCCIntSuffix> 
74   : PowerPC_Vec_Intrinsic<GCCIntSuffix,
75                           [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
76                           [IntrNoMem]>;
77
78
79 //===----------------------------------------------------------------------===//
80 // PowerPC Altivec Intrinsic Definitions.
81
82 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
83   // Data Stream Control.
84   def int_ppc_altivec_dss : GCCBuiltin<"__builtin_altivec_dss">,
85               Intrinsic<[llvm_void_ty, llvm_int_ty], [IntrWriteMem]>;
86   def int_ppc_altivec_dssall : GCCBuiltin<"__builtin_altivec_dssall">,
87               Intrinsic<[llvm_void_ty], [IntrWriteMem]>;
88   def int_ppc_altivec_dst : GCCBuiltin<"__builtin_altivec_dst">,
89               Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_int_ty, llvm_int_ty],
90                         [IntrWriteMem]>;
91   def int_ppc_altivec_dstt : GCCBuiltin<"__builtin_altivec_dstt">,
92               Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_int_ty, llvm_int_ty],
93                         [IntrWriteMem]>;
94   def int_ppc_altivec_dstst : GCCBuiltin<"__builtin_altivec_dstst">,
95               Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_int_ty, llvm_int_ty],
96                         [IntrWriteMem]>;
97   def int_ppc_altivec_dststt : GCCBuiltin<"__builtin_altivec_dststt">,
98               Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_int_ty, llvm_int_ty],
99                         [IntrWriteMem]>;
100
101   // VSCR access.
102   def int_ppc_altivec_mfvscr : GCCBuiltin<"__builtin_altivec_mfvscr">,
103               Intrinsic<[llvm_v8i16_ty], [IntrReadMem]>;
104   def int_ppc_altivec_mtvscr : GCCBuiltin<"__builtin_altivec_mtvscr">,
105               Intrinsic<[llvm_void_ty, llvm_v4i32_ty], [IntrWriteMem]>;
106
107
108   // Loads.  These don't map directly to GCC builtins because they represent the
109   // source address with a single pointer.
110   def int_ppc_altivec_lvx :
111               Intrinsic<[llvm_v4i32_ty, llvm_ptr_ty], [IntrReadMem]>;
112   def int_ppc_altivec_lvxl :
113               Intrinsic<[llvm_v4i32_ty, llvm_ptr_ty], [IntrReadMem]>;
114   def int_ppc_altivec_lvebx :
115               Intrinsic<[llvm_v16i8_ty, llvm_ptr_ty], [IntrReadMem]>;
116   def int_ppc_altivec_lvehx :
117               Intrinsic<[llvm_v8i16_ty, llvm_ptr_ty], [IntrReadMem]>;
118   def int_ppc_altivec_lvewx :
119               Intrinsic<[llvm_v4i32_ty, llvm_ptr_ty], [IntrReadMem]>;
120
121   // Stores.  These don't map directly to GCC builtins because they represent the
122   // source address with a single pointer.
123   def int_ppc_altivec_stvx :
124               Intrinsic<[llvm_void_ty, llvm_v4i32_ty, llvm_ptr_ty],
125                         [IntrWriteMem]>;
126   def int_ppc_altivec_stvxl :
127               Intrinsic<[llvm_void_ty, llvm_v4i32_ty, llvm_ptr_ty],
128                         [IntrWriteMem]>;
129   def int_ppc_altivec_stvebx :
130               Intrinsic<[llvm_void_ty, llvm_v16i8_ty, llvm_ptr_ty],
131                         [IntrWriteMem]>;
132   def int_ppc_altivec_stvehx :
133               Intrinsic<[llvm_void_ty, llvm_v8i16_ty, llvm_ptr_ty],
134                         [IntrWriteMem]>;
135   def int_ppc_altivec_stvewx :
136               Intrinsic<[llvm_void_ty, llvm_v4i32_ty, llvm_ptr_ty],
137                         [IntrWriteMem]>;
138
139   // Comparisons setting a vector.
140   def int_ppc_altivec_vcmpbfp : GCCBuiltin<"__builtin_altivec_vcmpbfp">,
141               Intrinsic<[llvm_v4i32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
142                         [IntrNoMem]>;
143   def int_ppc_altivec_vcmpeqfp : GCCBuiltin<"__builtin_altivec_vcmpeqfp">,
144               Intrinsic<[llvm_v4i32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
145                         [IntrNoMem]>;
146   def int_ppc_altivec_vcmpgefp : GCCBuiltin<"__builtin_altivec_vcmpgefp">,
147               Intrinsic<[llvm_v4i32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
148                         [IntrNoMem]>;
149   def int_ppc_altivec_vcmpgtfp : GCCBuiltin<"__builtin_altivec_vcmpgtfp">,
150               Intrinsic<[llvm_v4i32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
151                         [IntrNoMem]>;
152                         
153   def int_ppc_altivec_vcmpequw : GCCBuiltin<"__builtin_altivec_vcmpequw">,
154               Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
155                         [IntrNoMem]>;
156   def int_ppc_altivec_vcmpgtsw : GCCBuiltin<"__builtin_altivec_vcmpgtsw">,
157               Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
158                         [IntrNoMem]>;
159   def int_ppc_altivec_vcmpgtuw : GCCBuiltin<"__builtin_altivec_vcmpgtuw">,
160               Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
161                         [IntrNoMem]>;
162                         
163   def int_ppc_altivec_vcmpequh : GCCBuiltin<"__builtin_altivec_vcmpequh">,
164               Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
165                         [IntrNoMem]>;
166   def int_ppc_altivec_vcmpgtsh : GCCBuiltin<"__builtin_altivec_vcmpgtsh">,
167               Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
168                         [IntrNoMem]>;
169   def int_ppc_altivec_vcmpgtuh : GCCBuiltin<"__builtin_altivec_vcmpgtuh">,
170               Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
171                         [IntrNoMem]>;
172
173   def int_ppc_altivec_vcmpequb : GCCBuiltin<"__builtin_altivec_vcmpequb">,
174               Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
175                         [IntrNoMem]>;
176   def int_ppc_altivec_vcmpgtsb : GCCBuiltin<"__builtin_altivec_vcmpgtsb">,
177               Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
178                         [IntrNoMem]>;
179   def int_ppc_altivec_vcmpgtub : GCCBuiltin<"__builtin_altivec_vcmpgtub">,
180               Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
181                         [IntrNoMem]>;
182
183   // Predicate Comparisons.  The first operand specifies interpretation of CR6.
184   def int_ppc_altivec_vcmpbfp_p : GCCBuiltin<"__builtin_altivec_vcmpbfp_p">,
185               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4f32_ty,llvm_v4f32_ty],
186                         [IntrNoMem]>;
187   def int_ppc_altivec_vcmpeqfp_p : GCCBuiltin<"__builtin_altivec_vcmpeqfp_p">,
188               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4f32_ty,llvm_v4f32_ty],
189                         [IntrNoMem]>;
190   def int_ppc_altivec_vcmpgefp_p : GCCBuiltin<"__builtin_altivec_vcmpgefp_p">,
191               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4f32_ty,llvm_v4f32_ty],
192                         [IntrNoMem]>;
193   def int_ppc_altivec_vcmpgtfp_p : GCCBuiltin<"__builtin_altivec_vcmpgtfp_p">,
194               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4f32_ty,llvm_v4f32_ty],
195                         [IntrNoMem]>;
196                         
197   def int_ppc_altivec_vcmpequw_p : GCCBuiltin<"__builtin_altivec_vcmpequw_p">,
198               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4i32_ty,llvm_v4i32_ty],
199                         [IntrNoMem]>;
200   def int_ppc_altivec_vcmpgtsw_p : GCCBuiltin<"__builtin_altivec_vcmpgtsw_p">,
201               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4i32_ty,llvm_v4i32_ty],
202                         [IntrNoMem]>;
203   def int_ppc_altivec_vcmpgtuw_p : GCCBuiltin<"__builtin_altivec_vcmpgtuw_p">,
204               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v4i32_ty,llvm_v4i32_ty],
205                         [IntrNoMem]>;
206                         
207   def int_ppc_altivec_vcmpequh_p : GCCBuiltin<"__builtin_altivec_vcmpequh_p">,
208               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v8i16_ty,llvm_v8i16_ty],
209                         [IntrNoMem]>;
210   def int_ppc_altivec_vcmpgtsh_p : GCCBuiltin<"__builtin_altivec_vcmpgtsh_p">,
211               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v8i16_ty,llvm_v8i16_ty],
212                         [IntrNoMem]>;
213   def int_ppc_altivec_vcmpgtuh_p : GCCBuiltin<"__builtin_altivec_vcmpgtuh_p">,
214               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v8i16_ty,llvm_v8i16_ty],
215                         [IntrNoMem]>;
216
217   def int_ppc_altivec_vcmpequb_p : GCCBuiltin<"__builtin_altivec_vcmpequb_p">,
218               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v16i8_ty,llvm_v16i8_ty],
219                         [IntrNoMem]>;
220   def int_ppc_altivec_vcmpgtsb_p : GCCBuiltin<"__builtin_altivec_vcmpgtsb_p">,
221               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v16i8_ty,llvm_v16i8_ty],
222                         [IntrNoMem]>;
223   def int_ppc_altivec_vcmpgtub_p : GCCBuiltin<"__builtin_altivec_vcmpgtub_p">,
224               Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_v16i8_ty,llvm_v16i8_ty],
225                         [IntrNoMem]>;
226 }
227
228 // Vector average.
229 def int_ppc_altivec_vavgsb : PowerPC_Vec_BBB_Intrinsic<"vavgsb">;
230 def int_ppc_altivec_vavgsh : PowerPC_Vec_HHH_Intrinsic<"vavgsh">;
231 def int_ppc_altivec_vavgsw : PowerPC_Vec_WWW_Intrinsic<"vavgsw">;
232 def int_ppc_altivec_vavgub : PowerPC_Vec_BBB_Intrinsic<"vavgub">;
233 def int_ppc_altivec_vavguh : PowerPC_Vec_HHH_Intrinsic<"vavguh">;
234 def int_ppc_altivec_vavguw : PowerPC_Vec_WWW_Intrinsic<"vavguw">;
235
236 // Vector maximum.
237 def int_ppc_altivec_vmaxfp : PowerPC_Vec_FFF_Intrinsic<"vmaxfp">;
238 def int_ppc_altivec_vmaxsb : PowerPC_Vec_BBB_Intrinsic<"vmaxsb">;
239 def int_ppc_altivec_vmaxsh : PowerPC_Vec_HHH_Intrinsic<"vmaxsh">;
240 def int_ppc_altivec_vmaxsw : PowerPC_Vec_WWW_Intrinsic<"vmaxsw">;
241 def int_ppc_altivec_vmaxub : PowerPC_Vec_BBB_Intrinsic<"vmaxub">;
242 def int_ppc_altivec_vmaxuh : PowerPC_Vec_HHH_Intrinsic<"vmaxuh">;
243 def int_ppc_altivec_vmaxuw : PowerPC_Vec_WWW_Intrinsic<"vmaxuw">;
244
245 // Vector minimum.
246 def int_ppc_altivec_vminfp : PowerPC_Vec_FFF_Intrinsic<"vminfp">;
247 def int_ppc_altivec_vminsb : PowerPC_Vec_BBB_Intrinsic<"vminsb">;
248 def int_ppc_altivec_vminsh : PowerPC_Vec_HHH_Intrinsic<"vminsh">;
249 def int_ppc_altivec_vminsw : PowerPC_Vec_WWW_Intrinsic<"vminsw">;
250 def int_ppc_altivec_vminub : PowerPC_Vec_BBB_Intrinsic<"vminub">;
251 def int_ppc_altivec_vminuh : PowerPC_Vec_HHH_Intrinsic<"vminuh">;
252 def int_ppc_altivec_vminuw : PowerPC_Vec_WWW_Intrinsic<"vminuw">;
253
254 // Saturating adds.
255 def int_ppc_altivec_vaddubs : PowerPC_Vec_BBB_Intrinsic<"vaddubs">;
256 def int_ppc_altivec_vaddsbs : PowerPC_Vec_BBB_Intrinsic<"vaddsbs">;
257 def int_ppc_altivec_vadduhs : PowerPC_Vec_HHH_Intrinsic<"vadduhs">;
258 def int_ppc_altivec_vaddshs : PowerPC_Vec_HHH_Intrinsic<"vaddshs">;
259 def int_ppc_altivec_vadduws : PowerPC_Vec_WWW_Intrinsic<"vadduws">;
260 def int_ppc_altivec_vaddsws : PowerPC_Vec_WWW_Intrinsic<"vaddsws">;
261 def int_ppc_altivec_vaddcuw : PowerPC_Vec_WWW_Intrinsic<"vaddcuw">;
262
263 // Saturating subs.
264 def int_ppc_altivec_vsububs : PowerPC_Vec_BBB_Intrinsic<"vsububs">;
265 def int_ppc_altivec_vsubsbs : PowerPC_Vec_BBB_Intrinsic<"vsubsbs">;
266 def int_ppc_altivec_vsubuhs : PowerPC_Vec_HHH_Intrinsic<"vsubuhs">;
267 def int_ppc_altivec_vsubshs : PowerPC_Vec_HHH_Intrinsic<"vsubshs">;
268 def int_ppc_altivec_vsubuws : PowerPC_Vec_WWW_Intrinsic<"vsubuws">;
269 def int_ppc_altivec_vsubsws : PowerPC_Vec_WWW_Intrinsic<"vsubsws">;
270 def int_ppc_altivec_vsubcuw : PowerPC_Vec_WWW_Intrinsic<"vsubcuw">;
271
272 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
273   // Saturating multiply-adds.
274   def int_ppc_altivec_vmhaddshs : GCCBuiltin<"__builtin_altivec_vmhaddshs">,
275               Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty,
276                          llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
277   def int_ppc_altivec_vmhraddshs : GCCBuiltin<"__builtin_altivec_vmhraddshs">,
278               Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty,
279                          llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
280
281   def int_ppc_altivec_vmaddfp : GCCBuiltin<"__builtin_altivec_vmaddfp">,
282               Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
283                          llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
284   def int_ppc_altivec_vnmsubfp : GCCBuiltin<"__builtin_altivec_vnmsubfp">,
285               Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
286                          llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
287
288   // Vector Multiply Sum Intructions.
289   def int_ppc_altivec_vmsummbm : GCCBuiltin<"__builtin_altivec_vmsummbm">,
290             Intrinsic<[llvm_v4i32_ty, llvm_v16i8_ty, llvm_v16i8_ty,
291                        llvm_v4i32_ty], [IntrNoMem]>;
292   def int_ppc_altivec_vmsumshm : GCCBuiltin<"__builtin_altivec_vmsumshm">,
293             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty,
294                        llvm_v4i32_ty], [IntrNoMem]>;
295   def int_ppc_altivec_vmsumshs : GCCBuiltin<"__builtin_altivec_vmsumshs">,
296             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty, 
297                        llvm_v4i32_ty], [IntrNoMem]>;
298   def int_ppc_altivec_vmsumubm : GCCBuiltin<"__builtin_altivec_vmsumubm">,
299             Intrinsic<[llvm_v4i32_ty, llvm_v16i8_ty, llvm_v16i8_ty, 
300                        llvm_v4i32_ty], [IntrNoMem]>;
301   def int_ppc_altivec_vmsumuhm : GCCBuiltin<"__builtin_altivec_vmsumuhm">,
302             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty,
303                        llvm_v4i32_ty], [IntrNoMem]>;
304   def int_ppc_altivec_vmsumuhs : GCCBuiltin<"__builtin_altivec_vmsumuhs">,
305             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty,
306                        llvm_v4i32_ty], [IntrNoMem]>;
307
308   // Vector Multiply Intructions.
309   def int_ppc_altivec_vmulesb : GCCBuiltin<"__builtin_altivec_vmulesb">,
310           Intrinsic<[llvm_v8i16_ty, llvm_v16i8_ty, llvm_v16i8_ty],
311                     [IntrNoMem]>;
312   def int_ppc_altivec_vmulesh : GCCBuiltin<"__builtin_altivec_vmulesh">,
313           Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty],
314                     [IntrNoMem]>;
315   def int_ppc_altivec_vmuleub : GCCBuiltin<"__builtin_altivec_vmuleub">,
316           Intrinsic<[llvm_v8i16_ty, llvm_v16i8_ty, llvm_v16i8_ty],
317                     [IntrNoMem]>;
318   def int_ppc_altivec_vmuleuh : GCCBuiltin<"__builtin_altivec_vmuleuh">,
319           Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty],
320                     [IntrNoMem]>;
321
322   def int_ppc_altivec_vmulosb : GCCBuiltin<"__builtin_altivec_vmulosb">,
323           Intrinsic<[llvm_v8i16_ty, llvm_v16i8_ty, llvm_v16i8_ty],
324                     [IntrNoMem]>;
325   def int_ppc_altivec_vmulosh : GCCBuiltin<"__builtin_altivec_vmulosh">,
326           Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty],
327                     [IntrNoMem]>;
328   def int_ppc_altivec_vmuloub : GCCBuiltin<"__builtin_altivec_vmuloub">,
329           Intrinsic<[llvm_v8i16_ty, llvm_v16i8_ty, llvm_v16i8_ty],
330                     [IntrNoMem]>;
331   def int_ppc_altivec_vmulouh : GCCBuiltin<"__builtin_altivec_vmulouh">,
332           Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v8i16_ty],
333                     [IntrNoMem]>;
334
335   // Vector Sum Intructions.
336   def int_ppc_altivec_vsumsws : GCCBuiltin<"__builtin_altivec_vsumsws">,
337             Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
338                       [IntrNoMem]>;
339   def int_ppc_altivec_vsum2sws : GCCBuiltin<"__builtin_altivec_vsum2sws">,
340             Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
341                       [IntrNoMem]>;
342   def int_ppc_altivec_vsum4sbs : GCCBuiltin<"__builtin_altivec_vsum4sbs">,
343             Intrinsic<[llvm_v4i32_ty, llvm_v16i8_ty, llvm_v4i32_ty],
344                       [IntrNoMem]>;
345   def int_ppc_altivec_vsum4shs : GCCBuiltin<"__builtin_altivec_vsum4shs">,
346             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty, llvm_v4i32_ty],
347                       [IntrNoMem]>;
348   def int_ppc_altivec_vsum4ubs : GCCBuiltin<"__builtin_altivec_vsum4ubs">,
349             Intrinsic<[llvm_v4i32_ty, llvm_v16i8_ty, llvm_v4i32_ty],
350                       [IntrNoMem]>;
351
352   // Other multiplies.
353   def int_ppc_altivec_vmladduhm : GCCBuiltin<"__builtin_altivec_vmladduhm">,
354             Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty, 
355                        llvm_v8i16_ty], [IntrNoMem]>;
356
357   // Packs.
358   def int_ppc_altivec_vpkpx : GCCBuiltin<"__builtin_altivec_vpkpx">,
359             Intrinsic<[llvm_v8i16_ty, llvm_v4i32_ty, llvm_v4i32_ty],
360                       [IntrNoMem]>;
361   def int_ppc_altivec_vpkshss : GCCBuiltin<"__builtin_altivec_vpkshss">,
362             Intrinsic<[llvm_v16i8_ty, llvm_v8i16_ty, llvm_v8i16_ty],
363                       [IntrNoMem]>;
364   def int_ppc_altivec_vpkshus : GCCBuiltin<"__builtin_altivec_vpkshus">,
365             Intrinsic<[llvm_v16i8_ty, llvm_v8i16_ty, llvm_v8i16_ty],
366                       [IntrNoMem]>;
367   def int_ppc_altivec_vpkswss : GCCBuiltin<"__builtin_altivec_vpkswss">,
368             Intrinsic<[llvm_v16i8_ty, llvm_v4i32_ty, llvm_v4i32_ty],
369                       [IntrNoMem]>;
370   def int_ppc_altivec_vpkswus : GCCBuiltin<"__builtin_altivec_vpkswus">,
371             Intrinsic<[llvm_v8i16_ty, llvm_v4i32_ty, llvm_v4i32_ty],
372                       [IntrNoMem]>;
373   // vpkuhum is lowered to a shuffle.
374   def int_ppc_altivec_vpkuhus : GCCBuiltin<"__builtin_altivec_vpkuhus">,
375             Intrinsic<[llvm_v16i8_ty, llvm_v8i16_ty, llvm_v8i16_ty],
376                       [IntrNoMem]>;
377   // vpkuwum is lowered to a shuffle.
378   def int_ppc_altivec_vpkuwus : GCCBuiltin<"__builtin_altivec_vpkuwus">,
379             Intrinsic<[llvm_v8i16_ty, llvm_v4i32_ty, llvm_v4i32_ty],
380                       [IntrNoMem]>;
381
382   // Unpacks.
383   def int_ppc_altivec_vupkhpx : GCCBuiltin<"__builtin_altivec_vupkhpx">,
384             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty], [IntrNoMem]>;
385   def int_ppc_altivec_vupkhsb : GCCBuiltin<"__builtin_altivec_vupkhsb">,
386             Intrinsic<[llvm_v8i16_ty, llvm_v16i8_ty], [IntrNoMem]>;
387   def int_ppc_altivec_vupkhsh : GCCBuiltin<"__builtin_altivec_vupkhsh">,
388             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty], [IntrNoMem]>;
389   def int_ppc_altivec_vupklpx : GCCBuiltin<"__builtin_altivec_vupklpx">,
390             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty], [IntrNoMem]>;
391   def int_ppc_altivec_vupklsb : GCCBuiltin<"__builtin_altivec_vupklsb">,
392             Intrinsic<[llvm_v8i16_ty, llvm_v16i8_ty], [IntrNoMem]>;
393   def int_ppc_altivec_vupklsh : GCCBuiltin<"__builtin_altivec_vupklsh">,
394             Intrinsic<[llvm_v4i32_ty, llvm_v8i16_ty], [IntrNoMem]>;
395
396
397   // FP <-> integer conversion.
398   def int_ppc_altivec_vcfsx : GCCBuiltin<"__builtin_altivec_vcfsx">,
399               Intrinsic<[llvm_v4f32_ty, llvm_v4i32_ty, llvm_int_ty],
400                         [IntrNoMem]>;
401   def int_ppc_altivec_vcfux : GCCBuiltin<"__builtin_altivec_vcfux">,
402               Intrinsic<[llvm_v4f32_ty, llvm_v4i32_ty, llvm_int_ty],
403                         [IntrNoMem]>;
404   def int_ppc_altivec_vctsxs : GCCBuiltin<"__builtin_altivec_vctsxs">,
405               Intrinsic<[llvm_v4i32_ty, llvm_v4f32_ty, llvm_int_ty],
406                         [IntrNoMem]>;
407   def int_ppc_altivec_vctuxs : GCCBuiltin<"__builtin_altivec_vctuxs">,
408               Intrinsic<[llvm_v4i32_ty, llvm_v4f32_ty, llvm_int_ty],
409                         [IntrNoMem]>;
410
411   def int_ppc_altivec_vrfim : GCCBuiltin<"__builtin_altivec_vrfim">,
412               Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
413   def int_ppc_altivec_vrfin : GCCBuiltin<"__builtin_altivec_vrfin">,
414               Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
415   def int_ppc_altivec_vrfip : GCCBuiltin<"__builtin_altivec_vrfip">,
416               Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
417   def int_ppc_altivec_vrfiz : GCCBuiltin<"__builtin_altivec_vrfiz">,
418               Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty], [IntrNoMem]>;
419 }
420
421 def int_ppc_altivec_vsl   : PowerPC_Vec_WWW_Intrinsic<"vsl">;
422 def int_ppc_altivec_vslo  : PowerPC_Vec_WWW_Intrinsic<"vslo">;
423
424 def int_ppc_altivec_vslb  : PowerPC_Vec_BBB_Intrinsic<"vslb">;
425 def int_ppc_altivec_vslh  : PowerPC_Vec_HHH_Intrinsic<"vslh">;
426 def int_ppc_altivec_vslw  : PowerPC_Vec_WWW_Intrinsic<"vslw">;
427
428 // Right Shifts.
429 def int_ppc_altivec_vsr   : PowerPC_Vec_WWW_Intrinsic<"vsr">;
430 def int_ppc_altivec_vsro  : PowerPC_Vec_WWW_Intrinsic<"vsro">;
431   
432 def int_ppc_altivec_vsrb  : PowerPC_Vec_BBB_Intrinsic<"vsrb">;
433 def int_ppc_altivec_vsrh  : PowerPC_Vec_HHH_Intrinsic<"vsrh">;
434 def int_ppc_altivec_vsrw  : PowerPC_Vec_WWW_Intrinsic<"vsrw">;
435 def int_ppc_altivec_vsrab : PowerPC_Vec_BBB_Intrinsic<"vsrab">;
436 def int_ppc_altivec_vsrah : PowerPC_Vec_HHH_Intrinsic<"vsrah">;
437 def int_ppc_altivec_vsraw : PowerPC_Vec_WWW_Intrinsic<"vsraw">;
438
439 // Rotates.
440 def int_ppc_altivec_vrlb  : PowerPC_Vec_BBB_Intrinsic<"vrlb">;
441 def int_ppc_altivec_vrlh  : PowerPC_Vec_HHH_Intrinsic<"vrlh">;
442 def int_ppc_altivec_vrlw  : PowerPC_Vec_WWW_Intrinsic<"vrlw">;
443
444 let TargetPrefix = "ppc" in {  // All PPC intrinsics start with "llvm.ppc.".
445   // Miscellaneous.
446   def int_ppc_altivec_lvsl :
447               Intrinsic<[llvm_v16i8_ty, llvm_ptr_ty], [IntrNoMem]>;
448   def int_ppc_altivec_lvsr :
449               Intrinsic<[llvm_v16i8_ty, llvm_ptr_ty], [IntrNoMem]>;
450
451   def int_ppc_altivec_vperm : GCCBuiltin<"__builtin_altivec_vperm_4si">,
452               Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, 
453                          llvm_v4i32_ty, llvm_v16i8_ty], [IntrNoMem]>;
454   def int_ppc_altivec_vsel : GCCBuiltin<"__builtin_altivec_vsel_4si">,
455               Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, 
456                          llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
457 }
458
459 def int_ppc_altivec_vexptefp  : PowerPC_Vec_FF_Intrinsic<"vexptefp">;
460 def int_ppc_altivec_vlogefp   : PowerPC_Vec_FF_Intrinsic<"vlogefp">;
461 def int_ppc_altivec_vrefp     : PowerPC_Vec_FF_Intrinsic<"vrefp">;
462 def int_ppc_altivec_vrsqrtefp : PowerPC_Vec_FF_Intrinsic<"vrsqrtefp">;