ce4208f96ba0d2d58fdcc55549d62d01e799b870
[oota-llvm.git] / include / llvm / IR / IntrinsicsX86.td
1 //===- IntrinsicsX86.td - Defines X86 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 X86-specific intrinsics.
11 //
12 //===----------------------------------------------------------------------===//
13
14 //===----------------------------------------------------------------------===//
15 // Interrupt traps
16 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
17   def int_x86_int : Intrinsic<[], [llvm_i8_ty]>;
18 }
19
20 //===----------------------------------------------------------------------===//
21 // SEH intrinsics for Windows
22 let TargetPrefix = "x86" in {
23   def int_x86_seh_lsda : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty], [IntrNoMem]>;
24
25   // Restores the frame, base, and stack pointers as necessary after recovering
26   // from an exception. Any block resuming control flow in the parent function
27   // should call this before accessing any stack memory.
28   def int_x86_seh_restoreframe : Intrinsic<[], [], []>;
29
30   // Given a pointer to the end of an EH registration object, returns the true
31   // parent frame address that can be used with llvm.localrecover.
32   def int_x86_seh_recoverfp : Intrinsic<[llvm_ptr_ty],
33                                         [llvm_ptr_ty, llvm_ptr_ty],
34                                         [IntrNoMem]>;
35 }
36
37 //===----------------------------------------------------------------------===//
38 // Read Time Stamp Counter.
39 let TargetPrefix = "x86" in {
40   def int_x86_rdtsc : GCCBuiltin<"__builtin_ia32_rdtsc">,
41               Intrinsic<[llvm_i64_ty], [], []>;
42   def int_x86_rdtscp : GCCBuiltin<"__builtin_ia32_rdtscp">,
43               Intrinsic<[llvm_i64_ty], [llvm_ptr_ty], [IntrReadWriteArgMem]>;
44 }
45
46 // Read Performance-Monitoring Counter.
47 let TargetPrefix = "x86" in {
48   def int_x86_rdpmc : GCCBuiltin<"__builtin_ia32_rdpmc">,
49               Intrinsic<[llvm_i64_ty], [llvm_i32_ty], []>;
50 }
51
52 //===----------------------------------------------------------------------===//
53 // 3DNow!
54
55 let TargetPrefix = "x86" in {
56   def int_x86_3dnow_pavgusb : GCCBuiltin<"__builtin_ia32_pavgusb">,
57               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
58                         [IntrNoMem]>;
59   def int_x86_3dnow_pf2id : GCCBuiltin<"__builtin_ia32_pf2id">,
60               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
61   def int_x86_3dnow_pfacc : GCCBuiltin<"__builtin_ia32_pfacc">,
62               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
63                         [IntrNoMem]>;
64   def int_x86_3dnow_pfadd : GCCBuiltin<"__builtin_ia32_pfadd">,
65               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
66                         [IntrNoMem]>;
67   def int_x86_3dnow_pfcmpeq : GCCBuiltin<"__builtin_ia32_pfcmpeq">,
68               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
69                         [IntrNoMem]>;
70   def int_x86_3dnow_pfcmpge : GCCBuiltin<"__builtin_ia32_pfcmpge">,
71               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
72                         [IntrNoMem]>;
73   def int_x86_3dnow_pfcmpgt : GCCBuiltin<"__builtin_ia32_pfcmpgt">,
74               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
75                         [IntrNoMem]>;
76   def int_x86_3dnow_pfmax : GCCBuiltin<"__builtin_ia32_pfmax">,
77               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
78                         [IntrNoMem]>;
79   def int_x86_3dnow_pfmin : GCCBuiltin<"__builtin_ia32_pfmin">,
80               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
81                         [IntrNoMem]>;
82   def int_x86_3dnow_pfmul : GCCBuiltin<"__builtin_ia32_pfmul">,
83               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
84                         [IntrNoMem]>;
85   def int_x86_3dnow_pfrcp : GCCBuiltin<"__builtin_ia32_pfrcp">,
86               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
87   def int_x86_3dnow_pfrcpit1 : GCCBuiltin<"__builtin_ia32_pfrcpit1">,
88               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
89                         [IntrNoMem]>;
90   def int_x86_3dnow_pfrcpit2 : GCCBuiltin<"__builtin_ia32_pfrcpit2">,
91               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
92                         [IntrNoMem]>;
93   def int_x86_3dnow_pfrsqrt : GCCBuiltin<"__builtin_ia32_pfrsqrt">,
94               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
95   def int_x86_3dnow_pfrsqit1 : GCCBuiltin<"__builtin_ia32_pfrsqit1">,
96               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
97                         [IntrNoMem]>;
98   def int_x86_3dnow_pfsub : GCCBuiltin<"__builtin_ia32_pfsub">,
99               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
100                         [IntrNoMem]>;
101   def int_x86_3dnow_pfsubr : GCCBuiltin<"__builtin_ia32_pfsubr">,
102               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
103                         [IntrNoMem]>;
104   def int_x86_3dnow_pi2fd : GCCBuiltin<"__builtin_ia32_pi2fd">,
105               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
106   def int_x86_3dnow_pmulhrw : GCCBuiltin<"__builtin_ia32_pmulhrw">,
107               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
108                         [IntrNoMem]>;
109 }
110
111 //===----------------------------------------------------------------------===//
112 // 3DNow! extensions
113
114 let TargetPrefix = "x86" in {
115   def int_x86_3dnowa_pf2iw : GCCBuiltin<"__builtin_ia32_pf2iw">,
116               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
117   def int_x86_3dnowa_pfnacc : GCCBuiltin<"__builtin_ia32_pfnacc">,
118               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
119                         [IntrNoMem]>;
120   def int_x86_3dnowa_pfpnacc : GCCBuiltin<"__builtin_ia32_pfpnacc">,
121               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
122                         [IntrNoMem]>;
123   def int_x86_3dnowa_pi2fw : GCCBuiltin<"__builtin_ia32_pi2fw">,
124               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
125   def int_x86_3dnowa_pswapd :
126               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
127 }
128
129 //===----------------------------------------------------------------------===//
130 // SSE1
131
132 // Arithmetic ops
133 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
134   def int_x86_sse_add_ss : GCCBuiltin<"__builtin_ia32_addss">,
135               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
136                          llvm_v4f32_ty], [IntrNoMem]>;
137   def int_x86_sse_sub_ss : GCCBuiltin<"__builtin_ia32_subss">,
138               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
139                          llvm_v4f32_ty], [IntrNoMem]>;
140   def int_x86_sse_mul_ss : GCCBuiltin<"__builtin_ia32_mulss">,
141               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
142                          llvm_v4f32_ty], [IntrNoMem]>;
143   def int_x86_sse_div_ss : GCCBuiltin<"__builtin_ia32_divss">,
144               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
145                          llvm_v4f32_ty], [IntrNoMem]>;
146   def int_x86_sse_sqrt_ss : GCCBuiltin<"__builtin_ia32_sqrtss">,
147               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
148                         [IntrNoMem]>;
149   def int_x86_sse_sqrt_ps : GCCBuiltin<"__builtin_ia32_sqrtps">,
150               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
151                         [IntrNoMem]>;
152   def int_x86_sse_rcp_ss : GCCBuiltin<"__builtin_ia32_rcpss">,
153               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
154                         [IntrNoMem]>;
155   def int_x86_sse_rcp_ps : GCCBuiltin<"__builtin_ia32_rcpps">,
156               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
157                         [IntrNoMem]>;
158   def int_x86_sse_rsqrt_ss : GCCBuiltin<"__builtin_ia32_rsqrtss">,
159               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
160                         [IntrNoMem]>;
161   def int_x86_sse_rsqrt_ps : GCCBuiltin<"__builtin_ia32_rsqrtps">,
162               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
163                         [IntrNoMem]>;
164   def int_x86_sse_min_ss : GCCBuiltin<"__builtin_ia32_minss">,
165               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
166                          llvm_v4f32_ty], [IntrNoMem]>;
167   def int_x86_sse_min_ps : GCCBuiltin<"__builtin_ia32_minps">,
168               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
169                          llvm_v4f32_ty], [IntrNoMem]>;
170   def int_x86_sse_max_ss : GCCBuiltin<"__builtin_ia32_maxss">,
171               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
172                          llvm_v4f32_ty], [IntrNoMem]>;
173   def int_x86_sse_max_ps : GCCBuiltin<"__builtin_ia32_maxps">,
174               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
175                          llvm_v4f32_ty], [IntrNoMem]>;
176 }
177
178 // Comparison ops
179 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
180   def int_x86_sse_cmp_ss : GCCBuiltin<"__builtin_ia32_cmpss">,
181               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
182                          llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
183   def int_x86_sse_cmp_ps : GCCBuiltin<"__builtin_ia32_cmpps">,
184               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
185                          llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
186   def int_x86_sse_comieq_ss : GCCBuiltin<"__builtin_ia32_comieq">,
187               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
188                          llvm_v4f32_ty], [IntrNoMem]>;
189   def int_x86_sse_comilt_ss : GCCBuiltin<"__builtin_ia32_comilt">,
190               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
191                          llvm_v4f32_ty], [IntrNoMem]>;
192   def int_x86_sse_comile_ss : GCCBuiltin<"__builtin_ia32_comile">,
193               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
194                          llvm_v4f32_ty], [IntrNoMem]>;
195   def int_x86_sse_comigt_ss : GCCBuiltin<"__builtin_ia32_comigt">,
196               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
197                          llvm_v4f32_ty], [IntrNoMem]>;
198   def int_x86_sse_comige_ss : GCCBuiltin<"__builtin_ia32_comige">,
199               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
200                          llvm_v4f32_ty], [IntrNoMem]>;
201   def int_x86_sse_comineq_ss : GCCBuiltin<"__builtin_ia32_comineq">,
202               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
203                          llvm_v4f32_ty], [IntrNoMem]>;
204   def int_x86_sse_ucomieq_ss : GCCBuiltin<"__builtin_ia32_ucomieq">,
205               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
206                          llvm_v4f32_ty], [IntrNoMem]>;
207   def int_x86_sse_ucomilt_ss : GCCBuiltin<"__builtin_ia32_ucomilt">,
208               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
209                          llvm_v4f32_ty], [IntrNoMem]>;
210   def int_x86_sse_ucomile_ss : GCCBuiltin<"__builtin_ia32_ucomile">,
211               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
212                          llvm_v4f32_ty], [IntrNoMem]>;
213   def int_x86_sse_ucomigt_ss : GCCBuiltin<"__builtin_ia32_ucomigt">,
214               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
215                          llvm_v4f32_ty], [IntrNoMem]>;
216   def int_x86_sse_ucomige_ss : GCCBuiltin<"__builtin_ia32_ucomige">,
217               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
218                          llvm_v4f32_ty], [IntrNoMem]>;
219   def int_x86_sse_ucomineq_ss : GCCBuiltin<"__builtin_ia32_ucomineq">,
220               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
221                          llvm_v4f32_ty], [IntrNoMem]>;
222 }
223
224
225 // Conversion ops
226 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
227   def int_x86_sse_cvtss2si : GCCBuiltin<"__builtin_ia32_cvtss2si">,
228               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
229   def int_x86_sse_cvtss2si64 : GCCBuiltin<"__builtin_ia32_cvtss2si64">,
230               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
231   def int_x86_sse_cvttss2si : GCCBuiltin<"__builtin_ia32_cvttss2si">,
232               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
233   def int_x86_sse_cvttss2si64 : GCCBuiltin<"__builtin_ia32_cvttss2si64">,
234               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
235   def int_x86_sse_cvtsi2ss : GCCBuiltin<"__builtin_ia32_cvtsi2ss">,
236               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
237                          llvm_i32_ty], [IntrNoMem]>;
238   def int_x86_sse_cvtsi642ss : GCCBuiltin<"__builtin_ia32_cvtsi642ss">,
239               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
240                          llvm_i64_ty], [IntrNoMem]>;
241
242   def int_x86_sse_cvtps2pi : GCCBuiltin<"__builtin_ia32_cvtps2pi">,
243               Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
244   def int_x86_sse_cvttps2pi: GCCBuiltin<"__builtin_ia32_cvttps2pi">,
245               Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
246   def int_x86_sse_cvtpi2ps : GCCBuiltin<"__builtin_ia32_cvtpi2ps">,
247               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
248                          llvm_x86mmx_ty], [IntrNoMem]>;
249 }
250
251 // SIMD store ops
252 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
253   def int_x86_sse_storeu_ps : GCCBuiltin<"__builtin_ia32_storeups">,
254               Intrinsic<[], [llvm_ptr_ty,
255                          llvm_v4f32_ty], [IntrReadWriteArgMem]>;
256 }
257
258 // Cacheability support ops
259 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
260   def int_x86_sse_sfence : GCCBuiltin<"__builtin_ia32_sfence">,
261               Intrinsic<[], [], []>;
262 }
263
264 // Control register.
265 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
266   def int_x86_sse_stmxcsr :
267               Intrinsic<[], [llvm_ptr_ty], []>;
268   def int_x86_sse_ldmxcsr :
269               Intrinsic<[], [llvm_ptr_ty], []>;
270 }
271
272 // Misc.
273 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
274   def int_x86_sse_movmsk_ps : GCCBuiltin<"__builtin_ia32_movmskps">,
275               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
276 }
277
278 //===----------------------------------------------------------------------===//
279 // SSE2
280
281 // FP arithmetic ops
282 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
283   def int_x86_sse2_add_sd : GCCBuiltin<"__builtin_ia32_addsd">,
284               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
285                          llvm_v2f64_ty], [IntrNoMem]>;
286   def int_x86_sse2_sub_sd : GCCBuiltin<"__builtin_ia32_subsd">,
287               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
288                          llvm_v2f64_ty], [IntrNoMem]>;
289   def int_x86_sse2_mul_sd : GCCBuiltin<"__builtin_ia32_mulsd">,
290               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
291                          llvm_v2f64_ty], [IntrNoMem]>;
292   def int_x86_sse2_div_sd : GCCBuiltin<"__builtin_ia32_divsd">,
293               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
294                          llvm_v2f64_ty], [IntrNoMem]>;
295   def int_x86_sse2_sqrt_sd : GCCBuiltin<"__builtin_ia32_sqrtsd">,
296               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty],
297                         [IntrNoMem]>;
298   def int_x86_sse2_sqrt_pd : GCCBuiltin<"__builtin_ia32_sqrtpd">,
299               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty],
300                         [IntrNoMem]>;
301   def int_x86_sse2_min_sd : GCCBuiltin<"__builtin_ia32_minsd">,
302               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
303                          llvm_v2f64_ty], [IntrNoMem]>;
304   def int_x86_sse2_min_pd : GCCBuiltin<"__builtin_ia32_minpd">,
305               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
306                          llvm_v2f64_ty], [IntrNoMem]>;
307   def int_x86_sse2_max_sd : GCCBuiltin<"__builtin_ia32_maxsd">,
308               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
309                          llvm_v2f64_ty], [IntrNoMem]>;
310   def int_x86_sse2_max_pd : GCCBuiltin<"__builtin_ia32_maxpd">,
311               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
312                          llvm_v2f64_ty], [IntrNoMem]>;
313 }
314
315 // FP comparison ops
316 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
317   def int_x86_sse2_cmp_sd : GCCBuiltin<"__builtin_ia32_cmpsd">,
318               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
319                          llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
320   def int_x86_sse2_cmp_pd : GCCBuiltin<"__builtin_ia32_cmppd">,
321               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
322                          llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
323   def int_x86_sse2_comieq_sd : GCCBuiltin<"__builtin_ia32_comisdeq">,
324               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
325                          llvm_v2f64_ty], [IntrNoMem]>;
326   def int_x86_sse2_comilt_sd : GCCBuiltin<"__builtin_ia32_comisdlt">,
327               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
328                          llvm_v2f64_ty], [IntrNoMem]>;
329   def int_x86_sse2_comile_sd : GCCBuiltin<"__builtin_ia32_comisdle">,
330               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
331                          llvm_v2f64_ty], [IntrNoMem]>;
332   def int_x86_sse2_comigt_sd : GCCBuiltin<"__builtin_ia32_comisdgt">,
333               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
334                          llvm_v2f64_ty], [IntrNoMem]>;
335   def int_x86_sse2_comige_sd : GCCBuiltin<"__builtin_ia32_comisdge">,
336               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
337                          llvm_v2f64_ty], [IntrNoMem]>;
338   def int_x86_sse2_comineq_sd : GCCBuiltin<"__builtin_ia32_comisdneq">,
339               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
340                          llvm_v2f64_ty], [IntrNoMem]>;
341   def int_x86_sse2_ucomieq_sd : GCCBuiltin<"__builtin_ia32_ucomisdeq">,
342               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
343                          llvm_v2f64_ty], [IntrNoMem]>;
344   def int_x86_sse2_ucomilt_sd : GCCBuiltin<"__builtin_ia32_ucomisdlt">,
345               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
346                          llvm_v2f64_ty], [IntrNoMem]>;
347   def int_x86_sse2_ucomile_sd : GCCBuiltin<"__builtin_ia32_ucomisdle">,
348               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
349                          llvm_v2f64_ty], [IntrNoMem]>;
350   def int_x86_sse2_ucomigt_sd : GCCBuiltin<"__builtin_ia32_ucomisdgt">,
351               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
352                          llvm_v2f64_ty], [IntrNoMem]>;
353   def int_x86_sse2_ucomige_sd : GCCBuiltin<"__builtin_ia32_ucomisdge">,
354               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
355                          llvm_v2f64_ty], [IntrNoMem]>;
356   def int_x86_sse2_ucomineq_sd : GCCBuiltin<"__builtin_ia32_ucomisdneq">,
357               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
358                          llvm_v2f64_ty], [IntrNoMem]>;
359 }
360
361 // Integer arithmetic ops.
362 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
363   def int_x86_sse2_padds_b : GCCBuiltin<"__builtin_ia32_paddsb128">,
364               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
365                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
366   def int_x86_sse2_padds_w : GCCBuiltin<"__builtin_ia32_paddsw128">,
367               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
368                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
369   def int_x86_sse2_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb128">,
370               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
371                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
372   def int_x86_sse2_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw128">,
373               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
374                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
375   def int_x86_sse2_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb128">,
376               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
377                          llvm_v16i8_ty], [IntrNoMem]>;
378   def int_x86_sse2_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw128">,
379               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
380                          llvm_v8i16_ty], [IntrNoMem]>;
381   def int_x86_sse2_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb128">,
382               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
383                          llvm_v16i8_ty], [IntrNoMem]>;
384   def int_x86_sse2_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw128">,
385               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
386                          llvm_v8i16_ty], [IntrNoMem]>;
387   def int_x86_sse2_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw128">,
388               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
389                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
390   def int_x86_sse2_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw128">,
391               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
392                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
393   def int_x86_sse2_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq128">,
394               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty,
395                          llvm_v4i32_ty], [IntrNoMem, Commutative]>;
396   def int_x86_sse2_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd128">,
397               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty,
398                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
399   def int_x86_sse2_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb128">,
400               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
401                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
402   def int_x86_sse2_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw128">,
403               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
404                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
405   def int_x86_sse2_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub128">,
406               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
407                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
408   def int_x86_sse2_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw128">,
409               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
410                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
411   def int_x86_sse2_pminu_b : GCCBuiltin<"__builtin_ia32_pminub128">,
412               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
413                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
414   def int_x86_sse2_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw128">,
415               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
416                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
417   def int_x86_sse2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw128">,
418               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty,
419                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
420 }
421
422 // Integer shift ops.
423 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
424   def int_x86_sse2_psll_w : GCCBuiltin<"__builtin_ia32_psllw128">,
425               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
426                          llvm_v8i16_ty], [IntrNoMem]>;
427   def int_x86_sse2_psll_d : GCCBuiltin<"__builtin_ia32_pslld128">,
428               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
429                          llvm_v4i32_ty], [IntrNoMem]>;
430   def int_x86_sse2_psll_q : GCCBuiltin<"__builtin_ia32_psllq128">,
431               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
432                          llvm_v2i64_ty], [IntrNoMem]>;
433   def int_x86_sse2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw128">,
434               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
435                          llvm_v8i16_ty], [IntrNoMem]>;
436   def int_x86_sse2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld128">,
437               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
438                          llvm_v4i32_ty], [IntrNoMem]>;
439   def int_x86_sse2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq128">,
440               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
441                          llvm_v2i64_ty], [IntrNoMem]>;
442   def int_x86_sse2_psra_w : GCCBuiltin<"__builtin_ia32_psraw128">,
443               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
444                          llvm_v8i16_ty], [IntrNoMem]>;
445   def int_x86_sse2_psra_d : GCCBuiltin<"__builtin_ia32_psrad128">,
446               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
447                          llvm_v4i32_ty], [IntrNoMem]>;
448
449   def int_x86_sse2_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi128">,
450               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
451                          llvm_i32_ty], [IntrNoMem]>;
452   def int_x86_sse2_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi128">,
453               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
454                          llvm_i32_ty], [IntrNoMem]>;
455   def int_x86_sse2_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi128">,
456               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
457                          llvm_i32_ty], [IntrNoMem]>;
458   def int_x86_sse2_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi128">,
459               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
460                          llvm_i32_ty], [IntrNoMem]>;
461   def int_x86_sse2_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi128">,
462               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
463                          llvm_i32_ty], [IntrNoMem]>;
464   def int_x86_sse2_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi128">,
465               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
466                          llvm_i32_ty], [IntrNoMem]>;
467   def int_x86_sse2_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi128">,
468               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
469                          llvm_i32_ty], [IntrNoMem]>;
470   def int_x86_sse2_psrai_d : GCCBuiltin<"__builtin_ia32_psradi128">,
471               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
472                          llvm_i32_ty], [IntrNoMem]>;
473 }
474
475 // Conversion ops
476 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
477   def int_x86_sse2_cvtdq2pd : GCCBuiltin<"__builtin_ia32_cvtdq2pd">,
478               Intrinsic<[llvm_v2f64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
479   def int_x86_sse2_cvtdq2ps : GCCBuiltin<"__builtin_ia32_cvtdq2ps">,
480               Intrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
481   def int_x86_sse2_cvtpd2dq : GCCBuiltin<"__builtin_ia32_cvtpd2dq">,
482               Intrinsic<[llvm_v4i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
483   def int_x86_sse2_cvttpd2dq : GCCBuiltin<"__builtin_ia32_cvttpd2dq">,
484               Intrinsic<[llvm_v4i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
485   def int_x86_sse2_cvtpd2ps : GCCBuiltin<"__builtin_ia32_cvtpd2ps">,
486               Intrinsic<[llvm_v4f32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
487   def int_x86_sse2_cvtps2dq : GCCBuiltin<"__builtin_ia32_cvtps2dq">,
488               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
489   def int_x86_sse2_cvttps2dq : GCCBuiltin<"__builtin_ia32_cvttps2dq">,
490               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
491   def int_x86_sse2_cvtps2pd : GCCBuiltin<"__builtin_ia32_cvtps2pd">,
492               Intrinsic<[llvm_v2f64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
493   def int_x86_sse2_cvtsd2si : GCCBuiltin<"__builtin_ia32_cvtsd2si">,
494               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
495   def int_x86_sse2_cvtsd2si64 : GCCBuiltin<"__builtin_ia32_cvtsd2si64">,
496               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
497   def int_x86_sse2_cvttsd2si : GCCBuiltin<"__builtin_ia32_cvttsd2si">,
498               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
499   def int_x86_sse2_cvttsd2si64 : GCCBuiltin<"__builtin_ia32_cvttsd2si64">,
500               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
501   def int_x86_sse2_cvtsi2sd : GCCBuiltin<"__builtin_ia32_cvtsi2sd">,
502               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
503                          llvm_i32_ty], [IntrNoMem]>;
504   def int_x86_sse2_cvtsi642sd : GCCBuiltin<"__builtin_ia32_cvtsi642sd">,
505               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
506                          llvm_i64_ty], [IntrNoMem]>;
507   def int_x86_sse2_cvtsd2ss : GCCBuiltin<"__builtin_ia32_cvtsd2ss">,
508               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
509                          llvm_v2f64_ty], [IntrNoMem]>;
510   def int_x86_sse2_cvtss2sd : GCCBuiltin<"__builtin_ia32_cvtss2sd">,
511               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
512                          llvm_v4f32_ty], [IntrNoMem]>;
513   def int_x86_sse_cvtpd2pi : GCCBuiltin<"__builtin_ia32_cvtpd2pi">,
514               Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
515   def int_x86_sse_cvttpd2pi: GCCBuiltin<"__builtin_ia32_cvttpd2pi">,
516               Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
517   def int_x86_sse_cvtpi2pd : GCCBuiltin<"__builtin_ia32_cvtpi2pd">,
518               Intrinsic<[llvm_v2f64_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
519 }
520
521 // SIMD store ops
522 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
523   def int_x86_sse2_storeu_pd : GCCBuiltin<"__builtin_ia32_storeupd">,
524               Intrinsic<[], [llvm_ptr_ty,
525                          llvm_v2f64_ty], [IntrReadWriteArgMem]>;
526   def int_x86_sse2_storeu_dq : GCCBuiltin<"__builtin_ia32_storedqu">,
527               Intrinsic<[], [llvm_ptr_ty,
528                          llvm_v16i8_ty], [IntrReadWriteArgMem]>;
529   def int_x86_sse2_storel_dq : GCCBuiltin<"__builtin_ia32_storelv4si">,
530               Intrinsic<[], [llvm_ptr_ty,
531                          llvm_v4i32_ty], [IntrReadWriteArgMem]>;
532 }
533
534 // Misc.
535 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
536   def int_x86_sse2_packsswb_128 : GCCBuiltin<"__builtin_ia32_packsswb128">,
537               Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
538                          llvm_v8i16_ty], [IntrNoMem]>;
539   def int_x86_sse2_packssdw_128 : GCCBuiltin<"__builtin_ia32_packssdw128">,
540               Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty,
541                          llvm_v4i32_ty], [IntrNoMem]>;
542   def int_x86_sse2_packuswb_128 : GCCBuiltin<"__builtin_ia32_packuswb128">,
543               Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
544                          llvm_v8i16_ty], [IntrNoMem]>;
545   def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">,
546               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
547   def int_x86_sse2_pmovmskb_128 : GCCBuiltin<"__builtin_ia32_pmovmskb128">,
548               Intrinsic<[llvm_i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
549   def int_x86_sse2_maskmov_dqu : GCCBuiltin<"__builtin_ia32_maskmovdqu">,
550               Intrinsic<[], [llvm_v16i8_ty,
551                          llvm_v16i8_ty, llvm_ptr_ty], []>;
552   def int_x86_sse2_clflush : GCCBuiltin<"__builtin_ia32_clflush">,
553               Intrinsic<[], [llvm_ptr_ty], []>;
554   def int_x86_sse2_lfence : GCCBuiltin<"__builtin_ia32_lfence">,
555               Intrinsic<[], [], []>;
556   def int_x86_sse2_mfence : GCCBuiltin<"__builtin_ia32_mfence">,
557               Intrinsic<[], [], []>;
558   def int_x86_sse2_pause : GCCBuiltin<"__builtin_ia32_pause">,
559               Intrinsic<[], [], []>;
560 }
561
562 //===----------------------------------------------------------------------===//
563 // SSE3
564
565 // Addition / subtraction ops.
566 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
567   def int_x86_sse3_addsub_ps : GCCBuiltin<"__builtin_ia32_addsubps">,
568               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
569                          llvm_v4f32_ty], [IntrNoMem]>;
570   def int_x86_sse3_addsub_pd : GCCBuiltin<"__builtin_ia32_addsubpd">,
571               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
572                          llvm_v2f64_ty], [IntrNoMem]>;
573 }
574
575 // Horizontal ops.
576 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
577   def int_x86_sse3_hadd_ps : GCCBuiltin<"__builtin_ia32_haddps">,
578               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
579                          llvm_v4f32_ty], [IntrNoMem]>;
580   def int_x86_sse3_hadd_pd : GCCBuiltin<"__builtin_ia32_haddpd">,
581               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
582                          llvm_v2f64_ty], [IntrNoMem]>;
583   def int_x86_sse3_hsub_ps : GCCBuiltin<"__builtin_ia32_hsubps">,
584               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
585                          llvm_v4f32_ty], [IntrNoMem]>;
586   def int_x86_sse3_hsub_pd : GCCBuiltin<"__builtin_ia32_hsubpd">,
587               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
588                          llvm_v2f64_ty], [IntrNoMem]>;
589 }
590
591 // Specialized unaligned load.
592 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
593   def int_x86_sse3_ldu_dq : GCCBuiltin<"__builtin_ia32_lddqu">,
594               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrReadMem]>;
595 }
596
597 // Thread synchronization ops.
598 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
599   def int_x86_sse3_monitor : GCCBuiltin<"__builtin_ia32_monitor">,
600               Intrinsic<[], [llvm_ptr_ty,
601                          llvm_i32_ty, llvm_i32_ty], []>;
602   def int_x86_sse3_mwait : GCCBuiltin<"__builtin_ia32_mwait">,
603               Intrinsic<[], [llvm_i32_ty,
604                          llvm_i32_ty], []>;
605 }
606
607 //===----------------------------------------------------------------------===//
608 // SSSE3
609
610 // Horizontal arithmetic ops
611 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
612   def int_x86_ssse3_phadd_w         : GCCBuiltin<"__builtin_ia32_phaddw">,
613               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
614                          llvm_x86mmx_ty], [IntrNoMem]>;
615   def int_x86_ssse3_phadd_w_128     : GCCBuiltin<"__builtin_ia32_phaddw128">,
616               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
617                          llvm_v8i16_ty], [IntrNoMem]>;
618
619   def int_x86_ssse3_phadd_d         : GCCBuiltin<"__builtin_ia32_phaddd">,
620               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
621                          llvm_x86mmx_ty], [IntrNoMem]>;
622   def int_x86_ssse3_phadd_d_128     : GCCBuiltin<"__builtin_ia32_phaddd128">,
623               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
624                          llvm_v4i32_ty], [IntrNoMem]>;
625
626   def int_x86_ssse3_phadd_sw        : GCCBuiltin<"__builtin_ia32_phaddsw">,
627               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
628                          llvm_x86mmx_ty], [IntrNoMem]>;
629   def int_x86_ssse3_phadd_sw_128    : GCCBuiltin<"__builtin_ia32_phaddsw128">,
630               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
631                          llvm_v8i16_ty], [IntrNoMem]>;
632
633   def int_x86_ssse3_phsub_w         : GCCBuiltin<"__builtin_ia32_phsubw">,
634               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
635                          llvm_x86mmx_ty], [IntrNoMem]>;
636   def int_x86_ssse3_phsub_w_128     : GCCBuiltin<"__builtin_ia32_phsubw128">,
637               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
638                          llvm_v8i16_ty], [IntrNoMem]>;
639
640   def int_x86_ssse3_phsub_d         : GCCBuiltin<"__builtin_ia32_phsubd">,
641               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
642                          llvm_x86mmx_ty], [IntrNoMem]>;
643   def int_x86_ssse3_phsub_d_128     : GCCBuiltin<"__builtin_ia32_phsubd128">,
644               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
645                          llvm_v4i32_ty], [IntrNoMem]>;
646
647   def int_x86_ssse3_phsub_sw        : GCCBuiltin<"__builtin_ia32_phsubsw">,
648               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
649                          llvm_x86mmx_ty], [IntrNoMem]>;
650   def int_x86_ssse3_phsub_sw_128    : GCCBuiltin<"__builtin_ia32_phsubsw128">,
651               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
652                          llvm_v8i16_ty], [IntrNoMem]>;
653
654   def int_x86_ssse3_pmadd_ub_sw     : GCCBuiltin<"__builtin_ia32_pmaddubsw">,
655               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
656                          llvm_x86mmx_ty], [IntrNoMem]>;
657   def int_x86_ssse3_pmadd_ub_sw_128 : GCCBuiltin<"__builtin_ia32_pmaddubsw128">,
658               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty,
659                          llvm_v16i8_ty], [IntrNoMem]>;
660 }
661
662 // Packed multiply high with round and scale
663 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
664   def int_x86_ssse3_pmul_hr_sw      : GCCBuiltin<"__builtin_ia32_pmulhrsw">,
665               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
666                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
667   def int_x86_ssse3_pmul_hr_sw_128  : GCCBuiltin<"__builtin_ia32_pmulhrsw128">,
668               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
669                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
670 }
671
672 // Shuffle ops
673 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
674   def int_x86_ssse3_pshuf_b         : GCCBuiltin<"__builtin_ia32_pshufb">,
675               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
676                          llvm_x86mmx_ty], [IntrNoMem]>;
677   def int_x86_ssse3_pshuf_b_128     : GCCBuiltin<"__builtin_ia32_pshufb128">,
678               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
679                          llvm_v16i8_ty], [IntrNoMem]>;
680   def int_x86_sse2_pshuf_d          : GCCBuiltin<"__builtin_ia32_pshufd">,
681               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_i8_ty],
682                          [IntrNoMem]>;
683   def int_x86_sse2_pshufl_w         : GCCBuiltin<"__builtin_ia32_pshuflw">,
684               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_i8_ty],
685                          [IntrNoMem]>;
686   def int_x86_sse2_pshufh_w         : GCCBuiltin<"__builtin_ia32_pshufhw">,
687               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_i8_ty],
688                          [IntrNoMem]>;
689   def int_x86_sse_pshuf_w           : GCCBuiltin<"__builtin_ia32_pshufw">,
690               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_i8_ty],
691                          [IntrNoMem]>;
692 }
693
694 // Sign ops
695 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
696   def int_x86_ssse3_psign_b         : GCCBuiltin<"__builtin_ia32_psignb">,
697               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
698                          llvm_x86mmx_ty], [IntrNoMem]>;
699   def int_x86_ssse3_psign_b_128     : GCCBuiltin<"__builtin_ia32_psignb128">,
700               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
701                          llvm_v16i8_ty], [IntrNoMem]>;
702
703   def int_x86_ssse3_psign_w         : GCCBuiltin<"__builtin_ia32_psignw">,
704               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
705                          llvm_x86mmx_ty], [IntrNoMem]>;
706   def int_x86_ssse3_psign_w_128     : GCCBuiltin<"__builtin_ia32_psignw128">,
707               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
708                          llvm_v8i16_ty], [IntrNoMem]>;
709
710   def int_x86_ssse3_psign_d         : GCCBuiltin<"__builtin_ia32_psignd">,
711               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
712                          llvm_x86mmx_ty], [IntrNoMem]>;
713   def int_x86_ssse3_psign_d_128     : GCCBuiltin<"__builtin_ia32_psignd128">,
714               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
715                          llvm_v4i32_ty], [IntrNoMem]>;
716 }
717
718 // Absolute value ops
719 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
720   def int_x86_ssse3_pabs_b     : GCCBuiltin<"__builtin_ia32_pabsb">,
721               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
722   def int_x86_ssse3_pabs_b_128 : GCCBuiltin<"__builtin_ia32_pabsb128">,
723               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
724
725   def int_x86_ssse3_pabs_w     : GCCBuiltin<"__builtin_ia32_pabsw">,
726               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
727   def int_x86_ssse3_pabs_w_128 : GCCBuiltin<"__builtin_ia32_pabsw128">,
728               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
729
730   def int_x86_ssse3_pabs_d     : GCCBuiltin<"__builtin_ia32_pabsd">,
731               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
732   def int_x86_ssse3_pabs_d_128 : GCCBuiltin<"__builtin_ia32_pabsd128">,
733               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
734 }
735
736 //===----------------------------------------------------------------------===//
737 // SSE4.1
738
739 // FP rounding ops
740 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
741   def int_x86_sse41_round_ss        : GCCBuiltin<"__builtin_ia32_roundss">,
742               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
743                          llvm_i32_ty], [IntrNoMem]>;
744   def int_x86_sse41_round_ps        : GCCBuiltin<"__builtin_ia32_roundps">,
745               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
746                          llvm_i32_ty], [IntrNoMem]>;
747   def int_x86_sse41_round_sd        : GCCBuiltin<"__builtin_ia32_roundsd">,
748               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
749                          llvm_i32_ty], [IntrNoMem]>;
750   def int_x86_sse41_round_pd        : GCCBuiltin<"__builtin_ia32_roundpd">,
751               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
752                          llvm_i32_ty], [IntrNoMem]>;
753 }
754
755 // Vector sign and zero extend
756 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
757   def int_x86_sse41_pmovsxbd        : GCCBuiltin<"__builtin_ia32_pmovsxbd128">,
758               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty],
759                         [IntrNoMem]>;
760   def int_x86_sse41_pmovsxbq        : GCCBuiltin<"__builtin_ia32_pmovsxbq128">,
761               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty],
762                         [IntrNoMem]>;
763   def int_x86_sse41_pmovsxbw        : GCCBuiltin<"__builtin_ia32_pmovsxbw128">,
764               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty],
765                         [IntrNoMem]>;
766   def int_x86_sse41_pmovsxdq        : GCCBuiltin<"__builtin_ia32_pmovsxdq128">,
767               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty],
768                         [IntrNoMem]>;
769   def int_x86_sse41_pmovsxwd        : GCCBuiltin<"__builtin_ia32_pmovsxwd128">,
770               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty],
771                         [IntrNoMem]>;
772   def int_x86_sse41_pmovsxwq        : GCCBuiltin<"__builtin_ia32_pmovsxwq128">,
773               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty],
774                         [IntrNoMem]>;
775   def int_x86_sse41_pmovzxbd        : GCCBuiltin<"__builtin_ia32_pmovzxbd128">,
776               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty],
777                         [IntrNoMem]>;
778   def int_x86_sse41_pmovzxbq        : GCCBuiltin<"__builtin_ia32_pmovzxbq128">,
779               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty],
780                         [IntrNoMem]>;
781   def int_x86_sse41_pmovzxbw        : GCCBuiltin<"__builtin_ia32_pmovzxbw128">,
782               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty],
783                         [IntrNoMem]>;
784   def int_x86_sse41_pmovzxdq        : GCCBuiltin<"__builtin_ia32_pmovzxdq128">,
785               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty],
786                         [IntrNoMem]>;
787   def int_x86_sse41_pmovzxwd        : GCCBuiltin<"__builtin_ia32_pmovzxwd128">,
788               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty],
789                         [IntrNoMem]>;
790   def int_x86_sse41_pmovzxwq        : GCCBuiltin<"__builtin_ia32_pmovzxwq128">,
791               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty],
792                         [IntrNoMem]>;
793 }
794
795 // Vector min element
796 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
797   def int_x86_sse41_phminposuw     : GCCBuiltin<"__builtin_ia32_phminposuw128">,
798               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty],
799                         [IntrNoMem]>;
800 }
801
802 // Vector compare, min, max
803 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
804   def int_x86_sse41_pmaxsb          : GCCBuiltin<"__builtin_ia32_pmaxsb128">,
805               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
806                         [IntrNoMem, Commutative]>;
807   def int_x86_sse41_pmaxsd          : GCCBuiltin<"__builtin_ia32_pmaxsd128">,
808               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
809                         [IntrNoMem, Commutative]>;
810   def int_x86_sse41_pmaxud          : GCCBuiltin<"__builtin_ia32_pmaxud128">,
811               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
812                         [IntrNoMem, Commutative]>;
813   def int_x86_sse41_pmaxuw          : GCCBuiltin<"__builtin_ia32_pmaxuw128">,
814               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
815                         [IntrNoMem, Commutative]>;
816   def int_x86_sse41_pminsb          : GCCBuiltin<"__builtin_ia32_pminsb128">,
817               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
818                         [IntrNoMem, Commutative]>;
819   def int_x86_sse41_pminsd          : GCCBuiltin<"__builtin_ia32_pminsd128">,
820               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
821                         [IntrNoMem, Commutative]>;
822   def int_x86_sse41_pminud          : GCCBuiltin<"__builtin_ia32_pminud128">,
823               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
824                         [IntrNoMem, Commutative]>;
825   def int_x86_sse41_pminuw          : GCCBuiltin<"__builtin_ia32_pminuw128">,
826               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
827                         [IntrNoMem, Commutative]>;
828 }
829
830 // Advanced Encryption Standard (AES) Instructions
831 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
832   def int_x86_aesni_aesimc          : GCCBuiltin<"__builtin_ia32_aesimc128">,
833               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty],
834                         [IntrNoMem]>;
835   def int_x86_aesni_aesenc          : GCCBuiltin<"__builtin_ia32_aesenc128">,
836               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
837                         [IntrNoMem]>;
838   def int_x86_aesni_aesenclast : GCCBuiltin<"__builtin_ia32_aesenclast128">,
839               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
840                         [IntrNoMem]>;
841   def int_x86_aesni_aesdec          : GCCBuiltin<"__builtin_ia32_aesdec128">,
842               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
843                         [IntrNoMem]>;
844   def int_x86_aesni_aesdeclast : GCCBuiltin<"__builtin_ia32_aesdeclast128">,
845               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
846                         [IntrNoMem]>;
847   def int_x86_aesni_aeskeygenassist :
848               GCCBuiltin<"__builtin_ia32_aeskeygenassist128">,
849               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty],
850                         [IntrNoMem]>;
851 }
852
853 // PCLMUL instruction
854 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
855   def int_x86_pclmulqdq : GCCBuiltin<"__builtin_ia32_pclmulqdq128">,
856           Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
857                     [IntrNoMem]>;
858 }
859
860 // Vector pack
861 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
862   def int_x86_sse41_packusdw        : GCCBuiltin<"__builtin_ia32_packusdw128">,
863               Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
864                         [IntrNoMem]>;
865 }
866
867 // Vector multiply
868 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
869   def int_x86_sse41_pmuldq          : GCCBuiltin<"__builtin_ia32_pmuldq128">,
870               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
871                         [IntrNoMem, Commutative]>;
872 }
873
874 // Vector extract
875 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
876   def int_x86_sse41_pextrb         :
877               Intrinsic<[llvm_i32_ty], [llvm_v16i8_ty, llvm_i32_ty],
878                         [IntrNoMem]>;
879   def int_x86_sse41_pextrd         :
880               Intrinsic<[llvm_i32_ty], [llvm_v4i32_ty, llvm_i32_ty],
881                         [IntrNoMem]>;
882   def int_x86_sse41_pextrq         :
883               Intrinsic<[llvm_i64_ty], [llvm_v2i64_ty, llvm_i32_ty],
884                         [IntrNoMem]>;
885   def int_x86_sse41_extractps      : GCCBuiltin<"__builtin_ia32_extractps128">,
886               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
887                         [IntrNoMem]>;
888 }
889
890 // Vector insert
891 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
892   def int_x86_sse41_insertps       : GCCBuiltin<"__builtin_ia32_insertps128">,
893           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i8_ty],
894                     [IntrNoMem]>;
895 }
896
897 // Vector blend
898 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
899   def int_x86_sse41_pblendvb         : GCCBuiltin<"__builtin_ia32_pblendvb128">,
900         Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,llvm_v16i8_ty],
901                   [IntrNoMem]>;
902   def int_x86_sse41_blendvpd         : GCCBuiltin<"__builtin_ia32_blendvpd">,
903         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,llvm_v2f64_ty],
904                   [IntrNoMem]>;
905   def int_x86_sse41_blendvps         : GCCBuiltin<"__builtin_ia32_blendvps">,
906         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,llvm_v4f32_ty],
907                   [IntrNoMem]>;
908 }
909
910 // Vector dot product
911 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
912   def int_x86_sse41_dppd            : GCCBuiltin<"__builtin_ia32_dppd">,
913           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i8_ty],
914                     [IntrNoMem, Commutative]>;
915   def int_x86_sse41_dpps            : GCCBuiltin<"__builtin_ia32_dpps">,
916           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i8_ty],
917                     [IntrNoMem, Commutative]>;
918 }
919
920 // Vector sum of absolute differences
921 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
922   def int_x86_sse41_mpsadbw         : GCCBuiltin<"__builtin_ia32_mpsadbw128">,
923           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty,llvm_i8_ty],
924                     [IntrNoMem, Commutative]>;
925 }
926
927 // Cacheability support ops
928 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
929   def int_x86_sse41_movntdqa        : GCCBuiltin<"__builtin_ia32_movntdqa">,
930           Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty], [IntrReadMem]>;
931 }
932
933 // Test instruction with bitwise comparison.
934 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
935   def int_x86_sse41_ptestz          : GCCBuiltin<"__builtin_ia32_ptestz128">,
936           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
937                     [IntrNoMem]>;
938   def int_x86_sse41_ptestc          : GCCBuiltin<"__builtin_ia32_ptestc128">,
939           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
940                     [IntrNoMem]>;
941   def int_x86_sse41_ptestnzc        : GCCBuiltin<"__builtin_ia32_ptestnzc128">,
942           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
943                     [IntrNoMem]>;
944 }
945
946 //===----------------------------------------------------------------------===//
947 // SSE4.2
948
949 // Miscellaneous
950 // CRC Instruction
951 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
952   def int_x86_sse42_crc32_32_8       : GCCBuiltin<"__builtin_ia32_crc32qi">,
953           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i8_ty],
954                     [IntrNoMem]>;
955   def int_x86_sse42_crc32_32_16      : GCCBuiltin<"__builtin_ia32_crc32hi">,
956           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i16_ty],
957                     [IntrNoMem]>;
958   def int_x86_sse42_crc32_32_32      : GCCBuiltin<"__builtin_ia32_crc32si">,
959           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
960                     [IntrNoMem]>;
961   def int_x86_sse42_crc32_64_64      : GCCBuiltin<"__builtin_ia32_crc32di">,
962           Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
963                     [IntrNoMem]>;
964 }
965
966 // String/text processing ops.
967 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
968   def int_x86_sse42_pcmpistrm128  : GCCBuiltin<"__builtin_ia32_pcmpistrm128">,
969     Intrinsic<[llvm_v16i8_ty],
970         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
971         [IntrNoMem]>;
972   def int_x86_sse42_pcmpistri128  : GCCBuiltin<"__builtin_ia32_pcmpistri128">,
973     Intrinsic<[llvm_i32_ty],
974         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
975         [IntrNoMem]>;
976   def int_x86_sse42_pcmpistria128 : GCCBuiltin<"__builtin_ia32_pcmpistria128">,
977     Intrinsic<[llvm_i32_ty],
978         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
979         [IntrNoMem]>;
980   def int_x86_sse42_pcmpistric128 : GCCBuiltin<"__builtin_ia32_pcmpistric128">,
981     Intrinsic<[llvm_i32_ty],
982         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
983         [IntrNoMem]>;
984   def int_x86_sse42_pcmpistrio128 : GCCBuiltin<"__builtin_ia32_pcmpistrio128">,
985     Intrinsic<[llvm_i32_ty],
986         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
987         [IntrNoMem]>;
988   def int_x86_sse42_pcmpistris128 : GCCBuiltin<"__builtin_ia32_pcmpistris128">,
989     Intrinsic<[llvm_i32_ty],
990         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
991         [IntrNoMem]>;
992   def int_x86_sse42_pcmpistriz128 : GCCBuiltin<"__builtin_ia32_pcmpistriz128">,
993     Intrinsic<[llvm_i32_ty],
994         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
995         [IntrNoMem]>;
996   def int_x86_sse42_pcmpestrm128  : GCCBuiltin<"__builtin_ia32_pcmpestrm128">,
997     Intrinsic<[llvm_v16i8_ty],
998         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
999          llvm_i8_ty],
1000         [IntrNoMem]>;
1001   def int_x86_sse42_pcmpestri128  : GCCBuiltin<"__builtin_ia32_pcmpestri128">,
1002     Intrinsic<[llvm_i32_ty],
1003         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
1004          llvm_i8_ty],
1005         [IntrNoMem]>;
1006   def int_x86_sse42_pcmpestria128 : GCCBuiltin<"__builtin_ia32_pcmpestria128">,
1007     Intrinsic<[llvm_i32_ty],
1008         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
1009          llvm_i8_ty],
1010         [IntrNoMem]>;
1011   def int_x86_sse42_pcmpestric128 : GCCBuiltin<"__builtin_ia32_pcmpestric128">,
1012     Intrinsic<[llvm_i32_ty],
1013         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
1014          llvm_i8_ty],
1015         [IntrNoMem]>;
1016   def int_x86_sse42_pcmpestrio128 : GCCBuiltin<"__builtin_ia32_pcmpestrio128">,
1017     Intrinsic<[llvm_i32_ty],
1018         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
1019          llvm_i8_ty],
1020         [IntrNoMem]>;
1021   def int_x86_sse42_pcmpestris128 : GCCBuiltin<"__builtin_ia32_pcmpestris128">,
1022     Intrinsic<[llvm_i32_ty],
1023         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
1024          llvm_i8_ty],
1025         [IntrNoMem]>;
1026   def int_x86_sse42_pcmpestriz128 : GCCBuiltin<"__builtin_ia32_pcmpestriz128">,
1027     Intrinsic<[llvm_i32_ty],
1028         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
1029          llvm_i8_ty],
1030         [IntrNoMem]>;
1031 }
1032
1033 //===----------------------------------------------------------------------===//
1034 // SSE4A
1035
1036 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1037   def int_x86_sse4a_extrqi : GCCBuiltin<"__builtin_ia32_extrqi">,
1038     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty, llvm_i8_ty],
1039               [IntrNoMem]>;
1040   def int_x86_sse4a_extrq  : GCCBuiltin<"__builtin_ia32_extrq">,
1041     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v16i8_ty], [IntrNoMem]>;
1042
1043   def int_x86_sse4a_insertqi : GCCBuiltin<"__builtin_ia32_insertqi">,
1044     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
1045                                 llvm_i8_ty, llvm_i8_ty], [IntrNoMem]>;
1046   def int_x86_sse4a_insertq  : GCCBuiltin<"__builtin_ia32_insertq">,
1047     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>;
1048
1049   def int_x86_sse4a_movnt_ss : GCCBuiltin<"__builtin_ia32_movntss">,
1050     Intrinsic<[], [llvm_ptr_ty, llvm_v4f32_ty], []>;
1051   def int_x86_sse4a_movnt_sd : GCCBuiltin<"__builtin_ia32_movntsd">,
1052     Intrinsic<[], [llvm_ptr_ty, llvm_v2f64_ty], []>;
1053 }
1054
1055 //===----------------------------------------------------------------------===//
1056 // AVX
1057
1058 // Arithmetic ops
1059 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1060   def int_x86_avx_addsub_pd_256 : GCCBuiltin<"__builtin_ia32_addsubpd256">,
1061         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1062                   llvm_v4f64_ty], [IntrNoMem]>;
1063   def int_x86_avx_addsub_ps_256 : GCCBuiltin<"__builtin_ia32_addsubps256">,
1064         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1065                   llvm_v8f32_ty], [IntrNoMem]>;
1066   def int_x86_avx_max_pd_256 : GCCBuiltin<"__builtin_ia32_maxpd256">,
1067         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1068                   llvm_v4f64_ty], [IntrNoMem]>;
1069   def int_x86_avx_max_ps_256 : GCCBuiltin<"__builtin_ia32_maxps256">,
1070         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1071                   llvm_v8f32_ty], [IntrNoMem]>;
1072   def int_x86_avx_min_pd_256 : GCCBuiltin<"__builtin_ia32_minpd256">,
1073         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1074                   llvm_v4f64_ty], [IntrNoMem]>;
1075   def int_x86_avx_min_ps_256 : GCCBuiltin<"__builtin_ia32_minps256">,
1076         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1077                   llvm_v8f32_ty], [IntrNoMem]>;
1078
1079   def int_x86_avx_sqrt_pd_256 : GCCBuiltin<"__builtin_ia32_sqrtpd256">,
1080         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1081   def int_x86_avx_sqrt_ps_256 : GCCBuiltin<"__builtin_ia32_sqrtps256">,
1082         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1083
1084   def int_x86_avx_rsqrt_ps_256 : GCCBuiltin<"__builtin_ia32_rsqrtps256">,
1085         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1086
1087   def int_x86_avx_rcp_ps_256 : GCCBuiltin<"__builtin_ia32_rcpps256">,
1088         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1089
1090   def int_x86_avx_round_pd_256 : GCCBuiltin<"__builtin_ia32_roundpd256">,
1091         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1092                   llvm_i32_ty], [IntrNoMem]>;
1093   def int_x86_avx_round_ps_256 : GCCBuiltin<"__builtin_ia32_roundps256">,
1094         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1095                   llvm_i32_ty], [IntrNoMem]>;
1096 }
1097
1098 // Horizontal ops
1099 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1100   def int_x86_avx_hadd_pd_256 : GCCBuiltin<"__builtin_ia32_haddpd256">,
1101         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1102                   llvm_v4f64_ty], [IntrNoMem]>;
1103   def int_x86_avx_hsub_ps_256 : GCCBuiltin<"__builtin_ia32_hsubps256">,
1104         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1105                   llvm_v8f32_ty], [IntrNoMem]>;
1106   def int_x86_avx_hsub_pd_256 : GCCBuiltin<"__builtin_ia32_hsubpd256">,
1107         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1108                   llvm_v4f64_ty], [IntrNoMem]>;
1109   def int_x86_avx_hadd_ps_256 : GCCBuiltin<"__builtin_ia32_haddps256">,
1110         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1111                   llvm_v8f32_ty], [IntrNoMem]>;
1112 }
1113
1114 // Vector permutation
1115 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1116   def int_x86_avx_vpermilvar_pd : GCCBuiltin<"__builtin_ia32_vpermilvarpd">,
1117         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
1118                   llvm_v2i64_ty], [IntrNoMem]>;
1119   def int_x86_avx_vpermilvar_ps : GCCBuiltin<"__builtin_ia32_vpermilvarps">,
1120         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
1121                   llvm_v4i32_ty], [IntrNoMem]>;
1122
1123   def int_x86_avx_vpermilvar_pd_256 :
1124         GCCBuiltin<"__builtin_ia32_vpermilvarpd256">,
1125         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4i64_ty], [IntrNoMem]>;
1126   def int_x86_avx_vpermilvar_ps_256 :
1127         GCCBuiltin<"__builtin_ia32_vpermilvarps256">,
1128         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8i32_ty], [IntrNoMem]>;
1129
1130   def int_x86_avx_vperm2f128_pd_256 :
1131         GCCBuiltin<"__builtin_ia32_vperm2f128_pd256">,
1132         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1133                   llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
1134   def int_x86_avx_vperm2f128_ps_256 :
1135         GCCBuiltin<"__builtin_ia32_vperm2f128_ps256">,
1136         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1137                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
1138   def int_x86_avx_vperm2f128_si_256 :
1139         GCCBuiltin<"__builtin_ia32_vperm2f128_si256">,
1140         Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1141                   llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
1142
1143   def int_x86_avx512_mask_vpermi2var_d_128 : 
1144        GCCBuiltin<"__builtin_ia32_vpermi2vard128_mask">,
1145         Intrinsic<[llvm_v4i32_ty],
1146         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
1147         [IntrNoMem]>;
1148
1149   def int_x86_avx512_mask_vpermi2var_d_256 : 
1150         GCCBuiltin<"__builtin_ia32_vpermi2vard256_mask">,
1151           Intrinsic<[llvm_v8i32_ty],
1152           [llvm_v8i32_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty],
1153           [IntrNoMem]>;
1154
1155   def int_x86_avx512_mask_vpermi2var_d_512 : 
1156         GCCBuiltin<"__builtin_ia32_vpermi2vard512_mask">,
1157           Intrinsic<[llvm_v16i32_ty],
1158           [llvm_v16i32_ty, llvm_v16i32_ty, llvm_v16i32_ty, llvm_i16_ty],
1159           [IntrNoMem]>;
1160
1161   def int_x86_avx512_mask_vpermi2var_hi_128 : 
1162         GCCBuiltin<"__builtin_ia32_vpermi2varhi128_mask">,
1163           Intrinsic<[llvm_v8i16_ty],
1164           [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty, llvm_i8_ty],
1165           [IntrNoMem]>;
1166
1167   def int_x86_avx512_mask_vpermi2var_hi_256 : 
1168         GCCBuiltin<"__builtin_ia32_vpermi2varhi256_mask">,
1169           Intrinsic<[llvm_v16i16_ty],
1170           [llvm_v16i16_ty, llvm_v16i16_ty, llvm_v16i16_ty, llvm_i16_ty],
1171           [IntrNoMem]>;
1172
1173   def int_x86_avx512_mask_vpermi2var_hi_512 : 
1174         GCCBuiltin<"__builtin_ia32_vpermi2varhi512_mask">,
1175           Intrinsic<[llvm_v32i16_ty],
1176           [llvm_v32i16_ty, llvm_v32i16_ty, llvm_v32i16_ty, llvm_i32_ty],
1177           [IntrNoMem]>;
1178
1179   def int_x86_avx512_mask_vpermi2var_pd_128 : 
1180         GCCBuiltin<"__builtin_ia32_vpermi2varpd128_mask">,
1181           Intrinsic<[llvm_v2f64_ty],
1182           [llvm_v2f64_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i8_ty],
1183           [IntrNoMem]>;
1184
1185   def int_x86_avx512_mask_vpermi2var_pd_256 : 
1186         GCCBuiltin<"__builtin_ia32_vpermi2varpd256_mask">,
1187           Intrinsic<[llvm_v4f64_ty],
1188           [llvm_v4f64_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i8_ty],
1189           [IntrNoMem]>;
1190
1191   def int_x86_avx512_mask_vpermi2var_pd_512 : 
1192         GCCBuiltin<"__builtin_ia32_vpermi2varpd512_mask">,
1193           Intrinsic<[llvm_v8f64_ty],
1194           [llvm_v8f64_ty, llvm_v8i64_ty, llvm_v8f64_ty, llvm_i8_ty],
1195           [IntrNoMem]>;
1196
1197   def int_x86_avx512_mask_vpermi2var_ps_128 : 
1198         GCCBuiltin<"__builtin_ia32_vpermi2varps128_mask">,
1199           Intrinsic<[llvm_v4f32_ty],
1200           [llvm_v4f32_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i8_ty],
1201           [IntrNoMem]>;
1202
1203   def int_x86_avx512_mask_vpermi2var_ps_256 : 
1204         GCCBuiltin<"__builtin_ia32_vpermi2varps256_mask">,
1205           Intrinsic<[llvm_v8f32_ty],
1206           [llvm_v8f32_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i8_ty],
1207           [IntrNoMem]>;
1208
1209   def int_x86_avx512_mask_vpermi2var_ps_512 : 
1210         GCCBuiltin<"__builtin_ia32_vpermi2varps512_mask">,
1211           Intrinsic<[llvm_v16f32_ty],
1212           [llvm_v16f32_ty, llvm_v16i32_ty, llvm_v16f32_ty, llvm_i16_ty],
1213           [IntrNoMem]>;
1214
1215   def int_x86_avx512_mask_vpermi2var_q_128 : 
1216         GCCBuiltin<"__builtin_ia32_vpermi2varq128_mask">,
1217           Intrinsic<[llvm_v2i64_ty],
1218           [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
1219           [IntrNoMem]>;
1220
1221   def int_x86_avx512_mask_vpermi2var_q_256 : 
1222         GCCBuiltin<"__builtin_ia32_vpermi2varq256_mask">,
1223           Intrinsic<[llvm_v4i64_ty],
1224           [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
1225           [IntrNoMem]>;
1226
1227   def int_x86_avx512_mask_vpermi2var_q_512 : 
1228         GCCBuiltin<"__builtin_ia32_vpermi2varq512_mask">,
1229           Intrinsic<[llvm_v8i64_ty],
1230           [llvm_v8i64_ty, llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty],
1231           [IntrNoMem]>;
1232
1233   def int_x86_avx512_mask_vpermt2var_d_512:
1234         GCCBuiltin<"__builtin_ia32_vpermt2vard512_mask">,
1235         Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1236                   llvm_v16i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
1237
1238   def int_x86_avx512_mask_vpermt2var_q_512:
1239         GCCBuiltin<"__builtin_ia32_vpermt2varq512_mask">,
1240         Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1241                   llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
1242
1243   def int_x86_avx512_mask_vpermt2var_ps_512:
1244         GCCBuiltin<"__builtin_ia32_vpermt2varps512_mask">,
1245         Intrinsic<[llvm_v16f32_ty], [llvm_v16i32_ty,
1246                   llvm_v16f32_ty, llvm_v16f32_ty, llvm_i16_ty], [IntrNoMem]>;
1247
1248   def int_x86_avx512_mask_vpermt2var_pd_512:
1249         GCCBuiltin<"__builtin_ia32_vpermt2varpd512_mask">,
1250         Intrinsic<[llvm_v8f64_ty], [llvm_v8i64_ty,
1251                   llvm_v8f64_ty, llvm_v8f64_ty, llvm_i8_ty], [IntrNoMem]>;
1252
1253   def int_x86_avx512_mask_vpermt2var_d_128 : 
1254         GCCBuiltin<"__builtin_ia32_vpermt2vard128_mask">,
1255           Intrinsic<[llvm_v4i32_ty],
1256           [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
1257           [IntrNoMem]>;
1258
1259   def int_x86_avx512_maskz_vpermt2var_d_128 : 
1260         GCCBuiltin<"__builtin_ia32_vpermt2vard128_maskz">,
1261           Intrinsic<[llvm_v4i32_ty],
1262           [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
1263           [IntrNoMem]>;
1264
1265   def int_x86_avx512_mask_vpermt2var_d_256 : 
1266         GCCBuiltin<"__builtin_ia32_vpermt2vard256_mask">,
1267           Intrinsic<[llvm_v8i32_ty],
1268           [llvm_v8i32_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty],
1269           [IntrNoMem]>;
1270
1271   def int_x86_avx512_maskz_vpermt2var_d_256 : 
1272         GCCBuiltin<"__builtin_ia32_vpermt2vard256_maskz">,
1273           Intrinsic<[llvm_v8i32_ty],
1274           [llvm_v8i32_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty],
1275           [IntrNoMem]>;
1276
1277   def int_x86_avx512_maskz_vpermt2var_d_512 : 
1278         GCCBuiltin<"__builtin_ia32_vpermt2vard512_maskz">,
1279           Intrinsic<[llvm_v16i32_ty],
1280           [llvm_v16i32_ty, llvm_v16i32_ty, llvm_v16i32_ty, llvm_i16_ty],
1281           [IntrNoMem]>;
1282
1283   def int_x86_avx512_mask_vpermt2var_hi_128 : 
1284         GCCBuiltin<"__builtin_ia32_vpermt2varhi128_mask">,
1285           Intrinsic<[llvm_v8i16_ty],
1286           [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty, llvm_i8_ty],
1287           [IntrNoMem]>;
1288
1289   def int_x86_avx512_maskz_vpermt2var_hi_128 : 
1290         GCCBuiltin<"__builtin_ia32_vpermt2varhi128_maskz">,
1291           Intrinsic<[llvm_v8i16_ty],
1292           [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty, llvm_i8_ty],
1293           [IntrNoMem]>;
1294
1295   def int_x86_avx512_mask_vpermt2var_hi_256 : 
1296         GCCBuiltin<"__builtin_ia32_vpermt2varhi256_mask">,
1297           Intrinsic<[llvm_v16i16_ty],
1298           [llvm_v16i16_ty, llvm_v16i16_ty, llvm_v16i16_ty, llvm_i16_ty],
1299           [IntrNoMem]>;
1300
1301   def int_x86_avx512_maskz_vpermt2var_hi_256 : 
1302         GCCBuiltin<"__builtin_ia32_vpermt2varhi256_maskz">,
1303           Intrinsic<[llvm_v16i16_ty],
1304           [llvm_v16i16_ty, llvm_v16i16_ty, llvm_v16i16_ty, llvm_i16_ty],
1305           [IntrNoMem]>;
1306
1307   def int_x86_avx512_mask_vpermt2var_hi_512 : 
1308         GCCBuiltin<"__builtin_ia32_vpermt2varhi512_mask">,
1309           Intrinsic<[llvm_v32i16_ty],
1310           [llvm_v32i16_ty, llvm_v32i16_ty, llvm_v32i16_ty, llvm_i32_ty],
1311           [IntrNoMem]>;
1312
1313   def int_x86_avx512_maskz_vpermt2var_hi_512 : 
1314         GCCBuiltin<"__builtin_ia32_vpermt2varhi512_maskz">,
1315           Intrinsic<[llvm_v32i16_ty],
1316           [llvm_v32i16_ty, llvm_v32i16_ty, llvm_v32i16_ty, llvm_i32_ty],
1317           [IntrNoMem]>;
1318
1319   def int_x86_avx512_mask_vpermt2var_pd_128 : 
1320         GCCBuiltin<"__builtin_ia32_vpermt2varpd128_mask">,
1321           Intrinsic<[llvm_v2f64_ty],
1322           [llvm_v2i64_ty, llvm_v2f64_ty, llvm_v2f64_ty, llvm_i8_ty],
1323           [IntrNoMem]>;
1324
1325   def int_x86_avx512_maskz_vpermt2var_pd_128 : 
1326         GCCBuiltin<"__builtin_ia32_vpermt2varpd128_maskz">,
1327           Intrinsic<[llvm_v2f64_ty],
1328           [llvm_v2i64_ty, llvm_v2f64_ty, llvm_v2f64_ty, llvm_i8_ty],
1329           [IntrNoMem]>;
1330
1331   def int_x86_avx512_mask_vpermt2var_pd_256 : 
1332         GCCBuiltin<"__builtin_ia32_vpermt2varpd256_mask">,
1333           Intrinsic<[llvm_v4f64_ty],
1334           [llvm_v4i64_ty, llvm_v4f64_ty, llvm_v4f64_ty, llvm_i8_ty],
1335           [IntrNoMem]>;
1336
1337   def int_x86_avx512_maskz_vpermt2var_pd_256 : 
1338         GCCBuiltin<"__builtin_ia32_vpermt2varpd256_maskz">,
1339           Intrinsic<[llvm_v4f64_ty],
1340           [llvm_v4i64_ty, llvm_v4f64_ty, llvm_v4f64_ty, llvm_i8_ty],
1341           [IntrNoMem]>;
1342
1343   def int_x86_avx512_maskz_vpermt2var_pd_512 : 
1344         GCCBuiltin<"__builtin_ia32_vpermt2varpd512_maskz">,
1345           Intrinsic<[llvm_v8f64_ty],
1346           [llvm_v8i64_ty, llvm_v8f64_ty, llvm_v8f64_ty, llvm_i8_ty],
1347           [IntrNoMem]>;
1348
1349   def int_x86_avx512_mask_vpermt2var_ps_128 : 
1350         GCCBuiltin<"__builtin_ia32_vpermt2varps128_mask">,
1351           Intrinsic<[llvm_v4f32_ty],
1352           [llvm_v4i32_ty, llvm_v4f32_ty, llvm_v4f32_ty, llvm_i8_ty],
1353           [IntrNoMem]>;
1354
1355   def int_x86_avx512_maskz_vpermt2var_ps_128 : 
1356         GCCBuiltin<"__builtin_ia32_vpermt2varps128_maskz">,
1357           Intrinsic<[llvm_v4f32_ty],
1358           [llvm_v4i32_ty, llvm_v4f32_ty, llvm_v4f32_ty, llvm_i8_ty],
1359           [IntrNoMem]>;
1360
1361   def int_x86_avx512_mask_vpermt2var_ps_256 : 
1362         GCCBuiltin<"__builtin_ia32_vpermt2varps256_mask">,
1363           Intrinsic<[llvm_v8f32_ty],
1364           [llvm_v8i32_ty, llvm_v8f32_ty, llvm_v8f32_ty, llvm_i8_ty],
1365           [IntrNoMem]>;
1366
1367   def int_x86_avx512_maskz_vpermt2var_ps_256 : 
1368         GCCBuiltin<"__builtin_ia32_vpermt2varps256_maskz">,
1369           Intrinsic<[llvm_v8f32_ty],
1370           [llvm_v8i32_ty, llvm_v8f32_ty, llvm_v8f32_ty, llvm_i8_ty],
1371           [IntrNoMem]>;
1372
1373   def int_x86_avx512_maskz_vpermt2var_ps_512 : 
1374         GCCBuiltin<"__builtin_ia32_vpermt2varps512_maskz">,
1375           Intrinsic<[llvm_v16f32_ty],
1376           [llvm_v16i32_ty, llvm_v16f32_ty, llvm_v16f32_ty, llvm_i16_ty],
1377           [IntrNoMem]>;
1378
1379   def int_x86_avx512_mask_vpermt2var_q_128 : 
1380         GCCBuiltin<"__builtin_ia32_vpermt2varq128_mask">,
1381           Intrinsic<[llvm_v2i64_ty],
1382           [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
1383           [IntrNoMem]>;
1384
1385   def int_x86_avx512_maskz_vpermt2var_q_128 : 
1386         GCCBuiltin<"__builtin_ia32_vpermt2varq128_maskz">,
1387           Intrinsic<[llvm_v2i64_ty],
1388           [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
1389           [IntrNoMem]>;
1390
1391   def int_x86_avx512_mask_vpermt2var_q_256 : 
1392         GCCBuiltin<"__builtin_ia32_vpermt2varq256_mask">,
1393           Intrinsic<[llvm_v4i64_ty],
1394           [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
1395           [IntrNoMem]>;
1396
1397   def int_x86_avx512_maskz_vpermt2var_q_256 : 
1398         GCCBuiltin<"__builtin_ia32_vpermt2varq256_maskz">,
1399           Intrinsic<[llvm_v4i64_ty],
1400           [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
1401           [IntrNoMem]>;
1402
1403   def int_x86_avx512_maskz_vpermt2var_q_512 : 
1404         GCCBuiltin<"__builtin_ia32_vpermt2varq512_maskz">,
1405           Intrinsic<[llvm_v8i64_ty],
1406           [llvm_v8i64_ty, llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty],
1407           [IntrNoMem]>;
1408
1409   def int_x86_avx512_mask_vpermil_pd_128 :
1410         GCCBuiltin<"__builtin_ia32_vpermilpd_mask">,
1411           Intrinsic<[llvm_v2f64_ty],
1412           [llvm_v2f64_ty, llvm_i32_ty, llvm_v2f64_ty, llvm_i8_ty],
1413           [IntrNoMem]>;
1414
1415   def int_x86_avx512_mask_vpermil_pd_256 :
1416         GCCBuiltin<"__builtin_ia32_vpermilpd256_mask">,
1417           Intrinsic<[llvm_v4f64_ty],
1418           [llvm_v4f64_ty, llvm_i32_ty, llvm_v4f64_ty, llvm_i8_ty],
1419           [IntrNoMem]>;
1420
1421   def int_x86_avx512_mask_vpermil_pd_512 :
1422         GCCBuiltin<"__builtin_ia32_vpermilpd512_mask">,
1423           Intrinsic<[llvm_v8f64_ty],
1424           [llvm_v8f64_ty, llvm_i32_ty, llvm_v8f64_ty, llvm_i8_ty],
1425           [IntrNoMem]>;
1426
1427   def int_x86_avx512_mask_vpermil_ps_128 :
1428         GCCBuiltin<"__builtin_ia32_vpermilps_mask">,
1429           Intrinsic<[llvm_v4f32_ty],
1430           [llvm_v4f32_ty, llvm_i32_ty, llvm_v4f32_ty, llvm_i8_ty],
1431           [IntrNoMem]>;
1432
1433   def int_x86_avx512_mask_vpermil_ps_256 :
1434         GCCBuiltin<"__builtin_ia32_vpermilps256_mask">,
1435           Intrinsic<[llvm_v8f32_ty],
1436           [llvm_v8f32_ty, llvm_i32_ty, llvm_v8f32_ty, llvm_i8_ty],
1437           [IntrNoMem]>;
1438
1439   def int_x86_avx512_mask_vpermil_ps_512 :
1440         GCCBuiltin<"__builtin_ia32_vpermilps512_mask">,
1441           Intrinsic<[llvm_v16f32_ty],
1442           [llvm_v16f32_ty, llvm_i32_ty, llvm_v16f32_ty, llvm_i16_ty],
1443           [IntrNoMem]>;
1444
1445   def int_x86_avx512_mask_vpermilvar_pd_256 :
1446         GCCBuiltin<"__builtin_ia32_vpermilvarpd256_mask">,
1447           Intrinsic<[llvm_v4f64_ty],
1448           [llvm_v4f64_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i8_ty],
1449           [IntrNoMem]>;
1450
1451   def int_x86_avx512_mask_vpermilvar_pd_512 :
1452         GCCBuiltin<"__builtin_ia32_vpermilvarpd512_mask">,
1453           Intrinsic<[llvm_v8f64_ty],
1454           [llvm_v8f64_ty, llvm_v8i64_ty, llvm_v8f64_ty, llvm_i8_ty],
1455           [IntrNoMem]>;
1456
1457   def int_x86_avx512_mask_vpermilvar_pd_128 :
1458         GCCBuiltin<"__builtin_ia32_vpermilvarpd_mask">,
1459           Intrinsic<[llvm_v2f64_ty],
1460           [llvm_v2f64_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i8_ty],
1461           [IntrNoMem]>;
1462
1463   def int_x86_avx512_mask_vpermilvar_ps_256 :
1464         GCCBuiltin<"__builtin_ia32_vpermilvarps256_mask">,
1465           Intrinsic<[llvm_v8f32_ty],
1466           [llvm_v8f32_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i8_ty],
1467           [IntrNoMem]>;
1468
1469   def int_x86_avx512_mask_vpermilvar_ps_512 :
1470         GCCBuiltin<"__builtin_ia32_vpermilvarps512_mask">,
1471           Intrinsic<[llvm_v16f32_ty],
1472           [llvm_v16f32_ty, llvm_v16i32_ty, llvm_v16f32_ty, llvm_i16_ty],
1473           [IntrNoMem]>;
1474
1475   def int_x86_avx512_mask_vpermilvar_ps_128 :
1476         GCCBuiltin<"__builtin_ia32_vpermilvarps_mask">,
1477           Intrinsic<[llvm_v4f32_ty],
1478           [llvm_v4f32_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i8_ty],
1479           [IntrNoMem]>;
1480
1481   def int_x86_avx512_mask_pshuf_b_128 : 
1482         GCCBuiltin<"__builtin_ia32_pshufb128_mask">,
1483           Intrinsic<[llvm_v16i8_ty],
1484           [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty,  llvm_i16_ty],
1485           [IntrNoMem]>;
1486
1487   def int_x86_avx512_mask_pshuf_b_256 : 
1488         GCCBuiltin<"__builtin_ia32_pshufb256_mask">,
1489           Intrinsic<[llvm_v32i8_ty],
1490           [llvm_v32i8_ty, llvm_v32i8_ty, llvm_v32i8_ty,  llvm_i32_ty],
1491           [IntrNoMem]>;
1492
1493   def int_x86_avx512_mask_pshuf_b_512 : 
1494         GCCBuiltin<"__builtin_ia32_pshufb512_mask">,
1495           Intrinsic<[llvm_v64i8_ty],
1496           [llvm_v64i8_ty, llvm_v64i8_ty, llvm_v64i8_ty,  llvm_i64_ty],
1497           [IntrNoMem]>;
1498
1499   def int_x86_avx512_mask_shuf_f32x4_256 :
1500          GCCBuiltin<"__builtin_ia32_shuf_f32x4_256_mask">,
1501           Intrinsic<[llvm_v8f32_ty],
1502           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_i32_ty, llvm_v8f32_ty, llvm_i8_ty],
1503           [IntrNoMem]>;
1504
1505   def int_x86_avx512_mask_shuf_f32x4 :
1506          GCCBuiltin<"__builtin_ia32_shuf_f32x4_mask">,
1507           Intrinsic<[llvm_v16f32_ty],
1508           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_i32_ty, llvm_v16f32_ty, llvm_i16_ty],
1509           [IntrNoMem]>;
1510
1511   def int_x86_avx512_mask_shuf_f64x2_256 :
1512          GCCBuiltin<"__builtin_ia32_shuf_f64x2_256_mask">,
1513           Intrinsic<[llvm_v4f64_ty],
1514           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_i32_ty, llvm_v4f64_ty, llvm_i8_ty],
1515           [IntrNoMem]>;
1516
1517   def int_x86_avx512_mask_shuf_f64x2 :
1518          GCCBuiltin<"__builtin_ia32_shuf_f64x2_mask">,
1519           Intrinsic<[llvm_v8f64_ty],
1520           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_i32_ty, llvm_v8f64_ty, llvm_i8_ty],
1521           [IntrNoMem]>;
1522
1523   def int_x86_avx512_mask_shuf_i32x4_256 :
1524          GCCBuiltin<"__builtin_ia32_shuf_i32x4_256_mask">,
1525           Intrinsic<[llvm_v8i32_ty],
1526           [llvm_v8i32_ty, llvm_v8i32_ty, llvm_i32_ty, llvm_v8i32_ty, llvm_i8_ty],
1527           [IntrNoMem]>;
1528
1529   def int_x86_avx512_mask_shuf_i32x4 :
1530          GCCBuiltin<"__builtin_ia32_shuf_i32x4_mask">,
1531           Intrinsic<[llvm_v16i32_ty],
1532           [llvm_v16i32_ty, llvm_v16i32_ty, llvm_i32_ty, llvm_v16i32_ty, llvm_i16_ty],
1533           [IntrNoMem]>;
1534
1535   def int_x86_avx512_mask_shuf_i64x2_256 :
1536          GCCBuiltin<"__builtin_ia32_shuf_i64x2_256_mask">,
1537           Intrinsic<[llvm_v4i64_ty],
1538           [llvm_v4i64_ty, llvm_v4i64_ty, llvm_i32_ty, llvm_v4i64_ty, llvm_i8_ty],
1539           [IntrNoMem]>;
1540
1541   def int_x86_avx512_mask_shuf_i64x2 :
1542          GCCBuiltin<"__builtin_ia32_shuf_i64x2_mask">,
1543           Intrinsic<[llvm_v8i64_ty],
1544           [llvm_v8i64_ty, llvm_v8i64_ty, llvm_i32_ty, llvm_v8i64_ty, llvm_i8_ty],
1545           [IntrNoMem]>;
1546
1547   def int_x86_avx512_mask_shuf_pd_128 :
1548          GCCBuiltin<"__builtin_ia32_shufpd128_mask">,
1549           Intrinsic<[llvm_v2f64_ty],
1550           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty, llvm_v2f64_ty, llvm_i8_ty],
1551           [IntrNoMem]>;
1552
1553   def int_x86_avx512_mask_shuf_pd_256 :
1554          GCCBuiltin<"__builtin_ia32_shufpd256_mask">,
1555           Intrinsic<[llvm_v4f64_ty],
1556           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_i32_ty, llvm_v4f64_ty, llvm_i8_ty],
1557           [IntrNoMem]>;
1558
1559   def int_x86_avx512_mask_shuf_pd_512 :
1560          GCCBuiltin<"__builtin_ia32_shufpd512_mask">,
1561           Intrinsic<[llvm_v8f64_ty],
1562           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_i32_ty, llvm_v8f64_ty, llvm_i8_ty],
1563           [IntrNoMem]>;
1564
1565   def int_x86_avx512_mask_shuf_ps_128 :
1566          GCCBuiltin<"__builtin_ia32_shufps128_mask">,
1567           Intrinsic<[llvm_v4f32_ty],
1568           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty, llvm_v4f32_ty, llvm_i8_ty],
1569           [IntrNoMem]>;
1570
1571   def int_x86_avx512_mask_shuf_ps_256 :
1572          GCCBuiltin<"__builtin_ia32_shufps256_mask">,
1573           Intrinsic<[llvm_v8f32_ty],
1574           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_i32_ty, llvm_v8f32_ty, llvm_i8_ty],
1575           [IntrNoMem]>;
1576
1577   def int_x86_avx512_mask_shuf_ps_512 :
1578          GCCBuiltin<"__builtin_ia32_shufps512_mask">,
1579           Intrinsic<[llvm_v16f32_ty],
1580           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_i32_ty, llvm_v16f32_ty, llvm_i16_ty],
1581           [IntrNoMem]>;
1582 }
1583
1584 // Vector blend
1585 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1586   def int_x86_avx_blendv_pd_256 : GCCBuiltin<"__builtin_ia32_blendvpd256">,
1587         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1588                   llvm_v4f64_ty, llvm_v4f64_ty], [IntrNoMem]>;
1589   def int_x86_avx_blendv_ps_256 : GCCBuiltin<"__builtin_ia32_blendvps256">,
1590         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1591                   llvm_v8f32_ty, llvm_v8f32_ty], [IntrNoMem]>;
1592 }
1593
1594 // Vector dot product
1595 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1596   def int_x86_avx_dp_ps_256 : GCCBuiltin<"__builtin_ia32_dpps256">,
1597         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1598                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
1599 }
1600
1601 // Vector compare
1602 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1603   def int_x86_avx_cmp_pd_256 : GCCBuiltin<"__builtin_ia32_cmppd256">,
1604         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1605                   llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
1606   def int_x86_avx_cmp_ps_256 : GCCBuiltin<"__builtin_ia32_cmpps256">,
1607         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1608                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
1609 }
1610
1611 // Vector convert
1612 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1613   def int_x86_avx_cvtdq2_pd_256 : GCCBuiltin<"__builtin_ia32_cvtdq2pd256">,
1614         Intrinsic<[llvm_v4f64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
1615   def int_x86_avx_cvtdq2_ps_256 : GCCBuiltin<"__builtin_ia32_cvtdq2ps256">,
1616         Intrinsic<[llvm_v8f32_ty], [llvm_v8i32_ty], [IntrNoMem]>;
1617   def int_x86_avx_cvt_pd2_ps_256 : GCCBuiltin<"__builtin_ia32_cvtpd2ps256">,
1618         Intrinsic<[llvm_v4f32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1619   def int_x86_avx_cvt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvtps2dq256">,
1620         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1621   def int_x86_avx_cvt_ps2_pd_256 : GCCBuiltin<"__builtin_ia32_cvtps2pd256">,
1622         Intrinsic<[llvm_v4f64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1623   def int_x86_avx_cvtt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvttpd2dq256">,
1624         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1625   def int_x86_avx_cvt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvtpd2dq256">,
1626         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1627   def int_x86_avx_cvtt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvttps2dq256">,
1628         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1629 }
1630
1631 // Vector bit test
1632 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1633   def int_x86_avx_vtestz_pd : GCCBuiltin<"__builtin_ia32_vtestzpd">,
1634         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
1635                   llvm_v2f64_ty], [IntrNoMem]>;
1636   def int_x86_avx_vtestc_pd : GCCBuiltin<"__builtin_ia32_vtestcpd">,
1637         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
1638                   llvm_v2f64_ty], [IntrNoMem]>;
1639   def int_x86_avx_vtestnzc_pd : GCCBuiltin<"__builtin_ia32_vtestnzcpd">,
1640         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
1641                   llvm_v2f64_ty], [IntrNoMem]>;
1642   def int_x86_avx_vtestz_ps : GCCBuiltin<"__builtin_ia32_vtestzps">,
1643         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
1644                   llvm_v4f32_ty], [IntrNoMem]>;
1645   def int_x86_avx_vtestc_ps : GCCBuiltin<"__builtin_ia32_vtestcps">,
1646         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
1647                   llvm_v4f32_ty], [IntrNoMem]>;
1648   def int_x86_avx_vtestnzc_ps : GCCBuiltin<"__builtin_ia32_vtestnzcps">,
1649         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
1650                   llvm_v4f32_ty], [IntrNoMem]>;
1651   def int_x86_avx_vtestz_pd_256 : GCCBuiltin<"__builtin_ia32_vtestzpd256">,
1652         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
1653                   llvm_v4f64_ty], [IntrNoMem]>;
1654   def int_x86_avx_vtestc_pd_256 : GCCBuiltin<"__builtin_ia32_vtestcpd256">,
1655         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
1656                   llvm_v4f64_ty], [IntrNoMem]>;
1657   def int_x86_avx_vtestnzc_pd_256 : GCCBuiltin<"__builtin_ia32_vtestnzcpd256">,
1658         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
1659                   llvm_v4f64_ty], [IntrNoMem]>;
1660   def int_x86_avx_vtestz_ps_256 : GCCBuiltin<"__builtin_ia32_vtestzps256">,
1661         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
1662                   llvm_v8f32_ty], [IntrNoMem]>;
1663   def int_x86_avx_vtestc_ps_256 : GCCBuiltin<"__builtin_ia32_vtestcps256">,
1664         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
1665                   llvm_v8f32_ty], [IntrNoMem]>;
1666   def int_x86_avx_vtestnzc_ps_256 : GCCBuiltin<"__builtin_ia32_vtestnzcps256">,
1667         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
1668                   llvm_v8f32_ty], [IntrNoMem]>;
1669   def int_x86_avx_ptestz_256 : GCCBuiltin<"__builtin_ia32_ptestz256">,
1670         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
1671                   llvm_v4i64_ty], [IntrNoMem]>;
1672   def int_x86_avx_ptestc_256 : GCCBuiltin<"__builtin_ia32_ptestc256">,
1673         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
1674                   llvm_v4i64_ty], [IntrNoMem]>;
1675   def int_x86_avx_ptestnzc_256 : GCCBuiltin<"__builtin_ia32_ptestnzc256">,
1676         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
1677                   llvm_v4i64_ty], [IntrNoMem]>;
1678   def int_x86_avx512_mask_ptestm_d_512 : GCCBuiltin<"__builtin_ia32_ptestmd512">,
1679         Intrinsic<[llvm_i16_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1680                   llvm_i16_ty], [IntrNoMem]>;
1681   def int_x86_avx512_mask_ptestm_q_512 : GCCBuiltin<"__builtin_ia32_ptestmq512">,
1682         Intrinsic<[llvm_i8_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
1683                   llvm_i8_ty], [IntrNoMem]>;
1684   def int_x86_avx512_mask_fpclass_pd_128 : 
1685          GCCBuiltin<"__builtin_ia32_fpclasspd128_mask">,
1686           Intrinsic<[llvm_i8_ty], [llvm_v2f64_ty, llvm_i32_ty, llvm_i8_ty],
1687           [IntrNoMem]>;
1688   def int_x86_avx512_mask_fpclass_pd_256 : 
1689          GCCBuiltin<"__builtin_ia32_fpclasspd256_mask">,
1690           Intrinsic<[llvm_i8_ty], [llvm_v4f64_ty, llvm_i32_ty, llvm_i8_ty],
1691           [IntrNoMem]>;
1692   def int_x86_avx512_mask_fpclass_pd_512 : 
1693          GCCBuiltin<"__builtin_ia32_fpclasspd512_mask">,
1694           Intrinsic<[llvm_i8_ty], [llvm_v8f64_ty, llvm_i32_ty, llvm_i8_ty],
1695           [IntrNoMem]>;
1696   def int_x86_avx512_mask_fpclass_ps_128 : 
1697          GCCBuiltin<"__builtin_ia32_fpclassps128_mask">,
1698           Intrinsic<[llvm_i8_ty], [llvm_v4f32_ty, llvm_i32_ty, llvm_i8_ty],
1699           [IntrNoMem]>;
1700   def int_x86_avx512_mask_fpclass_ps_256 : 
1701          GCCBuiltin<"__builtin_ia32_fpclassps256_mask">,
1702           Intrinsic<[llvm_i8_ty], [llvm_v8f32_ty, llvm_i32_ty, llvm_i8_ty],
1703           [IntrNoMem]>;
1704   def int_x86_avx512_mask_fpclass_ps_512 : 
1705          GCCBuiltin<"__builtin_ia32_fpclassps512_mask">,
1706           Intrinsic<[llvm_i16_ty], [llvm_v16f32_ty, llvm_i32_ty, llvm_i16_ty],
1707           [IntrNoMem]>;
1708 }
1709
1710 // Vector extract sign mask
1711 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1712   def int_x86_avx_movmsk_pd_256 : GCCBuiltin<"__builtin_ia32_movmskpd256">,
1713         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1714   def int_x86_avx_movmsk_ps_256 : GCCBuiltin<"__builtin_ia32_movmskps256">,
1715         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1716 }
1717
1718 // Vector zero
1719 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1720   def int_x86_avx_vzeroall : GCCBuiltin<"__builtin_ia32_vzeroall">,
1721         Intrinsic<[], [], []>;
1722   def int_x86_avx_vzeroupper : GCCBuiltin<"__builtin_ia32_vzeroupper">,
1723         Intrinsic<[], [], []>;
1724 }
1725
1726 // Vector load with broadcast
1727 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1728   def int_x86_avx_vbroadcastf128_pd_256 :
1729         GCCBuiltin<"__builtin_ia32_vbroadcastf128_pd256">,
1730         Intrinsic<[llvm_v4f64_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
1731   def int_x86_avx_vbroadcastf128_ps_256 :
1732         GCCBuiltin<"__builtin_ia32_vbroadcastf128_ps256">,
1733         Intrinsic<[llvm_v8f32_ty], [llvm_ptr_ty], [IntrReadArgMem]>;
1734 }
1735
1736 // SIMD load ops
1737 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1738   def int_x86_avx_ldu_dq_256 : GCCBuiltin<"__builtin_ia32_lddqu256">,
1739         Intrinsic<[llvm_v32i8_ty], [llvm_ptr_ty], [IntrReadMem]>;
1740 }
1741
1742 // SIMD store ops
1743 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1744   def int_x86_avx_storeu_pd_256 : GCCBuiltin<"__builtin_ia32_storeupd256">,
1745         Intrinsic<[], [llvm_ptr_ty, llvm_v4f64_ty], [IntrReadWriteArgMem]>;
1746   def int_x86_avx_storeu_ps_256 : GCCBuiltin<"__builtin_ia32_storeups256">,
1747         Intrinsic<[], [llvm_ptr_ty, llvm_v8f32_ty], [IntrReadWriteArgMem]>;
1748   def int_x86_avx_storeu_dq_256 : GCCBuiltin<"__builtin_ia32_storedqu256">,
1749         Intrinsic<[], [llvm_ptr_ty, llvm_v32i8_ty], [IntrReadWriteArgMem]>;
1750 }
1751
1752 // Conditional load ops
1753 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1754   def int_x86_avx_maskload_pd : GCCBuiltin<"__builtin_ia32_maskloadpd">,
1755         Intrinsic<[llvm_v2f64_ty], [llvm_ptr_ty, llvm_v2f64_ty],
1756                   [IntrReadArgMem]>;
1757   def int_x86_avx_maskload_ps : GCCBuiltin<"__builtin_ia32_maskloadps">,
1758         Intrinsic<[llvm_v4f32_ty], [llvm_ptr_ty, llvm_v4f32_ty],
1759                   [IntrReadArgMem]>;
1760   def int_x86_avx_maskload_pd_256 : GCCBuiltin<"__builtin_ia32_maskloadpd256">,
1761         Intrinsic<[llvm_v4f64_ty], [llvm_ptr_ty, llvm_v4f64_ty],
1762                   [IntrReadArgMem]>;
1763   def int_x86_avx_maskload_ps_256 : GCCBuiltin<"__builtin_ia32_maskloadps256">,
1764         Intrinsic<[llvm_v8f32_ty], [llvm_ptr_ty, llvm_v8f32_ty],
1765                   [IntrReadArgMem]>;
1766   def int_x86_avx512_mask_loadu_ps_512 : GCCBuiltin<"__builtin_ia32_loadups512_mask">,
1767         Intrinsic<[llvm_v16f32_ty], [llvm_ptr_ty, llvm_v16f32_ty, llvm_i16_ty],
1768                   [IntrReadArgMem]>;
1769   def int_x86_avx512_mask_loadu_pd_512 : GCCBuiltin<"__builtin_ia32_loadupd512_mask">,
1770         Intrinsic<[llvm_v8f64_ty], [llvm_ptr_ty, llvm_v8f64_ty, llvm_i8_ty],
1771                   [IntrReadArgMem]>;
1772   def int_x86_avx512_mask_load_ps_512 : GCCBuiltin<"__builtin_ia32_loadaps512_mask">,
1773         Intrinsic<[llvm_v16f32_ty], [llvm_ptr_ty, llvm_v16f32_ty, llvm_i16_ty],
1774                   [IntrReadArgMem]>;
1775   def int_x86_avx512_mask_load_pd_512 : GCCBuiltin<"__builtin_ia32_loadapd512_mask">,
1776         Intrinsic<[llvm_v8f64_ty], [llvm_ptr_ty, llvm_v8f64_ty, llvm_i8_ty],
1777                   [IntrReadArgMem]>;
1778 }
1779
1780 // Conditional store ops
1781 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1782   def int_x86_avx_maskstore_pd : GCCBuiltin<"__builtin_ia32_maskstorepd">,
1783         Intrinsic<[], [llvm_ptr_ty,
1784                   llvm_v2f64_ty, llvm_v2f64_ty], [IntrReadWriteArgMem]>;
1785   def int_x86_avx_maskstore_ps : GCCBuiltin<"__builtin_ia32_maskstoreps">,
1786         Intrinsic<[], [llvm_ptr_ty,
1787                   llvm_v4f32_ty, llvm_v4f32_ty], [IntrReadWriteArgMem]>;
1788   def int_x86_avx_maskstore_pd_256 :
1789         GCCBuiltin<"__builtin_ia32_maskstorepd256">,
1790         Intrinsic<[], [llvm_ptr_ty,
1791                   llvm_v4f64_ty, llvm_v4f64_ty], [IntrReadWriteArgMem]>;
1792   def int_x86_avx_maskstore_ps_256 :
1793         GCCBuiltin<"__builtin_ia32_maskstoreps256">,
1794         Intrinsic<[], [llvm_ptr_ty,
1795                   llvm_v8f32_ty, llvm_v8f32_ty], [IntrReadWriteArgMem]>;
1796   def int_x86_avx512_mask_storeu_ps_512 :
1797         GCCBuiltin<"__builtin_ia32_storeups512_mask">,
1798         Intrinsic<[], [llvm_ptr_ty, llvm_v16f32_ty, llvm_i16_ty],
1799                   [IntrReadWriteArgMem]>;
1800   def int_x86_avx512_mask_storeu_pd_512 :
1801         GCCBuiltin<"__builtin_ia32_storeupd512_mask">,
1802         Intrinsic<[], [llvm_ptr_ty, llvm_v8f64_ty, llvm_i8_ty],
1803                   [IntrReadWriteArgMem]>;
1804   def int_x86_avx512_mask_store_ps_512 :
1805         GCCBuiltin<"__builtin_ia32_storeaps512_mask">,
1806         Intrinsic<[], [llvm_ptr_ty, llvm_v16f32_ty, llvm_i16_ty],
1807                   [IntrReadWriteArgMem]>;
1808   def int_x86_avx512_mask_store_pd_512 :
1809         GCCBuiltin<"__builtin_ia32_storeapd512_mask">,
1810         Intrinsic<[], [llvm_ptr_ty, llvm_v8f64_ty, llvm_i8_ty],
1811                   [IntrReadWriteArgMem]>;
1812   def int_x86_avx512_mask_store_ss :
1813         GCCBuiltin<"__builtin_ia32_storess_mask">,
1814         Intrinsic<[], [llvm_ptr_ty, llvm_v4f32_ty, llvm_i8_ty],
1815                   [IntrReadWriteArgMem]>;
1816 }
1817
1818 //===----------------------------------------------------------------------===//
1819 // AVX2
1820
1821 // Integer arithmetic ops.
1822 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1823   def int_x86_avx2_padds_b : GCCBuiltin<"__builtin_ia32_paddsb256">,
1824               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1825                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1826   def int_x86_avx2_padds_w : GCCBuiltin<"__builtin_ia32_paddsw256">,
1827               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1828                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1829   def int_x86_avx2_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb256">,
1830               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1831                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1832   def int_x86_avx2_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw256">,
1833               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1834                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1835   def int_x86_avx2_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb256">,
1836               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1837                          llvm_v32i8_ty], [IntrNoMem]>;
1838   def int_x86_avx2_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw256">,
1839               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1840                          llvm_v16i16_ty], [IntrNoMem]>;
1841   def int_x86_avx2_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb256">,
1842               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1843                          llvm_v32i8_ty], [IntrNoMem]>;
1844   def int_x86_avx2_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw256">,
1845               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1846                          llvm_v16i16_ty], [IntrNoMem]>;
1847   def int_x86_avx2_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw256">,
1848               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1849                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1850   def int_x86_avx2_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw256">,
1851               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1852                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1853   def int_x86_avx2_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq256">,
1854               Intrinsic<[llvm_v4i64_ty], [llvm_v8i32_ty,
1855                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
1856   def int_x86_avx2_pmul_dq : GCCBuiltin<"__builtin_ia32_pmuldq256">,
1857               Intrinsic<[llvm_v4i64_ty], [llvm_v8i32_ty,
1858                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
1859   def int_x86_avx2_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd256">,
1860               Intrinsic<[llvm_v8i32_ty], [llvm_v16i16_ty,
1861                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1862   def int_x86_avx2_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb256">,
1863               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1864                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1865   def int_x86_avx2_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw256">,
1866               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1867                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1868   def int_x86_avx2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw256">,
1869               Intrinsic<[llvm_v4i64_ty], [llvm_v32i8_ty,
1870                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1871 }
1872
1873 // Vector min, max
1874 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1875   def int_x86_avx2_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub256">,
1876               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1877                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1878   def int_x86_avx2_pmaxu_w : GCCBuiltin<"__builtin_ia32_pmaxuw256">,
1879               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1880                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1881   def int_x86_avx2_pmaxu_d : GCCBuiltin<"__builtin_ia32_pmaxud256">,
1882               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1883                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
1884   def int_x86_avx2_pmaxs_b : GCCBuiltin<"__builtin_ia32_pmaxsb256">,
1885               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1886                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1887   def int_x86_avx2_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw256">,
1888               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1889                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1890   def int_x86_avx2_pmaxs_d : GCCBuiltin<"__builtin_ia32_pmaxsd256">,
1891               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1892                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
1893   def int_x86_avx2_pminu_b : GCCBuiltin<"__builtin_ia32_pminub256">,
1894               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1895                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1896   def int_x86_avx2_pminu_w : GCCBuiltin<"__builtin_ia32_pminuw256">,
1897               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1898                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1899   def int_x86_avx2_pminu_d : GCCBuiltin<"__builtin_ia32_pminud256">,
1900               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1901                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
1902   def int_x86_avx2_pmins_b : GCCBuiltin<"__builtin_ia32_pminsb256">,
1903               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1904                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1905   def int_x86_avx2_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw256">,
1906               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1907                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1908   def int_x86_avx2_pmins_d : GCCBuiltin<"__builtin_ia32_pminsd256">,
1909               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1910                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
1911   def int_x86_avx512_mask_pmaxs_b_128 : GCCBuiltin<"__builtin_ia32_pmaxsb128_mask">,
1912               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, 
1913                          llvm_v16i8_ty, llvm_i16_ty], [IntrNoMem]>;
1914   def int_x86_avx512_mask_pmaxs_b_256 : GCCBuiltin<"__builtin_ia32_pmaxsb256_mask">,
1915               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty, 
1916                          llvm_v32i8_ty,  llvm_i32_ty], [IntrNoMem]>;
1917   def int_x86_avx512_mask_pmaxs_b_512 : GCCBuiltin<"__builtin_ia32_pmaxsb512_mask">,
1918               Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty, llvm_v64i8_ty, 
1919                          llvm_v64i8_ty,  llvm_i64_ty], [IntrNoMem]>;
1920   def int_x86_avx512_mask_pmaxu_b_128 : GCCBuiltin<"__builtin_ia32_pmaxub128_mask">,
1921               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, 
1922                          llvm_v16i8_ty, llvm_i16_ty], [IntrNoMem]>;
1923   def int_x86_avx512_mask_pmaxu_b_256 : GCCBuiltin<"__builtin_ia32_pmaxub256_mask">,
1924               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty, 
1925                          llvm_v32i8_ty,  llvm_i32_ty], [IntrNoMem]>;
1926   def int_x86_avx512_mask_pmaxu_b_512 : GCCBuiltin<"__builtin_ia32_pmaxub512_mask">,
1927               Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty, llvm_v64i8_ty, 
1928                          llvm_v64i8_ty,  llvm_i64_ty], [IntrNoMem]>;
1929   def int_x86_avx512_mask_pmaxs_w_128 : GCCBuiltin<"__builtin_ia32_pmaxsw128_mask">,
1930               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
1931                          llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
1932   def int_x86_avx512_mask_pmaxs_w_256 : GCCBuiltin<"__builtin_ia32_pmaxsw256_mask">,
1933               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty, 
1934                          llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>;
1935   def int_x86_avx512_mask_pmaxs_w_512 : GCCBuiltin<"__builtin_ia32_pmaxsw512_mask">,
1936               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty, 
1937                    llvm_v32i16_ty,  llvm_i32_ty],[IntrNoMem]>;
1938   def int_x86_avx512_mask_pmaxu_w_128 : GCCBuiltin<"__builtin_ia32_pmaxuw128_mask">,
1939               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
1940                          llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
1941   def int_x86_avx512_mask_pmaxu_w_256 : GCCBuiltin<"__builtin_ia32_pmaxuw256_mask">,
1942               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty, 
1943                          llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>;
1944   def int_x86_avx512_mask_pmaxu_w_512 : GCCBuiltin<"__builtin_ia32_pmaxuw512_mask">,
1945               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty,
1946                          llvm_v32i16_ty,  llvm_i32_ty],[IntrNoMem]>;
1947   def int_x86_avx512_mask_pmins_b_128 : GCCBuiltin<"__builtin_ia32_pminsb128_mask">,
1948               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty, 
1949                          llvm_v16i8_ty,llvm_i16_ty], [IntrNoMem]>;
1950   def int_x86_avx512_mask_pmins_b_256 : GCCBuiltin<"__builtin_ia32_pminsb256_mask">,
1951               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty, 
1952                          llvm_v32i8_ty, llvm_i32_ty], [IntrNoMem]>;
1953   def int_x86_avx512_mask_pmins_b_512 : GCCBuiltin<"__builtin_ia32_pminsb512_mask">,
1954               Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty, llvm_v64i8_ty,
1955                          llvm_v64i8_ty, llvm_i64_ty], [IntrNoMem]>;
1956   def int_x86_avx512_mask_pminu_b_128 : GCCBuiltin<"__builtin_ia32_pminub128_mask">,
1957               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
1958                          llvm_v16i8_ty, llvm_i16_ty], [IntrNoMem]>;
1959   def int_x86_avx512_mask_pminu_b_256 : GCCBuiltin<"__builtin_ia32_pminub256_mask">,
1960               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty, 
1961                          llvm_v32i8_ty, llvm_i32_ty], [IntrNoMem]>;
1962   def int_x86_avx512_mask_pminu_b_512 : GCCBuiltin<"__builtin_ia32_pminub512_mask">,
1963               Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty, llvm_v64i8_ty, 
1964                          llvm_v64i8_ty,  llvm_i64_ty], [IntrNoMem]>;
1965   def int_x86_avx512_mask_pmins_w_128 : GCCBuiltin<"__builtin_ia32_pminsw128_mask">,
1966               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
1967                          llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
1968   def int_x86_avx512_mask_pmins_w_256 : GCCBuiltin<"__builtin_ia32_pminsw256_mask">,
1969               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty, 
1970                          llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>;
1971   def int_x86_avx512_mask_pmins_w_512 : GCCBuiltin<"__builtin_ia32_pminsw512_mask">,
1972               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty,
1973                          llvm_v32i16_ty,  llvm_i32_ty],[IntrNoMem]>;
1974   def int_x86_avx512_mask_pminu_w_128 : GCCBuiltin<"__builtin_ia32_pminuw128_mask">,
1975               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
1976                          llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
1977   def int_x86_avx512_mask_pminu_w_256 : GCCBuiltin<"__builtin_ia32_pminuw256_mask">,
1978               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty, 
1979                          llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>;
1980   def int_x86_avx512_mask_pminu_w_512 : GCCBuiltin<"__builtin_ia32_pminuw512_mask">,
1981               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty, 
1982                          llvm_v32i16_ty,  llvm_i32_ty], [IntrNoMem]>;
1983   def int_x86_avx512_mask_pmaxu_d_512 : GCCBuiltin<"__builtin_ia32_pmaxud512_mask">,
1984               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1985                          llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
1986   def int_x86_avx512_mask_pmaxu_d_256 : GCCBuiltin<"__builtin_ia32_pmaxud256_mask">,
1987               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
1988                          llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
1989   def int_x86_avx512_mask_pmaxu_d_128 : GCCBuiltin<"__builtin_ia32_pmaxud128_mask">,
1990               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
1991                          llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
1992   def int_x86_avx512_mask_pmaxs_d_512 : GCCBuiltin<"__builtin_ia32_pmaxsd512_mask">,
1993               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1994                          llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
1995   def int_x86_avx512_mask_pmaxs_d_256 : GCCBuiltin<"__builtin_ia32_pmaxsd256_mask">,
1996               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
1997                          llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
1998   def int_x86_avx512_mask_pmaxs_d_128 : GCCBuiltin<"__builtin_ia32_pmaxsd128_mask">,
1999               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
2000                          llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
2001   def int_x86_avx512_mask_pmaxu_q_512 : GCCBuiltin<"__builtin_ia32_pmaxuq512_mask">,
2002               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
2003                          llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2004   def int_x86_avx512_mask_pmaxu_q_256 : GCCBuiltin<"__builtin_ia32_pmaxuq256_mask">,
2005               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty,
2006                          llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
2007   def int_x86_avx512_mask_pmaxu_q_128 : GCCBuiltin<"__builtin_ia32_pmaxuq128_mask">,
2008               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
2009                          llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>;
2010   def int_x86_avx512_mask_pmaxs_q_512 : GCCBuiltin<"__builtin_ia32_pmaxsq512_mask">,
2011               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
2012                          llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2013   def int_x86_avx512_mask_pmaxs_q_256 : GCCBuiltin<"__builtin_ia32_pmaxsq256_mask">,
2014               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty,
2015                          llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
2016   def int_x86_avx512_mask_pmaxs_q_128 : GCCBuiltin<"__builtin_ia32_pmaxsq128_mask">,
2017               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
2018                          llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>;
2019   def int_x86_avx512_mask_pminu_d_512 : GCCBuiltin<"__builtin_ia32_pminud512_mask">,
2020               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
2021                          llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2022   def int_x86_avx512_mask_pminu_d_256 : GCCBuiltin<"__builtin_ia32_pminud256_mask">,
2023               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
2024                          llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
2025   def int_x86_avx512_mask_pminu_d_128 : GCCBuiltin<"__builtin_ia32_pminud128_mask">,
2026               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
2027                          llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
2028   def int_x86_avx512_mask_pmins_d_512 : GCCBuiltin<"__builtin_ia32_pminsd512_mask">,
2029               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
2030                          llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2031   def int_x86_avx512_mask_pmins_d_256 : GCCBuiltin<"__builtin_ia32_pminsd256_mask">,
2032               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
2033                          llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
2034   def int_x86_avx512_mask_pmins_d_128 : GCCBuiltin<"__builtin_ia32_pminsd128_mask">,
2035               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
2036                          llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
2037   def int_x86_avx512_mask_pminu_q_512 : GCCBuiltin<"__builtin_ia32_pminuq512_mask">,
2038               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
2039                          llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2040   def int_x86_avx512_mask_pminu_q_256 : GCCBuiltin<"__builtin_ia32_pminuq256_mask">,
2041               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty,
2042                          llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
2043   def int_x86_avx512_mask_pminu_q_128 : GCCBuiltin<"__builtin_ia32_pminuq128_mask">,
2044               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
2045                          llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>;
2046   def int_x86_avx512_mask_pmins_q_512 : GCCBuiltin<"__builtin_ia32_pminsq512_mask">,
2047               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
2048                          llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2049   def int_x86_avx512_mask_pmins_q_256 : GCCBuiltin<"__builtin_ia32_pminsq256_mask">,
2050               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty,
2051                          llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
2052   def int_x86_avx512_mask_pmins_q_128 : GCCBuiltin<"__builtin_ia32_pminsq128_mask">,
2053               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
2054                          llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>;
2055 }
2056
2057 // Integer shift ops.
2058 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2059   def int_x86_avx2_psll_w : GCCBuiltin<"__builtin_ia32_psllw256">,
2060               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2061                          llvm_v8i16_ty], [IntrNoMem]>;
2062   def int_x86_avx2_psll_d : GCCBuiltin<"__builtin_ia32_pslld256">,
2063               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2064                          llvm_v4i32_ty], [IntrNoMem]>;
2065   def int_x86_avx2_psll_q : GCCBuiltin<"__builtin_ia32_psllq256">,
2066               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
2067                          llvm_v2i64_ty], [IntrNoMem]>;
2068   def int_x86_avx2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw256">,
2069               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2070                          llvm_v8i16_ty], [IntrNoMem]>;
2071   def int_x86_avx2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld256">,
2072               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2073                          llvm_v4i32_ty], [IntrNoMem]>;
2074   def int_x86_avx2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq256">,
2075               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
2076                          llvm_v2i64_ty], [IntrNoMem]>;
2077   def int_x86_avx2_psra_w : GCCBuiltin<"__builtin_ia32_psraw256">,
2078               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2079                          llvm_v8i16_ty], [IntrNoMem]>;
2080   def int_x86_avx2_psra_d : GCCBuiltin<"__builtin_ia32_psrad256">,
2081               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2082                          llvm_v4i32_ty], [IntrNoMem]>;
2083
2084   def int_x86_avx2_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi256">,
2085               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2086                          llvm_i32_ty], [IntrNoMem]>;
2087   def int_x86_avx2_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi256">,
2088               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2089                          llvm_i32_ty], [IntrNoMem]>;
2090   def int_x86_avx2_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi256">,
2091               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
2092                          llvm_i32_ty], [IntrNoMem]>;
2093   def int_x86_avx2_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi256">,
2094               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2095                          llvm_i32_ty], [IntrNoMem]>;
2096   def int_x86_avx2_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi256">,
2097               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2098                          llvm_i32_ty], [IntrNoMem]>;
2099   def int_x86_avx2_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi256">,
2100               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
2101                          llvm_i32_ty], [IntrNoMem]>;
2102   def int_x86_avx2_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi256">,
2103               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2104                          llvm_i32_ty], [IntrNoMem]>;
2105   def int_x86_avx2_psrai_d : GCCBuiltin<"__builtin_ia32_psradi256">,
2106               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2107                          llvm_i32_ty], [IntrNoMem]>;
2108
2109   def int_x86_avx512_mask_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi512">,
2110               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2111                          llvm_i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2112   def int_x86_avx512_mask_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi512">,
2113               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2114                          llvm_i32_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2115   def int_x86_avx512_mask_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi512">,
2116               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2117                          llvm_i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2118   def int_x86_avx512_mask_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi512">,
2119               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2120                          llvm_i32_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2121   def int_x86_avx512_mask_psrai_d : GCCBuiltin<"__builtin_ia32_psradi512">,
2122               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2123                          llvm_i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2124   def int_x86_avx512_mask_psrai_q : GCCBuiltin<"__builtin_ia32_psraqi512">,
2125               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2126                          llvm_i32_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2127
2128   def int_x86_avx512_mask_psll_d : GCCBuiltin<"__builtin_ia32_pslld512_mask">,
2129               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2130                          llvm_v4i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2131   def int_x86_avx512_mask_psll_q : GCCBuiltin<"__builtin_ia32_psllq512_mask">,
2132               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2133                          llvm_v2i64_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2134   def int_x86_avx512_mask_psrl_d : GCCBuiltin<"__builtin_ia32_psrld512_mask">,
2135               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2136                          llvm_v4i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2137   def int_x86_avx512_mask_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq512_mask">,
2138               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2139                          llvm_v2i64_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2140   def int_x86_avx512_mask_psra_d : GCCBuiltin<"__builtin_ia32_psrad512_mask">,
2141               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2142                          llvm_v4i32_ty, llvm_v16i32_ty, llvm_i16_ty], [IntrNoMem]>;
2143   def int_x86_avx512_mask_psra_q : GCCBuiltin<"__builtin_ia32_psraq512_mask">,
2144               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2145                          llvm_v2i64_ty, llvm_v8i64_ty, llvm_i8_ty], [IntrNoMem]>;
2146 }
2147
2148 // Pack ops.
2149 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2150   def int_x86_avx2_packsswb : GCCBuiltin<"__builtin_ia32_packsswb256">,
2151               Intrinsic<[llvm_v32i8_ty], [llvm_v16i16_ty,
2152                          llvm_v16i16_ty], [IntrNoMem]>;
2153   def int_x86_avx2_packssdw : GCCBuiltin<"__builtin_ia32_packssdw256">,
2154               Intrinsic<[llvm_v16i16_ty], [llvm_v8i32_ty,
2155                          llvm_v8i32_ty], [IntrNoMem]>;
2156   def int_x86_avx2_packuswb : GCCBuiltin<"__builtin_ia32_packuswb256">,
2157               Intrinsic<[llvm_v32i8_ty], [llvm_v16i16_ty,
2158                          llvm_v16i16_ty], [IntrNoMem]>;
2159   def int_x86_avx2_packusdw : GCCBuiltin<"__builtin_ia32_packusdw256">,
2160               Intrinsic<[llvm_v16i16_ty], [llvm_v8i32_ty,
2161                          llvm_v8i32_ty], [IntrNoMem]>;
2162 }
2163
2164 // Absolute value ops
2165 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2166   def int_x86_avx2_pabs_b : GCCBuiltin<"__builtin_ia32_pabsb256">,
2167               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty], [IntrNoMem]>;
2168   def int_x86_avx2_pabs_w : GCCBuiltin<"__builtin_ia32_pabsw256">,
2169               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty], [IntrNoMem]>;
2170   def int_x86_avx2_pabs_d : GCCBuiltin<"__builtin_ia32_pabsd256">,
2171               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty], [IntrNoMem]>;
2172
2173   def int_x86_avx512_mask_pabs_b_128 : 
2174        GCCBuiltin<"__builtin_ia32_pabsb128_mask">,
2175         Intrinsic<[llvm_v16i8_ty],
2176         [llvm_v16i8_ty, llvm_v16i8_ty,  llvm_i16_ty],
2177         [IntrNoMem]>;
2178
2179   def int_x86_avx512_mask_pabs_b_256 : 
2180         GCCBuiltin<"__builtin_ia32_pabsb256_mask">,
2181           Intrinsic<[llvm_v32i8_ty],
2182           [llvm_v32i8_ty, llvm_v32i8_ty,  llvm_i32_ty],
2183           [IntrNoMem]>;
2184
2185   def int_x86_avx512_mask_pabs_b_512 : 
2186         GCCBuiltin<"__builtin_ia32_pabsb512_mask">,
2187           Intrinsic<[llvm_v64i8_ty],
2188           [llvm_v64i8_ty, llvm_v64i8_ty,  llvm_i64_ty],
2189           [IntrNoMem]>;
2190
2191   def int_x86_avx512_mask_pabs_d_128 : 
2192         GCCBuiltin<"__builtin_ia32_pabsd128_mask">,
2193           Intrinsic<[llvm_v4i32_ty],
2194           [llvm_v4i32_ty, llvm_v4i32_ty,  llvm_i8_ty],
2195           [IntrNoMem]>;
2196
2197   def int_x86_avx512_mask_pabs_d_256 : 
2198         GCCBuiltin<"__builtin_ia32_pabsd256_mask">,
2199           Intrinsic<[llvm_v8i32_ty],
2200           [llvm_v8i32_ty, llvm_v8i32_ty,  llvm_i8_ty],
2201           [IntrNoMem]>;
2202
2203   def int_x86_avx512_mask_pabs_d_512 : 
2204         GCCBuiltin<"__builtin_ia32_pabsd512_mask">,
2205           Intrinsic<[llvm_v16i32_ty],
2206           [llvm_v16i32_ty, llvm_v16i32_ty,  llvm_i16_ty],
2207           [IntrNoMem]>;
2208
2209   def int_x86_avx512_mask_pabs_q_128 : 
2210         GCCBuiltin<"__builtin_ia32_pabsq128_mask">,
2211           Intrinsic<[llvm_v2i64_ty],
2212           [llvm_v2i64_ty, llvm_v2i64_ty,  llvm_i8_ty],
2213           [IntrNoMem]>;
2214
2215   def int_x86_avx512_mask_pabs_q_256 : 
2216         GCCBuiltin<"__builtin_ia32_pabsq256_mask">,
2217           Intrinsic<[llvm_v4i64_ty],
2218           [llvm_v4i64_ty, llvm_v4i64_ty,  llvm_i8_ty],
2219           [IntrNoMem]>;
2220
2221   def int_x86_avx512_mask_pabs_q_512 : 
2222         GCCBuiltin<"__builtin_ia32_pabsq512_mask">,
2223           Intrinsic<[llvm_v8i64_ty],
2224           [llvm_v8i64_ty, llvm_v8i64_ty,  llvm_i8_ty],
2225           [IntrNoMem]>;
2226
2227   def int_x86_avx512_mask_pabs_w_128 : 
2228         GCCBuiltin<"__builtin_ia32_pabsw128_mask">,
2229           Intrinsic<[llvm_v8i16_ty],
2230           [llvm_v8i16_ty, llvm_v8i16_ty,  llvm_i8_ty],
2231           [IntrNoMem]>;
2232
2233   def int_x86_avx512_mask_pabs_w_256 : 
2234         GCCBuiltin<"__builtin_ia32_pabsw256_mask">,
2235           Intrinsic<[llvm_v16i16_ty],
2236           [llvm_v16i16_ty, llvm_v16i16_ty,  llvm_i16_ty],
2237           [IntrNoMem]>;
2238
2239   def int_x86_avx512_mask_pabs_w_512 : 
2240         GCCBuiltin<"__builtin_ia32_pabsw512_mask">,
2241           Intrinsic<[llvm_v32i16_ty],
2242           [llvm_v32i16_ty, llvm_v32i16_ty,  llvm_i32_ty],
2243           [IntrNoMem]>;
2244 }
2245
2246 // Horizontal arithmetic ops
2247 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2248   def int_x86_avx2_phadd_w : GCCBuiltin<"__builtin_ia32_phaddw256">,
2249               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2250                          llvm_v16i16_ty], [IntrNoMem]>;
2251   def int_x86_avx2_phadd_d : GCCBuiltin<"__builtin_ia32_phaddd256">,
2252               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2253                          llvm_v8i32_ty], [IntrNoMem]>;
2254   def int_x86_avx2_phadd_sw : GCCBuiltin<"__builtin_ia32_phaddsw256">,
2255               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2256                          llvm_v16i16_ty], [IntrNoMem]>;
2257   def int_x86_avx2_phsub_w : GCCBuiltin<"__builtin_ia32_phsubw256">,
2258               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2259                          llvm_v16i16_ty], [IntrNoMem]>;
2260   def int_x86_avx2_phsub_d : GCCBuiltin<"__builtin_ia32_phsubd256">,
2261               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2262                          llvm_v8i32_ty], [IntrNoMem]>;
2263   def int_x86_avx2_phsub_sw : GCCBuiltin<"__builtin_ia32_phsubsw256">,
2264               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2265                          llvm_v16i16_ty], [IntrNoMem]>;
2266   def int_x86_avx2_pmadd_ub_sw : GCCBuiltin<"__builtin_ia32_pmaddubsw256">,
2267               Intrinsic<[llvm_v16i16_ty], [llvm_v32i8_ty,
2268                          llvm_v32i8_ty], [IntrNoMem]>;
2269 }
2270
2271 // Sign ops
2272 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2273   def int_x86_avx2_psign_b : GCCBuiltin<"__builtin_ia32_psignb256">,
2274               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
2275                          llvm_v32i8_ty], [IntrNoMem]>;
2276   def int_x86_avx2_psign_w : GCCBuiltin<"__builtin_ia32_psignw256">,
2277               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2278                          llvm_v16i16_ty], [IntrNoMem]>;
2279   def int_x86_avx2_psign_d : GCCBuiltin<"__builtin_ia32_psignd256">,
2280               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
2281                          llvm_v8i32_ty], [IntrNoMem]>;
2282 }
2283
2284 // Packed multiply high with round and scale
2285 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2286   def int_x86_avx2_pmul_hr_sw : GCCBuiltin<"__builtin_ia32_pmulhrsw256">,
2287               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2288                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
2289   def int_x86_avx512_mask_pmul_hr_sw_128 : GCCBuiltin<"__builtin_ia32_pmulhrsw128_mask">,
2290               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, 
2291                      llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
2292   def int_x86_avx512_mask_pmul_hr_sw_256 : GCCBuiltin<"__builtin_ia32_pmulhrsw256_mask">,
2293               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty, 
2294                      llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>;
2295   def int_x86_avx512_mask_pmul_hr_sw_512 : GCCBuiltin<"__builtin_ia32_pmulhrsw512_mask">,
2296               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty, 
2297                      llvm_v32i16_ty, llvm_i32_ty], [IntrNoMem]>;
2298 }
2299
2300 // Vector sign and zero extend
2301 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2302   def int_x86_avx2_pmovsxbd : GCCBuiltin<"__builtin_ia32_pmovsxbd256">,
2303               Intrinsic<[llvm_v8i32_ty], [llvm_v16i8_ty],
2304                         [IntrNoMem]>;
2305   def int_x86_avx2_pmovsxbq : GCCBuiltin<"__builtin_ia32_pmovsxbq256">,
2306               Intrinsic<[llvm_v4i64_ty], [llvm_v16i8_ty],
2307                         [IntrNoMem]>;
2308   def int_x86_avx2_pmovsxbw : GCCBuiltin<"__builtin_ia32_pmovsxbw256">,
2309               Intrinsic<[llvm_v16i16_ty], [llvm_v16i8_ty],
2310                         [IntrNoMem]>;
2311   def int_x86_avx2_pmovsxdq : GCCBuiltin<"__builtin_ia32_pmovsxdq256">,
2312               Intrinsic<[llvm_v4i64_ty], [llvm_v4i32_ty],
2313                         [IntrNoMem]>;
2314   def int_x86_avx2_pmovsxwd : GCCBuiltin<"__builtin_ia32_pmovsxwd256">,
2315               Intrinsic<[llvm_v8i32_ty], [llvm_v8i16_ty],
2316                         [IntrNoMem]>;
2317   def int_x86_avx2_pmovsxwq : GCCBuiltin<"__builtin_ia32_pmovsxwq256">,
2318               Intrinsic<[llvm_v4i64_ty], [llvm_v8i16_ty],
2319                         [IntrNoMem]>;
2320   def int_x86_avx2_pmovzxbd : GCCBuiltin<"__builtin_ia32_pmovzxbd256">,
2321               Intrinsic<[llvm_v8i32_ty], [llvm_v16i8_ty],
2322                         [IntrNoMem]>;
2323   def int_x86_avx2_pmovzxbq : GCCBuiltin<"__builtin_ia32_pmovzxbq256">,
2324               Intrinsic<[llvm_v4i64_ty], [llvm_v16i8_ty],
2325                         [IntrNoMem]>;
2326   def int_x86_avx2_pmovzxbw : GCCBuiltin<"__builtin_ia32_pmovzxbw256">,
2327               Intrinsic<[llvm_v16i16_ty], [llvm_v16i8_ty],
2328                         [IntrNoMem]>;
2329   def int_x86_avx2_pmovzxdq : GCCBuiltin<"__builtin_ia32_pmovzxdq256">,
2330               Intrinsic<[llvm_v4i64_ty], [llvm_v4i32_ty],
2331                         [IntrNoMem]>;
2332   def int_x86_avx2_pmovzxwd : GCCBuiltin<"__builtin_ia32_pmovzxwd256">,
2333               Intrinsic<[llvm_v8i32_ty], [llvm_v8i16_ty],
2334                         [IntrNoMem]>;
2335   def int_x86_avx2_pmovzxwq : GCCBuiltin<"__builtin_ia32_pmovzxwq256">,
2336               Intrinsic<[llvm_v4i64_ty], [llvm_v8i16_ty],
2337                         [IntrNoMem]>;
2338 }
2339
2340 // Vector blend
2341 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2342   def int_x86_avx2_pblendvb : GCCBuiltin<"__builtin_ia32_pblendvb256">,
2343               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty,
2344                          llvm_v32i8_ty], [IntrNoMem]>;
2345 }
2346
2347 // Vector load with broadcast
2348 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2349   def int_x86_avx512_mask_pbroadcast_d_gpr_512 :
2350               GCCBuiltin<"__builtin_ia32_pbroadcastd512_gpr_mask">,
2351               Intrinsic<[llvm_v16i32_ty], [llvm_i32_ty, llvm_v16i32_ty,
2352               llvm_i16_ty], [IntrNoMem]>;
2353   def int_x86_avx512_mask_pbroadcast_q_gpr_512 :
2354               GCCBuiltin<"__builtin_ia32_pbroadcastq512_gpr_mask">,
2355               Intrinsic<[llvm_v8i64_ty], [llvm_i64_ty, llvm_v8i64_ty,
2356               llvm_i8_ty], [IntrNoMem]>;
2357   def int_x86_avx512_mask_pbroadcast_q_mem_512 :
2358               GCCBuiltin<"__builtin_ia32_pbroadcastq512_mem_mask">,
2359               Intrinsic<[llvm_v8i64_ty], [llvm_i64_ty, llvm_v8i64_ty,
2360               llvm_i8_ty], [IntrNoMem]>;
2361 }
2362
2363 // Vector permutation
2364 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2365   def int_x86_avx2_permd : GCCBuiltin<"__builtin_ia32_permvarsi256">,
2366               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
2367                         [IntrNoMem]>;
2368   def int_x86_avx2_permps : GCCBuiltin<"__builtin_ia32_permvarsf256">,
2369               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty],
2370                         [IntrNoMem]>;
2371   def int_x86_avx2_vperm2i128 : GCCBuiltin<"__builtin_ia32_permti256">,
2372               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
2373                          llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
2374 }
2375
2376 // Vector extract and insert
2377 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2378   def int_x86_avx512_mask_vextractf32x4_512 :
2379       GCCBuiltin<"__builtin_ia32_extractf32x4_mask">,
2380                  Intrinsic<[llvm_v4f32_ty], [llvm_v16f32_ty, llvm_i32_ty,
2381                             llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
2382   def int_x86_avx512_mask_vextracti32x4_512 :
2383       GCCBuiltin<"__builtin_ia32_extracti32x4_mask">,
2384                  Intrinsic<[llvm_v4i32_ty], [llvm_v16i32_ty, llvm_i32_ty,
2385                             llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
2386   def int_x86_avx512_mask_vextractf32x4_256 :
2387       GCCBuiltin<"__builtin_ia32_extractf32x4_256_mask">,
2388                  Intrinsic<[llvm_v4f32_ty], [llvm_v8f32_ty, llvm_i32_ty,
2389                             llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
2390   def int_x86_avx512_mask_vextracti32x4_256 :
2391       GCCBuiltin<"__builtin_ia32_extracti32x4_256_mask">,
2392                  Intrinsic<[llvm_v4i32_ty], [llvm_v8i32_ty, llvm_i32_ty,
2393                             llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
2394   def int_x86_avx512_mask_vextractf64x2_256 :
2395       GCCBuiltin<"__builtin_ia32_extractf64x2_256_mask">,
2396                  Intrinsic<[llvm_v2f64_ty], [llvm_v4f64_ty, llvm_i32_ty,
2397                             llvm_v2f64_ty,  llvm_i8_ty], [IntrNoMem]>;
2398   def int_x86_avx512_mask_vextracti64x2_256 :
2399       GCCBuiltin<"__builtin_ia32_extracti64x2_256_mask">,
2400                  Intrinsic<[llvm_v2i64_ty], [llvm_v4i64_ty, llvm_i32_ty,
2401                             llvm_v2i64_ty,  llvm_i8_ty], [IntrNoMem]>;
2402   def int_x86_avx512_mask_vextractf64x2_512 :
2403       GCCBuiltin<"__builtin_ia32_extractf64x2_512_mask">,
2404                  Intrinsic<[llvm_v2f64_ty], [llvm_v8f64_ty, llvm_i32_ty,
2405                             llvm_v2f64_ty,  llvm_i8_ty], [IntrNoMem]>;
2406   def int_x86_avx512_mask_vextracti64x2_512 :
2407       GCCBuiltin<"__builtin_ia32_extracti64x2_512_mask">,
2408                  Intrinsic<[llvm_v2i64_ty], [llvm_v8i64_ty, llvm_i32_ty,
2409                             llvm_v2i64_ty,  llvm_i8_ty], [IntrNoMem]>;
2410   def int_x86_avx512_mask_vextractf32x8_512 :
2411       GCCBuiltin<"__builtin_ia32_extractf32x8_mask">,
2412                  Intrinsic<[llvm_v8f32_ty], [llvm_v16f32_ty, llvm_i32_ty,
2413                             llvm_v8f32_ty,  llvm_i8_ty], [IntrNoMem]>;
2414   def int_x86_avx512_mask_vextracti32x8_512 :
2415       GCCBuiltin<"__builtin_ia32_extracti32x8_mask">,
2416                  Intrinsic<[llvm_v8i32_ty],[llvm_v16i32_ty, llvm_i32_ty,
2417                             llvm_v8i32_ty,  llvm_i8_ty], [IntrNoMem]>;
2418   def int_x86_avx512_mask_vextractf64x4_512 :
2419       GCCBuiltin<"__builtin_ia32_extractf64x4_mask">,
2420                  Intrinsic<[llvm_v4f64_ty], [llvm_v8f64_ty, llvm_i32_ty,
2421                             llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
2422   def int_x86_avx512_mask_vextracti64x4_512 :
2423       GCCBuiltin<"__builtin_ia32_extracti64x4_mask">,
2424                  Intrinsic<[llvm_v4i64_ty], [llvm_v8i64_ty, llvm_i32_ty,
2425                             llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
2426
2427   def int_x86_avx512_mask_insertf32x4_256 :
2428         GCCBuiltin<"__builtin_ia32_insertf32x4_256_mask">,
2429           Intrinsic<[llvm_v8f32_ty],
2430           [llvm_v8f32_ty, llvm_v4f32_ty, llvm_i32_ty, llvm_v8f32_ty, llvm_i8_ty],
2431           [IntrNoMem]>;
2432
2433   def int_x86_avx512_mask_insertf32x4_512 :
2434         GCCBuiltin<"__builtin_ia32_insertf32x4_512_mask">,
2435           Intrinsic<[llvm_v16f32_ty],
2436           [llvm_v16f32_ty, llvm_v4f32_ty, llvm_i32_ty, llvm_v16f32_ty, llvm_i8_ty],
2437           [IntrNoMem]>;
2438
2439   def int_x86_avx512_mask_insertf32x8_512 :
2440         GCCBuiltin<"__builtin_ia32_insertf32x8_mask">,
2441           Intrinsic<[llvm_v16f32_ty],
2442           [llvm_v16f32_ty, llvm_v8f32_ty, llvm_i32_ty, llvm_v16f32_ty, llvm_i16_ty],
2443           [IntrNoMem]>;
2444
2445   def int_x86_avx512_mask_insertf64x2_256 :
2446         GCCBuiltin<"__builtin_ia32_insertf64x2_256_mask">,
2447           Intrinsic<[llvm_v4f64_ty],
2448           [llvm_v4f64_ty, llvm_v2f64_ty, llvm_i32_ty, llvm_v4f64_ty, llvm_i8_ty],
2449           [IntrNoMem]>;
2450
2451   def int_x86_avx512_mask_insertf64x2_512 :
2452         GCCBuiltin<"__builtin_ia32_insertf64x2_512_mask">,
2453           Intrinsic<[llvm_v8f64_ty],
2454           [llvm_v8f64_ty, llvm_v2f64_ty, llvm_i32_ty, llvm_v8f64_ty, llvm_i8_ty],
2455           [IntrNoMem]>;
2456
2457   def int_x86_avx512_mask_insertf64x4_512 :
2458         GCCBuiltin<"__builtin_ia32_insertf64x4_mask">,
2459           Intrinsic<[llvm_v8f64_ty],
2460           [llvm_v8f64_ty, llvm_v4f64_ty, llvm_i32_ty, llvm_v8f64_ty, llvm_i8_ty],
2461           [IntrNoMem]>;
2462
2463   def int_x86_avx512_mask_inserti32x4_256 :
2464         GCCBuiltin<"__builtin_ia32_inserti32x4_256_mask">,
2465           Intrinsic<[llvm_v8i32_ty],
2466           [llvm_v8i32_ty, llvm_v4i32_ty, llvm_i32_ty, llvm_v8i32_ty, llvm_i8_ty],
2467           [IntrNoMem]>;
2468
2469   def int_x86_avx512_mask_inserti32x4_512 :
2470         GCCBuiltin<"__builtin_ia32_inserti32x4_512_mask">,
2471           Intrinsic<[llvm_v16i32_ty],
2472           [llvm_v16i32_ty, llvm_v4i32_ty, llvm_i32_ty, llvm_v16i32_ty, llvm_i8_ty],
2473           [IntrNoMem]>;
2474
2475   def int_x86_avx512_mask_inserti32x8_512 :
2476         GCCBuiltin<"__builtin_ia32_inserti32x8_mask">,
2477           Intrinsic<[llvm_v16i32_ty],
2478           [llvm_v16i32_ty, llvm_v8i32_ty, llvm_i32_ty, llvm_v16i32_ty, llvm_i16_ty],
2479           [IntrNoMem]>;
2480
2481   def int_x86_avx512_mask_inserti64x2_256 :
2482         GCCBuiltin<"__builtin_ia32_inserti64x2_256_mask">,
2483           Intrinsic<[llvm_v4i64_ty],
2484           [llvm_v4i64_ty, llvm_v2i64_ty, llvm_i32_ty, llvm_v4i64_ty, llvm_i8_ty],
2485           [IntrNoMem]>;
2486
2487   def int_x86_avx512_mask_inserti64x2_512 :
2488         GCCBuiltin<"__builtin_ia32_inserti64x2_512_mask">,
2489           Intrinsic<[llvm_v8i64_ty],
2490           [llvm_v8i64_ty, llvm_v2i64_ty, llvm_i32_ty, llvm_v8i64_ty, llvm_i8_ty],
2491           [IntrNoMem]>;
2492
2493   def int_x86_avx512_mask_inserti64x4_512 :
2494         GCCBuiltin<"__builtin_ia32_inserti64x4_mask">,
2495           Intrinsic<[llvm_v8i64_ty],
2496           [llvm_v8i64_ty, llvm_v4i64_ty, llvm_i32_ty, llvm_v8i64_ty, llvm_i8_ty],
2497           [IntrNoMem]>;                            
2498 }
2499
2500 // Conditional load ops
2501 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2502   def int_x86_avx2_maskload_d : GCCBuiltin<"__builtin_ia32_maskloadd">,
2503         Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_v4i32_ty],
2504                   [IntrReadArgMem]>;
2505   def int_x86_avx2_maskload_q : GCCBuiltin<"__builtin_ia32_maskloadq">,
2506         Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty, llvm_v2i64_ty],
2507                   [IntrReadArgMem]>;
2508   def int_x86_avx2_maskload_d_256 : GCCBuiltin<"__builtin_ia32_maskloadd256">,
2509         Intrinsic<[llvm_v8i32_ty], [llvm_ptr_ty, llvm_v8i32_ty],
2510                   [IntrReadArgMem]>;
2511   def int_x86_avx2_maskload_q_256 : GCCBuiltin<"__builtin_ia32_maskloadq256">,
2512         Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty, llvm_v4i64_ty],
2513                   [IntrReadArgMem]>;
2514   def int_x86_avx512_mask_loadu_d_512 : GCCBuiltin<"__builtin_ia32_loaddqusi512_mask">,
2515         Intrinsic<[llvm_v16i32_ty], [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
2516                   [IntrReadArgMem]>;
2517   def int_x86_avx512_mask_loadu_q_512 : GCCBuiltin<"__builtin_ia32_loaddqudi512_mask">,
2518         Intrinsic<[llvm_v8i64_ty], [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
2519                   [IntrReadArgMem]>;
2520 }
2521
2522 // Conditional store ops
2523 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2524   def int_x86_avx2_maskstore_d : GCCBuiltin<"__builtin_ia32_maskstored">,
2525         Intrinsic<[], [llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i32_ty],
2526                   [IntrReadWriteArgMem]>;
2527   def int_x86_avx2_maskstore_q : GCCBuiltin<"__builtin_ia32_maskstoreq">,
2528         Intrinsic<[], [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty],
2529                   [IntrReadWriteArgMem]>;
2530   def int_x86_avx2_maskstore_d_256 :
2531         GCCBuiltin<"__builtin_ia32_maskstored256">,
2532         Intrinsic<[], [llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i32_ty],
2533                   [IntrReadWriteArgMem]>;
2534   def int_x86_avx2_maskstore_q_256 :
2535         GCCBuiltin<"__builtin_ia32_maskstoreq256">,
2536         Intrinsic<[], [llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty],
2537                   [IntrReadWriteArgMem]>;
2538   def int_x86_avx512_mask_storeu_d_512 :
2539         GCCBuiltin<"__builtin_ia32_storedqusi512_mask">,
2540         Intrinsic<[], [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
2541                   [IntrReadWriteArgMem]>;
2542   def int_x86_avx512_mask_storeu_q_512 :
2543         GCCBuiltin<"__builtin_ia32_storedqudi512_mask">,
2544         Intrinsic<[], [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
2545                   [IntrReadWriteArgMem]>;
2546 }
2547
2548 // Variable bit shift ops
2549 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2550   def int_x86_avx2_psllv_d : GCCBuiltin<"__builtin_ia32_psllv4si">,
2551               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
2552                         [IntrNoMem]>;
2553   def int_x86_avx2_psllv_d_256 : GCCBuiltin<"__builtin_ia32_psllv8si">,
2554               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
2555                         [IntrNoMem]>;
2556   def int_x86_avx2_psllv_q : GCCBuiltin<"__builtin_ia32_psllv2di">,
2557               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
2558                         [IntrNoMem]>;
2559   def int_x86_avx2_psllv_q_256 : GCCBuiltin<"__builtin_ia32_psllv4di">,
2560               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
2561                         [IntrNoMem]>;
2562
2563   def int_x86_avx2_psrlv_d : GCCBuiltin<"__builtin_ia32_psrlv4si">,
2564               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
2565                         [IntrNoMem]>;
2566   def int_x86_avx2_psrlv_d_256 : GCCBuiltin<"__builtin_ia32_psrlv8si">,
2567               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
2568                         [IntrNoMem]>;
2569   def int_x86_avx2_psrlv_q : GCCBuiltin<"__builtin_ia32_psrlv2di">,
2570               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
2571                         [IntrNoMem]>;
2572   def int_x86_avx2_psrlv_q_256 : GCCBuiltin<"__builtin_ia32_psrlv4di">,
2573               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
2574                         [IntrNoMem]>;
2575
2576   def int_x86_avx2_psrav_d : GCCBuiltin<"__builtin_ia32_psrav4si">,
2577               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
2578                         [IntrNoMem]>;
2579   def int_x86_avx2_psrav_d_256 : GCCBuiltin<"__builtin_ia32_psrav8si">,
2580               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
2581                         [IntrNoMem]>;
2582
2583   def int_x86_avx512_mask_psllv_d : GCCBuiltin<"__builtin_ia32_psllv16si_mask">,
2584               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2585                          llvm_v16i32_ty, llvm_v16i32_ty, llvm_i16_ty],
2586                         [IntrNoMem]>;
2587   def int_x86_avx512_mask_psllv_q : GCCBuiltin<"__builtin_ia32_psllv8di_mask">,
2588               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2589                          llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty], 
2590                         [IntrNoMem]>;
2591   def int_x86_avx512_mask_psrav_d : GCCBuiltin<"__builtin_ia32_psrav16si_mask">,
2592               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2593                          llvm_v16i32_ty, llvm_v16i32_ty, llvm_i16_ty],
2594                         [IntrNoMem]>;
2595   def int_x86_avx512_mask_psrav_q : GCCBuiltin<"__builtin_ia32_psrav8di_mask">,
2596               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2597                          llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty],
2598                         [IntrNoMem]>;
2599   def int_x86_avx512_mask_psrlv_d : GCCBuiltin<"__builtin_ia32_psrlv16si_mask">,
2600               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2601                          llvm_v16i32_ty, llvm_v16i32_ty, llvm_i16_ty],
2602                         [IntrNoMem]>;
2603   def int_x86_avx512_mask_psrlv_q : GCCBuiltin<"__builtin_ia32_psrlv8di_mask">,
2604               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2605                          llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty], 
2606                         [IntrNoMem]>;
2607   def int_x86_avx512_psll_dq_512 : GCCBuiltin<"__builtin_ia32_pslldq512">,
2608               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_i32_ty], 
2609                         [IntrNoMem]>;
2610   def int_x86_avx512_psrl_dq_512 : GCCBuiltin<"__builtin_ia32_psrldq512">,
2611               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_i32_ty], 
2612                         [IntrNoMem]>;                        
2613 }
2614
2615 // Gather ops
2616 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2617   def int_x86_avx2_gather_d_pd : GCCBuiltin<"__builtin_ia32_gatherd_pd">,
2618       Intrinsic<[llvm_v2f64_ty],
2619         [llvm_v2f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2f64_ty, llvm_i8_ty],
2620         [IntrReadArgMem]>;
2621   def int_x86_avx2_gather_d_pd_256 : GCCBuiltin<"__builtin_ia32_gatherd_pd256">,
2622       Intrinsic<[llvm_v4f64_ty],
2623         [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4f64_ty, llvm_i8_ty],
2624         [IntrReadArgMem]>;
2625   def int_x86_avx2_gather_q_pd : GCCBuiltin<"__builtin_ia32_gatherq_pd">,
2626       Intrinsic<[llvm_v2f64_ty],
2627         [llvm_v2f64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i8_ty],
2628         [IntrReadArgMem]>;
2629   def int_x86_avx2_gather_q_pd_256 : GCCBuiltin<"__builtin_ia32_gatherq_pd256">,
2630       Intrinsic<[llvm_v4f64_ty],
2631         [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i8_ty],
2632         [IntrReadArgMem]>;
2633   def int_x86_avx2_gather_d_ps : GCCBuiltin<"__builtin_ia32_gatherd_ps">,
2634       Intrinsic<[llvm_v4f32_ty],
2635         [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i8_ty],
2636         [IntrReadArgMem]>;
2637   def int_x86_avx2_gather_d_ps_256 : GCCBuiltin<"__builtin_ia32_gatherd_ps256">,
2638       Intrinsic<[llvm_v8f32_ty],
2639         [llvm_v8f32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i8_ty],
2640         [IntrReadArgMem]>;
2641   def int_x86_avx2_gather_q_ps : GCCBuiltin<"__builtin_ia32_gatherq_ps">,
2642       Intrinsic<[llvm_v4f32_ty],
2643         [llvm_v4f32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v4f32_ty, llvm_i8_ty],
2644         [IntrReadArgMem]>;
2645   def int_x86_avx2_gather_q_ps_256 : GCCBuiltin<"__builtin_ia32_gatherq_ps256">,
2646       Intrinsic<[llvm_v4f32_ty],
2647         [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4f32_ty, llvm_i8_ty],
2648         [IntrReadArgMem]>;
2649
2650   def int_x86_avx2_gather_d_q : GCCBuiltin<"__builtin_ia32_gatherd_q">,
2651       Intrinsic<[llvm_v2i64_ty],
2652         [llvm_v2i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2i64_ty, llvm_i8_ty],
2653         [IntrReadArgMem]>;
2654   def int_x86_avx2_gather_d_q_256 : GCCBuiltin<"__builtin_ia32_gatherd_q256">,
2655       Intrinsic<[llvm_v4i64_ty],
2656         [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i64_ty, llvm_i8_ty],
2657         [IntrReadArgMem]>;
2658   def int_x86_avx2_gather_q_q : GCCBuiltin<"__builtin_ia32_gatherq_q">,
2659       Intrinsic<[llvm_v2i64_ty],
2660         [llvm_v2i64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
2661         [IntrReadArgMem]>;
2662   def int_x86_avx2_gather_q_q_256 : GCCBuiltin<"__builtin_ia32_gatherq_q256">,
2663       Intrinsic<[llvm_v4i64_ty],
2664         [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
2665         [IntrReadArgMem]>;
2666   def int_x86_avx2_gather_d_d : GCCBuiltin<"__builtin_ia32_gatherd_d">,
2667       Intrinsic<[llvm_v4i32_ty],
2668         [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
2669         [IntrReadArgMem]>;
2670   def int_x86_avx2_gather_d_d_256 : GCCBuiltin<"__builtin_ia32_gatherd_d256">,
2671       Intrinsic<[llvm_v8i32_ty],
2672         [llvm_v8i32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty],
2673         [IntrReadArgMem]>;
2674   def int_x86_avx2_gather_q_d : GCCBuiltin<"__builtin_ia32_gatherq_d">,
2675       Intrinsic<[llvm_v4i32_ty],
2676         [llvm_v4i32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v4i32_ty, llvm_i8_ty],
2677         [IntrReadArgMem]>;
2678   def int_x86_avx2_gather_q_d_256 : GCCBuiltin<"__builtin_ia32_gatherq_d256">,
2679       Intrinsic<[llvm_v4i32_ty],
2680         [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i32_ty, llvm_i8_ty],
2681         [IntrReadArgMem]>;
2682 }
2683
2684 // Misc.
2685 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2686   def int_x86_avx2_pmovmskb : GCCBuiltin<"__builtin_ia32_pmovmskb256">,
2687               Intrinsic<[llvm_i32_ty], [llvm_v32i8_ty], [IntrNoMem]>;
2688   def int_x86_avx2_pshuf_b : GCCBuiltin<"__builtin_ia32_pshufb256">,
2689               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
2690                          llvm_v32i8_ty], [IntrNoMem]>;
2691   def int_x86_avx2_mpsadbw : GCCBuiltin<"__builtin_ia32_mpsadbw256">,
2692               Intrinsic<[llvm_v16i16_ty], [llvm_v32i8_ty, llvm_v32i8_ty,
2693                          llvm_i8_ty], [IntrNoMem, Commutative]>;
2694   def int_x86_avx2_movntdqa : GCCBuiltin<"__builtin_ia32_movntdqa256">,
2695               Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty], [IntrReadMem]>;
2696 }
2697
2698 //===----------------------------------------------------------------------===//
2699 // FMA3 and FMA4
2700
2701 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2702   def int_x86_fma_vfmadd_ss : GCCBuiltin<"__builtin_ia32_vfmaddss">,
2703               Intrinsic<[llvm_v4f32_ty],
2704                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2705                         [IntrNoMem]>;
2706   def int_x86_fma_vfmadd_sd : GCCBuiltin<"__builtin_ia32_vfmaddsd">,
2707               Intrinsic<[llvm_v2f64_ty],
2708                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2709                         [IntrNoMem]>;
2710   def int_x86_fma_vfmadd_ps : GCCBuiltin<"__builtin_ia32_vfmaddps">,
2711               Intrinsic<[llvm_v4f32_ty],
2712                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2713                         [IntrNoMem]>;
2714   def int_x86_fma_vfmadd_pd : GCCBuiltin<"__builtin_ia32_vfmaddpd">,
2715               Intrinsic<[llvm_v2f64_ty],
2716                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2717                         [IntrNoMem]>;
2718   def int_x86_fma_vfmadd_ps_256 : GCCBuiltin<"__builtin_ia32_vfmaddps256">,
2719               Intrinsic<[llvm_v8f32_ty],
2720                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
2721                         [IntrNoMem]>;
2722   def int_x86_fma_vfmadd_pd_256 : GCCBuiltin<"__builtin_ia32_vfmaddpd256">,
2723               Intrinsic<[llvm_v4f64_ty],
2724                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
2725                         [IntrNoMem]>;
2726
2727   def int_x86_fma_vfmsub_ss : GCCBuiltin<"__builtin_ia32_vfmsubss">,
2728               Intrinsic<[llvm_v4f32_ty],
2729                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2730                         [IntrNoMem]>;
2731   def int_x86_fma_vfmsub_sd : GCCBuiltin<"__builtin_ia32_vfmsubsd">,
2732               Intrinsic<[llvm_v2f64_ty],
2733                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2734                         [IntrNoMem]>;
2735   def int_x86_fma_vfmsub_ps : GCCBuiltin<"__builtin_ia32_vfmsubps">,
2736               Intrinsic<[llvm_v4f32_ty],
2737                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2738                         [IntrNoMem]>;
2739   def int_x86_fma_vfmsub_pd : GCCBuiltin<"__builtin_ia32_vfmsubpd">,
2740               Intrinsic<[llvm_v2f64_ty],
2741                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2742                         [IntrNoMem]>;
2743   def int_x86_fma_vfmsub_ps_256 : GCCBuiltin<"__builtin_ia32_vfmsubps256">,
2744               Intrinsic<[llvm_v8f32_ty],
2745                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
2746                         [IntrNoMem]>;
2747   def int_x86_fma_vfmsub_pd_256 : GCCBuiltin<"__builtin_ia32_vfmsubpd256">,
2748               Intrinsic<[llvm_v4f64_ty],
2749                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
2750                         [IntrNoMem]>;
2751   def int_x86_fma_vfnmadd_ss : GCCBuiltin<"__builtin_ia32_vfnmaddss">,
2752               Intrinsic<[llvm_v4f32_ty],
2753                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2754                         [IntrNoMem]>;
2755   def int_x86_fma_vfnmadd_sd : GCCBuiltin<"__builtin_ia32_vfnmaddsd">,
2756               Intrinsic<[llvm_v2f64_ty],
2757                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2758                         [IntrNoMem]>;
2759   def int_x86_fma_vfnmadd_ps : GCCBuiltin<"__builtin_ia32_vfnmaddps">,
2760               Intrinsic<[llvm_v4f32_ty],
2761                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2762                         [IntrNoMem]>;
2763   def int_x86_fma_vfnmadd_pd : GCCBuiltin<"__builtin_ia32_vfnmaddpd">,
2764               Intrinsic<[llvm_v2f64_ty],
2765                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2766                         [IntrNoMem]>;
2767   def int_x86_fma_vfnmadd_ps_256 : GCCBuiltin<"__builtin_ia32_vfnmaddps256">,
2768               Intrinsic<[llvm_v8f32_ty],
2769                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
2770                         [IntrNoMem]>;
2771   def int_x86_fma_vfnmadd_pd_256 : GCCBuiltin<"__builtin_ia32_vfnmaddpd256">,
2772               Intrinsic<[llvm_v4f64_ty],
2773                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
2774                         [IntrNoMem]>;
2775   def int_x86_fma_vfnmsub_ss : GCCBuiltin<"__builtin_ia32_vfnmsubss">,
2776               Intrinsic<[llvm_v4f32_ty],
2777                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2778                         [IntrNoMem]>;
2779   def int_x86_fma_vfnmsub_sd : GCCBuiltin<"__builtin_ia32_vfnmsubsd">,
2780               Intrinsic<[llvm_v2f64_ty],
2781                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2782                         [IntrNoMem]>;
2783   def int_x86_fma_vfnmsub_ps : GCCBuiltin<"__builtin_ia32_vfnmsubps">,
2784               Intrinsic<[llvm_v4f32_ty],
2785                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2786                         [IntrNoMem]>;
2787   def int_x86_fma_vfnmsub_pd : GCCBuiltin<"__builtin_ia32_vfnmsubpd">,
2788               Intrinsic<[llvm_v2f64_ty],
2789                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2790                         [IntrNoMem]>;
2791   def int_x86_fma_vfnmsub_ps_256 : GCCBuiltin<"__builtin_ia32_vfnmsubps256">,
2792               Intrinsic<[llvm_v8f32_ty],
2793                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
2794                         [IntrNoMem]>;
2795   def int_x86_fma_vfnmsub_pd_256 : GCCBuiltin<"__builtin_ia32_vfnmsubpd256">,
2796               Intrinsic<[llvm_v4f64_ty],
2797                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
2798                         [IntrNoMem]>;
2799   def int_x86_fma_vfmaddsub_ps : GCCBuiltin<"__builtin_ia32_vfmaddsubps">,
2800               Intrinsic<[llvm_v4f32_ty],
2801                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2802                         [IntrNoMem]>;
2803   def int_x86_fma_vfmaddsub_pd : GCCBuiltin<"__builtin_ia32_vfmaddsubpd">,
2804               Intrinsic<[llvm_v2f64_ty],
2805                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2806                         [IntrNoMem]>;
2807   def int_x86_fma_vfmaddsub_ps_256 :
2808                GCCBuiltin<"__builtin_ia32_vfmaddsubps256">,
2809               Intrinsic<[llvm_v8f32_ty],
2810                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
2811                         [IntrNoMem]>;
2812   def int_x86_fma_vfmaddsub_pd_256 :
2813               GCCBuiltin<"__builtin_ia32_vfmaddsubpd256">,
2814               Intrinsic<[llvm_v4f64_ty],
2815                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
2816                         [IntrNoMem]>;
2817   def int_x86_fma_vfmsubadd_ps : GCCBuiltin<"__builtin_ia32_vfmsubaddps">,
2818               Intrinsic<[llvm_v4f32_ty],
2819                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
2820                         [IntrNoMem]>;
2821   def int_x86_fma_vfmsubadd_pd : GCCBuiltin<"__builtin_ia32_vfmsubaddpd">,
2822               Intrinsic<[llvm_v2f64_ty],
2823                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
2824                         [IntrNoMem]>;
2825   def int_x86_fma_vfmsubadd_ps_256 :
2826               GCCBuiltin<"__builtin_ia32_vfmsubaddps256">,
2827               Intrinsic<[llvm_v8f32_ty],
2828                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
2829                         [IntrNoMem]>;
2830   def int_x86_fma_vfmsubadd_pd_256 :
2831               GCCBuiltin<"__builtin_ia32_vfmsubaddpd256">,
2832               Intrinsic<[llvm_v4f64_ty],
2833                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
2834                         [IntrNoMem]>;
2835
2836   def int_x86_avx512_mask_vfmadd_pd_128 :
2837          GCCBuiltin<"__builtin_ia32_vfmaddpd128_mask">,
2838           Intrinsic<[llvm_v2f64_ty],
2839           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
2840           [IntrNoMem]>;
2841
2842   def int_x86_avx512_mask3_vfmadd_pd_128 :
2843          GCCBuiltin<"__builtin_ia32_vfmaddpd128_mask3">,
2844           Intrinsic<[llvm_v2f64_ty],
2845           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
2846           [IntrNoMem]>;
2847
2848   def int_x86_avx512_maskz_vfmadd_pd_128 :
2849          GCCBuiltin<"__builtin_ia32_vfmaddpd128_maskz">,
2850           Intrinsic<[llvm_v2f64_ty],
2851           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
2852           [IntrNoMem]>;
2853
2854   def int_x86_avx512_mask_vfmadd_pd_256 :
2855          GCCBuiltin<"__builtin_ia32_vfmaddpd256_mask">,
2856           Intrinsic<[llvm_v4f64_ty],
2857           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
2858           [IntrNoMem]>;
2859
2860   def int_x86_avx512_mask3_vfmadd_pd_256 :
2861          GCCBuiltin<"__builtin_ia32_vfmaddpd256_mask3">,
2862           Intrinsic<[llvm_v4f64_ty],
2863           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
2864           [IntrNoMem]>;
2865
2866   def int_x86_avx512_maskz_vfmadd_pd_256 :
2867          GCCBuiltin<"__builtin_ia32_vfmaddpd256_maskz">,
2868           Intrinsic<[llvm_v4f64_ty],
2869           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
2870           [IntrNoMem]>;
2871
2872   def int_x86_avx512_mask_vfmadd_pd_512 :
2873          GCCBuiltin<"__builtin_ia32_vfmaddpd512_mask">,
2874           Intrinsic<[llvm_v8f64_ty],
2875           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
2876           llvm_i32_ty], [IntrNoMem]>;
2877
2878   def int_x86_avx512_mask3_vfmadd_pd_512 :
2879          GCCBuiltin<"__builtin_ia32_vfmaddpd512_mask3">,
2880           Intrinsic<[llvm_v8f64_ty],
2881           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
2882           llvm_i32_ty], [IntrNoMem]>;
2883
2884   def int_x86_avx512_maskz_vfmadd_pd_512 :
2885          GCCBuiltin<"__builtin_ia32_vfmaddpd512_maskz">,
2886           Intrinsic<[llvm_v8f64_ty],
2887           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
2888           llvm_i32_ty], [IntrNoMem]>;
2889
2890   def int_x86_avx512_mask_vfmadd_ps_128 :
2891          GCCBuiltin<"__builtin_ia32_vfmaddps128_mask">,
2892           Intrinsic<[llvm_v4f32_ty],
2893           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
2894           [IntrNoMem]>;
2895
2896   def int_x86_avx512_mask3_vfmadd_ps_128 :
2897          GCCBuiltin<"__builtin_ia32_vfmaddps128_mask3">,
2898           Intrinsic<[llvm_v4f32_ty],
2899           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
2900           [IntrNoMem]>;
2901
2902   def int_x86_avx512_maskz_vfmadd_ps_128 :
2903          GCCBuiltin<"__builtin_ia32_vfmaddps128_maskz">,
2904           Intrinsic<[llvm_v4f32_ty],
2905           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
2906           [IntrNoMem]>;
2907
2908   def int_x86_avx512_mask_vfmadd_ps_256 :
2909          GCCBuiltin<"__builtin_ia32_vfmaddps256_mask">,
2910           Intrinsic<[llvm_v8f32_ty],
2911           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
2912           [IntrNoMem]>;
2913
2914   def int_x86_avx512_mask3_vfmadd_ps_256 :
2915          GCCBuiltin<"__builtin_ia32_vfmaddps256_mask3">,
2916           Intrinsic<[llvm_v8f32_ty],
2917           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
2918           [IntrNoMem]>;
2919
2920   def int_x86_avx512_maskz_vfmadd_ps_256 :
2921          GCCBuiltin<"__builtin_ia32_vfmaddps256_maskz">,
2922           Intrinsic<[llvm_v8f32_ty],
2923           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
2924           [IntrNoMem]>;
2925
2926   def int_x86_avx512_mask_vfmadd_ps_512 :
2927          GCCBuiltin<"__builtin_ia32_vfmaddps512_mask">,
2928           Intrinsic<[llvm_v16f32_ty],
2929           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
2930           llvm_i32_ty], [IntrNoMem]>;
2931
2932   def int_x86_avx512_mask3_vfmadd_ps_512 :
2933          GCCBuiltin<"__builtin_ia32_vfmaddps512_mask3">,
2934           Intrinsic<[llvm_v16f32_ty],
2935           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
2936           llvm_i32_ty], [IntrNoMem]>;
2937
2938   def int_x86_avx512_maskz_vfmadd_ps_512 :
2939          GCCBuiltin<"__builtin_ia32_vfmaddps512_maskz">,
2940           Intrinsic<[llvm_v16f32_ty],
2941           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
2942           llvm_i32_ty], [IntrNoMem]>;
2943
2944   def int_x86_avx512_mask_vfmaddsub_pd_128 :
2945          GCCBuiltin<"__builtin_ia32_vfmaddsubpd128_mask">,
2946           Intrinsic<[llvm_v2f64_ty],
2947           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
2948           [IntrNoMem]>;
2949
2950   def int_x86_avx512_mask3_vfmaddsub_pd_128 :
2951          GCCBuiltin<"__builtin_ia32_vfmaddsubpd128_mask3">,
2952           Intrinsic<[llvm_v2f64_ty],
2953           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
2954           [IntrNoMem]>;
2955
2956   def int_x86_avx512_maskz_vfmaddsub_pd_128 :
2957          GCCBuiltin<"__builtin_ia32_vfmaddsubpd128_maskz">,
2958           Intrinsic<[llvm_v2f64_ty],
2959           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
2960           [IntrNoMem]>;
2961
2962   def int_x86_avx512_mask_vfmaddsub_pd_256 :
2963          GCCBuiltin<"__builtin_ia32_vfmaddsubpd256_mask">,
2964           Intrinsic<[llvm_v4f64_ty],
2965           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
2966           [IntrNoMem]>;
2967
2968   def int_x86_avx512_mask3_vfmaddsub_pd_256 :
2969          GCCBuiltin<"__builtin_ia32_vfmaddsubpd256_mask3">,
2970           Intrinsic<[llvm_v4f64_ty],
2971           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
2972           [IntrNoMem]>;
2973
2974   def int_x86_avx512_maskz_vfmaddsub_pd_256 :
2975          GCCBuiltin<"__builtin_ia32_vfmaddsubpd256_maskz">,
2976           Intrinsic<[llvm_v4f64_ty],
2977           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
2978           [IntrNoMem]>;
2979
2980   def int_x86_avx512_mask_vfmaddsub_pd_512 :
2981          GCCBuiltin<"__builtin_ia32_vfmaddsubpd512_mask">,
2982           Intrinsic<[llvm_v8f64_ty],
2983           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
2984           llvm_i32_ty], [IntrNoMem]>;
2985
2986   def int_x86_avx512_mask3_vfmaddsub_pd_512 :
2987          GCCBuiltin<"__builtin_ia32_vfmaddsubpd512_mask3">,
2988           Intrinsic<[llvm_v8f64_ty],
2989           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
2990           llvm_i32_ty], [IntrNoMem]>;
2991
2992   def int_x86_avx512_maskz_vfmaddsub_pd_512 :
2993          GCCBuiltin<"__builtin_ia32_vfmaddsubpd512_maskz">,
2994           Intrinsic<[llvm_v8f64_ty],
2995           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
2996           llvm_i32_ty], [IntrNoMem]>;
2997
2998   def int_x86_avx512_mask_vfmaddsub_ps_128 :
2999          GCCBuiltin<"__builtin_ia32_vfmaddsubps128_mask">,
3000           Intrinsic<[llvm_v4f32_ty],
3001           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3002           [IntrNoMem]>;
3003
3004   def int_x86_avx512_mask3_vfmaddsub_ps_128 :
3005          GCCBuiltin<"__builtin_ia32_vfmaddsubps128_mask3">,
3006           Intrinsic<[llvm_v4f32_ty],
3007           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3008           [IntrNoMem]>;
3009
3010   def int_x86_avx512_maskz_vfmaddsub_ps_128 :
3011          GCCBuiltin<"__builtin_ia32_vfmaddsubps128_maskz">,
3012           Intrinsic<[llvm_v4f32_ty],
3013           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3014           [IntrNoMem]>;
3015
3016   def int_x86_avx512_mask_vfmaddsub_ps_256 :
3017          GCCBuiltin<"__builtin_ia32_vfmaddsubps256_mask">,
3018           Intrinsic<[llvm_v8f32_ty],
3019           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3020           [IntrNoMem]>;
3021
3022   def int_x86_avx512_mask3_vfmaddsub_ps_256 :
3023          GCCBuiltin<"__builtin_ia32_vfmaddsubps256_mask3">,
3024           Intrinsic<[llvm_v8f32_ty],
3025           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3026           [IntrNoMem]>;
3027
3028   def int_x86_avx512_maskz_vfmaddsub_ps_256 :
3029          GCCBuiltin<"__builtin_ia32_vfmaddsubps256_maskz">,
3030           Intrinsic<[llvm_v8f32_ty],
3031           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3032           [IntrNoMem]>;
3033
3034   def int_x86_avx512_mask_vfmaddsub_ps_512 :
3035          GCCBuiltin<"__builtin_ia32_vfmaddsubps512_mask">,
3036           Intrinsic<[llvm_v16f32_ty],
3037           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3038           llvm_i32_ty], [IntrNoMem]>;
3039
3040   def int_x86_avx512_mask3_vfmaddsub_ps_512 :
3041          GCCBuiltin<"__builtin_ia32_vfmaddsubps512_mask3">,
3042           Intrinsic<[llvm_v16f32_ty],
3043           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3044           llvm_i32_ty], [IntrNoMem]>;
3045
3046   def int_x86_avx512_maskz_vfmaddsub_ps_512 :
3047          GCCBuiltin<"__builtin_ia32_vfmaddsubps512_maskz">,
3048           Intrinsic<[llvm_v16f32_ty],
3049           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3050           llvm_i32_ty], [IntrNoMem]>;
3051
3052   def int_x86_avx512_mask3_vfmsub_pd_128 :
3053          GCCBuiltin<"__builtin_ia32_vfmsubpd128_mask3">,
3054           Intrinsic<[llvm_v2f64_ty],
3055           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
3056           [IntrNoMem]>;
3057
3058   def int_x86_avx512_mask3_vfmsub_pd_256 :
3059          GCCBuiltin<"__builtin_ia32_vfmsubpd256_mask3">,
3060           Intrinsic<[llvm_v4f64_ty],
3061           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
3062           [IntrNoMem]>;
3063
3064   def int_x86_avx512_mask3_vfmsub_pd_512 :
3065          GCCBuiltin<"__builtin_ia32_vfmsubpd512_mask3">,
3066           Intrinsic<[llvm_v8f64_ty],
3067           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
3068           llvm_i32_ty], [IntrNoMem]>;
3069
3070   def int_x86_avx512_mask3_vfmsub_ps_128 :
3071          GCCBuiltin<"__builtin_ia32_vfmsubps128_mask3">,
3072           Intrinsic<[llvm_v4f32_ty],
3073           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3074           [IntrNoMem]>;
3075
3076   def int_x86_avx512_mask3_vfmsub_ps_256 :
3077          GCCBuiltin<"__builtin_ia32_vfmsubps256_mask3">,
3078           Intrinsic<[llvm_v8f32_ty],
3079           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3080           [IntrNoMem]>;
3081
3082   def int_x86_avx512_mask3_vfmsub_ps_512 :
3083          GCCBuiltin<"__builtin_ia32_vfmsubps512_mask3">,
3084           Intrinsic<[llvm_v16f32_ty],
3085           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3086           llvm_i32_ty], [IntrNoMem]>;
3087
3088   def int_x86_avx512_mask3_vfmsubadd_pd_128 :
3089          GCCBuiltin<"__builtin_ia32_vfmsubaddpd128_mask3">,
3090           Intrinsic<[llvm_v2f64_ty],
3091           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
3092           [IntrNoMem]>;
3093
3094   def int_x86_avx512_mask3_vfmsubadd_pd_256 :
3095          GCCBuiltin<"__builtin_ia32_vfmsubaddpd256_mask3">,
3096           Intrinsic<[llvm_v4f64_ty],
3097           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
3098           [IntrNoMem]>;
3099
3100   def int_x86_avx512_mask3_vfmsubadd_pd_512 :
3101          GCCBuiltin<"__builtin_ia32_vfmsubaddpd512_mask3">,
3102           Intrinsic<[llvm_v8f64_ty],
3103           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
3104           llvm_i32_ty], [IntrNoMem]>;
3105
3106   def int_x86_avx512_mask3_vfmsubadd_ps_128 :
3107          GCCBuiltin<"__builtin_ia32_vfmsubaddps128_mask3">,
3108           Intrinsic<[llvm_v4f32_ty],
3109           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3110           [IntrNoMem]>;
3111
3112   def int_x86_avx512_mask3_vfmsubadd_ps_256 :
3113          GCCBuiltin<"__builtin_ia32_vfmsubaddps256_mask3">,
3114           Intrinsic<[llvm_v8f32_ty],
3115           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3116           [IntrNoMem]>;
3117
3118   def int_x86_avx512_mask3_vfmsubadd_ps_512 :
3119          GCCBuiltin<"__builtin_ia32_vfmsubaddps512_mask3">,
3120           Intrinsic<[llvm_v16f32_ty],
3121           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3122           llvm_i32_ty], [IntrNoMem]>;
3123
3124   def int_x86_avx512_mask_vfnmadd_pd_128 :
3125          GCCBuiltin<"__builtin_ia32_vfnmaddpd128_mask">,
3126           Intrinsic<[llvm_v2f64_ty],
3127           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
3128           [IntrNoMem]>;
3129
3130   def int_x86_avx512_mask_vfnmadd_pd_256 :
3131          GCCBuiltin<"__builtin_ia32_vfnmaddpd256_mask">,
3132           Intrinsic<[llvm_v4f64_ty],
3133           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
3134           [IntrNoMem]>;
3135
3136   def int_x86_avx512_mask_vfnmadd_pd_512 :
3137          GCCBuiltin<"__builtin_ia32_vfnmaddpd512_mask">,
3138           Intrinsic<[llvm_v8f64_ty],
3139           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
3140           llvm_i32_ty], [IntrNoMem]>;
3141
3142   def int_x86_avx512_mask_vfnmadd_ps_128 :
3143          GCCBuiltin<"__builtin_ia32_vfnmaddps128_mask">,
3144           Intrinsic<[llvm_v4f32_ty],
3145           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3146           [IntrNoMem]>;
3147
3148   def int_x86_avx512_mask_vfnmadd_ps_256 :
3149          GCCBuiltin<"__builtin_ia32_vfnmaddps256_mask">,
3150           Intrinsic<[llvm_v8f32_ty],
3151           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3152           [IntrNoMem]>;
3153
3154   def int_x86_avx512_mask_vfnmadd_ps_512 :
3155          GCCBuiltin<"__builtin_ia32_vfnmaddps512_mask">,
3156           Intrinsic<[llvm_v16f32_ty],
3157           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3158           llvm_i32_ty], [IntrNoMem]>;
3159
3160   def int_x86_avx512_mask_vfnmsub_pd_128 :
3161          GCCBuiltin<"__builtin_ia32_vfnmsubpd128_mask">,
3162           Intrinsic<[llvm_v2f64_ty],
3163           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
3164           [IntrNoMem]>;
3165
3166   def int_x86_avx512_mask3_vfnmsub_pd_128 :
3167          GCCBuiltin<"__builtin_ia32_vfnmsubpd128_mask3">,
3168           Intrinsic<[llvm_v2f64_ty],
3169           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,  llvm_i8_ty],
3170           [IntrNoMem]>;
3171
3172   def int_x86_avx512_mask_vfnmsub_pd_256 :
3173          GCCBuiltin<"__builtin_ia32_vfnmsubpd256_mask">,
3174           Intrinsic<[llvm_v4f64_ty],
3175           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
3176           [IntrNoMem]>;
3177
3178   def int_x86_avx512_mask3_vfnmsub_pd_256 :
3179          GCCBuiltin<"__builtin_ia32_vfnmsubpd256_mask3">,
3180           Intrinsic<[llvm_v4f64_ty],
3181           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty,  llvm_i8_ty],
3182           [IntrNoMem]>;
3183
3184   def int_x86_avx512_mask_vfnmsub_pd_512 :
3185          GCCBuiltin<"__builtin_ia32_vfnmsubpd512_mask">,
3186           Intrinsic<[llvm_v8f64_ty],
3187           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
3188           llvm_i32_ty], [IntrNoMem]>;
3189
3190   def int_x86_avx512_mask3_vfnmsub_pd_512 :
3191          GCCBuiltin<"__builtin_ia32_vfnmsubpd512_mask3">,
3192           Intrinsic<[llvm_v8f64_ty],
3193           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty,  llvm_i8_ty,
3194           llvm_i32_ty], [IntrNoMem]>;
3195
3196   def int_x86_avx512_mask_vfnmsub_ps_128 :
3197          GCCBuiltin<"__builtin_ia32_vfnmsubps128_mask">,
3198           Intrinsic<[llvm_v4f32_ty],
3199           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3200           [IntrNoMem]>;
3201
3202   def int_x86_avx512_mask3_vfnmsub_ps_128 :
3203          GCCBuiltin<"__builtin_ia32_vfnmsubps128_mask3">,
3204           Intrinsic<[llvm_v4f32_ty],
3205           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3206           [IntrNoMem]>;
3207
3208   def int_x86_avx512_mask_vfnmsub_ps_256 :
3209          GCCBuiltin<"__builtin_ia32_vfnmsubps256_mask">,
3210           Intrinsic<[llvm_v8f32_ty],
3211           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3212           [IntrNoMem]>;
3213
3214   def int_x86_avx512_mask3_vfnmsub_ps_256 :
3215          GCCBuiltin<"__builtin_ia32_vfnmsubps256_mask3">,
3216           Intrinsic<[llvm_v8f32_ty],
3217           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3218           [IntrNoMem]>;
3219
3220   def int_x86_avx512_mask_vfnmsub_ps_512 :
3221          GCCBuiltin<"__builtin_ia32_vfnmsubps512_mask">,
3222           Intrinsic<[llvm_v16f32_ty],
3223           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3224           llvm_i32_ty], [IntrNoMem]>;
3225
3226   def int_x86_avx512_mask3_vfnmsub_ps_512 :
3227          GCCBuiltin<"__builtin_ia32_vfnmsubps512_mask3">,
3228           Intrinsic<[llvm_v16f32_ty],
3229           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty,  llvm_i16_ty,
3230           llvm_i32_ty], [IntrNoMem]>;
3231
3232 }
3233
3234 //===----------------------------------------------------------------------===//
3235 // XOP
3236
3237   def int_x86_xop_vpermil2pd : GCCBuiltin<"__builtin_ia32_vpermil2pd">,
3238               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3239                                           llvm_v2f64_ty, llvm_i8_ty],
3240                         [IntrNoMem]>;
3241
3242   def int_x86_xop_vpermil2pd_256 :
3243               GCCBuiltin<"__builtin_ia32_vpermil2pd256">,
3244               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
3245                                           llvm_v4f64_ty, llvm_i8_ty],
3246                         [IntrNoMem]>;
3247
3248   def int_x86_xop_vpermil2ps : GCCBuiltin<"__builtin_ia32_vpermil2ps">,
3249               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3250                                           llvm_v4f32_ty, llvm_i8_ty],
3251                         [IntrNoMem]>;
3252   def int_x86_xop_vpermil2ps_256 :
3253               GCCBuiltin<"__builtin_ia32_vpermil2ps256">,
3254               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
3255                                           llvm_v8f32_ty, llvm_i8_ty],
3256                         [IntrNoMem]>;
3257
3258   def int_x86_xop_vfrcz_pd : GCCBuiltin<"__builtin_ia32_vfrczpd">,
3259               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
3260   def int_x86_xop_vfrcz_ps : GCCBuiltin<"__builtin_ia32_vfrczps">,
3261               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
3262   def int_x86_xop_vfrcz_sd : GCCBuiltin<"__builtin_ia32_vfrczsd">,
3263               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
3264   def int_x86_xop_vfrcz_ss : GCCBuiltin<"__builtin_ia32_vfrczss">,
3265               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
3266   def int_x86_xop_vfrcz_pd_256 : GCCBuiltin<"__builtin_ia32_vfrczpd256">,
3267               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
3268   def int_x86_xop_vfrcz_ps_256 : GCCBuiltin<"__builtin_ia32_vfrczps256">,
3269               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
3270
3271   def int_x86_xop_vpcmov :
3272               GCCBuiltin<"__builtin_ia32_vpcmov">,
3273               Intrinsic<[llvm_v2i64_ty],
3274                         [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
3275                         [IntrNoMem]>;
3276   def int_x86_xop_vpcmov_256 :
3277               GCCBuiltin<"__builtin_ia32_vpcmov_256">,
3278               Intrinsic<[llvm_v4i64_ty],
3279                         [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty],
3280                         [IntrNoMem]>;
3281
3282   def int_x86_xop_vpcomb : GCCBuiltin<"__builtin_ia32_vpcomb">,
3283               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
3284                          llvm_i8_ty], [IntrNoMem]>;
3285   def int_x86_xop_vpcomw : GCCBuiltin<"__builtin_ia32_vpcomw">,
3286               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
3287                          llvm_i8_ty], [IntrNoMem]>;
3288   def int_x86_xop_vpcomd : GCCBuiltin<"__builtin_ia32_vpcomd">,
3289               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
3290                          llvm_i8_ty], [IntrNoMem]>;
3291   def int_x86_xop_vpcomq : GCCBuiltin<"__builtin_ia32_vpcomq">,
3292               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
3293                          llvm_i8_ty], [IntrNoMem]>;
3294   def int_x86_xop_vpcomub : GCCBuiltin<"__builtin_ia32_vpcomub">,
3295               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,
3296                          llvm_i8_ty], [IntrNoMem]>;
3297   def int_x86_xop_vpcomuw : GCCBuiltin<"__builtin_ia32_vpcomuw">,
3298               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty,
3299                          llvm_i8_ty], [IntrNoMem]>;
3300   def int_x86_xop_vpcomud : GCCBuiltin<"__builtin_ia32_vpcomud">,
3301               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
3302                          llvm_i8_ty], [IntrNoMem]>;
3303   def int_x86_xop_vpcomuq : GCCBuiltin<"__builtin_ia32_vpcomuq">,
3304               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
3305                          llvm_i8_ty], [IntrNoMem]>;
3306
3307   def int_x86_xop_vphaddbd :
3308               GCCBuiltin<"__builtin_ia32_vphaddbd">,
3309               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3310   def int_x86_xop_vphaddbq :
3311               GCCBuiltin<"__builtin_ia32_vphaddbq">,
3312               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3313   def int_x86_xop_vphaddbw :
3314               GCCBuiltin<"__builtin_ia32_vphaddbw">,
3315               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3316   def int_x86_xop_vphadddq :
3317               GCCBuiltin<"__builtin_ia32_vphadddq">,
3318               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
3319   def int_x86_xop_vphaddubd :
3320               GCCBuiltin<"__builtin_ia32_vphaddubd">,
3321               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3322   def int_x86_xop_vphaddubq :
3323               GCCBuiltin<"__builtin_ia32_vphaddubq">,
3324               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3325   def int_x86_xop_vphaddubw :
3326               GCCBuiltin<"__builtin_ia32_vphaddubw">,
3327               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3328   def int_x86_xop_vphaddudq :
3329               GCCBuiltin<"__builtin_ia32_vphaddudq">,
3330               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
3331   def int_x86_xop_vphadduwd :
3332               GCCBuiltin<"__builtin_ia32_vphadduwd">,
3333               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
3334   def int_x86_xop_vphadduwq :
3335               GCCBuiltin<"__builtin_ia32_vphadduwq">,
3336               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
3337   def int_x86_xop_vphaddwd :
3338               GCCBuiltin<"__builtin_ia32_vphaddwd">,
3339               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
3340   def int_x86_xop_vphaddwq :
3341               GCCBuiltin<"__builtin_ia32_vphaddwq">,
3342               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
3343   def int_x86_xop_vphsubbw :
3344               GCCBuiltin<"__builtin_ia32_vphsubbw">,
3345               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
3346   def int_x86_xop_vphsubdq :
3347               GCCBuiltin<"__builtin_ia32_vphsubdq">,
3348               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
3349   def int_x86_xop_vphsubwd :
3350               GCCBuiltin<"__builtin_ia32_vphsubwd">,
3351               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
3352   def int_x86_xop_vpmacsdd :
3353               GCCBuiltin<"__builtin_ia32_vpmacsdd">,
3354               Intrinsic<[llvm_v4i32_ty],
3355                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
3356                         [IntrNoMem]>;
3357   def int_x86_xop_vpmacsdqh :
3358               GCCBuiltin<"__builtin_ia32_vpmacsdqh">,
3359               Intrinsic<[llvm_v2i64_ty],
3360                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
3361                         [IntrNoMem]>;
3362   def int_x86_xop_vpmacsdql :
3363               GCCBuiltin<"__builtin_ia32_vpmacsdql">,
3364               Intrinsic<[llvm_v2i64_ty],
3365                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
3366                         [IntrNoMem]>;
3367   def int_x86_xop_vpmacssdd :
3368               GCCBuiltin<"__builtin_ia32_vpmacssdd">,
3369               Intrinsic<[llvm_v4i32_ty],
3370                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
3371                         [IntrNoMem]>;
3372   def int_x86_xop_vpmacssdqh :
3373               GCCBuiltin<"__builtin_ia32_vpmacssdqh">,
3374               Intrinsic<[llvm_v2i64_ty],
3375                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
3376                         [IntrNoMem]>;
3377   def int_x86_xop_vpmacssdql :
3378               GCCBuiltin<"__builtin_ia32_vpmacssdql">,
3379               Intrinsic<[llvm_v2i64_ty],
3380                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
3381                         [IntrNoMem]>;
3382   def int_x86_xop_vpmacsswd :
3383               GCCBuiltin<"__builtin_ia32_vpmacsswd">,
3384               Intrinsic<[llvm_v4i32_ty],
3385                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
3386                         [IntrNoMem]>;
3387   def int_x86_xop_vpmacssww :
3388               GCCBuiltin<"__builtin_ia32_vpmacssww">,
3389               Intrinsic<[llvm_v8i16_ty],
3390                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
3391                         [IntrNoMem]>;
3392   def int_x86_xop_vpmacswd :
3393               GCCBuiltin<"__builtin_ia32_vpmacswd">,
3394               Intrinsic<[llvm_v4i32_ty],
3395                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
3396                         [IntrNoMem]>;
3397   def int_x86_xop_vpmacsww :
3398               GCCBuiltin<"__builtin_ia32_vpmacsww">,
3399               Intrinsic<[llvm_v8i16_ty],
3400                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
3401                         [IntrNoMem]>;
3402   def int_x86_xop_vpmadcsswd :
3403               GCCBuiltin<"__builtin_ia32_vpmadcsswd">,
3404               Intrinsic<[llvm_v4i32_ty],
3405                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
3406                         [IntrNoMem]>;
3407   def int_x86_xop_vpmadcswd :
3408               GCCBuiltin<"__builtin_ia32_vpmadcswd">,
3409               Intrinsic<[llvm_v4i32_ty],
3410                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
3411                         [IntrNoMem]>;
3412   def int_x86_xop_vpperm :
3413               GCCBuiltin<"__builtin_ia32_vpperm">,
3414               Intrinsic<[llvm_v16i8_ty],
3415                         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
3416                         [IntrNoMem]>;
3417
3418   def int_x86_xop_vprotb : GCCBuiltin<"__builtin_ia32_vprotb">,
3419               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
3420                         [IntrNoMem]>;
3421   def int_x86_xop_vprotd : GCCBuiltin<"__builtin_ia32_vprotd">,
3422               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
3423                         [IntrNoMem]>;
3424   def int_x86_xop_vprotq : GCCBuiltin<"__builtin_ia32_vprotq">,
3425               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
3426                         [IntrNoMem]>;
3427   def int_x86_xop_vprotw : GCCBuiltin<"__builtin_ia32_vprotw">,
3428               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
3429                         [IntrNoMem]>;
3430   def int_x86_xop_vprotbi : GCCBuiltin<"__builtin_ia32_vprotbi">,
3431               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_i8_ty],
3432                         [IntrNoMem]>;
3433   def int_x86_xop_vprotdi : GCCBuiltin<"__builtin_ia32_vprotdi">,
3434               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_i8_ty],
3435                         [IntrNoMem]>;
3436   def int_x86_xop_vprotqi : GCCBuiltin<"__builtin_ia32_vprotqi">,
3437               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty],
3438                         [IntrNoMem]>;
3439   def int_x86_xop_vprotwi : GCCBuiltin<"__builtin_ia32_vprotwi">,
3440               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_i8_ty],
3441                         [IntrNoMem]>;
3442
3443   def int_x86_xop_vpshab :
3444               GCCBuiltin<"__builtin_ia32_vpshab">,
3445               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
3446                         [IntrNoMem]>;
3447   def int_x86_xop_vpshad :
3448               GCCBuiltin<"__builtin_ia32_vpshad">,
3449               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
3450                         [IntrNoMem]>;
3451   def int_x86_xop_vpshaq :
3452               GCCBuiltin<"__builtin_ia32_vpshaq">,
3453               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
3454                         [IntrNoMem]>;
3455   def int_x86_xop_vpshaw :
3456               GCCBuiltin<"__builtin_ia32_vpshaw">,
3457               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
3458                         [IntrNoMem]>;
3459   def int_x86_xop_vpshlb :
3460               GCCBuiltin<"__builtin_ia32_vpshlb">,
3461               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
3462                         [IntrNoMem]>;
3463   def int_x86_xop_vpshld :
3464               GCCBuiltin<"__builtin_ia32_vpshld">,
3465               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
3466                         [IntrNoMem]>;
3467   def int_x86_xop_vpshlq :
3468               GCCBuiltin<"__builtin_ia32_vpshlq">,
3469               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
3470                         [IntrNoMem]>;
3471   def int_x86_xop_vpshlw :
3472               GCCBuiltin<"__builtin_ia32_vpshlw">,
3473               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
3474                         [IntrNoMem]>;
3475
3476 //===----------------------------------------------------------------------===//
3477 // MMX
3478
3479 // Empty MMX state op.
3480 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
3481   def int_x86_mmx_emms  : GCCBuiltin<"__builtin_ia32_emms">,
3482               Intrinsic<[], [], []>;
3483   def int_x86_mmx_femms : GCCBuiltin<"__builtin_ia32_femms">,
3484               Intrinsic<[], [], []>;
3485 }
3486
3487 // Integer arithmetic ops.
3488 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
3489   // Addition
3490   def int_x86_mmx_padd_b : GCCBuiltin<"__builtin_ia32_paddb">,
3491               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3492                         [IntrNoMem]>;
3493   def int_x86_mmx_padd_w : GCCBuiltin<"__builtin_ia32_paddw">,
3494               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3495                         [IntrNoMem]>;
3496   def int_x86_mmx_padd_d : GCCBuiltin<"__builtin_ia32_paddd">,
3497               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3498                         [IntrNoMem]>;
3499   def int_x86_mmx_padd_q : GCCBuiltin<"__builtin_ia32_paddq">,
3500               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3501                         [IntrNoMem]>;
3502
3503   def int_x86_mmx_padds_b : GCCBuiltin<"__builtin_ia32_paddsb">,
3504               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3505                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3506   def int_x86_mmx_padds_w : GCCBuiltin<"__builtin_ia32_paddsw">,
3507               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3508                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3509
3510   def int_x86_mmx_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb">,
3511               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3512                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3513   def int_x86_mmx_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw">,
3514               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3515                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3516
3517   // Subtraction
3518   def int_x86_mmx_psub_b : GCCBuiltin<"__builtin_ia32_psubb">,
3519               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3520                         [IntrNoMem]>;
3521   def int_x86_mmx_psub_w : GCCBuiltin<"__builtin_ia32_psubw">,
3522               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3523                         [IntrNoMem]>;
3524   def int_x86_mmx_psub_d : GCCBuiltin<"__builtin_ia32_psubd">,
3525               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3526                         [IntrNoMem]>;
3527   def int_x86_mmx_psub_q : GCCBuiltin<"__builtin_ia32_psubq">,
3528               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3529                         [IntrNoMem]>;
3530
3531   def int_x86_mmx_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb">,
3532               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3533                          llvm_x86mmx_ty], [IntrNoMem]>;
3534   def int_x86_mmx_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw">,
3535               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3536                          llvm_x86mmx_ty], [IntrNoMem]>;
3537
3538   def int_x86_mmx_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb">,
3539               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3540                          llvm_x86mmx_ty], [IntrNoMem]>;
3541   def int_x86_mmx_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw">,
3542               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3543                          llvm_x86mmx_ty], [IntrNoMem]>;
3544
3545   // Multiplication
3546   def int_x86_mmx_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw">,
3547               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3548                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3549   def int_x86_mmx_pmull_w : GCCBuiltin<"__builtin_ia32_pmullw">,
3550               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3551                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3552   def int_x86_mmx_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw">,
3553               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3554                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3555   def int_x86_mmx_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq">,
3556               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3557                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3558   def int_x86_mmx_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd">,
3559               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3560                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3561
3562   // Bitwise operations
3563   def int_x86_mmx_pand : GCCBuiltin<"__builtin_ia32_pand">,
3564               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3565                         [IntrNoMem]>;
3566   def int_x86_mmx_pandn : GCCBuiltin<"__builtin_ia32_pandn">,
3567               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3568                         [IntrNoMem]>;
3569   def int_x86_mmx_por : GCCBuiltin<"__builtin_ia32_por">,
3570               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3571                         [IntrNoMem]>;
3572   def int_x86_mmx_pxor : GCCBuiltin<"__builtin_ia32_pxor">,
3573               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
3574                         [IntrNoMem]>;
3575
3576   // Averages
3577   def int_x86_mmx_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb">,
3578               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3579                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3580   def int_x86_mmx_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw">,
3581               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3582                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3583
3584   // Maximum
3585   def int_x86_mmx_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub">,
3586               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
3587                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
3588   def int_x86_mmx_pmaxs_w : GCCBuilti