Recommit [NFC] Better encapsulation of llvm::Optional Storage
[llvm-complete.git] / include / llvm / IR / IntrinsicsX86.td
bloba8c8cba56f4a2c267b44693d7ef7ec448fc1a0d6
1 //===- IntrinsicsX86.td - Defines X86 intrinsics -----------*- tablegen -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines all of the X86-specific intrinsics.
11 //===----------------------------------------------------------------------===//
13 //===----------------------------------------------------------------------===//
14 // Interrupt traps
15 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
16   def int_x86_int : Intrinsic<[], [llvm_i8_ty]>;
19 //===----------------------------------------------------------------------===//
20 // SEH intrinsics for Windows
21 let TargetPrefix = "x86" in {
22   def int_x86_seh_lsda : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty], [IntrNoMem]>;
24   // Marks the EH registration node created in LLVM IR prior to code generation.
25   def int_x86_seh_ehregnode : Intrinsic<[], [llvm_ptr_ty], []>;
27   // Marks the EH guard slot node created in LLVM IR prior to code generation.
28   def int_x86_seh_ehguard : Intrinsic<[], [llvm_ptr_ty], []>;
31 //===----------------------------------------------------------------------===//
32 // FLAGS.
33 let TargetPrefix = "x86" in {
34   def int_x86_flags_read_u32 : GCCBuiltin<"__builtin_ia32_readeflags_u32">,
35         Intrinsic<[llvm_i32_ty], [], []>;
36   def int_x86_flags_read_u64 : GCCBuiltin<"__builtin_ia32_readeflags_u64">,
37         Intrinsic<[llvm_i64_ty], [], []>;
38   def int_x86_flags_write_u32 : GCCBuiltin<"__builtin_ia32_writeeflags_u32">,
39         Intrinsic<[], [llvm_i32_ty], []>;
40   def int_x86_flags_write_u64 : GCCBuiltin<"__builtin_ia32_writeeflags_u64">,
41         Intrinsic<[], [llvm_i64_ty], []>;
44 //===----------------------------------------------------------------------===//
45 // Read Time Stamp Counter.
46 let TargetPrefix = "x86" in {
47   def int_x86_rdtsc : GCCBuiltin<"__builtin_ia32_rdtsc">,
48               Intrinsic<[llvm_i64_ty], [], []>;
49   def int_x86_rdtscp :
50               Intrinsic<[llvm_i64_ty, llvm_i32_ty], [], []>;
53 // Read Performance-Monitoring Counter.
54 let TargetPrefix = "x86" in {
55   def int_x86_rdpmc : GCCBuiltin<"__builtin_ia32_rdpmc">,
56               Intrinsic<[llvm_i64_ty], [llvm_i32_ty], []>;
59 // Read processor ID.
60 let TargetPrefix = "x86" in {
61   def int_x86_rdpid : GCCBuiltin<"__builtin_ia32_rdpid">,
62               Intrinsic<[llvm_i32_ty], [], []>;
65 //===----------------------------------------------------------------------===//
66 // CET SS
67 let TargetPrefix = "x86" in {
68   def int_x86_incsspd : GCCBuiltin<"__builtin_ia32_incsspd">,
69               Intrinsic<[], [llvm_i32_ty], []>;
70   def int_x86_incsspq : GCCBuiltin<"__builtin_ia32_incsspq">,
71               Intrinsic<[], [llvm_i64_ty], []>;
72   def int_x86_rdsspd : GCCBuiltin<"__builtin_ia32_rdsspd">,
73               Intrinsic<[llvm_i32_ty], [llvm_i32_ty], []>;
74   def int_x86_rdsspq : GCCBuiltin<"__builtin_ia32_rdsspq">,
75               Intrinsic<[llvm_i64_ty], [llvm_i64_ty], []>;
76   def int_x86_saveprevssp : GCCBuiltin<"__builtin_ia32_saveprevssp">,
77               Intrinsic<[], [], []>;
78   def int_x86_rstorssp : GCCBuiltin<"__builtin_ia32_rstorssp">,
79               Intrinsic<[], [llvm_ptr_ty], []>;
80   def int_x86_wrssd : GCCBuiltin<"__builtin_ia32_wrssd">,
81               Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], []>;
82   def int_x86_wrssq : GCCBuiltin<"__builtin_ia32_wrssq">,
83               Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty], []>;
84   def int_x86_wrussd : GCCBuiltin<"__builtin_ia32_wrussd">,
85               Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], []>;
86   def int_x86_wrussq : GCCBuiltin<"__builtin_ia32_wrussq">,
87               Intrinsic<[], [llvm_i64_ty, llvm_ptr_ty], []>;
88   def int_x86_setssbsy : GCCBuiltin<"__builtin_ia32_setssbsy">,
89               Intrinsic<[], [], []>;
90   def int_x86_clrssbsy : GCCBuiltin<"__builtin_ia32_clrssbsy">,
91               Intrinsic<[], [llvm_ptr_ty], []>;
94 //===----------------------------------------------------------------------===//
95 // 3DNow!
97 let TargetPrefix = "x86" in {
98   def int_x86_3dnow_pavgusb : GCCBuiltin<"__builtin_ia32_pavgusb">,
99               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
100                         [IntrNoMem]>;
101   def int_x86_3dnow_pf2id : GCCBuiltin<"__builtin_ia32_pf2id">,
102               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
103   def int_x86_3dnow_pfacc : GCCBuiltin<"__builtin_ia32_pfacc">,
104               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
105                         [IntrNoMem]>;
106   def int_x86_3dnow_pfadd : GCCBuiltin<"__builtin_ia32_pfadd">,
107               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
108                         [IntrNoMem]>;
109   def int_x86_3dnow_pfcmpeq : GCCBuiltin<"__builtin_ia32_pfcmpeq">,
110               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
111                         [IntrNoMem]>;
112   def int_x86_3dnow_pfcmpge : GCCBuiltin<"__builtin_ia32_pfcmpge">,
113               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
114                         [IntrNoMem]>;
115   def int_x86_3dnow_pfcmpgt : GCCBuiltin<"__builtin_ia32_pfcmpgt">,
116               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
117                         [IntrNoMem]>;
118   def int_x86_3dnow_pfmax : GCCBuiltin<"__builtin_ia32_pfmax">,
119               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
120                         [IntrNoMem]>;
121   def int_x86_3dnow_pfmin : GCCBuiltin<"__builtin_ia32_pfmin">,
122               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
123                         [IntrNoMem]>;
124   def int_x86_3dnow_pfmul : GCCBuiltin<"__builtin_ia32_pfmul">,
125               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
126                         [IntrNoMem]>;
127   def int_x86_3dnow_pfrcp : GCCBuiltin<"__builtin_ia32_pfrcp">,
128               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
129   def int_x86_3dnow_pfrcpit1 : GCCBuiltin<"__builtin_ia32_pfrcpit1">,
130               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
131                         [IntrNoMem]>;
132   def int_x86_3dnow_pfrcpit2 : GCCBuiltin<"__builtin_ia32_pfrcpit2">,
133               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
134                         [IntrNoMem]>;
135   def int_x86_3dnow_pfrsqrt : GCCBuiltin<"__builtin_ia32_pfrsqrt">,
136               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
137   def int_x86_3dnow_pfrsqit1 : GCCBuiltin<"__builtin_ia32_pfrsqit1">,
138               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
139                         [IntrNoMem]>;
140   def int_x86_3dnow_pfsub : GCCBuiltin<"__builtin_ia32_pfsub">,
141               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
142                         [IntrNoMem]>;
143   def int_x86_3dnow_pfsubr : GCCBuiltin<"__builtin_ia32_pfsubr">,
144               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
145                         [IntrNoMem]>;
146   def int_x86_3dnow_pi2fd : GCCBuiltin<"__builtin_ia32_pi2fd">,
147               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
148   def int_x86_3dnow_pmulhrw : GCCBuiltin<"__builtin_ia32_pmulhrw">,
149               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
150                         [IntrNoMem]>;
153 //===----------------------------------------------------------------------===//
154 // 3DNow! extensions
156 let TargetPrefix = "x86" in {
157   def int_x86_3dnowa_pf2iw : GCCBuiltin<"__builtin_ia32_pf2iw">,
158               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
159   def int_x86_3dnowa_pfnacc : GCCBuiltin<"__builtin_ia32_pfnacc">,
160               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
161                         [IntrNoMem]>;
162   def int_x86_3dnowa_pfpnacc : GCCBuiltin<"__builtin_ia32_pfpnacc">,
163               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
164                         [IntrNoMem]>;
165   def int_x86_3dnowa_pi2fw : GCCBuiltin<"__builtin_ia32_pi2fw">,
166               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
167   def int_x86_3dnowa_pswapd :
168               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
171 //===----------------------------------------------------------------------===//
172 // SSE1
174 // Arithmetic ops
175 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
176   def int_x86_sse_rcp_ss : GCCBuiltin<"__builtin_ia32_rcpss">,
177               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
178                         [IntrNoMem]>;
179   def int_x86_sse_rcp_ps : GCCBuiltin<"__builtin_ia32_rcpps">,
180               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
181                         [IntrNoMem]>;
182   def int_x86_sse_rsqrt_ss : GCCBuiltin<"__builtin_ia32_rsqrtss">,
183               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
184                         [IntrNoMem]>;
185   def int_x86_sse_rsqrt_ps : GCCBuiltin<"__builtin_ia32_rsqrtps">,
186               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
187                         [IntrNoMem]>;
188   def int_x86_sse_min_ss : GCCBuiltin<"__builtin_ia32_minss">,
189               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
190                          llvm_v4f32_ty], [IntrNoMem]>;
191   def int_x86_sse_min_ps : GCCBuiltin<"__builtin_ia32_minps">,
192               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
193                          llvm_v4f32_ty], [IntrNoMem]>;
194   def int_x86_sse_max_ss : GCCBuiltin<"__builtin_ia32_maxss">,
195               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
196                          llvm_v4f32_ty], [IntrNoMem]>;
197   def int_x86_sse_max_ps : GCCBuiltin<"__builtin_ia32_maxps">,
198               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
199                          llvm_v4f32_ty], [IntrNoMem]>;
202 // Comparison ops
203 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
204   def int_x86_sse_cmp_ss : GCCBuiltin<"__builtin_ia32_cmpss">,
205               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
206                          llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
207   // NOTE: This comparison intrinsic is not used by clang as long as the
208   //       distinction in signaling behaviour is not implemented.
209   def int_x86_sse_cmp_ps :
210               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
211                          llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
212   def int_x86_sse_comieq_ss : GCCBuiltin<"__builtin_ia32_comieq">,
213               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
214                          llvm_v4f32_ty], [IntrNoMem]>;
215   def int_x86_sse_comilt_ss : GCCBuiltin<"__builtin_ia32_comilt">,
216               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
217                          llvm_v4f32_ty], [IntrNoMem]>;
218   def int_x86_sse_comile_ss : GCCBuiltin<"__builtin_ia32_comile">,
219               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
220                          llvm_v4f32_ty], [IntrNoMem]>;
221   def int_x86_sse_comigt_ss : GCCBuiltin<"__builtin_ia32_comigt">,
222               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
223                          llvm_v4f32_ty], [IntrNoMem]>;
224   def int_x86_sse_comige_ss : GCCBuiltin<"__builtin_ia32_comige">,
225               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
226                          llvm_v4f32_ty], [IntrNoMem]>;
227   def int_x86_sse_comineq_ss : GCCBuiltin<"__builtin_ia32_comineq">,
228               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
229                          llvm_v4f32_ty], [IntrNoMem]>;
230   def int_x86_sse_ucomieq_ss : GCCBuiltin<"__builtin_ia32_ucomieq">,
231               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
232                          llvm_v4f32_ty], [IntrNoMem]>;
233   def int_x86_sse_ucomilt_ss : GCCBuiltin<"__builtin_ia32_ucomilt">,
234               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
235                          llvm_v4f32_ty], [IntrNoMem]>;
236   def int_x86_sse_ucomile_ss : GCCBuiltin<"__builtin_ia32_ucomile">,
237               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
238                          llvm_v4f32_ty], [IntrNoMem]>;
239   def int_x86_sse_ucomigt_ss : GCCBuiltin<"__builtin_ia32_ucomigt">,
240               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
241                          llvm_v4f32_ty], [IntrNoMem]>;
242   def int_x86_sse_ucomige_ss : GCCBuiltin<"__builtin_ia32_ucomige">,
243               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
244                          llvm_v4f32_ty], [IntrNoMem]>;
245   def int_x86_sse_ucomineq_ss : GCCBuiltin<"__builtin_ia32_ucomineq">,
246               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
247                          llvm_v4f32_ty], [IntrNoMem]>;
251 // Conversion ops
252 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
253   def int_x86_sse_cvtss2si : GCCBuiltin<"__builtin_ia32_cvtss2si">,
254               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
255   def int_x86_sse_cvtss2si64 : GCCBuiltin<"__builtin_ia32_cvtss2si64">,
256               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
257   def int_x86_sse_cvttss2si : GCCBuiltin<"__builtin_ia32_cvttss2si">,
258               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
259   def int_x86_sse_cvttss2si64 : GCCBuiltin<"__builtin_ia32_cvttss2si64">,
260               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
262   def int_x86_sse_cvtps2pi : GCCBuiltin<"__builtin_ia32_cvtps2pi">,
263               Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
264   def int_x86_sse_cvttps2pi: GCCBuiltin<"__builtin_ia32_cvttps2pi">,
265               Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
266   def int_x86_sse_cvtpi2ps : GCCBuiltin<"__builtin_ia32_cvtpi2ps">,
267               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
268                          llvm_x86mmx_ty], [IntrNoMem]>;
271 // Cacheability support ops
272 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
273   def int_x86_sse_sfence : GCCBuiltin<"__builtin_ia32_sfence">,
274               Intrinsic<[], [], []>;
277 // Control register.
278 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
279   def int_x86_sse_stmxcsr :
280               Intrinsic<[], [llvm_ptr_ty], []>;
281   def int_x86_sse_ldmxcsr :
282               Intrinsic<[], [llvm_ptr_ty], []>;
285 // Misc.
286 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
287   def int_x86_sse_movmsk_ps : GCCBuiltin<"__builtin_ia32_movmskps">,
288               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
291 //===----------------------------------------------------------------------===//
292 // SSE2
294 // FP arithmetic ops
295 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
296   def int_x86_sse2_min_sd : GCCBuiltin<"__builtin_ia32_minsd">,
297               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
298                          llvm_v2f64_ty], [IntrNoMem]>;
299   def int_x86_sse2_min_pd : GCCBuiltin<"__builtin_ia32_minpd">,
300               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
301                          llvm_v2f64_ty], [IntrNoMem]>;
302   def int_x86_sse2_max_sd : GCCBuiltin<"__builtin_ia32_maxsd">,
303               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
304                          llvm_v2f64_ty], [IntrNoMem]>;
305   def int_x86_sse2_max_pd : GCCBuiltin<"__builtin_ia32_maxpd">,
306               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
307                          llvm_v2f64_ty], [IntrNoMem]>;
310 // FP comparison ops
311 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
312   def int_x86_sse2_cmp_sd : GCCBuiltin<"__builtin_ia32_cmpsd">,
313               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
314                          llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
315   // NOTE: This comparison intrinsic is not used by clang as long as the
316   //       distinction in signaling behaviour is not implemented.
317   def int_x86_sse2_cmp_pd :
318               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
319                          llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
320   def int_x86_sse2_comieq_sd : GCCBuiltin<"__builtin_ia32_comisdeq">,
321               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
322                          llvm_v2f64_ty], [IntrNoMem]>;
323   def int_x86_sse2_comilt_sd : GCCBuiltin<"__builtin_ia32_comisdlt">,
324               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
325                          llvm_v2f64_ty], [IntrNoMem]>;
326   def int_x86_sse2_comile_sd : GCCBuiltin<"__builtin_ia32_comisdle">,
327               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
328                          llvm_v2f64_ty], [IntrNoMem]>;
329   def int_x86_sse2_comigt_sd : GCCBuiltin<"__builtin_ia32_comisdgt">,
330               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
331                          llvm_v2f64_ty], [IntrNoMem]>;
332   def int_x86_sse2_comige_sd : GCCBuiltin<"__builtin_ia32_comisdge">,
333               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
334                          llvm_v2f64_ty], [IntrNoMem]>;
335   def int_x86_sse2_comineq_sd : GCCBuiltin<"__builtin_ia32_comisdneq">,
336               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
337                          llvm_v2f64_ty], [IntrNoMem]>;
338   def int_x86_sse2_ucomieq_sd : GCCBuiltin<"__builtin_ia32_ucomisdeq">,
339               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
340                          llvm_v2f64_ty], [IntrNoMem]>;
341   def int_x86_sse2_ucomilt_sd : GCCBuiltin<"__builtin_ia32_ucomisdlt">,
342               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
343                          llvm_v2f64_ty], [IntrNoMem]>;
344   def int_x86_sse2_ucomile_sd : GCCBuiltin<"__builtin_ia32_ucomisdle">,
345               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
346                          llvm_v2f64_ty], [IntrNoMem]>;
347   def int_x86_sse2_ucomigt_sd : GCCBuiltin<"__builtin_ia32_ucomisdgt">,
348               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
349                          llvm_v2f64_ty], [IntrNoMem]>;
350   def int_x86_sse2_ucomige_sd : GCCBuiltin<"__builtin_ia32_ucomisdge">,
351               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
352                          llvm_v2f64_ty], [IntrNoMem]>;
353   def int_x86_sse2_ucomineq_sd : GCCBuiltin<"__builtin_ia32_ucomisdneq">,
354               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
355                          llvm_v2f64_ty], [IntrNoMem]>;
358 // Integer arithmetic ops.
359 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
360   def int_x86_sse2_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw128">,
361               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
362                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
363   def int_x86_sse2_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw128">,
364               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
365                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
366   def int_x86_sse2_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd128">,
367               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty,
368                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
369   def int_x86_sse2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw128">,
370               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty,
371                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
374 // Integer shift ops.
375 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
376   def int_x86_sse2_psll_w : GCCBuiltin<"__builtin_ia32_psllw128">,
377               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
378                          llvm_v8i16_ty], [IntrNoMem]>;
379   def int_x86_sse2_psll_d : GCCBuiltin<"__builtin_ia32_pslld128">,
380               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
381                          llvm_v4i32_ty], [IntrNoMem]>;
382   def int_x86_sse2_psll_q : GCCBuiltin<"__builtin_ia32_psllq128">,
383               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
384                          llvm_v2i64_ty], [IntrNoMem]>;
385   def int_x86_sse2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw128">,
386               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
387                          llvm_v8i16_ty], [IntrNoMem]>;
388   def int_x86_sse2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld128">,
389               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
390                          llvm_v4i32_ty], [IntrNoMem]>;
391   def int_x86_sse2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq128">,
392               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
393                          llvm_v2i64_ty], [IntrNoMem]>;
394   def int_x86_sse2_psra_w : GCCBuiltin<"__builtin_ia32_psraw128">,
395               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
396                          llvm_v8i16_ty], [IntrNoMem]>;
397   def int_x86_sse2_psra_d : GCCBuiltin<"__builtin_ia32_psrad128">,
398               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
399                          llvm_v4i32_ty], [IntrNoMem]>;
401   def int_x86_sse2_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi128">,
402               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
403                          llvm_i32_ty], [IntrNoMem]>;
404   def int_x86_sse2_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi128">,
405               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
406                          llvm_i32_ty], [IntrNoMem]>;
407   def int_x86_sse2_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi128">,
408               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
409                          llvm_i32_ty], [IntrNoMem]>;
410   def int_x86_sse2_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi128">,
411               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
412                          llvm_i32_ty], [IntrNoMem]>;
413   def int_x86_sse2_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi128">,
414               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
415                          llvm_i32_ty], [IntrNoMem]>;
416   def int_x86_sse2_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi128">,
417               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
418                          llvm_i32_ty], [IntrNoMem]>;
419   def int_x86_sse2_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi128">,
420               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
421                          llvm_i32_ty], [IntrNoMem]>;
422   def int_x86_sse2_psrai_d : GCCBuiltin<"__builtin_ia32_psradi128">,
423               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
424                          llvm_i32_ty], [IntrNoMem]>;
427 // Conversion ops
428 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
429   def int_x86_sse2_cvtpd2dq : GCCBuiltin<"__builtin_ia32_cvtpd2dq">,
430               Intrinsic<[llvm_v4i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
431   def int_x86_sse2_cvttpd2dq : GCCBuiltin<"__builtin_ia32_cvttpd2dq">,
432               Intrinsic<[llvm_v4i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
433   def int_x86_sse2_cvtpd2ps : GCCBuiltin<"__builtin_ia32_cvtpd2ps">,
434               Intrinsic<[llvm_v4f32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
435   def int_x86_sse2_cvtps2dq : GCCBuiltin<"__builtin_ia32_cvtps2dq">,
436               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
437   def int_x86_sse2_cvttps2dq : GCCBuiltin<"__builtin_ia32_cvttps2dq">,
438               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
439   def int_x86_sse2_cvtsd2si : GCCBuiltin<"__builtin_ia32_cvtsd2si">,
440               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
441   def int_x86_sse2_cvtsd2si64 : GCCBuiltin<"__builtin_ia32_cvtsd2si64">,
442               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
443   def int_x86_sse2_cvttsd2si : GCCBuiltin<"__builtin_ia32_cvttsd2si">,
444               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
445   def int_x86_sse2_cvttsd2si64 : GCCBuiltin<"__builtin_ia32_cvttsd2si64">,
446               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
447   def int_x86_sse2_cvtsd2ss : GCCBuiltin<"__builtin_ia32_cvtsd2ss">,
448               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
449                          llvm_v2f64_ty], [IntrNoMem]>;
450   def int_x86_sse_cvtpd2pi : GCCBuiltin<"__builtin_ia32_cvtpd2pi">,
451               Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
452   def int_x86_sse_cvttpd2pi: GCCBuiltin<"__builtin_ia32_cvttpd2pi">,
453               Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
454   def int_x86_sse_cvtpi2pd : GCCBuiltin<"__builtin_ia32_cvtpi2pd">,
455               Intrinsic<[llvm_v2f64_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
458 // Misc.
459 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
460   def int_x86_sse2_packsswb_128 : GCCBuiltin<"__builtin_ia32_packsswb128">,
461               Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
462                          llvm_v8i16_ty], [IntrNoMem]>;
463   def int_x86_sse2_packssdw_128 : GCCBuiltin<"__builtin_ia32_packssdw128">,
464               Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty,
465                          llvm_v4i32_ty], [IntrNoMem]>;
466   def int_x86_sse2_packuswb_128 : GCCBuiltin<"__builtin_ia32_packuswb128">,
467               Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
468                          llvm_v8i16_ty], [IntrNoMem]>;
469   def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">,
470               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
471   def int_x86_sse2_pmovmskb_128 : GCCBuiltin<"__builtin_ia32_pmovmskb128">,
472               Intrinsic<[llvm_i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
473   def int_x86_sse2_maskmov_dqu : GCCBuiltin<"__builtin_ia32_maskmovdqu">,
474               Intrinsic<[], [llvm_v16i8_ty,
475                          llvm_v16i8_ty, llvm_ptr_ty], []>;
476   def int_x86_sse2_clflush : GCCBuiltin<"__builtin_ia32_clflush">,
477               Intrinsic<[], [llvm_ptr_ty], []>;
478   def int_x86_sse2_lfence : GCCBuiltin<"__builtin_ia32_lfence">,
479               Intrinsic<[], [], []>;
480   def int_x86_sse2_mfence : GCCBuiltin<"__builtin_ia32_mfence">,
481               Intrinsic<[], [], []>;
482   def int_x86_sse2_pause : GCCBuiltin<"__builtin_ia32_pause">,
483               Intrinsic<[], [], []>;
486 //===----------------------------------------------------------------------===//
487 // SSE3
489 // Addition / subtraction ops.
490 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
491   def int_x86_sse3_addsub_ps : GCCBuiltin<"__builtin_ia32_addsubps">,
492               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
493                          llvm_v4f32_ty], [IntrNoMem]>;
494   def int_x86_sse3_addsub_pd : GCCBuiltin<"__builtin_ia32_addsubpd">,
495               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
496                          llvm_v2f64_ty], [IntrNoMem]>;
499 // Horizontal ops.
500 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
501   def int_x86_sse3_hadd_ps : GCCBuiltin<"__builtin_ia32_haddps">,
502               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
503                          llvm_v4f32_ty], [IntrNoMem]>;
504   def int_x86_sse3_hadd_pd : GCCBuiltin<"__builtin_ia32_haddpd">,
505               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
506                          llvm_v2f64_ty], [IntrNoMem]>;
507   def int_x86_sse3_hsub_ps : GCCBuiltin<"__builtin_ia32_hsubps">,
508               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
509                          llvm_v4f32_ty], [IntrNoMem]>;
510   def int_x86_sse3_hsub_pd : GCCBuiltin<"__builtin_ia32_hsubpd">,
511               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
512                          llvm_v2f64_ty], [IntrNoMem]>;
515 // Specialized unaligned load.
516 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
517   def int_x86_sse3_ldu_dq : GCCBuiltin<"__builtin_ia32_lddqu">,
518               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrReadMem]>;
521 // Thread synchronization ops.
522 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
523   def int_x86_sse3_monitor : GCCBuiltin<"__builtin_ia32_monitor">,
524               Intrinsic<[], [llvm_ptr_ty,
525                          llvm_i32_ty, llvm_i32_ty], []>;
526   def int_x86_sse3_mwait : GCCBuiltin<"__builtin_ia32_mwait">,
527               Intrinsic<[], [llvm_i32_ty,
528                          llvm_i32_ty], []>;
531 //===----------------------------------------------------------------------===//
532 // SSSE3
534 // Horizontal arithmetic ops
535 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
536   def int_x86_ssse3_phadd_w         : GCCBuiltin<"__builtin_ia32_phaddw">,
537               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
538                          llvm_x86mmx_ty], [IntrNoMem]>;
539   def int_x86_ssse3_phadd_w_128     : GCCBuiltin<"__builtin_ia32_phaddw128">,
540               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
541                          llvm_v8i16_ty], [IntrNoMem]>;
543   def int_x86_ssse3_phadd_d         : GCCBuiltin<"__builtin_ia32_phaddd">,
544               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
545                          llvm_x86mmx_ty], [IntrNoMem]>;
546   def int_x86_ssse3_phadd_d_128     : GCCBuiltin<"__builtin_ia32_phaddd128">,
547               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
548                          llvm_v4i32_ty], [IntrNoMem]>;
550   def int_x86_ssse3_phadd_sw        : GCCBuiltin<"__builtin_ia32_phaddsw">,
551               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
552                          llvm_x86mmx_ty], [IntrNoMem]>;
553   def int_x86_ssse3_phadd_sw_128    : GCCBuiltin<"__builtin_ia32_phaddsw128">,
554               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
555                          llvm_v8i16_ty], [IntrNoMem]>;
557   def int_x86_ssse3_phsub_w         : GCCBuiltin<"__builtin_ia32_phsubw">,
558               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
559                          llvm_x86mmx_ty], [IntrNoMem]>;
560   def int_x86_ssse3_phsub_w_128     : GCCBuiltin<"__builtin_ia32_phsubw128">,
561               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
562                          llvm_v8i16_ty], [IntrNoMem]>;
564   def int_x86_ssse3_phsub_d         : GCCBuiltin<"__builtin_ia32_phsubd">,
565               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
566                          llvm_x86mmx_ty], [IntrNoMem]>;
567   def int_x86_ssse3_phsub_d_128     : GCCBuiltin<"__builtin_ia32_phsubd128">,
568               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
569                          llvm_v4i32_ty], [IntrNoMem]>;
571   def int_x86_ssse3_phsub_sw        : GCCBuiltin<"__builtin_ia32_phsubsw">,
572               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
573                          llvm_x86mmx_ty], [IntrNoMem]>;
574   def int_x86_ssse3_phsub_sw_128    : GCCBuiltin<"__builtin_ia32_phsubsw128">,
575               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
576                          llvm_v8i16_ty], [IntrNoMem]>;
578   def int_x86_ssse3_pmadd_ub_sw     : GCCBuiltin<"__builtin_ia32_pmaddubsw">,
579               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
580                          llvm_x86mmx_ty], [IntrNoMem]>;
581   def int_x86_ssse3_pmadd_ub_sw_128 : GCCBuiltin<"__builtin_ia32_pmaddubsw128">,
582               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty,
583                          llvm_v16i8_ty], [IntrNoMem]>;
586 // Packed multiply high with round and scale
587 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
588   def int_x86_ssse3_pmul_hr_sw      : GCCBuiltin<"__builtin_ia32_pmulhrsw">,
589               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
590                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
591   def int_x86_ssse3_pmul_hr_sw_128  : GCCBuiltin<"__builtin_ia32_pmulhrsw128">,
592               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
593                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
596 // Shuffle ops
597 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
598   def int_x86_ssse3_pshuf_b         : GCCBuiltin<"__builtin_ia32_pshufb">,
599               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
600                          llvm_x86mmx_ty], [IntrNoMem]>;
601   def int_x86_ssse3_pshuf_b_128     : GCCBuiltin<"__builtin_ia32_pshufb128">,
602               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
603                          llvm_v16i8_ty], [IntrNoMem]>;
604   def int_x86_sse_pshuf_w           : GCCBuiltin<"__builtin_ia32_pshufw">,
605               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_i8_ty],
606                          [IntrNoMem]>;
609 // Sign ops
610 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
611   def int_x86_ssse3_psign_b         : GCCBuiltin<"__builtin_ia32_psignb">,
612               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
613                          llvm_x86mmx_ty], [IntrNoMem]>;
614   def int_x86_ssse3_psign_b_128     : GCCBuiltin<"__builtin_ia32_psignb128">,
615               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
616                          llvm_v16i8_ty], [IntrNoMem]>;
618   def int_x86_ssse3_psign_w         : GCCBuiltin<"__builtin_ia32_psignw">,
619               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
620                          llvm_x86mmx_ty], [IntrNoMem]>;
621   def int_x86_ssse3_psign_w_128     : GCCBuiltin<"__builtin_ia32_psignw128">,
622               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
623                          llvm_v8i16_ty], [IntrNoMem]>;
625   def int_x86_ssse3_psign_d         : GCCBuiltin<"__builtin_ia32_psignd">,
626               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
627                          llvm_x86mmx_ty], [IntrNoMem]>;
628   def int_x86_ssse3_psign_d_128     : GCCBuiltin<"__builtin_ia32_psignd128">,
629               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
630                          llvm_v4i32_ty], [IntrNoMem]>;
633 // Absolute value ops
634 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
635   def int_x86_ssse3_pabs_b     : GCCBuiltin<"__builtin_ia32_pabsb">,
636               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
638   def int_x86_ssse3_pabs_w     : GCCBuiltin<"__builtin_ia32_pabsw">,
639               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
641   def int_x86_ssse3_pabs_d     : GCCBuiltin<"__builtin_ia32_pabsd">,
642               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
645 //===----------------------------------------------------------------------===//
646 // SSE4.1
648 // FP rounding ops
649 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
650   def int_x86_sse41_round_ss        : GCCBuiltin<"__builtin_ia32_roundss">,
651               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
652                          llvm_i32_ty], [IntrNoMem]>;
653   def int_x86_sse41_round_ps        : GCCBuiltin<"__builtin_ia32_roundps">,
654               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
655                          llvm_i32_ty], [IntrNoMem]>;
656   def int_x86_sse41_round_sd        : GCCBuiltin<"__builtin_ia32_roundsd">,
657               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
658                          llvm_i32_ty], [IntrNoMem]>;
659   def int_x86_sse41_round_pd        : GCCBuiltin<"__builtin_ia32_roundpd">,
660               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
661                          llvm_i32_ty], [IntrNoMem]>;
664 // Vector min element
665 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
666   def int_x86_sse41_phminposuw     : GCCBuiltin<"__builtin_ia32_phminposuw128">,
667               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty],
668                         [IntrNoMem]>;
671 // Advanced Encryption Standard (AES) Instructions
672 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
673   def int_x86_aesni_aesimc          : GCCBuiltin<"__builtin_ia32_aesimc128">,
674               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty],
675                         [IntrNoMem]>;
677   def int_x86_aesni_aesenc          : GCCBuiltin<"__builtin_ia32_aesenc128">,
678               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
679                         [IntrNoMem]>;
680   def int_x86_aesni_aesenc_256      : GCCBuiltin<"__builtin_ia32_aesenc256">,
681               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
682                         [IntrNoMem]>;
683   def int_x86_aesni_aesenc_512      : GCCBuiltin<"__builtin_ia32_aesenc512">,
684               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
685                         [IntrNoMem]>;
687   def int_x86_aesni_aesenclast : GCCBuiltin<"__builtin_ia32_aesenclast128">,
688               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
689                         [IntrNoMem]>;
690   def int_x86_aesni_aesenclast_256 :
691     GCCBuiltin<"__builtin_ia32_aesenclast256">,
692     Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
693               [IntrNoMem]>;
694   def int_x86_aesni_aesenclast_512 :
695     GCCBuiltin<"__builtin_ia32_aesenclast512">,
696     Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
697               [IntrNoMem]>;
699   def int_x86_aesni_aesdec          : GCCBuiltin<"__builtin_ia32_aesdec128">,
700               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
701                         [IntrNoMem]>;
702   def int_x86_aesni_aesdec_256      : GCCBuiltin<"__builtin_ia32_aesdec256">,
703               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
704                         [IntrNoMem]>;
705   def int_x86_aesni_aesdec_512      : GCCBuiltin<"__builtin_ia32_aesdec512">,
706               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
707                         [IntrNoMem]>;
709   def int_x86_aesni_aesdeclast : GCCBuiltin<"__builtin_ia32_aesdeclast128">,
710               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
711                         [IntrNoMem]>;
712   def int_x86_aesni_aesdeclast_256 :
713     GCCBuiltin<"__builtin_ia32_aesdeclast256">,
714     Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
715               [IntrNoMem]>;
716   def int_x86_aesni_aesdeclast_512 :
717     GCCBuiltin<"__builtin_ia32_aesdeclast512">,
718     Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
719               [IntrNoMem]>;
721   def int_x86_aesni_aeskeygenassist :
722               GCCBuiltin<"__builtin_ia32_aeskeygenassist128">,
723               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty],
724                         [IntrNoMem]>;
727 // PCLMUL instructions
728 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
729   def int_x86_pclmulqdq : GCCBuiltin<"__builtin_ia32_pclmulqdq128">,
730           Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
731                     [IntrNoMem]>;
732   def int_x86_pclmulqdq_256 : GCCBuiltin<"__builtin_ia32_pclmulqdq256">,
733           Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
734                     [IntrNoMem]>;
735   def int_x86_pclmulqdq_512 : GCCBuiltin<"__builtin_ia32_pclmulqdq512">,
736           Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty, llvm_i8_ty],
737                     [IntrNoMem]>;
740 // Vector pack
741 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
742   def int_x86_sse41_packusdw        : GCCBuiltin<"__builtin_ia32_packusdw128">,
743               Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
744                         [IntrNoMem]>;
747 // Vector insert
748 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
749   def int_x86_sse41_insertps       : GCCBuiltin<"__builtin_ia32_insertps128">,
750           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i8_ty],
751                     [IntrNoMem]>;
754 // Vector blend
755 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
756   def int_x86_sse41_pblendvb         : GCCBuiltin<"__builtin_ia32_pblendvb128">,
757         Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,llvm_v16i8_ty],
758                   [IntrNoMem]>;
759   def int_x86_sse41_blendvpd         : GCCBuiltin<"__builtin_ia32_blendvpd">,
760         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,llvm_v2f64_ty],
761                   [IntrNoMem]>;
762   def int_x86_sse41_blendvps         : GCCBuiltin<"__builtin_ia32_blendvps">,
763         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,llvm_v4f32_ty],
764                   [IntrNoMem]>;
767 // Vector dot product
768 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
769   def int_x86_sse41_dppd            : GCCBuiltin<"__builtin_ia32_dppd">,
770           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i8_ty],
771                     [IntrNoMem, Commutative]>;
772   def int_x86_sse41_dpps            : GCCBuiltin<"__builtin_ia32_dpps">,
773           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i8_ty],
774                     [IntrNoMem, Commutative]>;
777 // Vector sum of absolute differences
778 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
779   def int_x86_sse41_mpsadbw         : GCCBuiltin<"__builtin_ia32_mpsadbw128">,
780           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty,llvm_i8_ty],
781                     [IntrNoMem, Commutative]>;
784 // Test instruction with bitwise comparison.
785 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
786   def int_x86_sse41_ptestz          : GCCBuiltin<"__builtin_ia32_ptestz128">,
787           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
788                     [IntrNoMem]>;
789   def int_x86_sse41_ptestc          : GCCBuiltin<"__builtin_ia32_ptestc128">,
790           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
791                     [IntrNoMem]>;
792   def int_x86_sse41_ptestnzc        : GCCBuiltin<"__builtin_ia32_ptestnzc128">,
793           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
794                     [IntrNoMem]>;
797 //===----------------------------------------------------------------------===//
798 // SSE4.2
800 // Miscellaneous
801 // CRC Instruction
802 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
803   def int_x86_sse42_crc32_32_8       : GCCBuiltin<"__builtin_ia32_crc32qi">,
804           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i8_ty],
805                     [IntrNoMem]>;
806   def int_x86_sse42_crc32_32_16      : GCCBuiltin<"__builtin_ia32_crc32hi">,
807           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i16_ty],
808                     [IntrNoMem]>;
809   def int_x86_sse42_crc32_32_32      : GCCBuiltin<"__builtin_ia32_crc32si">,
810           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
811                     [IntrNoMem]>;
812   def int_x86_sse42_crc32_64_64      : GCCBuiltin<"__builtin_ia32_crc32di">,
813           Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
814                     [IntrNoMem]>;
817 // String/text processing ops.
818 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
819   def int_x86_sse42_pcmpistrm128  : GCCBuiltin<"__builtin_ia32_pcmpistrm128">,
820     Intrinsic<[llvm_v16i8_ty],
821         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
822         [IntrNoMem]>;
823   def int_x86_sse42_pcmpistri128  : GCCBuiltin<"__builtin_ia32_pcmpistri128">,
824     Intrinsic<[llvm_i32_ty],
825         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
826         [IntrNoMem]>;
827   def int_x86_sse42_pcmpistria128 : GCCBuiltin<"__builtin_ia32_pcmpistria128">,
828     Intrinsic<[llvm_i32_ty],
829         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
830         [IntrNoMem]>;
831   def int_x86_sse42_pcmpistric128 : GCCBuiltin<"__builtin_ia32_pcmpistric128">,
832     Intrinsic<[llvm_i32_ty],
833         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
834         [IntrNoMem]>;
835   def int_x86_sse42_pcmpistrio128 : GCCBuiltin<"__builtin_ia32_pcmpistrio128">,
836     Intrinsic<[llvm_i32_ty],
837         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
838         [IntrNoMem]>;
839   def int_x86_sse42_pcmpistris128 : GCCBuiltin<"__builtin_ia32_pcmpistris128">,
840     Intrinsic<[llvm_i32_ty],
841         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
842         [IntrNoMem]>;
843   def int_x86_sse42_pcmpistriz128 : GCCBuiltin<"__builtin_ia32_pcmpistriz128">,
844     Intrinsic<[llvm_i32_ty],
845         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
846         [IntrNoMem]>;
847   def int_x86_sse42_pcmpestrm128  : GCCBuiltin<"__builtin_ia32_pcmpestrm128">,
848     Intrinsic<[llvm_v16i8_ty],
849         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
850          llvm_i8_ty],
851         [IntrNoMem]>;
852   def int_x86_sse42_pcmpestri128  : GCCBuiltin<"__builtin_ia32_pcmpestri128">,
853     Intrinsic<[llvm_i32_ty],
854         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
855          llvm_i8_ty],
856         [IntrNoMem]>;
857   def int_x86_sse42_pcmpestria128 : GCCBuiltin<"__builtin_ia32_pcmpestria128">,
858     Intrinsic<[llvm_i32_ty],
859         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
860          llvm_i8_ty],
861         [IntrNoMem]>;
862   def int_x86_sse42_pcmpestric128 : GCCBuiltin<"__builtin_ia32_pcmpestric128">,
863     Intrinsic<[llvm_i32_ty],
864         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
865          llvm_i8_ty],
866         [IntrNoMem]>;
867   def int_x86_sse42_pcmpestrio128 : GCCBuiltin<"__builtin_ia32_pcmpestrio128">,
868     Intrinsic<[llvm_i32_ty],
869         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
870          llvm_i8_ty],
871         [IntrNoMem]>;
872   def int_x86_sse42_pcmpestris128 : GCCBuiltin<"__builtin_ia32_pcmpestris128">,
873     Intrinsic<[llvm_i32_ty],
874         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
875          llvm_i8_ty],
876         [IntrNoMem]>;
877   def int_x86_sse42_pcmpestriz128 : GCCBuiltin<"__builtin_ia32_pcmpestriz128">,
878     Intrinsic<[llvm_i32_ty],
879         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
880          llvm_i8_ty],
881         [IntrNoMem]>;
884 //===----------------------------------------------------------------------===//
885 // SSE4A
887 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
888   def int_x86_sse4a_extrqi : GCCBuiltin<"__builtin_ia32_extrqi">,
889     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty, llvm_i8_ty],
890               [IntrNoMem]>;
891   def int_x86_sse4a_extrq  : GCCBuiltin<"__builtin_ia32_extrq">,
892     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v16i8_ty], [IntrNoMem]>;
894   def int_x86_sse4a_insertqi : GCCBuiltin<"__builtin_ia32_insertqi">,
895     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
896                                 llvm_i8_ty, llvm_i8_ty], [IntrNoMem]>;
897   def int_x86_sse4a_insertq  : GCCBuiltin<"__builtin_ia32_insertq">,
898     Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>;
901 //===----------------------------------------------------------------------===//
902 // AVX
904 // Arithmetic ops
905 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
906   def int_x86_avx_addsub_pd_256 : GCCBuiltin<"__builtin_ia32_addsubpd256">,
907         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
908                   llvm_v4f64_ty], [IntrNoMem]>;
909   def int_x86_avx_addsub_ps_256 : GCCBuiltin<"__builtin_ia32_addsubps256">,
910         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
911                   llvm_v8f32_ty], [IntrNoMem]>;
912   def int_x86_avx_max_pd_256 : GCCBuiltin<"__builtin_ia32_maxpd256">,
913         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
914                   llvm_v4f64_ty], [IntrNoMem]>;
915   def int_x86_avx_max_ps_256 : GCCBuiltin<"__builtin_ia32_maxps256">,
916         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
917                   llvm_v8f32_ty], [IntrNoMem]>;
918   def int_x86_avx_min_pd_256 : GCCBuiltin<"__builtin_ia32_minpd256">,
919         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
920                   llvm_v4f64_ty], [IntrNoMem]>;
921   def int_x86_avx_min_ps_256 : GCCBuiltin<"__builtin_ia32_minps256">,
922         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
923                   llvm_v8f32_ty], [IntrNoMem]>;
925   def int_x86_avx_rsqrt_ps_256 : GCCBuiltin<"__builtin_ia32_rsqrtps256">,
926         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
928   def int_x86_avx_rcp_ps_256 : GCCBuiltin<"__builtin_ia32_rcpps256">,
929         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
931   def int_x86_avx_round_pd_256 : GCCBuiltin<"__builtin_ia32_roundpd256">,
932         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
933                   llvm_i32_ty], [IntrNoMem]>;
934   def int_x86_avx_round_ps_256 : GCCBuiltin<"__builtin_ia32_roundps256">,
935         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
936                   llvm_i32_ty], [IntrNoMem]>;
939 // Horizontal ops
940 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
941   def int_x86_avx_hadd_pd_256 : GCCBuiltin<"__builtin_ia32_haddpd256">,
942         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
943                   llvm_v4f64_ty], [IntrNoMem]>;
944   def int_x86_avx_hsub_ps_256 : GCCBuiltin<"__builtin_ia32_hsubps256">,
945         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
946                   llvm_v8f32_ty], [IntrNoMem]>;
947   def int_x86_avx_hsub_pd_256 : GCCBuiltin<"__builtin_ia32_hsubpd256">,
948         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
949                   llvm_v4f64_ty], [IntrNoMem]>;
950   def int_x86_avx_hadd_ps_256 : GCCBuiltin<"__builtin_ia32_haddps256">,
951         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
952                   llvm_v8f32_ty], [IntrNoMem]>;
955 // Vector permutation
956 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
957   def int_x86_avx_vpermilvar_pd : GCCBuiltin<"__builtin_ia32_vpermilvarpd">,
958         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
959                   llvm_v2i64_ty], [IntrNoMem]>;
960   def int_x86_avx_vpermilvar_ps : GCCBuiltin<"__builtin_ia32_vpermilvarps">,
961         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
962                   llvm_v4i32_ty], [IntrNoMem]>;
964   def int_x86_avx_vpermilvar_pd_256 :
965         GCCBuiltin<"__builtin_ia32_vpermilvarpd256">,
966         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4i64_ty], [IntrNoMem]>;
967   def int_x86_avx_vpermilvar_ps_256 :
968         GCCBuiltin<"__builtin_ia32_vpermilvarps256">,
969         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8i32_ty], [IntrNoMem]>;
971   def int_x86_avx512_vpermi2var_d_128 :
972        GCCBuiltin<"__builtin_ia32_vpermi2vard128">,
973        Intrinsic<[llvm_v4i32_ty],
974                  [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
976   def int_x86_avx512_vpermi2var_d_256 :
977         GCCBuiltin<"__builtin_ia32_vpermi2vard256">,
978         Intrinsic<[llvm_v8i32_ty],
979                   [llvm_v8i32_ty, llvm_v8i32_ty, llvm_v8i32_ty], [IntrNoMem]>;
981   def int_x86_avx512_vpermi2var_d_512 :
982         GCCBuiltin<"__builtin_ia32_vpermi2vard512">,
983         Intrinsic<[llvm_v16i32_ty],
984                   [llvm_v16i32_ty, llvm_v16i32_ty, llvm_v16i32_ty],
985                   [IntrNoMem]>;
987   def int_x86_avx512_vpermi2var_hi_128 :
988         GCCBuiltin<"__builtin_ia32_vpermi2varhi128">,
989         Intrinsic<[llvm_v8i16_ty],
990                   [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>;
992   def int_x86_avx512_vpermi2var_hi_256 :
993         GCCBuiltin<"__builtin_ia32_vpermi2varhi256">,
994         Intrinsic<[llvm_v16i16_ty],
995                   [llvm_v16i16_ty, llvm_v16i16_ty, llvm_v16i16_ty],
996                   [IntrNoMem]>;
998   def int_x86_avx512_vpermi2var_hi_512 :
999         GCCBuiltin<"__builtin_ia32_vpermi2varhi512">,
1000         Intrinsic<[llvm_v32i16_ty],
1001                   [llvm_v32i16_ty, llvm_v32i16_ty, llvm_v32i16_ty],
1002                   [IntrNoMem]>;
1004   def int_x86_avx512_vpermi2var_pd_128 :
1005         GCCBuiltin<"__builtin_ia32_vpermi2varpd128">,
1006         Intrinsic<[llvm_v2f64_ty],
1007                   [llvm_v2f64_ty, llvm_v2i64_ty, llvm_v2f64_ty], [IntrNoMem]>;
1009   def int_x86_avx512_vpermi2var_pd_256 :
1010         GCCBuiltin<"__builtin_ia32_vpermi2varpd256">,
1011         Intrinsic<[llvm_v4f64_ty],
1012                   [llvm_v4f64_ty, llvm_v4i64_ty, llvm_v4f64_ty], [IntrNoMem]>;
1014   def int_x86_avx512_vpermi2var_pd_512 :
1015         GCCBuiltin<"__builtin_ia32_vpermi2varpd512">,
1016         Intrinsic<[llvm_v8f64_ty],
1017                   [llvm_v8f64_ty, llvm_v8i64_ty, llvm_v8f64_ty], [IntrNoMem]>;
1019   def int_x86_avx512_vpermi2var_ps_128 :
1020         GCCBuiltin<"__builtin_ia32_vpermi2varps128">,
1021         Intrinsic<[llvm_v4f32_ty],
1022                   [llvm_v4f32_ty, llvm_v4i32_ty, llvm_v4f32_ty], [IntrNoMem]>;
1024   def int_x86_avx512_vpermi2var_ps_256 :
1025         GCCBuiltin<"__builtin_ia32_vpermi2varps256">,
1026         Intrinsic<[llvm_v8f32_ty],
1027                   [llvm_v8f32_ty, llvm_v8i32_ty, llvm_v8f32_ty], [IntrNoMem]>;
1029   def int_x86_avx512_vpermi2var_ps_512 :
1030         GCCBuiltin<"__builtin_ia32_vpermi2varps512">,
1031         Intrinsic<[llvm_v16f32_ty],
1032                   [llvm_v16f32_ty, llvm_v16i32_ty, llvm_v16f32_ty],
1033                   [IntrNoMem]>;
1035   def int_x86_avx512_vpermi2var_q_128 :
1036         GCCBuiltin<"__builtin_ia32_vpermi2varq128">,
1037         Intrinsic<[llvm_v2i64_ty],
1038                   [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty], [IntrNoMem]>;
1040   def int_x86_avx512_vpermi2var_q_256 :
1041         GCCBuiltin<"__builtin_ia32_vpermi2varq256">,
1042         Intrinsic<[llvm_v4i64_ty],
1043                   [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty], [IntrNoMem]>;
1045   def int_x86_avx512_vpermi2var_q_512 :
1046         GCCBuiltin<"__builtin_ia32_vpermi2varq512">,
1047         Intrinsic<[llvm_v8i64_ty],
1048                   [llvm_v8i64_ty, llvm_v8i64_ty, llvm_v8i64_ty], [IntrNoMem]>;
1050   def int_x86_avx512_vpermi2var_qi_128 :
1051         GCCBuiltin<"__builtin_ia32_vpermi2varqi128">,
1052         Intrinsic<[llvm_v16i8_ty],
1053                   [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
1055   def int_x86_avx512_vpermi2var_qi_256 :
1056         GCCBuiltin<"__builtin_ia32_vpermi2varqi256">,
1057         Intrinsic<[llvm_v32i8_ty],
1058                   [llvm_v32i8_ty, llvm_v32i8_ty, llvm_v32i8_ty], [IntrNoMem]>;
1060   def int_x86_avx512_vpermi2var_qi_512 :
1061         GCCBuiltin<"__builtin_ia32_vpermi2varqi512">,
1062         Intrinsic<[llvm_v64i8_ty],
1063                   [llvm_v64i8_ty, llvm_v64i8_ty, llvm_v64i8_ty], [IntrNoMem]>;
1065   def int_x86_avx512_vpermilvar_pd_512 :
1066         GCCBuiltin<"__builtin_ia32_vpermilvarpd512">,
1067           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8i64_ty],
1068           [IntrNoMem]>;
1070   def int_x86_avx512_vpermilvar_ps_512 :
1071         GCCBuiltin<"__builtin_ia32_vpermilvarps512">,
1072           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16i32_ty],
1073           [IntrNoMem]>;
1075   def int_x86_avx512_pshuf_b_512 :
1076         GCCBuiltin<"__builtin_ia32_pshufb512">,
1077           Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty, llvm_v64i8_ty],
1078           [IntrNoMem]>;
1082 // GFNI Instructions
1083 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1084   def int_x86_vgf2p8affineinvqb_128 :
1085          GCCBuiltin<"__builtin_ia32_vgf2p8affineinvqb_v16qi">,
1086           Intrinsic<[llvm_v16i8_ty],
1087           [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
1088           [IntrNoMem]>;
1089   def int_x86_vgf2p8affineinvqb_256 :
1090          GCCBuiltin<"__builtin_ia32_vgf2p8affineinvqb_v32qi">,
1091           Intrinsic<[llvm_v32i8_ty],
1092           [llvm_v32i8_ty, llvm_v32i8_ty, llvm_i8_ty],
1093           [IntrNoMem]>;
1094   def int_x86_vgf2p8affineinvqb_512 :
1095          GCCBuiltin<"__builtin_ia32_vgf2p8affineinvqb_v64qi">,
1096           Intrinsic<[llvm_v64i8_ty],
1097           [llvm_v64i8_ty, llvm_v64i8_ty, llvm_i8_ty],
1098           [IntrNoMem]>;
1100   def int_x86_vgf2p8affineqb_128 :
1101          GCCBuiltin<"__builtin_ia32_vgf2p8affineqb_v16qi">,
1102           Intrinsic<[llvm_v16i8_ty],
1103           [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
1104           [IntrNoMem]>;
1105   def int_x86_vgf2p8affineqb_256 :
1106          GCCBuiltin<"__builtin_ia32_vgf2p8affineqb_v32qi">,
1107           Intrinsic<[llvm_v32i8_ty],
1108           [llvm_v32i8_ty, llvm_v32i8_ty, llvm_i8_ty],
1109           [IntrNoMem]>;
1110   def int_x86_vgf2p8affineqb_512 :
1111          GCCBuiltin<"__builtin_ia32_vgf2p8affineqb_v64qi">,
1112           Intrinsic<[llvm_v64i8_ty],
1113           [llvm_v64i8_ty, llvm_v64i8_ty, llvm_i8_ty],
1114           [IntrNoMem]>;
1116   def int_x86_vgf2p8mulb_128     :
1117          GCCBuiltin<"__builtin_ia32_vgf2p8mulb_v16qi">,
1118           Intrinsic<[llvm_v16i8_ty],
1119           [llvm_v16i8_ty, llvm_v16i8_ty],
1120           [IntrNoMem]>;
1121   def int_x86_vgf2p8mulb_256     :
1122          GCCBuiltin<"__builtin_ia32_vgf2p8mulb_v32qi">,
1123           Intrinsic<[llvm_v32i8_ty],
1124           [llvm_v32i8_ty, llvm_v32i8_ty],
1125           [IntrNoMem]>;
1126   def int_x86_vgf2p8mulb_512     :
1127          GCCBuiltin<"__builtin_ia32_vgf2p8mulb_v64qi">,
1128           Intrinsic<[llvm_v64i8_ty],
1129           [llvm_v64i8_ty, llvm_v64i8_ty],
1130           [IntrNoMem]>;
1133 // Vector blend
1134 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1135   def int_x86_avx_blendv_pd_256 : GCCBuiltin<"__builtin_ia32_blendvpd256">,
1136         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1137                   llvm_v4f64_ty, llvm_v4f64_ty], [IntrNoMem]>;
1138   def int_x86_avx_blendv_ps_256 : GCCBuiltin<"__builtin_ia32_blendvps256">,
1139         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1140                   llvm_v8f32_ty, llvm_v8f32_ty], [IntrNoMem]>;
1143 // Vector dot product
1144 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1145   def int_x86_avx_dp_ps_256 : GCCBuiltin<"__builtin_ia32_dpps256">,
1146         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1147                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem, Commutative]>;
1150 // Vector compare
1151 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1152   def int_x86_avx_cmp_pd_256 :
1153         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
1154                   llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
1155   def int_x86_avx_cmp_ps_256 :
1156         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
1157                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
1160 // Vector convert
1161 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1162   def int_x86_avx_cvt_pd2_ps_256 : GCCBuiltin<"__builtin_ia32_cvtpd2ps256">,
1163         Intrinsic<[llvm_v4f32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1164   def int_x86_avx_cvt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvtps2dq256">,
1165         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1166   def int_x86_avx_cvtt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvttpd2dq256">,
1167         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1168   def int_x86_avx_cvt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvtpd2dq256">,
1169         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1170   def int_x86_avx_cvtt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvttps2dq256">,
1171         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1174 // Vector bit test
1175 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1176   def int_x86_avx_vtestz_pd : GCCBuiltin<"__builtin_ia32_vtestzpd">,
1177         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
1178                   llvm_v2f64_ty], [IntrNoMem]>;
1179   def int_x86_avx_vtestc_pd : GCCBuiltin<"__builtin_ia32_vtestcpd">,
1180         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
1181                   llvm_v2f64_ty], [IntrNoMem]>;
1182   def int_x86_avx_vtestnzc_pd : GCCBuiltin<"__builtin_ia32_vtestnzcpd">,
1183         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
1184                   llvm_v2f64_ty], [IntrNoMem]>;
1185   def int_x86_avx_vtestz_ps : GCCBuiltin<"__builtin_ia32_vtestzps">,
1186         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
1187                   llvm_v4f32_ty], [IntrNoMem]>;
1188   def int_x86_avx_vtestc_ps : GCCBuiltin<"__builtin_ia32_vtestcps">,
1189         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
1190                   llvm_v4f32_ty], [IntrNoMem]>;
1191   def int_x86_avx_vtestnzc_ps : GCCBuiltin<"__builtin_ia32_vtestnzcps">,
1192         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
1193                   llvm_v4f32_ty], [IntrNoMem]>;
1194   def int_x86_avx_vtestz_pd_256 : GCCBuiltin<"__builtin_ia32_vtestzpd256">,
1195         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
1196                   llvm_v4f64_ty], [IntrNoMem]>;
1197   def int_x86_avx_vtestc_pd_256 : GCCBuiltin<"__builtin_ia32_vtestcpd256">,
1198         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
1199                   llvm_v4f64_ty], [IntrNoMem]>;
1200   def int_x86_avx_vtestnzc_pd_256 : GCCBuiltin<"__builtin_ia32_vtestnzcpd256">,
1201         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
1202                   llvm_v4f64_ty], [IntrNoMem]>;
1203   def int_x86_avx_vtestz_ps_256 : GCCBuiltin<"__builtin_ia32_vtestzps256">,
1204         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
1205                   llvm_v8f32_ty], [IntrNoMem]>;
1206   def int_x86_avx_vtestc_ps_256 : GCCBuiltin<"__builtin_ia32_vtestcps256">,
1207         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
1208                   llvm_v8f32_ty], [IntrNoMem]>;
1209   def int_x86_avx_vtestnzc_ps_256 : GCCBuiltin<"__builtin_ia32_vtestnzcps256">,
1210         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
1211                   llvm_v8f32_ty], [IntrNoMem]>;
1212   def int_x86_avx_ptestz_256 : GCCBuiltin<"__builtin_ia32_ptestz256">,
1213         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
1214                   llvm_v4i64_ty], [IntrNoMem]>;
1215   def int_x86_avx_ptestc_256 : GCCBuiltin<"__builtin_ia32_ptestc256">,
1216         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
1217                   llvm_v4i64_ty], [IntrNoMem]>;
1218   def int_x86_avx_ptestnzc_256 : GCCBuiltin<"__builtin_ia32_ptestnzc256">,
1219         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
1220                   llvm_v4i64_ty], [IntrNoMem]>;
1222   def int_x86_avx512_fpclass_pd_128 :
1223           Intrinsic<[llvm_v2i1_ty], [llvm_v2f64_ty, llvm_i32_ty],
1224           [IntrNoMem]>;
1225   def int_x86_avx512_fpclass_pd_256 :
1226           Intrinsic<[llvm_v4i1_ty], [llvm_v4f64_ty, llvm_i32_ty],
1227           [IntrNoMem]>;
1228   def int_x86_avx512_fpclass_pd_512 :
1229           Intrinsic<[llvm_v8i1_ty], [llvm_v8f64_ty, llvm_i32_ty],
1230           [IntrNoMem]>;
1231   def int_x86_avx512_fpclass_ps_128 :
1232           Intrinsic<[llvm_v4i1_ty], [llvm_v4f32_ty, llvm_i32_ty],
1233           [IntrNoMem]>;
1234   def int_x86_avx512_fpclass_ps_256 :
1235           Intrinsic<[llvm_v8i1_ty], [llvm_v8f32_ty, llvm_i32_ty],
1236           [IntrNoMem]>;
1237   def int_x86_avx512_fpclass_ps_512 :
1238           Intrinsic<[llvm_v16i1_ty], [llvm_v16f32_ty, llvm_i32_ty],
1239           [IntrNoMem]>;
1240   def int_x86_avx512_mask_fpclass_sd :
1241          GCCBuiltin<"__builtin_ia32_fpclasssd_mask">,
1242           Intrinsic<[llvm_i8_ty], [llvm_v2f64_ty, llvm_i32_ty, llvm_i8_ty],
1243           [IntrNoMem]>;
1244   def int_x86_avx512_mask_fpclass_ss :
1245          GCCBuiltin<"__builtin_ia32_fpclassss_mask">,
1246           Intrinsic<[llvm_i8_ty], [llvm_v4f32_ty, llvm_i32_ty, llvm_i8_ty],
1247           [IntrNoMem]>;
1250 // Vector extract sign mask
1251 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1252   def int_x86_avx_movmsk_pd_256 : GCCBuiltin<"__builtin_ia32_movmskpd256">,
1253         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1254   def int_x86_avx_movmsk_ps_256 : GCCBuiltin<"__builtin_ia32_movmskps256">,
1255         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1258 // Vector zero
1259 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1260   def int_x86_avx_vzeroall : GCCBuiltin<"__builtin_ia32_vzeroall">,
1261         Intrinsic<[], [], []>;
1262   def int_x86_avx_vzeroupper : GCCBuiltin<"__builtin_ia32_vzeroupper">,
1263         Intrinsic<[], [], []>;
1266 // SIMD load ops
1267 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1268   def int_x86_avx_ldu_dq_256 : GCCBuiltin<"__builtin_ia32_lddqu256">,
1269         Intrinsic<[llvm_v32i8_ty], [llvm_ptr_ty], [IntrReadMem]>;
1272 // Conditional load ops
1273 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1274   def int_x86_avx_maskload_pd : GCCBuiltin<"__builtin_ia32_maskloadpd">,
1275         Intrinsic<[llvm_v2f64_ty], [llvm_ptr_ty, llvm_v2i64_ty],
1276                   [IntrReadMem, IntrArgMemOnly]>;
1277   def int_x86_avx_maskload_ps : GCCBuiltin<"__builtin_ia32_maskloadps">,
1278         Intrinsic<[llvm_v4f32_ty], [llvm_ptr_ty, llvm_v4i32_ty],
1279                   [IntrReadMem, IntrArgMemOnly]>;
1280   def int_x86_avx_maskload_pd_256 : GCCBuiltin<"__builtin_ia32_maskloadpd256">,
1281         Intrinsic<[llvm_v4f64_ty], [llvm_ptr_ty, llvm_v4i64_ty],
1282                   [IntrReadMem, IntrArgMemOnly]>;
1283   def int_x86_avx_maskload_ps_256 : GCCBuiltin<"__builtin_ia32_maskloadps256">,
1284         Intrinsic<[llvm_v8f32_ty], [llvm_ptr_ty, llvm_v8i32_ty],
1285                   [IntrReadMem, IntrArgMemOnly]>;
1288 // Conditional store ops
1289 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1290   def int_x86_avx_maskstore_pd : GCCBuiltin<"__builtin_ia32_maskstorepd">,
1291         Intrinsic<[], [llvm_ptr_ty,
1292                   llvm_v2i64_ty, llvm_v2f64_ty], [IntrArgMemOnly]>;
1293   def int_x86_avx_maskstore_ps : GCCBuiltin<"__builtin_ia32_maskstoreps">,
1294         Intrinsic<[], [llvm_ptr_ty,
1295                   llvm_v4i32_ty, llvm_v4f32_ty], [IntrArgMemOnly]>;
1296   def int_x86_avx_maskstore_pd_256 :
1297         GCCBuiltin<"__builtin_ia32_maskstorepd256">,
1298         Intrinsic<[], [llvm_ptr_ty,
1299                   llvm_v4i64_ty, llvm_v4f64_ty], [IntrArgMemOnly]>;
1300   def int_x86_avx_maskstore_ps_256 :
1301         GCCBuiltin<"__builtin_ia32_maskstoreps256">,
1302         Intrinsic<[], [llvm_ptr_ty,
1303                   llvm_v8i32_ty, llvm_v8f32_ty], [IntrArgMemOnly]>;
1306 // BITALG bits shuffle
1307 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1308   def int_x86_avx512_vpshufbitqmb_128 :
1309     Intrinsic<[llvm_v16i1_ty], [llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
1310   def int_x86_avx512_vpshufbitqmb_256 :
1311     Intrinsic<[llvm_v32i1_ty], [llvm_v32i8_ty, llvm_v32i8_ty], [IntrNoMem]>;
1312   def int_x86_avx512_vpshufbitqmb_512 :
1313     Intrinsic<[llvm_v64i1_ty], [llvm_v64i8_ty, llvm_v64i8_ty], [IntrNoMem]>;
1316 //===----------------------------------------------------------------------===//
1317 // AVX2
1319 // Integer arithmetic ops.
1320 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1321   def int_x86_avx2_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw256">,
1322               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1323                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1324   def int_x86_avx2_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw256">,
1325               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1326                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1327   def int_x86_avx2_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd256">,
1328               Intrinsic<[llvm_v8i32_ty], [llvm_v16i16_ty,
1329                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1330   def int_x86_avx2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw256">,
1331               Intrinsic<[llvm_v4i64_ty], [llvm_v32i8_ty,
1332                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
1335 // Integer shift ops.
1336 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1337   def int_x86_avx2_psll_w : GCCBuiltin<"__builtin_ia32_psllw256">,
1338               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1339                          llvm_v8i16_ty], [IntrNoMem]>;
1340   def int_x86_avx2_psll_d : GCCBuiltin<"__builtin_ia32_pslld256">,
1341               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1342                          llvm_v4i32_ty], [IntrNoMem]>;
1343   def int_x86_avx2_psll_q : GCCBuiltin<"__builtin_ia32_psllq256">,
1344               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
1345                          llvm_v2i64_ty], [IntrNoMem]>;
1346   def int_x86_avx2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw256">,
1347               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1348                          llvm_v8i16_ty], [IntrNoMem]>;
1349   def int_x86_avx2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld256">,
1350               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1351                          llvm_v4i32_ty], [IntrNoMem]>;
1352   def int_x86_avx2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq256">,
1353               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
1354                          llvm_v2i64_ty], [IntrNoMem]>;
1355   def int_x86_avx2_psra_w : GCCBuiltin<"__builtin_ia32_psraw256">,
1356               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1357                          llvm_v8i16_ty], [IntrNoMem]>;
1358   def int_x86_avx2_psra_d : GCCBuiltin<"__builtin_ia32_psrad256">,
1359               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1360                          llvm_v4i32_ty], [IntrNoMem]>;
1362   def int_x86_avx2_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi256">,
1363               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1364                          llvm_i32_ty], [IntrNoMem]>;
1365   def int_x86_avx2_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi256">,
1366               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1367                          llvm_i32_ty], [IntrNoMem]>;
1368   def int_x86_avx2_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi256">,
1369               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
1370                          llvm_i32_ty], [IntrNoMem]>;
1371   def int_x86_avx2_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi256">,
1372               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1373                          llvm_i32_ty], [IntrNoMem]>;
1374   def int_x86_avx2_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi256">,
1375               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1376                          llvm_i32_ty], [IntrNoMem]>;
1377   def int_x86_avx2_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi256">,
1378               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
1379                          llvm_i32_ty], [IntrNoMem]>;
1380   def int_x86_avx2_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi256">,
1381               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1382                          llvm_i32_ty], [IntrNoMem]>;
1383   def int_x86_avx2_psrai_d : GCCBuiltin<"__builtin_ia32_psradi256">,
1384               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1385                          llvm_i32_ty], [IntrNoMem]>;
1387   def int_x86_avx512_psra_q_128 : GCCBuiltin<"__builtin_ia32_psraq128">,
1388               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
1389                          llvm_v2i64_ty], [IntrNoMem]>;
1390   def int_x86_avx512_psra_q_256 : GCCBuiltin<"__builtin_ia32_psraq256">,
1391               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
1392                          llvm_v2i64_ty], [IntrNoMem]>;
1394   def int_x86_avx512_psrai_q_128 : GCCBuiltin<"__builtin_ia32_psraqi128">,
1395               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
1396                          llvm_i32_ty], [IntrNoMem]>;
1397   def int_x86_avx512_psrai_q_256 : GCCBuiltin<"__builtin_ia32_psraqi256">,
1398               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
1399                          llvm_i32_ty], [IntrNoMem]>;
1401   def int_x86_avx512_psll_w_512 : GCCBuiltin<"__builtin_ia32_psllw512">,
1402               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1403                          llvm_v8i16_ty], [IntrNoMem]>;
1404   def int_x86_avx512_psll_d_512 : GCCBuiltin<"__builtin_ia32_pslld512">,
1405               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1406                          llvm_v4i32_ty], [IntrNoMem]>;
1407   def int_x86_avx512_psll_q_512 : GCCBuiltin<"__builtin_ia32_psllq512">,
1408               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1409                          llvm_v2i64_ty], [IntrNoMem]>;
1410   def int_x86_avx512_psrl_w_512 : GCCBuiltin<"__builtin_ia32_psrlw512">,
1411               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1412                          llvm_v8i16_ty], [IntrNoMem]>;
1413   def int_x86_avx512_psrl_d_512 : GCCBuiltin<"__builtin_ia32_psrld512">,
1414               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1415                          llvm_v4i32_ty], [IntrNoMem]>;
1416   def int_x86_avx512_psrl_q_512 : GCCBuiltin<"__builtin_ia32_psrlq512">,
1417               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1418                          llvm_v2i64_ty], [IntrNoMem]>;
1419   def int_x86_avx512_psra_w_512 : GCCBuiltin<"__builtin_ia32_psraw512">,
1420               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1421                          llvm_v8i16_ty], [IntrNoMem]>;
1422   def int_x86_avx512_psra_d_512 : GCCBuiltin<"__builtin_ia32_psrad512">,
1423               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1424                          llvm_v4i32_ty], [IntrNoMem]>;
1425   def int_x86_avx512_psra_q_512 : GCCBuiltin<"__builtin_ia32_psraq512">,
1426               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1427                          llvm_v2i64_ty], [IntrNoMem]>;
1429   def int_x86_avx512_pslli_w_512 : GCCBuiltin<"__builtin_ia32_psllwi512">,
1430               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1431                          llvm_i32_ty], [IntrNoMem]>;
1432   def int_x86_avx512_pslli_d_512 : GCCBuiltin<"__builtin_ia32_pslldi512">,
1433               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1434                          llvm_i32_ty], [IntrNoMem]>;
1435   def int_x86_avx512_pslli_q_512 : GCCBuiltin<"__builtin_ia32_psllqi512">,
1436               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1437                          llvm_i32_ty], [IntrNoMem]>;
1438   def int_x86_avx512_psrli_w_512 : GCCBuiltin<"__builtin_ia32_psrlwi512">,
1439               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1440                          llvm_i32_ty], [IntrNoMem]>;
1441   def int_x86_avx512_psrli_d_512 : GCCBuiltin<"__builtin_ia32_psrldi512">,
1442               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1443                          llvm_i32_ty], [IntrNoMem]>;
1444   def int_x86_avx512_psrli_q_512 : GCCBuiltin<"__builtin_ia32_psrlqi512">,
1445               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1446                          llvm_i32_ty], [IntrNoMem]>;
1447   def int_x86_avx512_psrai_w_512 : GCCBuiltin<"__builtin_ia32_psrawi512">,
1448               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1449                          llvm_i32_ty], [IntrNoMem]>;
1450   def int_x86_avx512_psrai_d_512 : GCCBuiltin<"__builtin_ia32_psradi512">,
1451               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
1452                          llvm_i32_ty], [IntrNoMem]>;
1453   def int_x86_avx512_psrai_q_512 : GCCBuiltin<"__builtin_ia32_psraqi512">,
1454               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
1455                          llvm_i32_ty], [IntrNoMem]>;
1457   def int_x86_avx512_pmultishift_qb_128:
1458         GCCBuiltin<"__builtin_ia32_vpmultishiftqb128">,
1459         Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty], [IntrNoMem]>;
1460   def int_x86_avx512_pmultishift_qb_256:
1461         GCCBuiltin<"__builtin_ia32_vpmultishiftqb256">,
1462         Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty], [IntrNoMem]>;
1463   def int_x86_avx512_pmultishift_qb_512:
1464         GCCBuiltin<"__builtin_ia32_vpmultishiftqb512">,
1465         Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty, llvm_v64i8_ty], [IntrNoMem]>;
1468 // Pack ops.
1469 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1470   def int_x86_avx2_packsswb : GCCBuiltin<"__builtin_ia32_packsswb256">,
1471               Intrinsic<[llvm_v32i8_ty], [llvm_v16i16_ty,
1472                          llvm_v16i16_ty], [IntrNoMem]>;
1473   def int_x86_avx2_packssdw : GCCBuiltin<"__builtin_ia32_packssdw256">,
1474               Intrinsic<[llvm_v16i16_ty], [llvm_v8i32_ty,
1475                          llvm_v8i32_ty], [IntrNoMem]>;
1476   def int_x86_avx2_packuswb : GCCBuiltin<"__builtin_ia32_packuswb256">,
1477               Intrinsic<[llvm_v32i8_ty], [llvm_v16i16_ty,
1478                          llvm_v16i16_ty], [IntrNoMem]>;
1479   def int_x86_avx2_packusdw : GCCBuiltin<"__builtin_ia32_packusdw256">,
1480               Intrinsic<[llvm_v16i16_ty], [llvm_v8i32_ty,
1481                          llvm_v8i32_ty], [IntrNoMem]>;
1484 // Horizontal arithmetic ops
1485 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1486   def int_x86_avx2_phadd_w : GCCBuiltin<"__builtin_ia32_phaddw256">,
1487               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1488                          llvm_v16i16_ty], [IntrNoMem]>;
1489   def int_x86_avx2_phadd_d : GCCBuiltin<"__builtin_ia32_phaddd256">,
1490               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1491                          llvm_v8i32_ty], [IntrNoMem]>;
1492   def int_x86_avx2_phadd_sw : GCCBuiltin<"__builtin_ia32_phaddsw256">,
1493               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1494                          llvm_v16i16_ty], [IntrNoMem]>;
1495   def int_x86_avx2_phsub_w : GCCBuiltin<"__builtin_ia32_phsubw256">,
1496               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1497                          llvm_v16i16_ty], [IntrNoMem]>;
1498   def int_x86_avx2_phsub_d : GCCBuiltin<"__builtin_ia32_phsubd256">,
1499               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1500                          llvm_v8i32_ty], [IntrNoMem]>;
1501   def int_x86_avx2_phsub_sw : GCCBuiltin<"__builtin_ia32_phsubsw256">,
1502               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1503                          llvm_v16i16_ty], [IntrNoMem]>;
1504   def int_x86_avx2_pmadd_ub_sw : GCCBuiltin<"__builtin_ia32_pmaddubsw256">,
1505               Intrinsic<[llvm_v16i16_ty], [llvm_v32i8_ty,
1506                          llvm_v32i8_ty], [IntrNoMem]>;
1509 // Sign ops
1510 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1511   def int_x86_avx2_psign_b : GCCBuiltin<"__builtin_ia32_psignb256">,
1512               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1513                          llvm_v32i8_ty], [IntrNoMem]>;
1514   def int_x86_avx2_psign_w : GCCBuiltin<"__builtin_ia32_psignw256">,
1515               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1516                          llvm_v16i16_ty], [IntrNoMem]>;
1517   def int_x86_avx2_psign_d : GCCBuiltin<"__builtin_ia32_psignd256">,
1518               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
1519                          llvm_v8i32_ty], [IntrNoMem]>;
1522 // Packed multiply high with round and scale
1523 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1524   def int_x86_avx2_pmul_hr_sw : GCCBuiltin<"__builtin_ia32_pmulhrsw256">,
1525               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
1526                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
1527   def int_x86_avx512_pmul_hr_sw_512 : GCCBuiltin<"__builtin_ia32_pmulhrsw512">,
1528               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
1529                          llvm_v32i16_ty], [IntrNoMem, Commutative]>;
1532 // Vector blend
1533 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1534   def int_x86_avx2_pblendvb : GCCBuiltin<"__builtin_ia32_pblendvb256">,
1535               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty,
1536                          llvm_v32i8_ty], [IntrNoMem]>;
1540 // Vector permutation
1541 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1542   def int_x86_avx2_permd : GCCBuiltin<"__builtin_ia32_permvarsi256">,
1543               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
1544                         [IntrNoMem]>;
1545   def int_x86_avx2_permps : GCCBuiltin<"__builtin_ia32_permvarsf256">,
1546               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8i32_ty],
1547                         [IntrNoMem]>;
1550 // Conditional load ops
1551 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1552   def int_x86_avx2_maskload_d : GCCBuiltin<"__builtin_ia32_maskloadd">,
1553         Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_v4i32_ty],
1554                   [IntrReadMem, IntrArgMemOnly]>;
1555   def int_x86_avx2_maskload_q : GCCBuiltin<"__builtin_ia32_maskloadq">,
1556         Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty, llvm_v2i64_ty],
1557                   [IntrReadMem, IntrArgMemOnly]>;
1558   def int_x86_avx2_maskload_d_256 : GCCBuiltin<"__builtin_ia32_maskloadd256">,
1559         Intrinsic<[llvm_v8i32_ty], [llvm_ptr_ty, llvm_v8i32_ty],
1560                   [IntrReadMem, IntrArgMemOnly]>;
1561   def int_x86_avx2_maskload_q_256 : GCCBuiltin<"__builtin_ia32_maskloadq256">,
1562         Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty, llvm_v4i64_ty],
1563                   [IntrReadMem, IntrArgMemOnly]>;
1566 // Conditional store ops
1567 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1568   def int_x86_avx2_maskstore_d : GCCBuiltin<"__builtin_ia32_maskstored">,
1569         Intrinsic<[], [llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i32_ty],
1570                   [IntrArgMemOnly]>;
1571   def int_x86_avx2_maskstore_q : GCCBuiltin<"__builtin_ia32_maskstoreq">,
1572         Intrinsic<[], [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty],
1573                   [IntrArgMemOnly]>;
1574   def int_x86_avx2_maskstore_d_256 :
1575         GCCBuiltin<"__builtin_ia32_maskstored256">,
1576         Intrinsic<[], [llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i32_ty],
1577                   [IntrArgMemOnly]>;
1578   def int_x86_avx2_maskstore_q_256 :
1579         GCCBuiltin<"__builtin_ia32_maskstoreq256">,
1580         Intrinsic<[], [llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty],
1581                   [IntrArgMemOnly]>;
1584 // Variable bit shift ops
1585 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1586   def int_x86_avx2_psllv_d : GCCBuiltin<"__builtin_ia32_psllv4si">,
1587               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1588                         [IntrNoMem]>;
1589   def int_x86_avx2_psllv_d_256 : GCCBuiltin<"__builtin_ia32_psllv8si">,
1590               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
1591                         [IntrNoMem]>;
1592   def int_x86_avx2_psllv_q : GCCBuiltin<"__builtin_ia32_psllv2di">,
1593               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1594                         [IntrNoMem]>;
1595   def int_x86_avx2_psllv_q_256 : GCCBuiltin<"__builtin_ia32_psllv4di">,
1596               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
1597                         [IntrNoMem]>;
1599   def int_x86_avx512_psllv_d_512 : GCCBuiltin<"__builtin_ia32_psllv16si">,
1600               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty],
1601                         [IntrNoMem]>;
1602   def int_x86_avx512_psllv_q_512 : GCCBuiltin<"__builtin_ia32_psllv8di">,
1603               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
1604                         [IntrNoMem]>;
1606   def int_x86_avx2_psrlv_d : GCCBuiltin<"__builtin_ia32_psrlv4si">,
1607               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1608                         [IntrNoMem]>;
1609   def int_x86_avx2_psrlv_d_256 : GCCBuiltin<"__builtin_ia32_psrlv8si">,
1610               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
1611                         [IntrNoMem]>;
1612   def int_x86_avx2_psrlv_q : GCCBuiltin<"__builtin_ia32_psrlv2di">,
1613               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1614                         [IntrNoMem]>;
1615   def int_x86_avx2_psrlv_q_256 : GCCBuiltin<"__builtin_ia32_psrlv4di">,
1616               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
1617                         [IntrNoMem]>;
1619   def int_x86_avx512_psrlv_d_512 : GCCBuiltin<"__builtin_ia32_psrlv16si">,
1620               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty],
1621                         [IntrNoMem]>;
1622   def int_x86_avx512_psrlv_q_512 : GCCBuiltin<"__builtin_ia32_psrlv8di">,
1623               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
1624                         [IntrNoMem]>;
1626   def int_x86_avx2_psrav_d : GCCBuiltin<"__builtin_ia32_psrav4si">,
1627               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
1628                         [IntrNoMem]>;
1629   def int_x86_avx2_psrav_d_256 : GCCBuiltin<"__builtin_ia32_psrav8si">,
1630               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
1631                         [IntrNoMem]>;
1633   def int_x86_avx512_psrav_d_512 : GCCBuiltin<"__builtin_ia32_psrav16si">,
1634               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty],
1635                         [IntrNoMem]>;
1636   def int_x86_avx512_psrav_q_128 : GCCBuiltin<"__builtin_ia32_psravq128">,
1637               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
1638                         [IntrNoMem]>;
1639   def int_x86_avx512_psrav_q_256 : GCCBuiltin<"__builtin_ia32_psravq256">,
1640               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
1641                         [IntrNoMem]>;
1642   def int_x86_avx512_psrav_q_512 : GCCBuiltin<"__builtin_ia32_psrav8di">,
1643               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty],
1644                         [IntrNoMem]>;
1646   def int_x86_avx512_psllv_w_128 : GCCBuiltin<"__builtin_ia32_psllv8hi">,
1647               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
1648                         [IntrNoMem]>;
1649   def int_x86_avx512_psllv_w_256 : GCCBuiltin<"__builtin_ia32_psllv16hi">,
1650               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty],
1651                         [IntrNoMem]>;
1652   def int_x86_avx512_psllv_w_512 : GCCBuiltin<"__builtin_ia32_psllv32hi">,
1653               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty],
1654                         [IntrNoMem]>;
1656   def int_x86_avx512_psrlv_w_128 : GCCBuiltin<"__builtin_ia32_psrlv8hi">,
1657               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
1658                         [IntrNoMem]>;
1659   def int_x86_avx512_psrlv_w_256 : GCCBuiltin<"__builtin_ia32_psrlv16hi">,
1660               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty],
1661                         [IntrNoMem]>;
1662   def int_x86_avx512_psrlv_w_512 : GCCBuiltin<"__builtin_ia32_psrlv32hi">,
1663               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty],
1664                         [IntrNoMem]>;
1666   def int_x86_avx512_psrav_w_128 : GCCBuiltin<"__builtin_ia32_psrav8hi">,
1667               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
1668                         [IntrNoMem]>;
1669   def int_x86_avx512_psrav_w_256 : GCCBuiltin<"__builtin_ia32_psrav16hi">,
1670               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty],
1671                         [IntrNoMem]>;
1672   def int_x86_avx512_psrav_w_512 : GCCBuiltin<"__builtin_ia32_psrav32hi">,
1673               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty, llvm_v32i16_ty],
1674                         [IntrNoMem]>;
1677 // Gather ops
1678 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1679   def int_x86_avx2_gather_d_pd : GCCBuiltin<"__builtin_ia32_gatherd_pd">,
1680       Intrinsic<[llvm_v2f64_ty],
1681         [llvm_v2f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2f64_ty, llvm_i8_ty],
1682         [IntrReadMem, IntrArgMemOnly]>;
1683   def int_x86_avx2_gather_d_pd_256 : GCCBuiltin<"__builtin_ia32_gatherd_pd256">,
1684       Intrinsic<[llvm_v4f64_ty],
1685         [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4f64_ty, llvm_i8_ty],
1686         [IntrReadMem, IntrArgMemOnly]>;
1687   def int_x86_avx2_gather_q_pd : GCCBuiltin<"__builtin_ia32_gatherq_pd">,
1688       Intrinsic<[llvm_v2f64_ty],
1689         [llvm_v2f64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i8_ty],
1690         [IntrReadMem, IntrArgMemOnly]>;
1691   def int_x86_avx2_gather_q_pd_256 : GCCBuiltin<"__builtin_ia32_gatherq_pd256">,
1692       Intrinsic<[llvm_v4f64_ty],
1693         [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i8_ty],
1694         [IntrReadMem, IntrArgMemOnly]>;
1695   def int_x86_avx2_gather_d_ps : GCCBuiltin<"__builtin_ia32_gatherd_ps">,
1696       Intrinsic<[llvm_v4f32_ty],
1697         [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i8_ty],
1698         [IntrReadMem, IntrArgMemOnly]>;
1699   def int_x86_avx2_gather_d_ps_256 : GCCBuiltin<"__builtin_ia32_gatherd_ps256">,
1700       Intrinsic<[llvm_v8f32_ty],
1701         [llvm_v8f32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i8_ty],
1702         [IntrReadMem, IntrArgMemOnly]>;
1703   def int_x86_avx2_gather_q_ps : GCCBuiltin<"__builtin_ia32_gatherq_ps">,
1704       Intrinsic<[llvm_v4f32_ty],
1705         [llvm_v4f32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v4f32_ty, llvm_i8_ty],
1706         [IntrReadMem, IntrArgMemOnly]>;
1707   def int_x86_avx2_gather_q_ps_256 : GCCBuiltin<"__builtin_ia32_gatherq_ps256">,
1708       Intrinsic<[llvm_v4f32_ty],
1709         [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4f32_ty, llvm_i8_ty],
1710         [IntrReadMem, IntrArgMemOnly]>;
1712   def int_x86_avx2_gather_d_q : GCCBuiltin<"__builtin_ia32_gatherd_q">,
1713       Intrinsic<[llvm_v2i64_ty],
1714         [llvm_v2i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2i64_ty, llvm_i8_ty],
1715         [IntrReadMem, IntrArgMemOnly]>;
1716   def int_x86_avx2_gather_d_q_256 : GCCBuiltin<"__builtin_ia32_gatherd_q256">,
1717       Intrinsic<[llvm_v4i64_ty],
1718         [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i64_ty, llvm_i8_ty],
1719         [IntrReadMem, IntrArgMemOnly]>;
1720   def int_x86_avx2_gather_q_q : GCCBuiltin<"__builtin_ia32_gatherq_q">,
1721       Intrinsic<[llvm_v2i64_ty],
1722         [llvm_v2i64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i8_ty],
1723         [IntrReadMem, IntrArgMemOnly]>;
1724   def int_x86_avx2_gather_q_q_256 : GCCBuiltin<"__builtin_ia32_gatherq_q256">,
1725       Intrinsic<[llvm_v4i64_ty],
1726         [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i8_ty],
1727         [IntrReadMem, IntrArgMemOnly]>;
1728   def int_x86_avx2_gather_d_d : GCCBuiltin<"__builtin_ia32_gatherd_d">,
1729       Intrinsic<[llvm_v4i32_ty],
1730         [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
1731         [IntrReadMem, IntrArgMemOnly]>;
1732   def int_x86_avx2_gather_d_d_256 : GCCBuiltin<"__builtin_ia32_gatherd_d256">,
1733       Intrinsic<[llvm_v8i32_ty],
1734         [llvm_v8i32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i8_ty],
1735         [IntrReadMem, IntrArgMemOnly]>;
1736   def int_x86_avx2_gather_q_d : GCCBuiltin<"__builtin_ia32_gatherq_d">,
1737       Intrinsic<[llvm_v4i32_ty],
1738         [llvm_v4i32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v4i32_ty, llvm_i8_ty],
1739         [IntrReadMem, IntrArgMemOnly]>;
1740   def int_x86_avx2_gather_q_d_256 : GCCBuiltin<"__builtin_ia32_gatherq_d256">,
1741       Intrinsic<[llvm_v4i32_ty],
1742         [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i32_ty, llvm_i8_ty],
1743         [IntrReadMem, IntrArgMemOnly]>;
1746 // Misc.
1747 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1748   def int_x86_avx2_pmovmskb : GCCBuiltin<"__builtin_ia32_pmovmskb256">,
1749               Intrinsic<[llvm_i32_ty], [llvm_v32i8_ty], [IntrNoMem]>;
1750   def int_x86_avx2_pshuf_b : GCCBuiltin<"__builtin_ia32_pshufb256">,
1751               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
1752                          llvm_v32i8_ty], [IntrNoMem]>;
1753   def int_x86_avx2_mpsadbw : GCCBuiltin<"__builtin_ia32_mpsadbw256">,
1754               Intrinsic<[llvm_v16i16_ty], [llvm_v32i8_ty, llvm_v32i8_ty,
1755                          llvm_i8_ty], [IntrNoMem, Commutative]>;
1758 //===----------------------------------------------------------------------===//
1759 // FMA3 and FMA4
1761 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1762   def int_x86_avx512_vfmadd_pd_512 :
1763           Intrinsic<[llvm_v8f64_ty],
1764           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty, llvm_i32_ty],
1765           [IntrNoMem]>;
1767   def int_x86_avx512_vfmadd_ps_512 :
1768           Intrinsic<[llvm_v16f32_ty],
1769           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty, llvm_i32_ty],
1770           [IntrNoMem]>;
1772   // TODO: Can we use 2 vfmadds+shufflevector?
1773   def int_x86_avx512_vfmaddsub_pd_512 :
1774           Intrinsic<[llvm_v8f64_ty],
1775           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8f64_ty, llvm_i32_ty],
1776           [IntrNoMem]>;
1778   def int_x86_avx512_vfmaddsub_ps_512 :
1779           Intrinsic<[llvm_v16f32_ty],
1780           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16f32_ty, llvm_i32_ty],
1781           [IntrNoMem]>;
1783   def int_x86_avx512_vfmadd_f64 :
1784           Intrinsic<[llvm_double_ty],
1785                     [llvm_double_ty, llvm_double_ty, llvm_double_ty, llvm_i32_ty],
1786                     [IntrNoMem]>;
1787   def int_x86_avx512_vfmadd_f32 :
1788           Intrinsic<[llvm_float_ty],
1789                     [llvm_float_ty, llvm_float_ty, llvm_float_ty, llvm_i32_ty],
1790                     [IntrNoMem]>;
1792   def int_x86_avx512_vpmadd52h_uq_128 :
1793               GCCBuiltin<"__builtin_ia32_vpmadd52huq128">,
1794               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
1795                          llvm_v2i64_ty], [IntrNoMem]>;
1796   def int_x86_avx512_vpmadd52l_uq_128 :
1797               GCCBuiltin<"__builtin_ia32_vpmadd52luq128">,
1798               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty,
1799                          llvm_v2i64_ty], [IntrNoMem]>;
1800   def int_x86_avx512_vpmadd52h_uq_256 :
1801               GCCBuiltin<"__builtin_ia32_vpmadd52huq256">,
1802               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty,
1803                          llvm_v4i64_ty], [IntrNoMem]>;
1804   def int_x86_avx512_vpmadd52l_uq_256 :
1805               GCCBuiltin<"__builtin_ia32_vpmadd52luq256">,
1806               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty,
1807                          llvm_v4i64_ty], [IntrNoMem]>;
1808   def int_x86_avx512_vpmadd52h_uq_512 :
1809               GCCBuiltin<"__builtin_ia32_vpmadd52huq512">,
1810               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
1811                          llvm_v8i64_ty], [IntrNoMem]>;
1812   def int_x86_avx512_vpmadd52l_uq_512 :
1813               GCCBuiltin<"__builtin_ia32_vpmadd52luq512">,
1814               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_v8i64_ty,
1815                          llvm_v8i64_ty], [IntrNoMem]>;
1818 // VNNI
1819 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1820   def int_x86_avx512_vpdpbusd_128 :
1821               GCCBuiltin<"__builtin_ia32_vpdpbusd128">,
1822               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
1823                          llvm_v4i32_ty], [IntrNoMem]>;
1824   def int_x86_avx512_vpdpbusd_256 :
1825               GCCBuiltin<"__builtin_ia32_vpdpbusd256">,
1826               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
1827                          llvm_v8i32_ty], [IntrNoMem]>;
1828   def int_x86_avx512_vpdpbusd_512 :
1829               GCCBuiltin<"__builtin_ia32_vpdpbusd512">,
1830               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1831                          llvm_v16i32_ty], [IntrNoMem]>;
1833   def int_x86_avx512_vpdpbusds_128 :
1834               GCCBuiltin<"__builtin_ia32_vpdpbusds128">,
1835               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
1836                          llvm_v4i32_ty], [IntrNoMem]>;
1837   def int_x86_avx512_vpdpbusds_256 :
1838               GCCBuiltin<"__builtin_ia32_vpdpbusds256">,
1839               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
1840                          llvm_v8i32_ty], [IntrNoMem]>;
1841   def int_x86_avx512_vpdpbusds_512 :
1842               GCCBuiltin<"__builtin_ia32_vpdpbusds512">,
1843               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1844                          llvm_v16i32_ty], [IntrNoMem]>;
1846   def int_x86_avx512_vpdpwssd_128 :
1847               GCCBuiltin<"__builtin_ia32_vpdpwssd128">,
1848               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
1849                          llvm_v4i32_ty], [IntrNoMem]>;
1850   def int_x86_avx512_vpdpwssd_256 :
1851               GCCBuiltin<"__builtin_ia32_vpdpwssd256">,
1852               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
1853                          llvm_v8i32_ty], [IntrNoMem]>;
1854   def int_x86_avx512_vpdpwssd_512 :
1855               GCCBuiltin<"__builtin_ia32_vpdpwssd512">,
1856               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1857                          llvm_v16i32_ty], [IntrNoMem]>;
1859   def int_x86_avx512_vpdpwssds_128 :
1860               GCCBuiltin<"__builtin_ia32_vpdpwssds128">,
1861               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
1862                          llvm_v4i32_ty], [IntrNoMem]>;
1863   def int_x86_avx512_vpdpwssds_256 :
1864               GCCBuiltin<"__builtin_ia32_vpdpwssds256">,
1865               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
1866                          llvm_v8i32_ty], [IntrNoMem]>;
1867   def int_x86_avx512_vpdpwssds_512 :
1868               GCCBuiltin<"__builtin_ia32_vpdpwssds512">,
1869               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_v16i32_ty,
1870                          llvm_v16i32_ty], [IntrNoMem]>;
1873 //===----------------------------------------------------------------------===//
1874 // XOP
1876 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
1877   def int_x86_xop_vpermil2pd : GCCBuiltin<"__builtin_ia32_vpermil2pd">,
1878               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
1879                                           llvm_v2i64_ty, llvm_i8_ty],
1880                         [IntrNoMem]>;
1882   def int_x86_xop_vpermil2pd_256 :
1883               GCCBuiltin<"__builtin_ia32_vpermil2pd256">,
1884               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
1885                                           llvm_v4i64_ty, llvm_i8_ty],
1886                         [IntrNoMem]>;
1888   def int_x86_xop_vpermil2ps : GCCBuiltin<"__builtin_ia32_vpermil2ps">,
1889               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
1890                                           llvm_v4i32_ty, llvm_i8_ty],
1891                         [IntrNoMem]>;
1892   def int_x86_xop_vpermil2ps_256 :
1893               GCCBuiltin<"__builtin_ia32_vpermil2ps256">,
1894               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
1895                                           llvm_v8i32_ty, llvm_i8_ty],
1896                         [IntrNoMem]>;
1898   def int_x86_xop_vfrcz_pd : GCCBuiltin<"__builtin_ia32_vfrczpd">,
1899               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
1900   def int_x86_xop_vfrcz_ps : GCCBuiltin<"__builtin_ia32_vfrczps">,
1901               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1902   def int_x86_xop_vfrcz_sd : GCCBuiltin<"__builtin_ia32_vfrczsd">,
1903               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
1904   def int_x86_xop_vfrcz_ss : GCCBuiltin<"__builtin_ia32_vfrczss">,
1905               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
1906   def int_x86_xop_vfrcz_pd_256 : GCCBuiltin<"__builtin_ia32_vfrczpd256">,
1907               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
1908   def int_x86_xop_vfrcz_ps_256 : GCCBuiltin<"__builtin_ia32_vfrczps256">,
1909               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
1911   def int_x86_xop_vphaddbd :
1912               GCCBuiltin<"__builtin_ia32_vphaddbd">,
1913               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1914   def int_x86_xop_vphaddbq :
1915               GCCBuiltin<"__builtin_ia32_vphaddbq">,
1916               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1917   def int_x86_xop_vphaddbw :
1918               GCCBuiltin<"__builtin_ia32_vphaddbw">,
1919               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1920   def int_x86_xop_vphadddq :
1921               GCCBuiltin<"__builtin_ia32_vphadddq">,
1922               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
1923   def int_x86_xop_vphaddubd :
1924               GCCBuiltin<"__builtin_ia32_vphaddubd">,
1925               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1926   def int_x86_xop_vphaddubq :
1927               GCCBuiltin<"__builtin_ia32_vphaddubq">,
1928               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1929   def int_x86_xop_vphaddubw :
1930               GCCBuiltin<"__builtin_ia32_vphaddubw">,
1931               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1932   def int_x86_xop_vphaddudq :
1933               GCCBuiltin<"__builtin_ia32_vphaddudq">,
1934               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
1935   def int_x86_xop_vphadduwd :
1936               GCCBuiltin<"__builtin_ia32_vphadduwd">,
1937               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1938   def int_x86_xop_vphadduwq :
1939               GCCBuiltin<"__builtin_ia32_vphadduwq">,
1940               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1941   def int_x86_xop_vphaddwd :
1942               GCCBuiltin<"__builtin_ia32_vphaddwd">,
1943               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1944   def int_x86_xop_vphaddwq :
1945               GCCBuiltin<"__builtin_ia32_vphaddwq">,
1946               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1947   def int_x86_xop_vphsubbw :
1948               GCCBuiltin<"__builtin_ia32_vphsubbw">,
1949               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
1950   def int_x86_xop_vphsubdq :
1951               GCCBuiltin<"__builtin_ia32_vphsubdq">,
1952               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
1953   def int_x86_xop_vphsubwd :
1954               GCCBuiltin<"__builtin_ia32_vphsubwd">,
1955               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
1956   def int_x86_xop_vpmacsdd :
1957               GCCBuiltin<"__builtin_ia32_vpmacsdd">,
1958               Intrinsic<[llvm_v4i32_ty],
1959                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
1960                         [IntrNoMem, Commutative]>;
1961   def int_x86_xop_vpmacsdqh :
1962               GCCBuiltin<"__builtin_ia32_vpmacsdqh">,
1963               Intrinsic<[llvm_v2i64_ty],
1964                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
1965                         [IntrNoMem, Commutative]>;
1966   def int_x86_xop_vpmacsdql :
1967               GCCBuiltin<"__builtin_ia32_vpmacsdql">,
1968               Intrinsic<[llvm_v2i64_ty],
1969                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
1970                         [IntrNoMem, Commutative]>;
1971   def int_x86_xop_vpmacssdd :
1972               GCCBuiltin<"__builtin_ia32_vpmacssdd">,
1973               Intrinsic<[llvm_v4i32_ty],
1974                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
1975                         [IntrNoMem, Commutative]>;
1976   def int_x86_xop_vpmacssdqh :
1977               GCCBuiltin<"__builtin_ia32_vpmacssdqh">,
1978               Intrinsic<[llvm_v2i64_ty],
1979                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
1980                         [IntrNoMem, Commutative]>;
1981   def int_x86_xop_vpmacssdql :
1982               GCCBuiltin<"__builtin_ia32_vpmacssdql">,
1983               Intrinsic<[llvm_v2i64_ty],
1984                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
1985                         [IntrNoMem, Commutative]>;
1986   def int_x86_xop_vpmacsswd :
1987               GCCBuiltin<"__builtin_ia32_vpmacsswd">,
1988               Intrinsic<[llvm_v4i32_ty],
1989                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
1990                         [IntrNoMem, Commutative]>;
1991   def int_x86_xop_vpmacssww :
1992               GCCBuiltin<"__builtin_ia32_vpmacssww">,
1993               Intrinsic<[llvm_v8i16_ty],
1994                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
1995                         [IntrNoMem, Commutative]>;
1996   def int_x86_xop_vpmacswd :
1997               GCCBuiltin<"__builtin_ia32_vpmacswd">,
1998               Intrinsic<[llvm_v4i32_ty],
1999                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
2000                         [IntrNoMem, Commutative]>;
2001   def int_x86_xop_vpmacsww :
2002               GCCBuiltin<"__builtin_ia32_vpmacsww">,
2003               Intrinsic<[llvm_v8i16_ty],
2004                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
2005                         [IntrNoMem, Commutative]>;
2006   def int_x86_xop_vpmadcsswd :
2007               GCCBuiltin<"__builtin_ia32_vpmadcsswd">,
2008               Intrinsic<[llvm_v4i32_ty],
2009                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
2010                         [IntrNoMem, Commutative]>;
2011   def int_x86_xop_vpmadcswd :
2012               GCCBuiltin<"__builtin_ia32_vpmadcswd">,
2013               Intrinsic<[llvm_v4i32_ty],
2014                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
2015                         [IntrNoMem, Commutative]>;
2016   def int_x86_xop_vpperm :
2017               GCCBuiltin<"__builtin_ia32_vpperm">,
2018               Intrinsic<[llvm_v16i8_ty],
2019                         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
2020                         [IntrNoMem]>;
2021   def int_x86_xop_vpshab :
2022               GCCBuiltin<"__builtin_ia32_vpshab">,
2023               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
2024                         [IntrNoMem]>;
2025   def int_x86_xop_vpshad :
2026               GCCBuiltin<"__builtin_ia32_vpshad">,
2027               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
2028                         [IntrNoMem]>;
2029   def int_x86_xop_vpshaq :
2030               GCCBuiltin<"__builtin_ia32_vpshaq">,
2031               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
2032                         [IntrNoMem]>;
2033   def int_x86_xop_vpshaw :
2034               GCCBuiltin<"__builtin_ia32_vpshaw">,
2035               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
2036                         [IntrNoMem]>;
2037   def int_x86_xop_vpshlb :
2038               GCCBuiltin<"__builtin_ia32_vpshlb">,
2039               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
2040                         [IntrNoMem]>;
2041   def int_x86_xop_vpshld :
2042               GCCBuiltin<"__builtin_ia32_vpshld">,
2043               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
2044                         [IntrNoMem]>;
2045   def int_x86_xop_vpshlq :
2046               GCCBuiltin<"__builtin_ia32_vpshlq">,
2047               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
2048                         [IntrNoMem]>;
2049   def int_x86_xop_vpshlw :
2050               GCCBuiltin<"__builtin_ia32_vpshlw">,
2051               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
2052                         [IntrNoMem]>;
2055 //===----------------------------------------------------------------------===//
2056 // LWP
2057 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2058   def int_x86_llwpcb :
2059               GCCBuiltin<"__builtin_ia32_llwpcb">,
2060               Intrinsic<[], [llvm_ptr_ty], []>;
2061   def int_x86_slwpcb :
2062               GCCBuiltin<"__builtin_ia32_slwpcb">,
2063               Intrinsic<[llvm_ptr_ty], [], []>;
2064   def int_x86_lwpins32 :
2065               GCCBuiltin<"__builtin_ia32_lwpins32">,
2066               Intrinsic<[llvm_i8_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
2067   def int_x86_lwpins64 :
2068               GCCBuiltin<"__builtin_ia32_lwpins64">,
2069               Intrinsic<[llvm_i8_ty], [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty], []>;
2070   def int_x86_lwpval32 :
2071               GCCBuiltin<"__builtin_ia32_lwpval32">,
2072               Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
2073   def int_x86_lwpval64 :
2074               GCCBuiltin<"__builtin_ia32_lwpval64">,
2075               Intrinsic<[], [llvm_i64_ty, llvm_i32_ty, llvm_i32_ty], []>;
2078 //===----------------------------------------------------------------------===//
2079 // MMX
2081 // Empty MMX state op.
2082 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2083   def int_x86_mmx_emms  : GCCBuiltin<"__builtin_ia32_emms">,
2084               Intrinsic<[], [], []>;
2085   def int_x86_mmx_femms : GCCBuiltin<"__builtin_ia32_femms">,
2086               Intrinsic<[], [], []>;
2089 // Integer arithmetic ops.
2090 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2091   // Addition
2092   def int_x86_mmx_padd_b : GCCBuiltin<"__builtin_ia32_paddb">,
2093               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2094                         [IntrNoMem, Commutative]>;
2095   def int_x86_mmx_padd_w : GCCBuiltin<"__builtin_ia32_paddw">,
2096               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2097                         [IntrNoMem, Commutative]>;
2098   def int_x86_mmx_padd_d : GCCBuiltin<"__builtin_ia32_paddd">,
2099               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2100                         [IntrNoMem, Commutative]>;
2101   def int_x86_mmx_padd_q : GCCBuiltin<"__builtin_ia32_paddq">,
2102               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2103                         [IntrNoMem, Commutative]>;
2105   def int_x86_mmx_padds_b : GCCBuiltin<"__builtin_ia32_paddsb">,
2106               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2107                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2108   def int_x86_mmx_padds_w : GCCBuiltin<"__builtin_ia32_paddsw">,
2109               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2110                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2112   def int_x86_mmx_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb">,
2113               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2114                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2115   def int_x86_mmx_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw">,
2116               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2117                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2119   // Subtraction
2120   def int_x86_mmx_psub_b : GCCBuiltin<"__builtin_ia32_psubb">,
2121               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2122                         [IntrNoMem]>;
2123   def int_x86_mmx_psub_w : GCCBuiltin<"__builtin_ia32_psubw">,
2124               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2125                         [IntrNoMem]>;
2126   def int_x86_mmx_psub_d : GCCBuiltin<"__builtin_ia32_psubd">,
2127               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2128                         [IntrNoMem]>;
2129   def int_x86_mmx_psub_q : GCCBuiltin<"__builtin_ia32_psubq">,
2130               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2131                         [IntrNoMem]>;
2133   def int_x86_mmx_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb">,
2134               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2135                          llvm_x86mmx_ty], [IntrNoMem]>;
2136   def int_x86_mmx_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw">,
2137               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2138                          llvm_x86mmx_ty], [IntrNoMem]>;
2140   def int_x86_mmx_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb">,
2141               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2142                          llvm_x86mmx_ty], [IntrNoMem]>;
2143   def int_x86_mmx_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw">,
2144               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2145                          llvm_x86mmx_ty], [IntrNoMem]>;
2147   // Multiplication
2148   def int_x86_mmx_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw">,
2149               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2150                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2151   def int_x86_mmx_pmull_w : GCCBuiltin<"__builtin_ia32_pmullw">,
2152               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2153                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2154   def int_x86_mmx_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw">,
2155               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2156                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2157   def int_x86_mmx_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq">,
2158               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2159                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2160   def int_x86_mmx_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd">,
2161               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2162                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2164   // Bitwise operations
2165   def int_x86_mmx_pand : GCCBuiltin<"__builtin_ia32_pand">,
2166               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2167                         [IntrNoMem, Commutative]>;
2168   def int_x86_mmx_pandn : GCCBuiltin<"__builtin_ia32_pandn">,
2169               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2170                         [IntrNoMem]>;
2171   def int_x86_mmx_por : GCCBuiltin<"__builtin_ia32_por">,
2172               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2173                         [IntrNoMem, Commutative]>;
2174   def int_x86_mmx_pxor : GCCBuiltin<"__builtin_ia32_pxor">,
2175               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2176                         [IntrNoMem, Commutative]>;
2178   // Averages
2179   def int_x86_mmx_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb">,
2180               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2181                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2182   def int_x86_mmx_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw">,
2183               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2184                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2186   // Maximum
2187   def int_x86_mmx_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub">,
2188               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2189                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2190   def int_x86_mmx_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw">,
2191               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2192                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2194   // Minimum
2195   def int_x86_mmx_pminu_b : GCCBuiltin<"__builtin_ia32_pminub">,
2196               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2197                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2198   def int_x86_mmx_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw">,
2199               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2200                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2202   // Packed sum of absolute differences
2203   def int_x86_mmx_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw">,
2204               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2205                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2208 // Integer shift ops.
2209 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2210   // Shift left logical
2211   def int_x86_mmx_psll_w : GCCBuiltin<"__builtin_ia32_psllw">,
2212               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2213                          llvm_x86mmx_ty], [IntrNoMem]>;
2214   def int_x86_mmx_psll_d : GCCBuiltin<"__builtin_ia32_pslld">,
2215               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2216                          llvm_x86mmx_ty], [IntrNoMem]>;
2217   def int_x86_mmx_psll_q : GCCBuiltin<"__builtin_ia32_psllq">,
2218               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2219                          llvm_x86mmx_ty], [IntrNoMem]>;
2221   def int_x86_mmx_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw">,
2222               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2223                          llvm_x86mmx_ty], [IntrNoMem]>;
2224   def int_x86_mmx_psrl_d : GCCBuiltin<"__builtin_ia32_psrld">,
2225               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2226                          llvm_x86mmx_ty], [IntrNoMem]>;
2227   def int_x86_mmx_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq">,
2228               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2229                          llvm_x86mmx_ty], [IntrNoMem]>;
2231   def int_x86_mmx_psra_w : GCCBuiltin<"__builtin_ia32_psraw">,
2232               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2233                          llvm_x86mmx_ty], [IntrNoMem]>;
2234   def int_x86_mmx_psra_d : GCCBuiltin<"__builtin_ia32_psrad">,
2235               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2236                          llvm_x86mmx_ty], [IntrNoMem]>;
2238   def int_x86_mmx_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi">,
2239               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2240                          llvm_i32_ty], [IntrNoMem]>;
2241   def int_x86_mmx_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi">,
2242               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2243                          llvm_i32_ty], [IntrNoMem]>;
2244   def int_x86_mmx_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi">,
2245               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2246                          llvm_i32_ty], [IntrNoMem]>;
2248   def int_x86_mmx_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi">,
2249               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2250                          llvm_i32_ty], [IntrNoMem]>;
2251   def int_x86_mmx_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi">,
2252               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2253                          llvm_i32_ty], [IntrNoMem]>;
2254   def int_x86_mmx_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi">,
2255               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2256                          llvm_i32_ty], [IntrNoMem]>;
2258   def int_x86_mmx_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi">,
2259               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2260                          llvm_i32_ty], [IntrNoMem]>;
2261   def int_x86_mmx_psrai_d : GCCBuiltin<"__builtin_ia32_psradi">,
2262               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2263                          llvm_i32_ty], [IntrNoMem]>;
2265 // Permute
2266 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2267   def int_x86_avx512_permvar_df_256 : GCCBuiltin<"__builtin_ia32_permvardf256">,
2268               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
2269                         llvm_v4i64_ty],  [IntrNoMem]>;
2270   def int_x86_avx512_permvar_df_512 : GCCBuiltin<"__builtin_ia32_permvardf512">,
2271               Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty,
2272                         llvm_v8i64_ty],  [IntrNoMem]>;
2273   def int_x86_avx512_permvar_di_256 : GCCBuiltin<"__builtin_ia32_permvardi256">,
2274               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
2275                         llvm_v4i64_ty],  [IntrNoMem]>;
2276   def int_x86_avx512_permvar_di_512 : GCCBuiltin<"__builtin_ia32_permvardi512">,
2277               Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty,
2278                         llvm_v8i64_ty],  [IntrNoMem]>;
2279   def int_x86_avx512_permvar_hi_128 : GCCBuiltin<"__builtin_ia32_permvarhi128">,
2280               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
2281                         llvm_v8i16_ty],  [IntrNoMem]>;
2282   def int_x86_avx512_permvar_hi_256 : GCCBuiltin<"__builtin_ia32_permvarhi256">,
2283               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
2284                         llvm_v16i16_ty],  [IntrNoMem]>;
2285   def int_x86_avx512_permvar_hi_512 : GCCBuiltin<"__builtin_ia32_permvarhi512">,
2286               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
2287                         llvm_v32i16_ty],  [IntrNoMem]>;
2288   def int_x86_avx512_permvar_qi_128 : GCCBuiltin<"__builtin_ia32_permvarqi128">,
2289               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
2290                         llvm_v16i8_ty],  [IntrNoMem]>;
2291   def int_x86_avx512_permvar_qi_256 : GCCBuiltin<"__builtin_ia32_permvarqi256">,
2292               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
2293                         llvm_v32i8_ty],  [IntrNoMem]>;
2294   def int_x86_avx512_permvar_qi_512 : GCCBuiltin<"__builtin_ia32_permvarqi512">,
2295               Intrinsic<[llvm_v64i8_ty], [llvm_v64i8_ty,
2296                         llvm_v64i8_ty],  [IntrNoMem]>;
2297   def int_x86_avx512_permvar_sf_512 : GCCBuiltin<"__builtin_ia32_permvarsf512">,
2298               Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty,
2299                         llvm_v16i32_ty],  [IntrNoMem]>;
2300   def int_x86_avx512_permvar_si_512 : GCCBuiltin<"__builtin_ia32_permvarsi512">,
2301               Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty,
2302                         llvm_v16i32_ty],  [IntrNoMem]>;
2304 // Pack ops.
2305 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2306   def int_x86_mmx_packsswb : GCCBuiltin<"__builtin_ia32_packsswb">,
2307               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2308                          llvm_x86mmx_ty], [IntrNoMem]>;
2309   def int_x86_mmx_packssdw : GCCBuiltin<"__builtin_ia32_packssdw">,
2310               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2311                          llvm_x86mmx_ty], [IntrNoMem]>;
2312   def int_x86_mmx_packuswb : GCCBuiltin<"__builtin_ia32_packuswb">,
2313               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2314                          llvm_x86mmx_ty], [IntrNoMem]>;
2317 // Unpacking ops.
2318 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2319   def int_x86_mmx_punpckhbw : GCCBuiltin<"__builtin_ia32_punpckhbw">,
2320               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2321                         [IntrNoMem]>;
2322   def int_x86_mmx_punpckhwd : GCCBuiltin<"__builtin_ia32_punpckhwd">,
2323               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2324                         [IntrNoMem]>;
2325   def int_x86_mmx_punpckhdq : GCCBuiltin<"__builtin_ia32_punpckhdq">,
2326               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2327                         [IntrNoMem]>;
2328   def int_x86_mmx_punpcklbw : GCCBuiltin<"__builtin_ia32_punpcklbw">,
2329               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2330                         [IntrNoMem]>;
2331   def int_x86_mmx_punpcklwd : GCCBuiltin<"__builtin_ia32_punpcklwd">,
2332               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2333                         [IntrNoMem]>;
2334   def int_x86_mmx_punpckldq : GCCBuiltin<"__builtin_ia32_punpckldq">,
2335               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
2336                         [IntrNoMem]>;
2339 // Integer comparison ops
2340 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2341   def int_x86_mmx_pcmpeq_b : GCCBuiltin<"__builtin_ia32_pcmpeqb">,
2342               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2343                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2344   def int_x86_mmx_pcmpeq_w : GCCBuiltin<"__builtin_ia32_pcmpeqw">,
2345               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2346                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2347   def int_x86_mmx_pcmpeq_d : GCCBuiltin<"__builtin_ia32_pcmpeqd">,
2348               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2349                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
2351   def int_x86_mmx_pcmpgt_b : GCCBuiltin<"__builtin_ia32_pcmpgtb">,
2352               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2353                          llvm_x86mmx_ty], [IntrNoMem]>;
2354   def int_x86_mmx_pcmpgt_w : GCCBuiltin<"__builtin_ia32_pcmpgtw">,
2355               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2356                          llvm_x86mmx_ty], [IntrNoMem]>;
2357   def int_x86_mmx_pcmpgt_d : GCCBuiltin<"__builtin_ia32_pcmpgtd">,
2358               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2359                          llvm_x86mmx_ty], [IntrNoMem]>;
2362 // Misc.
2363 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2364   def int_x86_mmx_maskmovq : GCCBuiltin<"__builtin_ia32_maskmovq">,
2365               Intrinsic<[], [llvm_x86mmx_ty, llvm_x86mmx_ty, llvm_ptr_ty], []>;
2367   def int_x86_mmx_pmovmskb : GCCBuiltin<"__builtin_ia32_pmovmskb">,
2368               Intrinsic<[llvm_i32_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
2370   def int_x86_mmx_movnt_dq : GCCBuiltin<"__builtin_ia32_movntq">,
2371               Intrinsic<[], [llvm_ptrx86mmx_ty, llvm_x86mmx_ty], []>;
2373   def int_x86_mmx_palignr_b : GCCBuiltin<"__builtin_ia32_palignr">,
2374               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2375                         llvm_x86mmx_ty, llvm_i8_ty], [IntrNoMem]>;
2377   def int_x86_mmx_pextr_w : GCCBuiltin<"__builtin_ia32_vec_ext_v4hi">,
2378               Intrinsic<[llvm_i32_ty], [llvm_x86mmx_ty, llvm_i32_ty],
2379                         [IntrNoMem]>;
2381   def int_x86_mmx_pinsr_w : GCCBuiltin<"__builtin_ia32_vec_set_v4hi">,
2382               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
2383                         llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2386 //===----------------------------------------------------------------------===//
2387 // BMI
2389 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2390   def int_x86_bmi_bextr_32 : GCCBuiltin<"__builtin_ia32_bextr_u32">,
2391               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2392   def int_x86_bmi_bextr_64 : GCCBuiltin<"__builtin_ia32_bextr_u64">,
2393               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2394   def int_x86_bmi_bzhi_32 : GCCBuiltin<"__builtin_ia32_bzhi_si">,
2395               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2396   def int_x86_bmi_bzhi_64 : GCCBuiltin<"__builtin_ia32_bzhi_di">,
2397               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2398   def int_x86_bmi_pdep_32 : GCCBuiltin<"__builtin_ia32_pdep_si">,
2399               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2400   def int_x86_bmi_pdep_64 : GCCBuiltin<"__builtin_ia32_pdep_di">,
2401               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2402   def int_x86_bmi_pext_32 : GCCBuiltin<"__builtin_ia32_pext_si">,
2403               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2404   def int_x86_bmi_pext_64 : GCCBuiltin<"__builtin_ia32_pext_di">,
2405               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2408 //===----------------------------------------------------------------------===//
2409 // FS/GS Base
2411 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2412   def int_x86_rdfsbase_32 : GCCBuiltin<"__builtin_ia32_rdfsbase32">,
2413               Intrinsic<[llvm_i32_ty], []>;
2414   def int_x86_rdgsbase_32 : GCCBuiltin<"__builtin_ia32_rdgsbase32">,
2415               Intrinsic<[llvm_i32_ty], []>;
2416   def int_x86_rdfsbase_64 : GCCBuiltin<"__builtin_ia32_rdfsbase64">,
2417               Intrinsic<[llvm_i64_ty], []>;
2418   def int_x86_rdgsbase_64 : GCCBuiltin<"__builtin_ia32_rdgsbase64">,
2419               Intrinsic<[llvm_i64_ty], []>;
2420   def int_x86_wrfsbase_32 : GCCBuiltin<"__builtin_ia32_wrfsbase32">,
2421               Intrinsic<[], [llvm_i32_ty]>;
2422   def int_x86_wrgsbase_32 : GCCBuiltin<"__builtin_ia32_wrgsbase32">,
2423               Intrinsic<[], [llvm_i32_ty]>;
2424   def int_x86_wrfsbase_64 : GCCBuiltin<"__builtin_ia32_wrfsbase64">,
2425               Intrinsic<[], [llvm_i64_ty]>;
2426   def int_x86_wrgsbase_64 : GCCBuiltin<"__builtin_ia32_wrgsbase64">,
2427               Intrinsic<[], [llvm_i64_ty]>;
2430 //===----------------------------------------------------------------------===//
2431 // FXSR
2432 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2433   def int_x86_fxrstor : GCCBuiltin<"__builtin_ia32_fxrstor">,
2434               Intrinsic<[], [llvm_ptr_ty], []>;
2435   def int_x86_fxrstor64 : GCCBuiltin<"__builtin_ia32_fxrstor64">,
2436               Intrinsic<[], [llvm_ptr_ty], []>;
2437   def int_x86_fxsave : GCCBuiltin<"__builtin_ia32_fxsave">,
2438               Intrinsic<[], [llvm_ptr_ty], []>;
2439   def int_x86_fxsave64 : GCCBuiltin<"__builtin_ia32_fxsave64">,
2440               Intrinsic<[], [llvm_ptr_ty], []>;
2443 //===----------------------------------------------------------------------===//
2444 // XSAVE
2445 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2446   def int_x86_xsave :
2447               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2448   def int_x86_xsave64 :
2449               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2450   def int_x86_xrstor :
2451               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2452   def int_x86_xrstor64 :
2453               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2454   def int_x86_xsaveopt :
2455               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2456   def int_x86_xsaveopt64 :
2457               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2458   def int_x86_xrstors :
2459               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2460   def int_x86_xrstors64 :
2461               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2462   def int_x86_xsavec :
2463               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2464   def int_x86_xsavec64 :
2465               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2466   def int_x86_xsaves :
2467               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2468   def int_x86_xsaves64 :
2469               Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty], []>;
2470   def int_x86_xgetbv :
2471               Intrinsic<[llvm_i64_ty], [llvm_i32_ty], []>;
2472   def int_x86_xsetbv :
2473               Intrinsic<[], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
2476 //===----------------------------------------------------------------------===//
2477 // CLFLUSHOPT and CLWB
2478 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2479   def int_x86_clflushopt : GCCBuiltin<"__builtin_ia32_clflushopt">,
2480               Intrinsic<[], [llvm_ptr_ty], []>;
2482   def int_x86_clwb : GCCBuiltin<"__builtin_ia32_clwb">,
2483               Intrinsic<[], [llvm_ptr_ty], []>;
2486 //===----------------------------------------------------------------------===//
2487 // Support protection key
2488 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2489   def int_x86_rdpkru : GCCBuiltin <"__builtin_ia32_rdpkru">,
2490               Intrinsic<[llvm_i32_ty], [], []>;
2491   def int_x86_wrpkru : GCCBuiltin<"__builtin_ia32_wrpkru">,
2492               Intrinsic<[], [llvm_i32_ty], []>;
2494 //===----------------------------------------------------------------------===//
2495 // Half float conversion
2497 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2498   def int_x86_vcvtph2ps_128 : GCCBuiltin<"__builtin_ia32_vcvtph2ps">,
2499               Intrinsic<[llvm_v4f32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
2500   def int_x86_vcvtph2ps_256 : GCCBuiltin<"__builtin_ia32_vcvtph2ps256">,
2501               Intrinsic<[llvm_v8f32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
2502   def int_x86_vcvtps2ph_128 : GCCBuiltin<"__builtin_ia32_vcvtps2ph">,
2503               Intrinsic<[llvm_v8i16_ty], [llvm_v4f32_ty, llvm_i32_ty],
2504                         [IntrNoMem]>;
2505   def int_x86_vcvtps2ph_256 : GCCBuiltin<"__builtin_ia32_vcvtps2ph256">,
2506               Intrinsic<[llvm_v8i16_ty], [llvm_v8f32_ty, llvm_i32_ty],
2507                         [IntrNoMem]>;
2508   def int_x86_avx512_mask_vcvtph2ps_512 : GCCBuiltin<"__builtin_ia32_vcvtph2ps512_mask">,
2509               Intrinsic<[llvm_v16f32_ty], [llvm_v16i16_ty, llvm_v16f32_ty,
2510                                            llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
2511   def int_x86_avx512_mask_vcvtph2ps_256 : GCCBuiltin<"__builtin_ia32_vcvtph2ps256_mask">,
2512               Intrinsic<[llvm_v8f32_ty], [llvm_v8i16_ty, llvm_v8f32_ty,
2513                                            llvm_i8_ty], [IntrNoMem]>;
2514   def int_x86_avx512_mask_vcvtph2ps_128 : GCCBuiltin<"__builtin_ia32_vcvtph2ps_mask">,
2515               Intrinsic<[llvm_v4f32_ty], [llvm_v8i16_ty, llvm_v4f32_ty,
2516                                            llvm_i8_ty], [IntrNoMem]>;
2517   def int_x86_avx512_mask_vcvtps2ph_512 : GCCBuiltin<"__builtin_ia32_vcvtps2ph512_mask">,
2518               Intrinsic<[llvm_v16i16_ty], [llvm_v16f32_ty, llvm_i32_ty,
2519                                            llvm_v16i16_ty, llvm_i16_ty], [IntrNoMem]>;
2520   def int_x86_avx512_mask_vcvtps2ph_256 : GCCBuiltin<"__builtin_ia32_vcvtps2ph256_mask">,
2521               Intrinsic<[llvm_v8i16_ty], [llvm_v8f32_ty, llvm_i32_ty,
2522                                            llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
2523   def int_x86_avx512_mask_vcvtps2ph_128 : GCCBuiltin<"__builtin_ia32_vcvtps2ph_mask">,
2524               Intrinsic<[llvm_v8i16_ty], [llvm_v4f32_ty, llvm_i32_ty,
2525                                            llvm_v8i16_ty, llvm_i8_ty], [IntrNoMem]>;
2528 //===----------------------------------------------------------------------===//
2529 // TBM
2531 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2532   def int_x86_tbm_bextri_u32 : GCCBuiltin<"__builtin_ia32_bextri_u32">,
2533         Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2534   def int_x86_tbm_bextri_u64 : GCCBuiltin<"__builtin_ia32_bextri_u64">,
2535         Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2538 //===----------------------------------------------------------------------===//
2539 // RDRAND intrinsics - Return a random value and whether it is valid.
2540 // RDSEED intrinsics - Return a NIST SP800-90B & C compliant random value and
2541 // whether it is valid.
2543 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2544   // These are declared side-effecting so they don't get eliminated by CSE or
2545   // LICM.
2546   def int_x86_rdrand_16 : Intrinsic<[llvm_i16_ty, llvm_i32_ty], [], []>;
2547   def int_x86_rdrand_32 : Intrinsic<[llvm_i32_ty, llvm_i32_ty], [], []>;
2548   def int_x86_rdrand_64 : Intrinsic<[llvm_i64_ty, llvm_i32_ty], [], []>;
2549   def int_x86_rdseed_16 : Intrinsic<[llvm_i16_ty, llvm_i32_ty], [], []>;
2550   def int_x86_rdseed_32 : Intrinsic<[llvm_i32_ty, llvm_i32_ty], [], []>;
2551   def int_x86_rdseed_64 : Intrinsic<[llvm_i64_ty, llvm_i32_ty], [], []>;
2554 //===----------------------------------------------------------------------===//
2555 // ADX
2557 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2558   def int_x86_addcarry_32:
2559         Intrinsic<[llvm_i8_ty, llvm_i32_ty],
2560                   [llvm_i8_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2561   def int_x86_addcarry_64:
2562         Intrinsic<[llvm_i8_ty, llvm_i64_ty],
2563                   [llvm_i8_ty, llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2564   def int_x86_subborrow_32:
2565         Intrinsic<[llvm_i8_ty, llvm_i32_ty],
2566                   [llvm_i8_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2567   def int_x86_subborrow_64:
2568         Intrinsic<[llvm_i8_ty, llvm_i64_ty],
2569                   [llvm_i8_ty, llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
2572 //===----------------------------------------------------------------------===//
2573 // RTM intrinsics. Transactional Memory support.
2575 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2576   def int_x86_xbegin : GCCBuiltin<"__builtin_ia32_xbegin">,
2577               Intrinsic<[llvm_i32_ty], [], []>;
2578   def int_x86_xend : GCCBuiltin<"__builtin_ia32_xend">,
2579               Intrinsic<[], [], []>;
2580   def int_x86_xabort : GCCBuiltin<"__builtin_ia32_xabort">,
2581               Intrinsic<[], [llvm_i8_ty], []>;
2582   def int_x86_xtest : GCCBuiltin<"__builtin_ia32_xtest">,
2583               Intrinsic<[llvm_i32_ty], [], []>;
2586 //===----------------------------------------------------------------------===//
2587 // AVX512
2589 // Mask ops
2590 let TargetPrefix = "x86" in {
2591   def int_x86_avx512_kadd_b :
2592         Intrinsic<[llvm_v8i1_ty], [llvm_v8i1_ty, llvm_v8i1_ty], [IntrNoMem]>;
2593   def int_x86_avx512_kadd_w :
2594         Intrinsic<[llvm_v16i1_ty], [llvm_v16i1_ty, llvm_v16i1_ty], [IntrNoMem]>;
2595   def int_x86_avx512_kadd_d :
2596         Intrinsic<[llvm_v32i1_ty], [llvm_v32i1_ty, llvm_v32i1_ty], [IntrNoMem]>;
2597   def int_x86_avx512_kadd_q :
2598         Intrinsic<[llvm_v64i1_ty], [llvm_v64i1_ty, llvm_v64i1_ty], [IntrNoMem]>;
2600   def int_x86_avx512_ktestc_b :
2601           Intrinsic<[llvm_i32_ty], [llvm_v8i1_ty, llvm_v8i1_ty], [IntrNoMem]>;
2602   def int_x86_avx512_ktestc_w :
2603           Intrinsic<[llvm_i32_ty], [llvm_v16i1_ty, llvm_v16i1_ty], [IntrNoMem]>;
2604   def int_x86_avx512_ktestc_d :
2605           Intrinsic<[llvm_i32_ty], [llvm_v32i1_ty, llvm_v32i1_ty], [IntrNoMem]>;
2606   def int_x86_avx512_ktestc_q :
2607           Intrinsic<[llvm_i32_ty], [llvm_v64i1_ty, llvm_v64i1_ty], [IntrNoMem]>;
2609   def int_x86_avx512_ktestz_b :
2610           Intrinsic<[llvm_i32_ty], [llvm_v8i1_ty, llvm_v8i1_ty], [IntrNoMem]>;
2611   def int_x86_avx512_ktestz_w :
2612           Intrinsic<[llvm_i32_ty], [llvm_v16i1_ty, llvm_v16i1_ty], [IntrNoMem]>;
2613   def int_x86_avx512_ktestz_d :
2614           Intrinsic<[llvm_i32_ty], [llvm_v32i1_ty, llvm_v32i1_ty], [IntrNoMem]>;
2615   def int_x86_avx512_ktestz_q :
2616           Intrinsic<[llvm_i32_ty], [llvm_v64i1_ty, llvm_v64i1_ty], [IntrNoMem]>;
2619 // Conversion ops
2620 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2621   def int_x86_avx512_cvttss2si : GCCBuiltin<"__builtin_ia32_vcvttss2si32">,
2622               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2623   def int_x86_avx512_cvttss2si64 : GCCBuiltin<"__builtin_ia32_vcvttss2si64">,
2624               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2625   def int_x86_avx512_cvttss2usi : GCCBuiltin<"__builtin_ia32_vcvttss2usi32">,
2626               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2627   def int_x86_avx512_cvttss2usi64 : GCCBuiltin<"__builtin_ia32_vcvttss2usi64">,
2628               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2629   def int_x86_avx512_cvtusi2ss : GCCBuiltin<"__builtin_ia32_cvtusi2ss32">,
2630               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
2631                          llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2632   def int_x86_avx512_cvtusi642ss : GCCBuiltin<"__builtin_ia32_cvtusi2ss64">,
2633               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
2634                          llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>;
2635   def int_x86_avx512_cvttsd2si : GCCBuiltin<"__builtin_ia32_vcvttsd2si32">,
2636               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2637   def int_x86_avx512_cvttsd2si64 : GCCBuiltin<"__builtin_ia32_vcvttsd2si64">,
2638               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2639   def int_x86_avx512_cvttsd2usi : GCCBuiltin<"__builtin_ia32_vcvttsd2usi32">,
2640               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2641   def int_x86_avx512_cvttsd2usi64 : GCCBuiltin<"__builtin_ia32_vcvttsd2usi64">,
2642               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2643   def int_x86_avx512_cvtusi642sd : GCCBuiltin<"__builtin_ia32_cvtusi2sd64">,
2644               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
2645                          llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>;
2646   def int_x86_avx512_vcvtss2usi32 : GCCBuiltin<"__builtin_ia32_vcvtss2usi32">,
2647               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2648   def int_x86_avx512_vcvtss2usi64 : GCCBuiltin<"__builtin_ia32_vcvtss2usi64">,
2649               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2650   def int_x86_avx512_vcvtss2si32 : GCCBuiltin<"__builtin_ia32_vcvtss2si32">,
2651               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2652   def int_x86_avx512_vcvtss2si64 : GCCBuiltin<"__builtin_ia32_vcvtss2si64">,
2653               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty, llvm_i32_ty], [IntrNoMem]>;
2654   def int_x86_avx512_vcvtsd2usi32 : GCCBuiltin<"__builtin_ia32_vcvtsd2usi32">,
2655               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2656   def int_x86_avx512_vcvtsd2usi64 : GCCBuiltin<"__builtin_ia32_vcvtsd2usi64">,
2657               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2658   def int_x86_avx512_vcvtsd2si32 : GCCBuiltin<"__builtin_ia32_vcvtsd2si32">,
2659               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2660   def int_x86_avx512_vcvtsd2si64 : GCCBuiltin<"__builtin_ia32_vcvtsd2si64">,
2661               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty, llvm_i32_ty], [IntrNoMem]>;
2662   def int_x86_avx512_cvtsi2ss32 : GCCBuiltin<"__builtin_ia32_cvtsi2ss32">,
2663               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
2664                          llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
2665   def int_x86_avx512_cvtsi2ss64 : GCCBuiltin<"__builtin_ia32_cvtsi2ss64">,
2666               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
2667                          llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>;
2668   def int_x86_avx512_cvtsi2sd64 : GCCBuiltin<"__builtin_ia32_cvtsi2sd64">,
2669               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
2670                          llvm_i64_ty, llvm_i32_ty], [IntrNoMem]>;
2673 // Pack ops.
2674 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2675   def int_x86_avx512_packsswb_512 : GCCBuiltin<"__builtin_ia32_packsswb512">,
2676               Intrinsic<[llvm_v64i8_ty], [llvm_v32i16_ty,llvm_v32i16_ty],
2677                         [IntrNoMem]>;
2678   def int_x86_avx512_packssdw_512 : GCCBuiltin<"__builtin_ia32_packssdw512">,
2679               Intrinsic<[llvm_v32i16_ty], [llvm_v16i32_ty, llvm_v16i32_ty],
2680                          [IntrNoMem]>;
2681   def int_x86_avx512_packuswb_512 : GCCBuiltin<"__builtin_ia32_packuswb512">,
2682               Intrinsic<[llvm_v64i8_ty], [llvm_v32i16_ty,llvm_v32i16_ty],
2683                          [IntrNoMem]>;
2684   def int_x86_avx512_packusdw_512 : GCCBuiltin<"__builtin_ia32_packusdw512">,
2685               Intrinsic<[llvm_v32i16_ty], [llvm_v16i32_ty, llvm_v16i32_ty],
2686                          [IntrNoMem]>;
2689 // Vector convert
2690 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
2691   def int_x86_avx512_sitofp_round :
2692           Intrinsic<[llvm_anyfloat_ty], [llvm_anyint_ty, llvm_i32_ty],
2693           [IntrNoMem]>;
2695   def int_x86_avx512_uitofp_round :
2696           Intrinsic<[llvm_anyfloat_ty], [llvm_anyint_ty, llvm_i32_ty],
2697           [IntrNoMem]>;
2699   def int_x86_avx512_mask_cvtpd2dq_128 :
2700         GCCBuiltin<"__builtin_ia32_cvtpd2dq128_mask">,
2701           Intrinsic<[llvm_v4i32_ty],
2702           [llvm_v2f64_ty, llvm_v4i32_ty,  llvm_i8_ty],
2703           [IntrNoMem]>;
2705   def int_x86_avx512_mask_cvtpd2dq_512 :
2706         GCCBuiltin<"__builtin_ia32_cvtpd2dq512_mask">,
2707           Intrinsic<[llvm_v8i32_ty],
2708           [llvm_v8f64_ty, llvm_v8i32_ty,  llvm_i8_ty,  llvm_i32_ty],
2709           [IntrNoMem]>;
2711   def int_x86_avx512_mask_cvtpd2ps_512 :
2712         GCCBuiltin<"__builtin_ia32_cvtpd2ps512_mask">,
2713           Intrinsic<[llvm_v8f32_ty],
2714           [llvm_v8f64_ty, llvm_v8f32_ty,  llvm_i8_ty,  llvm_i32_ty],
2715           [IntrNoMem]>;
2717   def int_x86_avx512_mask_cvtsd2ss_round :
2718         GCCBuiltin<"__builtin_ia32_cvtsd2ss_round_mask">,
2719           Intrinsic<[llvm_v4f32_ty],
2720           [llvm_v4f32_ty, llvm_v2f64_ty, llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty],
2721           [IntrNoMem]>;
2723   def int_x86_avx512_mask_cvtss2sd_round :
2724         GCCBuiltin<"__builtin_ia32_cvtss2sd_round_mask">,
2725           Intrinsic<[llvm_v2f64_ty],
2726           [llvm_v2f64_ty, llvm_v4f32_ty, llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty],
2727           [IntrNoMem]>;
2729   def int_x86_avx512_mask_cvtpd2ps :
2730         GCCBuiltin<"__builtin_ia32_cvtpd2ps_mask">,
2731           Intrinsic<[llvm_v4f32_ty],
2732           [llvm_v2f64_ty, llvm_v4f32_ty,  llvm_i8_ty],
2733           [IntrNoMem]>;
2735   def int_x86_avx512_mask_cvtpd2qq_128 :
2736         GCCBuiltin<"__builtin_ia32_cvtpd2qq128_mask">,
2737           Intrinsic<[llvm_v2i64_ty],
2738           [llvm_v2f64_ty, llvm_v2i64_ty,  llvm_i8_ty],
2739           [IntrNoMem]>;
2741   def int_x86_avx512_mask_cvtpd2qq_256 :
2742         GCCBuiltin<"__builtin_ia32_cvtpd2qq256_mask">,
2743           Intrinsic<[llvm_v4i64_ty],
2744           [llvm_v4f64_ty, llvm_v4i64_ty,  llvm_i8_ty],
2745           [IntrNoMem]>;
2747   def int_x86_avx512_mask_cvtpd2qq_512 :
2748         GCCBuiltin<"__builtin_ia32_cvtpd2qq512_mask">,
2749           Intrinsic<[llvm_v8i64_ty],
2750           [llvm_v8f64_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2751           [IntrNoMem]>;
2753   def int_x86_avx512_mask_cvtpd2udq_128 :
2754         GCCBuiltin<"__builtin_ia32_cvtpd2udq128_mask">,
2755           Intrinsic<[llvm_v4i32_ty],
2756           [llvm_v2f64_ty, llvm_v4i32_ty,  llvm_i8_ty],
2757           [IntrNoMem]>;
2759   def int_x86_avx512_mask_cvtpd2udq_256 :
2760         GCCBuiltin<"__builtin_ia32_cvtpd2udq256_mask">,
2761           Intrinsic<[llvm_v4i32_ty],
2762           [llvm_v4f64_ty, llvm_v4i32_ty,  llvm_i8_ty],
2763           [IntrNoMem]>;
2765   def int_x86_avx512_mask_cvtpd2udq_512 :
2766         GCCBuiltin<"__builtin_ia32_cvtpd2udq512_mask">,
2767           Intrinsic<[llvm_v8i32_ty],
2768           [llvm_v8f64_ty, llvm_v8i32_ty,  llvm_i8_ty,  llvm_i32_ty],
2769           [IntrNoMem]>;
2771   def int_x86_avx512_mask_cvtpd2uqq_128 :
2772         GCCBuiltin<"__builtin_ia32_cvtpd2uqq128_mask">,
2773           Intrinsic<[llvm_v2i64_ty],
2774           [llvm_v2f64_ty, llvm_v2i64_ty,  llvm_i8_ty],
2775           [IntrNoMem]>;
2777   def int_x86_avx512_mask_cvtpd2uqq_256 :
2778         GCCBuiltin<"__builtin_ia32_cvtpd2uqq256_mask">,
2779           Intrinsic<[llvm_v4i64_ty],
2780           [llvm_v4f64_ty, llvm_v4i64_ty,  llvm_i8_ty],
2781           [IntrNoMem]>;
2783   def int_x86_avx512_mask_cvtpd2uqq_512 :
2784         GCCBuiltin<"__builtin_ia32_cvtpd2uqq512_mask">,
2785           Intrinsic<[llvm_v8i64_ty],
2786           [llvm_v8f64_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2787           [IntrNoMem]>;
2789   def int_x86_avx512_mask_cvtps2dq_128 :
2790         GCCBuiltin<"__builtin_ia32_cvtps2dq128_mask">,
2791           Intrinsic<[llvm_v4i32_ty],
2792           [llvm_v4f32_ty, llvm_v4i32_ty,  llvm_i8_ty],
2793           [IntrNoMem]>;
2795   def int_x86_avx512_mask_cvtps2dq_256 :
2796         GCCBuiltin<"__builtin_ia32_cvtps2dq256_mask">,
2797           Intrinsic<[llvm_v8i32_ty],
2798           [llvm_v8f32_ty, llvm_v8i32_ty,  llvm_i8_ty],
2799           [IntrNoMem]>;
2801   def int_x86_avx512_mask_cvtps2dq_512 :
2802         GCCBuiltin<"__builtin_ia32_cvtps2dq512_mask">,
2803           Intrinsic<[llvm_v16i32_ty],
2804           [llvm_v16f32_ty, llvm_v16i32_ty,  llvm_i16_ty,  llvm_i32_ty],
2805           [IntrNoMem]>;
2807   def int_x86_avx512_mask_cvtps2pd_512 :
2808         GCCBuiltin<"__builtin_ia32_cvtps2pd512_mask">,
2809           Intrinsic<[llvm_v8f64_ty],
2810           [llvm_v8f32_ty, llvm_v8f64_ty,  llvm_i8_ty,  llvm_i32_ty],
2811           [IntrNoMem]>;
2813   def int_x86_avx512_mask_cvtps2qq_128 :
2814         GCCBuiltin<"__builtin_ia32_cvtps2qq128_mask">,
2815           Intrinsic<[llvm_v2i64_ty],
2816           [llvm_v4f32_ty, llvm_v2i64_ty,  llvm_i8_ty],
2817           [IntrNoMem]>;
2819   def int_x86_avx512_mask_cvtps2qq_256 :
2820         GCCBuiltin<"__builtin_ia32_cvtps2qq256_mask">,
2821           Intrinsic<[llvm_v4i64_ty],
2822           [llvm_v4f32_ty, llvm_v4i64_ty,  llvm_i8_ty],
2823           [IntrNoMem]>;
2825   def int_x86_avx512_mask_cvtps2qq_512 :
2826         GCCBuiltin<"__builtin_ia32_cvtps2qq512_mask">,
2827           Intrinsic<[llvm_v8i64_ty],
2828           [llvm_v8f32_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2829           [IntrNoMem]>;
2831   def int_x86_avx512_mask_cvtps2udq_128 :
2832         GCCBuiltin<"__builtin_ia32_cvtps2udq128_mask">,
2833           Intrinsic<[llvm_v4i32_ty],
2834           [llvm_v4f32_ty, llvm_v4i32_ty,  llvm_i8_ty],
2835           [IntrNoMem]>;
2837   def int_x86_avx512_mask_cvtps2udq_256 :
2838         GCCBuiltin<"__builtin_ia32_cvtps2udq256_mask">,
2839           Intrinsic<[llvm_v8i32_ty],
2840           [llvm_v8f32_ty, llvm_v8i32_ty,  llvm_i8_ty],
2841           [IntrNoMem]>;
2843   def int_x86_avx512_mask_cvtps2udq_512 :
2844         GCCBuiltin<"__builtin_ia32_cvtps2udq512_mask">,
2845           Intrinsic<[llvm_v16i32_ty],
2846           [llvm_v16f32_ty, llvm_v16i32_ty,  llvm_i16_ty,  llvm_i32_ty],
2847           [IntrNoMem]>;
2849   def int_x86_avx512_mask_cvtps2uqq_128 :
2850         GCCBuiltin<"__builtin_ia32_cvtps2uqq128_mask">,
2851           Intrinsic<[llvm_v2i64_ty],
2852           [llvm_v4f32_ty, llvm_v2i64_ty,  llvm_i8_ty],
2853           [IntrNoMem]>;
2855   def int_x86_avx512_mask_cvtps2uqq_256 :
2856         GCCBuiltin<"__builtin_ia32_cvtps2uqq256_mask">,
2857           Intrinsic<[llvm_v4i64_ty],
2858           [llvm_v4f32_ty, llvm_v4i64_ty,  llvm_i8_ty],
2859           [IntrNoMem]>;
2861   def int_x86_avx512_mask_cvtps2uqq_512 :
2862         GCCBuiltin<"__builtin_ia32_cvtps2uqq512_mask">,
2863           Intrinsic<[llvm_v8i64_ty],
2864           [llvm_v8f32_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2865           [IntrNoMem]>;
2867   def int_x86_avx512_mask_cvtqq2ps_128 :
2868         GCCBuiltin<"__builtin_ia32_cvtqq2ps128_mask">,
2869           Intrinsic<[llvm_v4f32_ty],
2870           [llvm_v2i64_ty, llvm_v4f32_ty,  llvm_i8_ty],
2871           [IntrNoMem]>;
2873   def int_x86_avx512_mask_cvttpd2dq_128 :
2874         GCCBuiltin<"__builtin_ia32_cvttpd2dq128_mask">,
2875           Intrinsic<[llvm_v4i32_ty],
2876           [llvm_v2f64_ty, llvm_v4i32_ty,  llvm_i8_ty],
2877           [IntrNoMem]>;
2879   def int_x86_avx512_mask_cvttpd2dq_512 :
2880         GCCBuiltin<"__builtin_ia32_cvttpd2dq512_mask">,
2881           Intrinsic<[llvm_v8i32_ty],
2882           [llvm_v8f64_ty, llvm_v8i32_ty,  llvm_i8_ty,  llvm_i32_ty],
2883           [IntrNoMem]>;
2885   def int_x86_avx512_mask_cvttpd2qq_128 :
2886         GCCBuiltin<"__builtin_ia32_cvttpd2qq128_mask">,
2887           Intrinsic<[llvm_v2i64_ty],
2888           [llvm_v2f64_ty, llvm_v2i64_ty,  llvm_i8_ty],
2889           [IntrNoMem]>;
2891   def int_x86_avx512_mask_cvttpd2qq_256 :
2892         GCCBuiltin<"__builtin_ia32_cvttpd2qq256_mask">,
2893           Intrinsic<[llvm_v4i64_ty],
2894           [llvm_v4f64_ty, llvm_v4i64_ty,  llvm_i8_ty],
2895           [IntrNoMem]>;
2897   def int_x86_avx512_mask_cvttpd2qq_512 :
2898         GCCBuiltin<"__builtin_ia32_cvttpd2qq512_mask">,
2899           Intrinsic<[llvm_v8i64_ty],
2900           [llvm_v8f64_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2901           [IntrNoMem]>;
2903   def int_x86_avx512_mask_cvttpd2udq_128 :
2904         GCCBuiltin<"__builtin_ia32_cvttpd2udq128_mask">,
2905           Intrinsic<[llvm_v4i32_ty],
2906           [llvm_v2f64_ty, llvm_v4i32_ty,  llvm_i8_ty],
2907           [IntrNoMem]>;
2909   def int_x86_avx512_mask_cvttpd2udq_256 :
2910         GCCBuiltin<"__builtin_ia32_cvttpd2udq256_mask">,
2911           Intrinsic<[llvm_v4i32_ty],
2912           [llvm_v4f64_ty, llvm_v4i32_ty,  llvm_i8_ty],
2913           [IntrNoMem]>;
2915   def int_x86_avx512_mask_cvttpd2udq_512 :
2916         GCCBuiltin<"__builtin_ia32_cvttpd2udq512_mask">,
2917           Intrinsic<[llvm_v8i32_ty],
2918           [llvm_v8f64_ty, llvm_v8i32_ty,  llvm_i8_ty,  llvm_i32_ty],
2919           [IntrNoMem]>;
2921   def int_x86_avx512_mask_cvttpd2uqq_128 :
2922         GCCBuiltin<"__builtin_ia32_cvttpd2uqq128_mask">,
2923           Intrinsic<[llvm_v2i64_ty],
2924           [llvm_v2f64_ty, llvm_v2i64_ty,  llvm_i8_ty],
2925           [IntrNoMem]>;
2927   def int_x86_avx512_mask_cvttpd2uqq_256 :
2928         GCCBuiltin<"__builtin_ia32_cvttpd2uqq256_mask">,
2929           Intrinsic<[llvm_v4i64_ty],
2930           [llvm_v4f64_ty, llvm_v4i64_ty,  llvm_i8_ty],
2931           [IntrNoMem]>;
2933   def int_x86_avx512_mask_cvttpd2uqq_512 :
2934         GCCBuiltin<"__builtin_ia32_cvttpd2uqq512_mask">,
2935           Intrinsic<[llvm_v8i64_ty],
2936           [llvm_v8f64_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2937           [IntrNoMem]>;
2939   def int_x86_avx512_mask_cvttps2dq_512 :
2940         GCCBuiltin<"__builtin_ia32_cvttps2dq512_mask">,
2941           Intrinsic<[llvm_v16i32_ty],
2942           [llvm_v16f32_ty, llvm_v16i32_ty,  llvm_i16_ty,  llvm_i32_ty],
2943           [IntrNoMem]>;
2945   def int_x86_avx512_mask_cvttps2qq_128 :
2946         GCCBuiltin<"__builtin_ia32_cvttps2qq128_mask">,
2947           Intrinsic<[llvm_v2i64_ty],
2948           [llvm_v4f32_ty, llvm_v2i64_ty,  llvm_i8_ty],
2949           [IntrNoMem]>;
2951   def int_x86_avx512_mask_cvttps2qq_256 :
2952         GCCBuiltin<"__builtin_ia32_cvttps2qq256_mask">,
2953           Intrinsic<[llvm_v4i64_ty],
2954           [llvm_v4f32_ty, llvm_v4i64_ty,  llvm_i8_ty],
2955           [IntrNoMem]>;
2957   def int_x86_avx512_mask_cvttps2qq_512 :
2958         GCCBuiltin<"__builtin_ia32_cvttps2qq512_mask">,
2959           Intrinsic<[llvm_v8i64_ty],
2960           [llvm_v8f32_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2961           [IntrNoMem]>;
2963   def int_x86_avx512_mask_cvttps2udq_128 :
2964         GCCBuiltin<"__builtin_ia32_cvttps2udq128_mask">,
2965           Intrinsic<[llvm_v4i32_ty],
2966           [llvm_v4f32_ty, llvm_v4i32_ty,  llvm_i8_ty],
2967           [IntrNoMem]>;
2969   def int_x86_avx512_mask_cvttps2udq_256 :
2970         GCCBuiltin<"__builtin_ia32_cvttps2udq256_mask">,
2971           Intrinsic<[llvm_v8i32_ty],
2972           [llvm_v8f32_ty, llvm_v8i32_ty,  llvm_i8_ty],
2973           [IntrNoMem]>;
2975   def int_x86_avx512_mask_cvttps2udq_512 :
2976         GCCBuiltin<"__builtin_ia32_cvttps2udq512_mask">,
2977           Intrinsic<[llvm_v16i32_ty],
2978           [llvm_v16f32_ty, llvm_v16i32_ty,  llvm_i16_ty,  llvm_i32_ty],
2979           [IntrNoMem]>;
2981   def int_x86_avx512_mask_cvttps2uqq_128 :
2982         GCCBuiltin<"__builtin_ia32_cvttps2uqq128_mask">,
2983           Intrinsic<[llvm_v2i64_ty],
2984           [llvm_v4f32_ty, llvm_v2i64_ty,  llvm_i8_ty],
2985           [IntrNoMem]>;
2987   def int_x86_avx512_mask_cvttps2uqq_256 :
2988         GCCBuiltin<"__builtin_ia32_cvttps2uqq256_mask">,
2989           Intrinsic<[llvm_v4i64_ty],
2990           [llvm_v4f32_ty, llvm_v4i64_ty,  llvm_i8_ty],
2991           [IntrNoMem]>;
2993   def int_x86_avx512_mask_cvttps2uqq_512 :
2994         GCCBuiltin<"__builtin_ia32_cvttps2uqq512_mask">,
2995           Intrinsic<[llvm_v8i64_ty],
2996           [llvm_v8f32_ty, llvm_v8i64_ty,  llvm_i8_ty,  llvm_i32_ty],
2997           [IntrNoMem]>;
2999   def int_x86_avx512_mask_cvtuqq2ps_128 :
3000         GCCBuiltin<"__builtin_ia32_cvtuqq2ps128_mask">,
3001           Intrinsic<[llvm_v4f32_ty],
3002           [llvm_v2i64_ty, llvm_v4f32_ty,  llvm_i8_ty],
3003           [IntrNoMem]>;
3005   def int_x86_avx512_mask_rndscale_pd_128 : GCCBuiltin<"__builtin_ia32_rndscalepd_128_mask">,
3006         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_i32_ty,
3007                                      llvm_v2f64_ty,  llvm_i8_ty], [IntrNoMem]>;
3008   def int_x86_avx512_mask_rndscale_pd_256 : GCCBuiltin<"__builtin_ia32_rndscalepd_256_mask">,
3009         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_i32_ty,
3010                                      llvm_v4f64_ty,  llvm_i8_ty], [IntrNoMem]>;
3011   def int_x86_avx512_mask_rndscale_pd_512 : GCCBuiltin<"__builtin_ia32_rndscalepd_mask">,
3012         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_i32_ty, llvm_v8f64_ty,
3013                                      llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3014   def int_x86_avx512_mask_rndscale_ps_128 : GCCBuiltin<"__builtin_ia32_rndscaleps_128_mask">,
3015         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_i32_ty,
3016                                      llvm_v4f32_ty,  llvm_i8_ty], [IntrNoMem]>;
3017   def int_x86_avx512_mask_rndscale_ps_256 : GCCBuiltin<"__builtin_ia32_rndscaleps_256_mask">,
3018         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_i32_ty,
3019                                      llvm_v8f32_ty,  llvm_i8_ty], [IntrNoMem]>;
3020   def int_x86_avx512_mask_rndscale_ps_512 : GCCBuiltin<"__builtin_ia32_rndscaleps_mask">,
3021         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_i32_ty, llvm_v16f32_ty,
3022                                      llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3023   def int_x86_avx512_mask_reduce_pd_128 : GCCBuiltin<"__builtin_ia32_reducepd128_mask">,
3024         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_i32_ty,
3025                                      llvm_v2f64_ty,  llvm_i8_ty], [IntrNoMem]>;
3026   def int_x86_avx512_mask_reduce_pd_256 : GCCBuiltin<"__builtin_ia32_reducepd256_mask">,
3027         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_i32_ty,
3028                                      llvm_v4f64_ty,  llvm_i8_ty], [IntrNoMem]>;
3029   def int_x86_avx512_mask_reduce_pd_512 : GCCBuiltin<"__builtin_ia32_reducepd512_mask">,
3030         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_i32_ty, llvm_v8f64_ty,
3031                                      llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3032   def int_x86_avx512_mask_reduce_ps_128 : GCCBuiltin<"__builtin_ia32_reduceps128_mask">,
3033         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_i32_ty,
3034                                      llvm_v4f32_ty,  llvm_i8_ty], [IntrNoMem]>;
3035   def int_x86_avx512_mask_reduce_ps_256 : GCCBuiltin<"__builtin_ia32_reduceps256_mask">,
3036         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_i32_ty,
3037                                      llvm_v8f32_ty,  llvm_i8_ty], [IntrNoMem]>;
3038   def int_x86_avx512_mask_reduce_ps_512 : GCCBuiltin<"__builtin_ia32_reduceps512_mask">,
3039         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_i32_ty, llvm_v16f32_ty,
3040                                      llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3041 def int_x86_avx512_mask_range_pd_128 : GCCBuiltin<"__builtin_ia32_rangepd128_mask">,
3042         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty,
3043                                     llvm_v2f64_ty,  llvm_i8_ty], [IntrNoMem]>;
3044 def int_x86_avx512_mask_range_pd_256 : GCCBuiltin<"__builtin_ia32_rangepd256_mask">,
3045         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty, llvm_i32_ty,
3046                                     llvm_v4f64_ty,  llvm_i8_ty], [IntrNoMem]>;
3047 def int_x86_avx512_mask_range_pd_512 : GCCBuiltin<"__builtin_ia32_rangepd512_mask">,
3048         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty, llvm_i32_ty,
3049                                     llvm_v8f64_ty,  llvm_i8_ty,  llvm_i32_ty], [IntrNoMem]>;
3050 def int_x86_avx512_mask_range_ps_128 : GCCBuiltin<"__builtin_ia32_rangeps128_mask">,
3051         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty,
3052                                     llvm_v4f32_ty,  llvm_i8_ty], [IntrNoMem]>;
3053 def int_x86_avx512_mask_range_ps_256 : GCCBuiltin<"__builtin_ia32_rangeps256_mask">,
3054         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty, llvm_i32_ty,
3055                                     llvm_v8f32_ty,  llvm_i8_ty], [IntrNoMem]>;
3056 def int_x86_avx512_mask_range_ps_512 : GCCBuiltin<"__builtin_ia32_rangeps512_mask">,
3057         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty, llvm_i32_ty,
3058                                      llvm_v16f32_ty,  llvm_i16_ty,  llvm_i32_ty], [IntrNoMem]>;
3061 // Vector load with broadcast
3062 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
3063    def int_x86_avx512_broadcastmw_512 :
3064           GCCBuiltin<"__builtin_ia32_broadcastmw512">,
3065           Intrinsic<[llvm_v16i32_ty], [llvm_i16_ty], [IntrNoMem]>;
3066    def int_x86_avx512_broadcastmw_256 :
3067           GCCBuiltin<"__builtin_ia32_broadcastmw256">,
3068           Intrinsic<[llvm_v8i32_ty], [llvm_i16_ty], [IntrNoMem]>;
3069    def int_x86_avx512_broadcastmw_128 :
3070           GCCBuiltin<"__builtin_ia32_broadcastmw128">,
3071           Intrinsic<[llvm_v4i32_ty], [llvm_i16_ty], [IntrNoMem]>;
3072    def int_x86_avx512_broadcastmb_512 :
3073           GCCBuiltin<"__builtin_ia32_broadcastmb512">,
3074           Intrinsic<[llvm_v8i64_ty], [llvm_i8_ty], [IntrNoMem]>;
3075    def int_x86_avx512_broadcastmb_256 :
3076           GCCBuiltin<"__builtin_ia32_broadcastmb256">,
3077           Intrinsic<[llvm_v4i64_ty], [llvm_i8_ty], [IntrNoMem]>;
3078    def int_x86_avx512_broadcastmb_128 :
3079           GCCBuiltin<"__builtin_ia32_broadcastmb128">,
3080           Intrinsic<[llvm_v2i64_ty], [llvm_i8_ty], [IntrNoMem]>;
3083 // Arithmetic ops
3084 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
3086   def int_x86_avx512_add_ps_512 : GCCBuiltin<"__builtin_ia32_addps512">,
3087           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3088                      llvm_i32_ty], [IntrNoMem]>;
3089   def int_x86_avx512_add_pd_512 : GCCBuiltin<"__builtin_ia32_addpd512">,
3090           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3091                      llvm_i32_ty], [IntrNoMem]>;
3092   def int_x86_avx512_sub_ps_512 : GCCBuiltin<"__builtin_ia32_subps512">,
3093           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3094                      llvm_i32_ty], [IntrNoMem]>;
3095   def int_x86_avx512_sub_pd_512 : GCCBuiltin<"__builtin_ia32_subpd512">,
3096           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3097                      llvm_i32_ty], [IntrNoMem]>;
3098   def int_x86_avx512_mul_ps_512 : GCCBuiltin<"__builtin_ia32_mulps512">,
3099           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3100                      llvm_i32_ty], [IntrNoMem]>;
3101   def int_x86_avx512_mul_pd_512 : GCCBuiltin<"__builtin_ia32_mulpd512">,
3102           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3103                      llvm_i32_ty], [IntrNoMem]>;
3104   def int_x86_avx512_div_ps_512 : GCCBuiltin<"__builtin_ia32_divps512">,
3105           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3106                      llvm_i32_ty], [IntrNoMem]>;
3107   def int_x86_avx512_div_pd_512 : GCCBuiltin<"__builtin_ia32_divpd512">,
3108           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3109                      llvm_i32_ty], [IntrNoMem]>;
3111   def int_x86_avx512_max_ps_512 : GCCBuiltin<"__builtin_ia32_maxps512">,
3112           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3113                      llvm_i32_ty], [IntrNoMem]>;
3114   def int_x86_avx512_max_pd_512 : GCCBuiltin<"__builtin_ia32_maxpd512">,
3115           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3116                      llvm_i32_ty], [IntrNoMem]>;
3117   def int_x86_avx512_min_ps_512 : GCCBuiltin<"__builtin_ia32_minps512">,
3118           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3119                      llvm_i32_ty], [IntrNoMem]>;
3120   def int_x86_avx512_min_pd_512 : GCCBuiltin<"__builtin_ia32_minpd512">,
3121           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3122                      llvm_i32_ty], [IntrNoMem]>;
3124   def int_x86_avx512_mask_add_ss_round : GCCBuiltin<"__builtin_ia32_addss_round_mask">,
3125           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3126                      llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3127   def int_x86_avx512_mask_div_ss_round : GCCBuiltin<"__builtin_ia32_divss_round_mask">,
3128           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3129                      llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3130   def int_x86_avx512_mask_mul_ss_round : GCCBuiltin<"__builtin_ia32_mulss_round_mask">,
3131           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3132                      llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3133   def int_x86_avx512_mask_sub_ss_round : GCCBuiltin<"__builtin_ia32_subss_round_mask">,
3134           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3135                      llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3136   def int_x86_avx512_mask_max_ss_round : GCCBuiltin<"__builtin_ia32_maxss_round_mask">,
3137           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3138                      llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3139   def int_x86_avx512_mask_min_ss_round : GCCBuiltin<"__builtin_ia32_minss_round_mask">,
3140           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3141                      llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3142   def int_x86_avx512_mask_add_sd_round : GCCBuiltin<"__builtin_ia32_addsd_round_mask">,
3143           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3144                      llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3145   def int_x86_avx512_mask_div_sd_round : GCCBuiltin<"__builtin_ia32_divsd_round_mask">,
3146           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3147                      llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3148   def int_x86_avx512_mask_mul_sd_round : GCCBuiltin<"__builtin_ia32_mulsd_round_mask">,
3149           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3150                      llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3151   def int_x86_avx512_mask_sub_sd_round : GCCBuiltin<"__builtin_ia32_subsd_round_mask">,
3152           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3153                      llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3154   def int_x86_avx512_mask_max_sd_round : GCCBuiltin<"__builtin_ia32_maxsd_round_mask">,
3155           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3156                      llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3157   def int_x86_avx512_mask_min_sd_round : GCCBuiltin<"__builtin_ia32_minsd_round_mask">,
3158           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3159                      llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3161   def int_x86_avx512_mask_rndscale_ss : GCCBuiltin<"__builtin_ia32_rndscaless_round_mask">,
3162           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3163                                      llvm_i8_ty, llvm_i32_ty, llvm_i32_ty],
3164                                      [IntrNoMem]>;
3165   def int_x86_avx512_mask_rndscale_sd : GCCBuiltin<"__builtin_ia32_rndscalesd_round_mask">,
3166           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3167                                       llvm_i8_ty, llvm_i32_ty, llvm_i32_ty],
3168                                      [IntrNoMem]>;
3169   def int_x86_avx512_mask_range_ss : GCCBuiltin<"__builtin_ia32_rangess128_round_mask">,
3170           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3171                                      llvm_i8_ty, llvm_i32_ty, llvm_i32_ty],
3172                                      [IntrNoMem]>;
3173   def int_x86_avx512_mask_range_sd : GCCBuiltin<"__builtin_ia32_rangesd128_round_mask">,
3174           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3175                                       llvm_i8_ty, llvm_i32_ty, llvm_i32_ty],
3176                                      [IntrNoMem]>;
3177   def int_x86_avx512_mask_reduce_ss : GCCBuiltin<"__builtin_ia32_reducess_mask">,
3178           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3179                                      llvm_i8_ty, llvm_i32_ty, llvm_i32_ty],
3180                                      [IntrNoMem]>;
3181   def int_x86_avx512_mask_reduce_sd : GCCBuiltin<"__builtin_ia32_reducesd_mask">,
3182           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3183                                       llvm_i8_ty, llvm_i32_ty, llvm_i32_ty],
3184                                      [IntrNoMem]>;
3185   def int_x86_avx512_mask_scalef_sd : GCCBuiltin<"__builtin_ia32_scalefsd_round_mask">,
3186           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3187                                       llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3188   def int_x86_avx512_mask_scalef_ss : GCCBuiltin<"__builtin_ia32_scalefss_round_mask">,
3189           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3190                                       llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3191   def int_x86_avx512_mask_scalef_pd_128 : GCCBuiltin<"__builtin_ia32_scalefpd128_mask">,
3192           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3193                     llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
3194   def int_x86_avx512_mask_scalef_pd_256 : GCCBuiltin<"__builtin_ia32_scalefpd256_mask">,
3195           Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
3196                     llvm_v4f64_ty, llvm_i8_ty],[IntrNoMem]>;
3197   def int_x86_avx512_mask_scalef_pd_512 : GCCBuiltin<"__builtin_ia32_scalefpd512_mask">,
3198           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3199                     llvm_v8f64_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3200   def int_x86_avx512_mask_scalef_ps_128 : GCCBuiltin<"__builtin_ia32_scalefps128_mask">,
3201           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3202                     llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
3203   def int_x86_avx512_mask_scalef_ps_256 : GCCBuiltin<"__builtin_ia32_scalefps256_mask">,
3204           Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
3205                     llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
3206   def int_x86_avx512_mask_scalef_ps_512 : GCCBuiltin<"__builtin_ia32_scalefps512_mask">,
3207           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3208                     llvm_v16f32_ty, llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3210   def int_x86_avx512_mask_sqrt_ss :
3211         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3212                                     llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3213   def int_x86_avx512_mask_sqrt_sd :
3214         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3215                                     llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3217   def int_x86_avx512_sqrt_pd_512 :
3218         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_i32_ty], [IntrNoMem]>;
3219   def int_x86_avx512_sqrt_ps_512 :
3220         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_i32_ty], [IntrNoMem]>;
3221   def int_x86_avx512_mask_fixupimm_pd_128 :
3222          GCCBuiltin<"__builtin_ia32_fixupimmpd128_mask">,
3223           Intrinsic<[llvm_v2f64_ty],
3224           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2i64_ty, llvm_i32_ty, llvm_i8_ty],
3225           [IntrNoMem]>;
3226   def int_x86_avx512_maskz_fixupimm_pd_128 :
3227          GCCBuiltin<"__builtin_ia32_fixupimmpd128_maskz">,
3228           Intrinsic<[llvm_v2f64_ty],
3229           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2i64_ty, llvm_i32_ty, llvm_i8_ty],
3230           [IntrNoMem]>;
3231   def int_x86_avx512_mask_fixupimm_pd_256 :
3232          GCCBuiltin<"__builtin_ia32_fixupimmpd256_mask">,
3233           Intrinsic<[llvm_v4f64_ty],
3234           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4i64_ty, llvm_i32_ty, llvm_i8_ty],
3235           [IntrNoMem]>;
3236   def int_x86_avx512_maskz_fixupimm_pd_256 :
3237          GCCBuiltin<"__builtin_ia32_fixupimmpd256_maskz">,
3238           Intrinsic<[llvm_v4f64_ty],
3239           [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4i64_ty, llvm_i32_ty, llvm_i8_ty],
3240           [IntrNoMem]>;
3241   def int_x86_avx512_mask_fixupimm_pd_512 :
3242          GCCBuiltin<"__builtin_ia32_fixupimmpd512_mask">,
3243           Intrinsic<[llvm_v8f64_ty],
3244           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8i64_ty, llvm_i32_ty, llvm_i8_ty,
3245           llvm_i32_ty], [IntrNoMem]>;
3246   def int_x86_avx512_maskz_fixupimm_pd_512 :
3247          GCCBuiltin<"__builtin_ia32_fixupimmpd512_maskz">,
3248           Intrinsic<[llvm_v8f64_ty],
3249           [llvm_v8f64_ty, llvm_v8f64_ty, llvm_v8i64_ty, llvm_i32_ty, llvm_i8_ty,
3250           llvm_i32_ty], [IntrNoMem]>;
3251   def int_x86_avx512_mask_fixupimm_ps_128 :
3252          GCCBuiltin<"__builtin_ia32_fixupimmps128_mask">,
3253           Intrinsic<[llvm_v4f32_ty],
3254           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4i32_ty, llvm_i32_ty, llvm_i8_ty],
3255           [IntrNoMem]>;
3256   def int_x86_avx512_maskz_fixupimm_ps_128 :
3257          GCCBuiltin<"__builtin_ia32_fixupimmps128_maskz">,
3258           Intrinsic<[llvm_v4f32_ty],
3259           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4i32_ty, llvm_i32_ty, llvm_i8_ty],
3260           [IntrNoMem]>;
3261   def int_x86_avx512_mask_fixupimm_ps_256 :
3262          GCCBuiltin<"__builtin_ia32_fixupimmps256_mask">,
3263           Intrinsic<[llvm_v8f32_ty],
3264           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8i32_ty, llvm_i32_ty, llvm_i8_ty],
3265           [IntrNoMem]>;
3266   def int_x86_avx512_maskz_fixupimm_ps_256 :
3267          GCCBuiltin<"__builtin_ia32_fixupimmps256_maskz">,
3268           Intrinsic<[llvm_v8f32_ty],
3269           [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8i32_ty, llvm_i32_ty, llvm_i8_ty],
3270           [IntrNoMem]>;
3271   def int_x86_avx512_mask_fixupimm_ps_512 :
3272          GCCBuiltin<"__builtin_ia32_fixupimmps512_mask">,
3273           Intrinsic<[llvm_v16f32_ty],
3274           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16i32_ty, llvm_i32_ty,
3275           llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3276   def int_x86_avx512_maskz_fixupimm_ps_512 :
3277          GCCBuiltin<"__builtin_ia32_fixupimmps512_maskz">,
3278           Intrinsic<[llvm_v16f32_ty],
3279           [llvm_v16f32_ty, llvm_v16f32_ty, llvm_v16i32_ty, llvm_i32_ty,
3280           llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3281   def int_x86_avx512_mask_fixupimm_sd :
3282          GCCBuiltin<"__builtin_ia32_fixupimmsd_mask">,
3283           Intrinsic<[llvm_v2f64_ty],
3284           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2i64_ty, llvm_i32_ty, llvm_i8_ty,
3285           llvm_i32_ty], [IntrNoMem]>;
3286   def int_x86_avx512_maskz_fixupimm_sd :
3287          GCCBuiltin<"__builtin_ia32_fixupimmsd_maskz">,
3288           Intrinsic<[llvm_v2f64_ty],
3289           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2i64_ty, llvm_i32_ty, llvm_i8_ty,
3290           llvm_i32_ty], [IntrNoMem]>;
3291   def int_x86_avx512_mask_fixupimm_ss :
3292          GCCBuiltin<"__builtin_ia32_fixupimmss_mask">,
3293           Intrinsic<[llvm_v4f32_ty],
3294           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4i32_ty, llvm_i32_ty, llvm_i8_ty,
3295           llvm_i32_ty], [IntrNoMem]>;
3296   def int_x86_avx512_maskz_fixupimm_ss :
3297          GCCBuiltin<"__builtin_ia32_fixupimmss_maskz">,
3298           Intrinsic<[llvm_v4f32_ty],
3299           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4i32_ty, llvm_i32_ty, llvm_i8_ty,
3300           llvm_i32_ty], [IntrNoMem]>;
3301   def int_x86_avx512_mask_getexp_pd_128 : GCCBuiltin<"__builtin_ia32_getexppd128_mask">,
3302         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3303                                     llvm_i8_ty], [IntrNoMem]>;
3304   def int_x86_avx512_mask_getexp_pd_256 : GCCBuiltin<"__builtin_ia32_getexppd256_mask">,
3305         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
3306                                     llvm_i8_ty], [IntrNoMem]>;
3307   def int_x86_avx512_mask_getexp_pd_512 : GCCBuiltin<"__builtin_ia32_getexppd512_mask">,
3308         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3309                                     llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3310   def int_x86_avx512_mask_getexp_ps_128 : GCCBuiltin<"__builtin_ia32_getexpps128_mask">,
3311         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3312                                      llvm_i8_ty], [IntrNoMem]>;
3313   def int_x86_avx512_mask_getexp_ps_256 : GCCBuiltin<"__builtin_ia32_getexpps256_mask">,
3314         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
3315                                      llvm_i8_ty], [IntrNoMem]>;
3316   def int_x86_avx512_mask_getexp_ps_512 : GCCBuiltin<"__builtin_ia32_getexpps512_mask">,
3317         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3318                                      llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3320   def int_x86_avx512_mask_getexp_ss : GCCBuiltin<"__builtin_ia32_getexpss128_round_mask">,
3321         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3322                                     llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3323   def int_x86_avx512_mask_getexp_sd : GCCBuiltin<"__builtin_ia32_getexpsd128_round_mask">,
3324         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3325                                     llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3327   def int_x86_avx512_mask_getmant_pd_128 :
3328          GCCBuiltin<"__builtin_ia32_getmantpd128_mask">,
3329           Intrinsic<[llvm_v2f64_ty],
3330           [llvm_v2f64_ty,llvm_i32_ty, llvm_v2f64_ty,  llvm_i8_ty],
3331           [IntrNoMem]>;
3333   def int_x86_avx512_mask_getmant_pd_256 :
3334          GCCBuiltin<"__builtin_ia32_getmantpd256_mask">,
3335           Intrinsic<[llvm_v4f64_ty],
3336           [llvm_v4f64_ty,llvm_i32_ty, llvm_v4f64_ty,  llvm_i8_ty],
3337           [IntrNoMem]>;
3339   def int_x86_avx512_mask_getmant_pd_512 :
3340          GCCBuiltin<"__builtin_ia32_getmantpd512_mask">,
3341           Intrinsic<[llvm_v8f64_ty],
3342           [llvm_v8f64_ty,llvm_i32_ty, llvm_v8f64_ty,  llvm_i8_ty,llvm_i32_ty ],
3343           [IntrNoMem]>;
3345   def int_x86_avx512_mask_getmant_ps_128 :
3346          GCCBuiltin<"__builtin_ia32_getmantps128_mask">,
3347           Intrinsic<[llvm_v4f32_ty],
3348           [llvm_v4f32_ty, llvm_i32_ty, llvm_v4f32_ty,  llvm_i8_ty],
3349           [IntrNoMem]>;
3351   def int_x86_avx512_mask_getmant_ps_256 :
3352          GCCBuiltin<"__builtin_ia32_getmantps256_mask">,
3353           Intrinsic<[llvm_v8f32_ty],
3354           [llvm_v8f32_ty, llvm_i32_ty, llvm_v8f32_ty,  llvm_i8_ty],
3355           [IntrNoMem]>;
3357   def int_x86_avx512_mask_getmant_ps_512 :
3358          GCCBuiltin<"__builtin_ia32_getmantps512_mask">,
3359           Intrinsic<[llvm_v16f32_ty],
3360           [llvm_v16f32_ty,llvm_i32_ty, llvm_v16f32_ty,llvm_i16_ty,llvm_i32_ty],
3361           [IntrNoMem]>;
3363   def int_x86_avx512_mask_getmant_ss :
3364          GCCBuiltin<"__builtin_ia32_getmantss_round_mask">,
3365           Intrinsic<[llvm_v4f32_ty],
3366           [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty, llvm_v4f32_ty,
3367            llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3369   def int_x86_avx512_mask_getmant_sd :
3370          GCCBuiltin<"__builtin_ia32_getmantsd_round_mask">,
3371           Intrinsic<[llvm_v2f64_ty],
3372           [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty, llvm_v2f64_ty,
3373            llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3375   def int_x86_avx512_rsqrt14_ss : GCCBuiltin<"__builtin_ia32_rsqrt14ss_mask">,
3376         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3377                                     llvm_i8_ty], [IntrNoMem]>;
3378   def int_x86_avx512_rsqrt14_sd : GCCBuiltin<"__builtin_ia32_rsqrt14sd_mask">,
3379         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3380                                     llvm_i8_ty], [IntrNoMem]>;
3382   def int_x86_avx512_rsqrt14_pd_128 : GCCBuiltin<"__builtin_ia32_rsqrt14pd128_mask">,
3383         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3384                                     llvm_i8_ty], [IntrNoMem]>;
3385   def int_x86_avx512_rsqrt14_pd_256 : GCCBuiltin<"__builtin_ia32_rsqrt14pd256_mask">,
3386         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
3387                                     llvm_i8_ty], [IntrNoMem]>;
3388   def int_x86_avx512_rsqrt14_pd_512 : GCCBuiltin<"__builtin_ia32_rsqrt14pd512_mask">,
3389         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3390                                     llvm_i8_ty], [IntrNoMem]>;
3391   def int_x86_avx512_rsqrt14_ps_128 : GCCBuiltin<"__builtin_ia32_rsqrt14ps128_mask">,
3392         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3393                                      llvm_i8_ty], [IntrNoMem]>;
3394   def int_x86_avx512_rsqrt14_ps_256 : GCCBuiltin<"__builtin_ia32_rsqrt14ps256_mask">,
3395           Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
3396                                      llvm_i8_ty], [IntrNoMem]>;
3397   def int_x86_avx512_rsqrt14_ps_512 : GCCBuiltin<"__builtin_ia32_rsqrt14ps512_mask">,
3398         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3399                                      llvm_i16_ty], [IntrNoMem]>;
3400   def int_x86_avx512_rcp14_ss : GCCBuiltin<"__builtin_ia32_rcp14ss_mask">,
3401         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty,
3402                                     llvm_i8_ty], [IntrNoMem]>;
3403   def int_x86_avx512_rcp14_sd : GCCBuiltin<"__builtin_ia32_rcp14sd_mask">,
3404         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty,
3405                                     llvm_i8_ty], [IntrNoMem]>;
3407   def int_x86_avx512_rcp14_pd_128 : GCCBuiltin<"__builtin_ia32_rcp14pd128_mask">,
3408         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3409                                     llvm_i8_ty], [IntrNoMem]>;
3410   def int_x86_avx512_rcp14_pd_256 : GCCBuiltin<"__builtin_ia32_rcp14pd256_mask">,
3411         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
3412                                     llvm_i8_ty], [IntrNoMem]>;
3413   def int_x86_avx512_rcp14_pd_512 : GCCBuiltin<"__builtin_ia32_rcp14pd512_mask">,
3414         Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3415                                     llvm_i8_ty], [IntrNoMem]>;
3416   def int_x86_avx512_rcp14_ps_128 : GCCBuiltin<"__builtin_ia32_rcp14ps128_mask">,
3417         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3418                                      llvm_i8_ty], [IntrNoMem]>;
3419   def int_x86_avx512_rcp14_ps_256 : GCCBuiltin<"__builtin_ia32_rcp14ps256_mask">,
3420           Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
3421                                      llvm_i8_ty], [IntrNoMem]>;
3422   def int_x86_avx512_rcp14_ps_512 : GCCBuiltin<"__builtin_ia32_rcp14ps512_mask">,
3423         Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3424                                      llvm_i16_ty], [IntrNoMem]>;
3426   def int_x86_avx512_rcp28_ps : GCCBuiltin<"__builtin_ia32_rcp28ps_mask">,
3427             Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3428                                          llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3429   def int_x86_avx512_rcp28_pd : GCCBuiltin<"__builtin_ia32_rcp28pd_mask">,
3430             Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3431                                         llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3432   def int_x86_avx512_exp2_ps : GCCBuiltin<"__builtin_ia32_exp2ps_mask">,
3433             Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3434                                          llvm_i16_ty, llvm_i32_ty], [IntrNoMem]>;
3435   def int_x86_avx512_exp2_pd : GCCBuiltin<"__builtin_ia32_exp2pd_mask">,
3436             Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3437                                         llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
3439   def int_x86_avx512_rcp28_ss : GCCBuiltin<"__builtin_ia32_rcp28ss_round_mask">,
3440             Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3441                                         llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty],
3442                       [IntrNoMem]>;
3443   def int_x86_avx512_rcp28_sd : GCCBuiltin<"__builtin_ia32_rcp28sd_round_mask">,
3444             Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3445                                         llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty],
3446                       [IntrNoMem]>;
3447   def int_x86_avx512_rsqrt28_ps : GCCBuiltin<"__builtin_ia32_rsqrt28ps_mask">,
3448             Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
3449                                          llvm_i16_ty, llvm_i32_ty],
3450                       [IntrNoMem]>;
3451   def int_x86_avx512_rsqrt28_pd : GCCBuiltin<"__builtin_ia32_rsqrt28pd_mask">,
3452             Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
3453                                         llvm_i8_ty, llvm_i32_ty],
3454                       [IntrNoMem]>;
3455   def int_x86_avx512_rsqrt28_ss : GCCBuiltin<"__builtin_ia32_rsqrt28ss_round_mask">,
3456             Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
3457                                         llvm_v4f32_ty, llvm_i8_ty, llvm_i32_ty],
3458                       [IntrNoMem]>;
3459   def int_x86_avx512_rsqrt28_sd : GCCBuiltin<"__builtin_ia32_rsqrt28sd_round_mask">,
3460             Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
3461                                         llvm_v2f64_ty, llvm_i8_ty, llvm_i32_ty],
3462                       [IntrNoMem]>;
3463   def int_x86_avx512_psad_bw_512 : GCCBuiltin<"__builtin_ia32_psadbw512">,
3464               Intrinsic<[llvm_v8i64_ty], [llvm_v64i8_ty, llvm_v64i8_ty],
3465                         [IntrNoMem, Commutative]>;
3467 // Integer arithmetic ops
3468 let TargetPrefix = "x86" in {
3469   def int_x86_avx512_pmulhu_w_512 : GCCBuiltin<"__builtin_ia32_pmulhuw512">,
3470               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
3471                          llvm_v32i16_ty], [IntrNoMem, Commutative]>;
3472   def int_x86_avx512_pmulh_w_512 : GCCBuiltin<"__builtin_ia32_pmulhw512">,
3473               Intrinsic<[llvm_v32i16_ty], [llvm_v32i16_ty,
3474                          llvm_v32i16_ty], [IntrNoMem, Commutative]>;
3475   def int_x86_avx512_pmaddw_d_512 : GCCBuiltin<"__builtin_ia32_pmaddwd512">,
3476               Intrinsic<[llvm_v16i32_ty], [llvm_v32i16_ty,
3477                          llvm_v32i16_ty], [IntrNoMem, Commutative]>;
3478   def int_x86_avx512_pmaddubs_w_512 : GCCBuiltin<"__builtin_ia32_pmaddubsw512">,
3479               Intrinsic<[llvm_v32i16_ty], [llvm_v64i8_ty,
3480                          llvm_v64i8_ty], [IntrNoMem]>;
3482   def int_x86_avx512_dbpsadbw_128 :
3483          GCCBuiltin<"__builtin_ia32_dbpsadbw128">,
3484           Intrinsic<[llvm_v8i16_ty],
3485                     [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i32_ty], [IntrNoMem]>;
3487   def int_x86_avx512_dbpsadbw_256 :
3488          GCCBuiltin<"__builtin_ia32_dbpsadbw256">,
3489           Intrinsic<[llvm_v16i16_ty],
3490                     [llvm_v32i8_ty, llvm_v32i8_ty, llvm_i32_ty], [IntrNoMem]>;
3492   def int_x86_avx512_dbpsadbw_512 :
3493          GCCBuiltin<"__builtin_ia32_dbpsadbw512">,
3494           Intrinsic<[llvm_v32i16_ty],
3495                     [llvm_v64i8_ty, llvm_v64i8_ty, llvm_i32_ty], [IntrNoMem]>;
3498 // Gather and Scatter ops
3499 let TargetPrefix = "x86" in {
3500   // NOTE: These are deprecated in favor of the versions that take a vXi1 mask.
3501   def int_x86_avx512_gather_dpd_512  :
3502           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_ptr_ty,
3503                      llvm_v8i32_ty, llvm_i8_ty, llvm_i32_ty],
3504                     [IntrReadMem, IntrArgMemOnly]>;
3505   def int_x86_avx512_gather_dps_512  :
3506           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_ptr_ty,
3507                      llvm_v16i32_ty, llvm_i16_ty, llvm_i32_ty],
3508                     [IntrReadMem, IntrArgMemOnly]>;
3509   def int_x86_avx512_gather_qpd_512  :
3510           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_ptr_ty,
3511                      llvm_v8i64_ty, llvm_i8_ty, llvm_i32_ty],
3512                     [IntrReadMem, IntrArgMemOnly]>;
3513   def int_x86_avx512_gather_qps_512  :
3514           Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_ptr_ty,
3515                      llvm_v8i64_ty, llvm_i8_ty, llvm_i32_ty],
3516                     [IntrReadMem, IntrArgMemOnly]>;
3519   def int_x86_avx512_gather_dpq_512  :
3520           Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_ptr_ty,
3521                      llvm_v8i32_ty, llvm_i8_ty, llvm_i32_ty],
3522                     [IntrReadMem, IntrArgMemOnly]>;
3523   def int_x86_avx512_gather_dpi_512  :
3524           Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_ptr_ty,
3525                      llvm_v16i32_ty, llvm_i16_ty, llvm_i32_ty],
3526                     [IntrReadMem, IntrArgMemOnly]>;
3527   def int_x86_avx512_gather_qpq_512  :
3528           Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_ptr_ty,
3529                      llvm_v8i64_ty, llvm_i8_ty, llvm_i32_ty],
3530                     [IntrReadMem, IntrArgMemOnly]>;
3531   def int_x86_avx512_gather_qpi_512  :
3532           Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_ptr_ty,
3533                      llvm_v8i64_ty, llvm_i8_ty, llvm_i32_ty],
3534                     [IntrReadMem, IntrArgMemOnly]>;
3536   def int_x86_avx512_gather3div2_df :
3537           Intrinsic<[llvm_v2f64_ty],
3538           [llvm_v2f64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty, llvm_i32_ty],
3539           [IntrReadMem, IntrArgMemOnly]>;
3541   def int_x86_avx512_gather3div2_di :
3542           Intrinsic<[llvm_v2i64_ty],
3543           [llvm_v2i64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty, llvm_i32_ty],
3544           [IntrReadMem, IntrArgMemOnly]>;
3546   def int_x86_avx512_gather3div4_df :
3547           Intrinsic<[llvm_v4f64_ty],
3548           [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty, llvm_i32_ty],
3549           [IntrReadMem, IntrArgMemOnly]>;
3551   def int_x86_avx512_gather3div4_di :
3552           Intrinsic<[llvm_v4i64_ty],
3553           [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty, llvm_i32_ty],
3554           [IntrReadMem, IntrArgMemOnly]>;
3556   def int_x86_avx512_gather3div4_sf :
3557           Intrinsic<[llvm_v4f32_ty],
3558           [llvm_v4f32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty, llvm_i32_ty],
3559           [IntrReadMem, IntrArgMemOnly]>;
3561   def int_x86_avx512_gather3div4_si :
3562           Intrinsic<[llvm_v4i32_ty],
3563           [llvm_v4i32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty, llvm_i32_ty],
3564           [IntrReadMem, IntrArgMemOnly]>;
3566   def int_x86_avx512_gather3div8_sf :
3567           Intrinsic<[llvm_v4f32_ty],
3568           [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty, llvm_i32_ty],
3569           [IntrReadMem, IntrArgMemOnly]>;
3571   def int_x86_avx512_gather3div8_si :
3572           Intrinsic<[llvm_v4i32_ty],
3573           [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty, llvm_i32_ty],
3574           [IntrReadMem, IntrArgMemOnly]>;
3576   def int_x86_avx512_gather3siv2_df :
3577           Intrinsic<[llvm_v2f64_ty],
3578           [llvm_v2f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty, llvm_i32_ty],
3579           [IntrReadMem, IntrArgMemOnly]>;
3581   def int_x86_avx512_gather3siv2_di :
3582           Intrinsic<[llvm_v2i64_ty],
3583           [llvm_v2i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty, llvm_i32_ty],
3584           [IntrReadMem, IntrArgMemOnly]>;
3586   def int_x86_avx512_gather3siv4_df :
3587           Intrinsic<[llvm_v4f64_ty],
3588           [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty, llvm_i32_ty],
3589           [IntrReadMem, IntrArgMemOnly]>;
3591   def int_x86_avx512_gather3siv4_di :
3592           Intrinsic<[llvm_v4i64_ty],
3593           [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty, llvm_i32_ty],
3594           [IntrReadMem, IntrArgMemOnly]>;
3596   def int_x86_avx512_gather3siv4_sf :
3597           Intrinsic<[llvm_v4f32_ty],
3598           [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty, llvm_i32_ty],
3599           [IntrReadMem, IntrArgMemOnly]>;
3601   def int_x86_avx512_gather3siv4_si :
3602           Intrinsic<[llvm_v4i32_ty],
3603           [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty, llvm_i32_ty],
3604           [IntrReadMem, IntrArgMemOnly]>;
3606   def int_x86_avx512_gather3siv8_sf :
3607           Intrinsic<[llvm_v8f32_ty],
3608           [llvm_v8f32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty, llvm_i32_ty],
3609           [IntrReadMem, IntrArgMemOnly]>;
3611   def int_x86_avx512_gather3siv8_si :
3612           Intrinsic<[llvm_v8i32_ty],
3613           [llvm_v8i32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty, llvm_i32_ty],
3614           [IntrReadMem, IntrArgMemOnly]>;
3616 // scatter
3617   // NOTE: These are deprecated in favor of the versions that take a vXi1 mask.
3618   def int_x86_avx512_scatter_dpd_512  :
3619           Intrinsic<[], [llvm_ptr_ty, llvm_i8_ty,
3620                         llvm_v8i32_ty, llvm_v8f64_ty, llvm_i32_ty],
3621                     [IntrArgMemOnly]>;
3622   def int_x86_avx512_scatter_dps_512  :
3623           Intrinsic<[], [llvm_ptr_ty, llvm_i16_ty,
3624                        llvm_v16i32_ty, llvm_v16f32_ty, llvm_i32_ty],
3625                     [IntrArgMemOnly]>;
3626   def int_x86_avx512_scatter_qpd_512  :
3627           Intrinsic<[], [llvm_ptr_ty, llvm_i8_ty,
3628                      llvm_v8i64_ty, llvm_v8f64_ty, llvm_i32_ty],
3629                     [IntrArgMemOnly]>;
3630   def int_x86_avx512_scatter_qps_512  :
3631           Intrinsic<[], [llvm_ptr_ty, llvm_i8_ty,
3632                      llvm_v8i64_ty, llvm_v8f32_ty, llvm_i32_ty],
3633                     [IntrArgMemOnly]>;
3636   def int_x86_avx512_scatter_dpq_512  :
3637           Intrinsic<[], [llvm_ptr_ty, llvm_i8_ty,
3638                          llvm_v8i32_ty, llvm_v8i64_ty, llvm_i32_ty],
3639                     [IntrArgMemOnly]>;
3640   def int_x86_avx512_scatter_dpi_512  :
3641           Intrinsic<[], [llvm_ptr_ty, llvm_i16_ty,
3642                      llvm_v16i32_ty, llvm_v16i32_ty, llvm_i32_ty],
3643                     [IntrArgMemOnly]>;
3644   def int_x86_avx512_scatter_qpq_512  :
3645           Intrinsic<[], [llvm_ptr_ty, llvm_i8_ty,llvm_v8i64_ty, llvm_v8i64_ty,
3646                          llvm_i32_ty],
3647                     [IntrArgMemOnly]>;
3648   def int_x86_avx512_scatter_qpi_512  :
3649           Intrinsic<[], [llvm_ptr_ty, llvm_i8_ty, llvm_v8i64_ty, llvm_v8i32_ty,
3650                          llvm_i32_ty],
3651                     [IntrArgMemOnly]>;
3653   def int_x86_avx512_scatterdiv2_df :
3654         Intrinsic<[],
3655         [llvm_ptr_ty, llvm_i8_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i32_ty],
3656         [IntrArgMemOnly]>;
3658   def int_x86_avx512_scatterdiv2_di :
3659           Intrinsic<[],
3660           [llvm_ptr_ty, llvm_i8_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
3661           [IntrArgMemOnly]>;
3663   def int_x86_avx512_scatterdiv4_df :
3664           Intrinsic<[],
3665           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i32_ty],
3666           [IntrArgMemOnly]>;
3668   def int_x86_avx512_scatterdiv4_di :
3669           Intrinsic<[],
3670           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i32_ty],
3671           [IntrArgMemOnly]>;
3673   def int_x86_avx512_scatterdiv4_sf :
3674           Intrinsic<[],
3675           [llvm_ptr_ty, llvm_i8_ty, llvm_v2i64_ty, llvm_v4f32_ty, llvm_i32_ty],
3676           [IntrArgMemOnly]>;
3678   def int_x86_avx512_scatterdiv4_si :
3679           Intrinsic<[],
3680           [llvm_ptr_ty, llvm_i8_ty, llvm_v2i64_ty, llvm_v4i32_ty, llvm_i32_ty],
3681           [IntrArgMemOnly]>;
3683   def int_x86_avx512_scatterdiv8_sf :
3684           Intrinsic<[],
3685           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i64_ty, llvm_v4f32_ty, llvm_i32_ty],
3686           [IntrArgMemOnly]>;
3688   def int_x86_avx512_scatterdiv8_si :
3689           Intrinsic<[],
3690           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i64_ty, llvm_v4i32_ty, llvm_i32_ty],
3691           [IntrArgMemOnly]>;
3693   def int_x86_avx512_scattersiv2_df :
3694           Intrinsic<[],
3695           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i32_ty, llvm_v2f64_ty, llvm_i32_ty],
3696           [IntrArgMemOnly]>;
3698   def int_x86_avx512_scattersiv2_di :
3699           Intrinsic<[],
3700           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i32_ty, llvm_v2i64_ty, llvm_i32_ty],
3701           [IntrArgMemOnly]>;
3703   def int_x86_avx512_scattersiv4_df :
3704           Intrinsic<[],
3705           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i32_ty, llvm_v4f64_ty, llvm_i32_ty],
3706           [IntrArgMemOnly]>;
3708   def int_x86_avx512_scattersiv4_di :
3709           Intrinsic<[],
3710           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i32_ty, llvm_v4i64_ty, llvm_i32_ty],
3711           [IntrArgMemOnly]>;
3713   def int_x86_avx512_scattersiv4_sf :
3714           Intrinsic<[],
3715           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i32_ty],
3716           [IntrArgMemOnly]>;
3718   def int_x86_avx512_scattersiv4_si :
3719           Intrinsic<[],
3720           [llvm_ptr_ty, llvm_i8_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
3721           [IntrArgMemOnly]>;
3723   def int_x86_avx512_scattersiv8_sf :
3724           Intrinsic<[],
3725           [llvm_ptr_ty, llvm_i8_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i32_ty],
3726           [IntrArgMemOnly]>;
3728   def int_x86_avx512_scattersiv8_si :
3729           Intrinsic<[],
3730           [llvm_ptr_ty, llvm_i8_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i32_ty],
3731           [IntrArgMemOnly]>;
3733   // gather prefetch
3734   def int_x86_avx512_gatherpf_dpd_512  : GCCBuiltin<"__builtin_ia32_gatherpfdpd">,
3735           Intrinsic<[], [llvm_i8_ty, llvm_v8i32_ty, llvm_ptr_ty,
3736                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3737   def int_x86_avx512_gatherpf_dps_512  : GCCBuiltin<"__builtin_ia32_gatherpfdps">,
3738           Intrinsic<[], [llvm_i16_ty, llvm_v16i32_ty, llvm_ptr_ty,
3739                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3740   def int_x86_avx512_gatherpf_qpd_512  : GCCBuiltin<"__builtin_ia32_gatherpfqpd">,
3741           Intrinsic<[], [llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty,
3742                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3743   def int_x86_avx512_gatherpf_qps_512  : GCCBuiltin<"__builtin_ia32_gatherpfqps">,
3744           Intrinsic<[], [llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty,
3745                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3747   // scatter prefetch
3748   def int_x86_avx512_scatterpf_dpd_512  : GCCBuiltin<"__builtin_ia32_scatterpfdpd">,
3749           Intrinsic<[], [llvm_i8_ty, llvm_v8i32_ty, llvm_ptr_ty,
3750                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3751   def int_x86_avx512_scatterpf_dps_512  : GCCBuiltin<"__builtin_ia32_scatterpfdps">,
3752           Intrinsic<[], [llvm_i16_ty, llvm_v16i32_ty, llvm_ptr_ty,
3753                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3754   def int_x86_avx512_scatterpf_qpd_512  : GCCBuiltin<"__builtin_ia32_scatterpfqpd">,
3755           Intrinsic<[], [llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty,
3756                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3757   def int_x86_avx512_scatterpf_qps_512  : GCCBuiltin<"__builtin_ia32_scatterpfqps">,
3758           Intrinsic<[], [llvm_i8_ty, llvm_v8i64_ty, llvm_ptr_ty,
3759                      llvm_i32_ty, llvm_i32_ty], [IntrArgMemOnly]>;
3762 // AVX512 gather/scatter intrinsics that use vXi1 masks.
3763 let TargetPrefix = "x86" in {
3764   def int_x86_avx512_mask_gather_dpd_512  :
3765           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_ptr_ty,
3766                      llvm_v8i32_ty, llvm_v8i1_ty, llvm_i32_ty],
3767                     [IntrReadMem, IntrArgMemOnly]>;
3768   def int_x86_avx512_mask_gather_dps_512  :
3769           Intrinsic<[llvm_v16f32_ty], [llvm_v16f32_ty, llvm_ptr_ty,
3770                      llvm_v16i32_ty, llvm_v16i1_ty, llvm_i32_ty],
3771                     [IntrReadMem, IntrArgMemOnly]>;
3772   def int_x86_avx512_mask_gather_qpd_512  :
3773           Intrinsic<[llvm_v8f64_ty], [llvm_v8f64_ty, llvm_ptr_ty,
3774                      llvm_v8i64_ty, llvm_v8i1_ty, llvm_i32_ty],
3775                     [IntrReadMem, IntrArgMemOnly]>;
3776   def int_x86_avx512_mask_gather_qps_512  :
3777           Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_ptr_ty,
3778                      llvm_v8i64_ty, llvm_v8i1_ty, llvm_i32_ty],
3779                     [IntrReadMem, IntrArgMemOnly]>;
3782   def int_x86_avx512_mask_gather_dpq_512  :
3783           Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_ptr_ty,
3784                      llvm_v8i32_ty, llvm_v8i1_ty, llvm_i32_ty],
3785                     [IntrReadMem, IntrArgMemOnly]>;
3786   def int_x86_avx512_mask_gather_dpi_512  :
3787           Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty, llvm_ptr_ty,
3788                      llvm_v16i32_ty, llvm_v16i1_ty, llvm_i32_ty],
3789                     [IntrReadMem, IntrArgMemOnly]>;
3790   def int_x86_avx512_mask_gather_qpq_512  :
3791           Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty, llvm_ptr_ty,
3792                      llvm_v8i64_ty, llvm_v8i1_ty, llvm_i32_ty],
3793                     [IntrReadMem, IntrArgMemOnly]>;
3794   def int_x86_avx512_mask_gather_qpi_512  :
3795           Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_ptr_ty,
3796                      llvm_v8i64_ty, llvm_v8i1_ty, llvm_i32_ty],
3797                     [IntrReadMem, IntrArgMemOnly]>;
3799   def int_x86_avx512_mask_gather3div2_df :
3800           Intrinsic<[llvm_v2f64_ty],
3801           [llvm_v2f64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i1_ty, llvm_i32_ty],
3802           [IntrReadMem, IntrArgMemOnly]>;
3804   def int_x86_avx512_mask_gather3div2_di :
3805           Intrinsic<[llvm_v2i64_ty],
3806           [llvm_v2i64_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i1_ty, llvm_i32_ty],
3807           [IntrReadMem, IntrArgMemOnly]>;
3809   def int_x86_avx512_mask_gather3div4_df :
3810           Intrinsic<[llvm_v4f64_ty],
3811           [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i1_ty, llvm_i32_ty],
3812           [IntrReadMem, IntrArgMemOnly]>;
3814   def int_x86_avx512_mask_gather3div4_di :
3815           Intrinsic<[llvm_v4i64_ty],
3816           [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i1_ty, llvm_i32_ty],
3817           [IntrReadMem, IntrArgMemOnly]>;
3819   def int_x86_avx512_mask_gather3div4_sf :
3820           Intrinsic<[llvm_v4f32_ty],
3821           [llvm_v4f32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i1_ty, llvm_i32_ty],
3822           [IntrReadMem, IntrArgMemOnly]>;
3824   def int_x86_avx512_mask_gather3div4_si :
3825           Intrinsic<[llvm_v4i32_ty],
3826           [llvm_v4i32_ty, llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i1_ty, llvm_i32_ty],
3827           [IntrReadMem, IntrArgMemOnly]>;
3829   def int_x86_avx512_mask_gather3div8_sf :
3830           Intrinsic<[llvm_v4f32_ty],
3831           [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i1_ty, llvm_i32_ty],
3832           [IntrReadMem, IntrArgMemOnly]>;
3834   def int_x86_avx512_mask_gather3div8_si :
3835           Intrinsic<[llvm_v4i32_ty],
3836           [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i1_ty, llvm_i32_ty],
3837           [IntrReadMem, IntrArgMemOnly]>;
3839   def int_x86_avx512_mask_gather3siv2_df :
3840           Intrinsic<[llvm_v2f64_ty],
3841           [llvm_v2f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2i1_ty, llvm_i32_ty],
3842           [IntrReadMem, IntrArgMemOnly]>;
3844   def int_x86_avx512_mask_gather3siv2_di :
3845           Intrinsic<[llvm_v2i64_ty],
3846           [llvm_v2i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v2i1_ty, llvm_i32_ty],
3847           [IntrReadMem, IntrArgMemOnly]>;
3849   def int_x86_avx512_mask_gather3siv4_df :
3850           Intrinsic<[llvm_v4f64_ty],
3851           [llvm_v4f64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i1_ty, llvm_i32_ty],
3852           [IntrReadMem, IntrArgMemOnly]>;
3854   def int_x86_avx512_mask_gather3siv4_di :
3855           Intrinsic<[llvm_v4i64_ty],
3856           [llvm_v4i64_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i1_ty, llvm_i32_ty],
3857           [IntrReadMem, IntrArgMemOnly]>;
3859   def int_x86_avx512_mask_gather3siv4_sf :
3860           Intrinsic<[llvm_v4f32_ty],
3861           [llvm_v4f32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i1_ty, llvm_i32_ty],
3862           [IntrReadMem, IntrArgMemOnly]>;
3864   def int_x86_avx512_mask_gather3siv4_si :
3865           Intrinsic<[llvm_v4i32_ty],
3866           [llvm_v4i32_ty, llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i1_ty, llvm_i32_ty],
3867           [IntrReadMem, IntrArgMemOnly]>;
3869   def int_x86_avx512_mask_gather3siv8_sf :
3870           Intrinsic<[llvm_v8f32_ty],
3871           [llvm_v8f32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i1_ty, llvm_i32_ty],
3872           [IntrReadMem, IntrArgMemOnly]>;
3874   def int_x86_avx512_mask_gather3siv8_si :
3875           Intrinsic<[llvm_v8i32_ty],
3876           [llvm_v8i32_ty, llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i1_ty, llvm_i32_ty],
3877           [IntrReadMem, IntrArgMemOnly]>;
3879   def int_x86_avx512_mask_scatter_dpd_512  :
3880           Intrinsic<[], [llvm_ptr_ty, llvm_v8i1_ty,
3881                         llvm_v8i32_ty, llvm_v8f64_ty, llvm_i32_ty],
3882                     [IntrArgMemOnly]>;
3883   def int_x86_avx512_mask_scatter_dps_512  :
3884           Intrinsic<[], [llvm_ptr_ty, llvm_v16i1_ty,
3885                        llvm_v16i32_ty, llvm_v16f32_ty, llvm_i32_ty],
3886                     [IntrArgMemOnly]>;
3887   def int_x86_avx512_mask_scatter_qpd_512  :
3888           Intrinsic<[], [llvm_ptr_ty, llvm_v8i1_ty,
3889                      llvm_v8i64_ty, llvm_v8f64_ty, llvm_i32_ty],
3890                     [IntrArgMemOnly]>;
3891   def int_x86_avx512_mask_scatter_qps_512  :
3892           Intrinsic<[], [llvm_ptr_ty, llvm_v8i1_ty,
3893                      llvm_v8i64_ty, llvm_v8f32_ty, llvm_i32_ty],
3894                     [IntrArgMemOnly]>;
3897   def int_x86_avx512_mask_scatter_dpq_512  :
3898           Intrinsic<[], [llvm_ptr_ty, llvm_v8i1_ty,
3899                          llvm_v8i32_ty, llvm_v8i64_ty, llvm_i32_ty],
3900                     [IntrArgMemOnly]>;
3901   def int_x86_avx512_mask_scatter_dpi_512  :
3902           Intrinsic<[], [llvm_ptr_ty, llvm_v16i1_ty,
3903                      llvm_v16i32_ty, llvm_v16i32_ty, llvm_i32_ty],
3904                     [IntrArgMemOnly]>;
3905   def int_x86_avx512_mask_scatter_qpq_512  :
3906           Intrinsic<[], [llvm_ptr_ty, llvm_v8i1_ty,llvm_v8i64_ty, llvm_v8i64_ty,
3907                          llvm_i32_ty],
3908                     [IntrArgMemOnly]>;
3909   def int_x86_avx512_mask_scatter_qpi_512  :
3910           Intrinsic<[], [llvm_ptr_ty, llvm_v8i1_ty, llvm_v8i64_ty, llvm_v8i32_ty,
3911                          llvm_i32_ty],
3912                     [IntrArgMemOnly]>;
3914   def int_x86_avx512_mask_scatterdiv2_df :
3915         Intrinsic<[],
3916         [llvm_ptr_ty, llvm_v2i1_ty, llvm_v2i64_ty, llvm_v2f64_ty, llvm_i32_ty],
3917         [IntrArgMemOnly]>;
3919   def int_x86_avx512_mask_scatterdiv2_di :
3920           Intrinsic<[],
3921           [llvm_ptr_ty, llvm_v2i1_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
3922           [IntrArgMemOnly]>;
3924   def int_x86_avx512_mask_scatterdiv4_df :
3925           Intrinsic<[],
3926           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i64_ty, llvm_v4f64_ty, llvm_i32_ty],
3927           [IntrArgMemOnly]>;
3929   def int_x86_avx512_mask_scatterdiv4_di :
3930           Intrinsic<[],
3931           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i32_ty],
3932           [IntrArgMemOnly]>;
3934   def int_x86_avx512_mask_scatterdiv4_sf :
3935           Intrinsic<[],
3936           [llvm_ptr_ty, llvm_v2i1_ty, llvm_v2i64_ty, llvm_v4f32_ty, llvm_i32_ty],
3937           [IntrArgMemOnly]>;
3939   def int_x86_avx512_mask_scatterdiv4_si :
3940           Intrinsic<[],
3941           [llvm_ptr_ty, llvm_v2i1_ty, llvm_v2i64_ty, llvm_v4i32_ty, llvm_i32_ty],
3942           [IntrArgMemOnly]>;
3944   def int_x86_avx512_mask_scatterdiv8_sf :
3945           Intrinsic<[],
3946           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i64_ty, llvm_v4f32_ty, llvm_i32_ty],
3947           [IntrArgMemOnly]>;
3949   def int_x86_avx512_mask_scatterdiv8_si :
3950           Intrinsic<[],
3951           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i64_ty, llvm_v4i32_ty, llvm_i32_ty],
3952           [IntrArgMemOnly]>;
3954   def int_x86_avx512_mask_scattersiv2_df :
3955           Intrinsic<[],
3956           [llvm_ptr_ty, llvm_v2i1_ty, llvm_v4i32_ty, llvm_v2f64_ty, llvm_i32_ty],
3957           [IntrArgMemOnly]>;
3959   def int_x86_avx512_mask_scattersiv2_di :
3960           Intrinsic<[],
3961           [llvm_ptr_ty, llvm_v2i1_ty, llvm_v4i32_ty, llvm_v2i64_ty, llvm_i32_ty],
3962           [IntrArgMemOnly]>;
3964   def int_x86_avx512_mask_scattersiv4_df :
3965           Intrinsic<[],
3966           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i32_ty, llvm_v4f64_ty, llvm_i32_ty],
3967           [IntrArgMemOnly]>;
3969   def int_x86_avx512_mask_scattersiv4_di :
3970           Intrinsic<[],
3971           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i32_ty, llvm_v4i64_ty, llvm_i32_ty],
3972           [IntrArgMemOnly]>;
3974   def int_x86_avx512_mask_scattersiv4_sf :
3975           Intrinsic<[],
3976           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i32_ty, llvm_v4f32_ty, llvm_i32_ty],
3977           [IntrArgMemOnly]>;
3979   def int_x86_avx512_mask_scattersiv4_si :
3980           Intrinsic<[],
3981           [llvm_ptr_ty, llvm_v4i1_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
3982           [IntrArgMemOnly]>;
3984   def int_x86_avx512_mask_scattersiv8_sf :
3985           Intrinsic<[],
3986           [llvm_ptr_ty, llvm_v8i1_ty, llvm_v8i32_ty, llvm_v8f32_ty, llvm_i32_ty],
3987           [IntrArgMemOnly]>;
3989   def int_x86_avx512_mask_scattersiv8_si :
3990           Intrinsic<[],
3991           [llvm_ptr_ty, llvm_v8i1_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i32_ty],
3992           [IntrArgMemOnly]>;
3995 // AVX-512 conflict detection instruction
3996 // Instructions that count the number of leading zero bits
3997 let TargetPrefix = "x86" in {
3998   def int_x86_avx512_conflict_d_128 :
3999           GCCBuiltin<"__builtin_ia32_vpconflictsi_128">,
4000           Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
4001   def int_x86_avx512_conflict_d_256 :
4002           GCCBuiltin<"__builtin_ia32_vpconflictsi_256">,
4003           Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty], [IntrNoMem]>;
4004   def int_x86_avx512_conflict_d_512 :
4005           GCCBuiltin<"__builtin_ia32_vpconflictsi_512">,
4006           Intrinsic<[llvm_v16i32_ty], [llvm_v16i32_ty], [IntrNoMem]>;
4008   def int_x86_avx512_conflict_q_128 :
4009           GCCBuiltin<"__builtin_ia32_vpconflictdi_128">,
4010           Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
4011   def int_x86_avx512_conflict_q_256 :
4012           GCCBuiltin<"__builtin_ia32_vpconflictdi_256">,
4013           Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty], [IntrNoMem]>;
4014   def int_x86_avx512_conflict_q_512 :
4015           GCCBuiltin<"__builtin_ia32_vpconflictdi_512">,
4016           Intrinsic<[llvm_v8i64_ty], [llvm_v8i64_ty], [IntrNoMem]>;
4019 // Compares
4020 let TargetPrefix = "x86" in {
4021   // 512-bit
4022   def int_x86_avx512_vcomi_sd : GCCBuiltin<"__builtin_ia32_vcomisd">,
4023               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
4024                          llvm_v2f64_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
4025   def int_x86_avx512_vcomi_ss : GCCBuiltin<"__builtin_ia32_vcomiss">,
4026               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
4027                          llvm_v4f32_ty, llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
4030 // Compress, Expand
4031 let TargetPrefix = "x86" in {
4032   def int_x86_avx512_mask_compress :
4033         Intrinsic<[llvm_anyvector_ty],
4034                   [LLVMMatchType<0>, LLVMMatchType<0>,
4035                    LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
4036                   [IntrNoMem]>;
4037   def int_x86_avx512_mask_expand :
4038         Intrinsic<[llvm_anyvector_ty],
4039                   [LLVMMatchType<0>, LLVMMatchType<0>,
4040                    LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>],
4041                   [IntrNoMem]>;
4044 // truncate
4045 let TargetPrefix = "x86" in {
4046   def int_x86_avx512_mask_pmov_qb_128 :
4047           GCCBuiltin<"__builtin_ia32_pmovqb128_mask">,
4048           Intrinsic<[llvm_v16i8_ty],
4049                     [llvm_v2i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4050                     [IntrNoMem]>;
4051   def int_x86_avx512_mask_pmov_qb_mem_128 :
4052           GCCBuiltin<"__builtin_ia32_pmovqb128mem_mask">,
4053           Intrinsic<[],
4054                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4055                     [IntrArgMemOnly]>;
4056   def int_x86_avx512_mask_pmovs_qb_128 :
4057           GCCBuiltin<"__builtin_ia32_pmovsqb128_mask">,
4058           Intrinsic<[llvm_v16i8_ty],
4059                     [llvm_v2i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4060                     [IntrNoMem]>;
4061   def int_x86_avx512_mask_pmovs_qb_mem_128 :
4062           GCCBuiltin<"__builtin_ia32_pmovsqb128mem_mask">,
4063           Intrinsic<[],
4064                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4065                     [IntrArgMemOnly]>;
4066   def int_x86_avx512_mask_pmovus_qb_128 :
4067           GCCBuiltin<"__builtin_ia32_pmovusqb128_mask">,
4068           Intrinsic<[llvm_v16i8_ty],
4069                     [llvm_v2i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4070                     [IntrNoMem]>;
4071   def int_x86_avx512_mask_pmovus_qb_mem_128 :
4072           GCCBuiltin<"__builtin_ia32_pmovusqb128mem_mask">,
4073           Intrinsic<[],
4074                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4075                     [IntrArgMemOnly]>;
4076   def int_x86_avx512_mask_pmov_qb_256 :
4077           GCCBuiltin<"__builtin_ia32_pmovqb256_mask">,
4078           Intrinsic<[llvm_v16i8_ty],
4079                     [llvm_v4i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4080                     [IntrNoMem]>;
4081   def int_x86_avx512_mask_pmov_qb_mem_256 :
4082           GCCBuiltin<"__builtin_ia32_pmovqb256mem_mask">,
4083           Intrinsic<[],
4084                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4085                     [IntrArgMemOnly]>;
4086   def int_x86_avx512_mask_pmovs_qb_256 :
4087           GCCBuiltin<"__builtin_ia32_pmovsqb256_mask">,
4088           Intrinsic<[llvm_v16i8_ty],
4089                     [llvm_v4i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4090                     [IntrNoMem]>;
4091   def int_x86_avx512_mask_pmovs_qb_mem_256 :
4092           GCCBuiltin<"__builtin_ia32_pmovsqb256mem_mask">,
4093           Intrinsic<[],
4094                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4095                     [IntrArgMemOnly]>;
4096   def int_x86_avx512_mask_pmovus_qb_256 :
4097           GCCBuiltin<"__builtin_ia32_pmovusqb256_mask">,
4098           Intrinsic<[llvm_v16i8_ty],
4099                     [llvm_v4i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4100                     [IntrNoMem]>;
4101   def int_x86_avx512_mask_pmovus_qb_mem_256 :
4102           GCCBuiltin<"__builtin_ia32_pmovusqb256mem_mask">,
4103           Intrinsic<[],
4104                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4105                     [IntrArgMemOnly]>;
4106   def int_x86_avx512_mask_pmov_qb_512 :
4107           GCCBuiltin<"__builtin_ia32_pmovqb512_mask">,
4108           Intrinsic<[llvm_v16i8_ty],
4109                     [llvm_v8i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4110                     [IntrNoMem]>;
4111   def int_x86_avx512_mask_pmov_qb_mem_512 :
4112           GCCBuiltin<"__builtin_ia32_pmovqb512mem_mask">,
4113           Intrinsic<[],
4114                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4115                     [IntrArgMemOnly]>;
4116   def int_x86_avx512_mask_pmovs_qb_512 :
4117           GCCBuiltin<"__builtin_ia32_pmovsqb512_mask">,
4118           Intrinsic<[llvm_v16i8_ty],
4119                     [llvm_v8i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4120                     [IntrNoMem]>;
4121   def int_x86_avx512_mask_pmovs_qb_mem_512 :
4122           GCCBuiltin<"__builtin_ia32_pmovsqb512mem_mask">,
4123           Intrinsic<[],
4124                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4125                     [IntrArgMemOnly]>;
4126   def int_x86_avx512_mask_pmovus_qb_512 :
4127           GCCBuiltin<"__builtin_ia32_pmovusqb512_mask">,
4128           Intrinsic<[llvm_v16i8_ty],
4129                     [llvm_v8i64_ty, llvm_v16i8_ty, llvm_i8_ty],
4130                     [IntrNoMem]>;
4131   def int_x86_avx512_mask_pmovus_qb_mem_512 :
4132           GCCBuiltin<"__builtin_ia32_pmovusqb512mem_mask">,
4133           Intrinsic<[],
4134                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4135                     [IntrArgMemOnly]>;
4136   def int_x86_avx512_mask_pmov_qw_128 :
4137           GCCBuiltin<"__builtin_ia32_pmovqw128_mask">,
4138           Intrinsic<[llvm_v8i16_ty],
4139                     [llvm_v2i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4140                     [IntrNoMem]>;
4141   def int_x86_avx512_mask_pmov_qw_mem_128 :
4142           GCCBuiltin<"__builtin_ia32_pmovqw128mem_mask">,
4143           Intrinsic<[],
4144                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4145                     [IntrArgMemOnly]>;
4146   def int_x86_avx512_mask_pmovs_qw_128 :
4147           GCCBuiltin<"__builtin_ia32_pmovsqw128_mask">,
4148           Intrinsic<[llvm_v8i16_ty],
4149                     [llvm_v2i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4150                     [IntrNoMem]>;
4151   def int_x86_avx512_mask_pmovs_qw_mem_128 :
4152           GCCBuiltin<"__builtin_ia32_pmovsqw128mem_mask">,
4153           Intrinsic<[],
4154                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4155                     [IntrArgMemOnly]>;
4156   def int_x86_avx512_mask_pmovus_qw_128 :
4157           GCCBuiltin<"__builtin_ia32_pmovusqw128_mask">,
4158           Intrinsic<[llvm_v8i16_ty],
4159                     [llvm_v2i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4160                     [IntrNoMem]>;
4161   def int_x86_avx512_mask_pmovus_qw_mem_128 :
4162           GCCBuiltin<"__builtin_ia32_pmovusqw128mem_mask">,
4163           Intrinsic<[],
4164                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4165                     [IntrArgMemOnly]>;
4166   def int_x86_avx512_mask_pmov_qw_256 :
4167           GCCBuiltin<"__builtin_ia32_pmovqw256_mask">,
4168           Intrinsic<[llvm_v8i16_ty],
4169                     [llvm_v4i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4170                     [IntrNoMem]>;
4171   def int_x86_avx512_mask_pmov_qw_mem_256 :
4172           GCCBuiltin<"__builtin_ia32_pmovqw256mem_mask">,
4173           Intrinsic<[],
4174                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4175                     [IntrArgMemOnly]>;
4176   def int_x86_avx512_mask_pmovs_qw_256 :
4177           GCCBuiltin<"__builtin_ia32_pmovsqw256_mask">,
4178           Intrinsic<[llvm_v8i16_ty],
4179                     [llvm_v4i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4180                     [IntrNoMem]>;
4181   def int_x86_avx512_mask_pmovs_qw_mem_256 :
4182           GCCBuiltin<"__builtin_ia32_pmovsqw256mem_mask">,
4183           Intrinsic<[],
4184                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4185                     [IntrArgMemOnly]>;
4186   def int_x86_avx512_mask_pmovus_qw_256 :
4187           GCCBuiltin<"__builtin_ia32_pmovusqw256_mask">,
4188           Intrinsic<[llvm_v8i16_ty],
4189                     [llvm_v4i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4190                     [IntrNoMem]>;
4191   def int_x86_avx512_mask_pmovus_qw_mem_256 :
4192           GCCBuiltin<"__builtin_ia32_pmovusqw256mem_mask">,
4193           Intrinsic<[],
4194                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4195                     [IntrArgMemOnly]>;
4196   def int_x86_avx512_mask_pmov_qw_512 :
4197           Intrinsic<[llvm_v8i16_ty],
4198                     [llvm_v8i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4199                     [IntrNoMem]>;
4200   def int_x86_avx512_mask_pmov_qw_mem_512 :
4201           GCCBuiltin<"__builtin_ia32_pmovqw512mem_mask">,
4202           Intrinsic<[],
4203                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4204                     [IntrArgMemOnly]>;
4205   def int_x86_avx512_mask_pmovs_qw_512 :
4206           GCCBuiltin<"__builtin_ia32_pmovsqw512_mask">,
4207           Intrinsic<[llvm_v8i16_ty],
4208                     [llvm_v8i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4209                     [IntrNoMem]>;
4210   def int_x86_avx512_mask_pmovs_qw_mem_512 :
4211           GCCBuiltin<"__builtin_ia32_pmovsqw512mem_mask">,
4212           Intrinsic<[],
4213                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4214                     [IntrArgMemOnly]>;
4215   def int_x86_avx512_mask_pmovus_qw_512 :
4216           GCCBuiltin<"__builtin_ia32_pmovusqw512_mask">,
4217           Intrinsic<[llvm_v8i16_ty],
4218                     [llvm_v8i64_ty, llvm_v8i16_ty, llvm_i8_ty],
4219                     [IntrNoMem]>;
4220   def int_x86_avx512_mask_pmovus_qw_mem_512 :
4221           GCCBuiltin<"__builtin_ia32_pmovusqw512mem_mask">,
4222           Intrinsic<[],
4223                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4224                     [IntrArgMemOnly]>;
4225   def int_x86_avx512_mask_pmov_qd_128 :
4226           GCCBuiltin<"__builtin_ia32_pmovqd128_mask">,
4227           Intrinsic<[llvm_v4i32_ty],
4228                     [llvm_v2i64_ty, llvm_v4i32_ty, llvm_i8_ty],
4229                     [IntrNoMem]>;
4230   def int_x86_avx512_mask_pmov_qd_mem_128 :
4231           GCCBuiltin<"__builtin_ia32_pmovqd128mem_mask">,
4232           Intrinsic<[],
4233                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4234                     [IntrArgMemOnly]>;
4235   def int_x86_avx512_mask_pmovs_qd_128 :
4236           GCCBuiltin<"__builtin_ia32_pmovsqd128_mask">,
4237           Intrinsic<[llvm_v4i32_ty],
4238                     [llvm_v2i64_ty, llvm_v4i32_ty, llvm_i8_ty],
4239                     [IntrNoMem]>;
4240   def int_x86_avx512_mask_pmovs_qd_mem_128 :
4241           GCCBuiltin<"__builtin_ia32_pmovsqd128mem_mask">,
4242           Intrinsic<[],
4243                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4244                     [IntrArgMemOnly]>;
4245   def int_x86_avx512_mask_pmovus_qd_128 :
4246           GCCBuiltin<"__builtin_ia32_pmovusqd128_mask">,
4247           Intrinsic<[llvm_v4i32_ty],
4248                     [llvm_v2i64_ty, llvm_v4i32_ty, llvm_i8_ty],
4249                     [IntrNoMem]>;
4250   def int_x86_avx512_mask_pmovus_qd_mem_128 :
4251           GCCBuiltin<"__builtin_ia32_pmovusqd128mem_mask">,
4252           Intrinsic<[],
4253                     [llvm_ptr_ty, llvm_v2i64_ty, llvm_i8_ty],
4254                     [IntrArgMemOnly]>;
4255   def int_x86_avx512_mask_pmov_qd_mem_256 :
4256           GCCBuiltin<"__builtin_ia32_pmovqd256mem_mask">,
4257           Intrinsic<[],
4258                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4259                     [IntrArgMemOnly]>;
4260   def int_x86_avx512_mask_pmovs_qd_256 :
4261           GCCBuiltin<"__builtin_ia32_pmovsqd256_mask">,
4262           Intrinsic<[llvm_v4i32_ty],
4263                     [llvm_v4i64_ty, llvm_v4i32_ty, llvm_i8_ty],
4264                     [IntrNoMem]>;
4265   def int_x86_avx512_mask_pmovs_qd_mem_256 :
4266           GCCBuiltin<"__builtin_ia32_pmovsqd256mem_mask">,
4267           Intrinsic<[],
4268                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4269                     [IntrArgMemOnly]>;
4270   def int_x86_avx512_mask_pmovus_qd_256 :
4271           GCCBuiltin<"__builtin_ia32_pmovusqd256_mask">,
4272           Intrinsic<[llvm_v4i32_ty],
4273                     [llvm_v4i64_ty, llvm_v4i32_ty, llvm_i8_ty],
4274                     [IntrNoMem]>;
4275   def int_x86_avx512_mask_pmovus_qd_mem_256 :
4276           GCCBuiltin<"__builtin_ia32_pmovusqd256mem_mask">,
4277           Intrinsic<[],
4278                     [llvm_ptr_ty, llvm_v4i64_ty, llvm_i8_ty],
4279                     [IntrArgMemOnly]>;
4280   def int_x86_avx512_mask_pmov_qd_mem_512 :
4281           GCCBuiltin<"__builtin_ia32_pmovqd512mem_mask">,
4282           Intrinsic<[],
4283                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4284                     [IntrArgMemOnly]>;
4285   def int_x86_avx512_mask_pmovs_qd_512 :
4286           GCCBuiltin<"__builtin_ia32_pmovsqd512_mask">,
4287           Intrinsic<[llvm_v8i32_ty],
4288                     [llvm_v8i64_ty, llvm_v8i32_ty, llvm_i8_ty],
4289                     [IntrNoMem]>;
4290   def int_x86_avx512_mask_pmovs_qd_mem_512 :
4291           GCCBuiltin<"__builtin_ia32_pmovsqd512mem_mask">,
4292           Intrinsic<[],
4293                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4294                     [IntrArgMemOnly]>;
4295   def int_x86_avx512_mask_pmovus_qd_512 :
4296           GCCBuiltin<"__builtin_ia32_pmovusqd512_mask">,
4297           Intrinsic<[llvm_v8i32_ty],
4298                     [llvm_v8i64_ty, llvm_v8i32_ty, llvm_i8_ty],
4299                     [IntrNoMem]>;
4300   def int_x86_avx512_mask_pmovus_qd_mem_512 :
4301           GCCBuiltin<"__builtin_ia32_pmovusqd512mem_mask">,
4302           Intrinsic<[],
4303                     [llvm_ptr_ty, llvm_v8i64_ty, llvm_i8_ty],
4304                     [IntrArgMemOnly]>;
4305   def int_x86_avx512_mask_pmov_db_128 :
4306           GCCBuiltin<"__builtin_ia32_pmovdb128_mask">,
4307           Intrinsic<[llvm_v16i8_ty],
4308                     [llvm_v4i32_ty, llvm_v16i8_ty, llvm_i8_ty],
4309                     [IntrNoMem]>;
4310   def int_x86_avx512_mask_pmov_db_mem_128 :
4311           GCCBuiltin<"__builtin_ia32_pmovdb128mem_mask">,
4312           Intrinsic<[],
4313                     [llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty],
4314                     [IntrArgMemOnly]>;
4315   def int_x86_avx512_mask_pmovs_db_128 :
4316           GCCBuiltin<"__builtin_ia32_pmovsdb128_mask">,
4317           Intrinsic<[llvm_v16i8_ty],
4318                     [llvm_v4i32_ty, llvm_v16i8_ty, llvm_i8_ty],
4319                     [IntrNoMem]>;
4320   def int_x86_avx512_mask_pmovs_db_mem_128 :
4321           GCCBuiltin<"__builtin_ia32_pmovsdb128mem_mask">,
4322           Intrinsic<[],
4323                     [llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty],
4324                     [IntrArgMemOnly]>;
4325   def int_x86_avx512_mask_pmovus_db_128 :
4326           GCCBuiltin<"__builtin_ia32_pmovusdb128_mask">,
4327           Intrinsic<[llvm_v16i8_ty],
4328                     [llvm_v4i32_ty, llvm_v16i8_ty, llvm_i8_ty],
4329                     [IntrNoMem]>;
4330   def int_x86_avx512_mask_pmovus_db_mem_128 :
4331           GCCBuiltin<"__builtin_ia32_pmovusdb128mem_mask">,
4332           Intrinsic<[],
4333                     [llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty],
4334                     [IntrArgMemOnly]>;
4335   def int_x86_avx512_mask_pmov_db_256 :
4336           GCCBuiltin<"__builtin_ia32_pmovdb256_mask">,
4337           Intrinsic<[llvm_v16i8_ty],
4338                     [llvm_v8i32_ty, llvm_v16i8_ty, llvm_i8_ty],
4339                     [IntrNoMem]>;
4340   def int_x86_avx512_mask_pmov_db_mem_256 :
4341           GCCBuiltin<"__builtin_ia32_pmovdb256mem_mask">,
4342           Intrinsic<[],
4343                     [llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty],
4344                     [IntrArgMemOnly]>;
4345   def int_x86_avx512_mask_pmovs_db_256 :
4346           GCCBuiltin<"__builtin_ia32_pmovsdb256_mask">,
4347           Intrinsic<[llvm_v16i8_ty],
4348                     [llvm_v8i32_ty, llvm_v16i8_ty, llvm_i8_ty],
4349                     [IntrNoMem]>;
4350   def int_x86_avx512_mask_pmovs_db_mem_256 :
4351           GCCBuiltin<"__builtin_ia32_pmovsdb256mem_mask">,
4352           Intrinsic<[],
4353                     [llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty],
4354                     [IntrArgMemOnly]>;
4355   def int_x86_avx512_mask_pmovus_db_256 :
4356           GCCBuiltin<"__builtin_ia32_pmovusdb256_mask">,
4357           Intrinsic<[llvm_v16i8_ty],
4358                     [llvm_v8i32_ty, llvm_v16i8_ty, llvm_i8_ty],
4359                     [IntrNoMem]>;
4360   def int_x86_avx512_mask_pmovus_db_mem_256 :
4361           GCCBuiltin<"__builtin_ia32_pmovusdb256mem_mask">,
4362           Intrinsic<[],
4363                     [llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty],
4364                     [IntrArgMemOnly]>;
4365   def int_x86_avx512_mask_pmov_db_512 :
4366           Intrinsic<[llvm_v16i8_ty],
4367                     [llvm_v16i32_ty, llvm_v16i8_ty, llvm_i16_ty],
4368                     [IntrNoMem]>;
4369   def int_x86_avx512_mask_pmov_db_mem_512 :
4370           GCCBuiltin<"__builtin_ia32_pmovdb512mem_mask">,
4371           Intrinsic<[],
4372                     [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
4373                     [IntrArgMemOnly]>;
4374   def int_x86_avx512_mask_pmovs_db_512 :
4375           GCCBuiltin<"__builtin_ia32_pmovsdb512_mask">,
4376           Intrinsic<[llvm_v16i8_ty],
4377                     [llvm_v16i32_ty, llvm_v16i8_ty, llvm_i16_ty],
4378                     [IntrNoMem]>;
4379   def int_x86_avx512_mask_pmovs_db_mem_512 :
4380           GCCBuiltin<"__builtin_ia32_pmovsdb512mem_mask">,
4381           Intrinsic<[],
4382                     [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
4383                     [IntrArgMemOnly]>;
4384   def int_x86_avx512_mask_pmovus_db_512 :
4385           GCCBuiltin<"__builtin_ia32_pmovusdb512_mask">,
4386           Intrinsic<[llvm_v16i8_ty],
4387                     [llvm_v16i32_ty, llvm_v16i8_ty, llvm_i16_ty],
4388                     [IntrNoMem]>;
4389   def int_x86_avx512_mask_pmovus_db_mem_512 :
4390           GCCBuiltin<"__builtin_ia32_pmovusdb512mem_mask">,
4391           Intrinsic<[],
4392                     [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
4393                     [IntrArgMemOnly]>;
4394   def int_x86_avx512_mask_pmov_dw_128 :
4395           GCCBuiltin<"__builtin_ia32_pmovdw128_mask">,
4396           Intrinsic<[llvm_v8i16_ty],
4397                     [llvm_v4i32_ty, llvm_v8i16_ty, llvm_i8_ty],
4398                     [IntrNoMem]>;
4399   def int_x86_avx512_mask_pmov_dw_mem_128 :
4400           GCCBuiltin<"__builtin_ia32_pmovdw128mem_mask">,
4401           Intrinsic<[],
4402                     [llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty],
4403                     [IntrArgMemOnly]>;
4404   def int_x86_avx512_mask_pmovs_dw_128 :
4405           GCCBuiltin<"__builtin_ia32_pmovsdw128_mask">,
4406           Intrinsic<[llvm_v8i16_ty],
4407                     [llvm_v4i32_ty, llvm_v8i16_ty, llvm_i8_ty],
4408                     [IntrNoMem]>;
4409   def int_x86_avx512_mask_pmovs_dw_mem_128 :
4410           GCCBuiltin<"__builtin_ia32_pmovsdw128mem_mask">,
4411           Intrinsic<[],
4412                     [llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty],
4413                     [IntrArgMemOnly]>;
4414   def int_x86_avx512_mask_pmovus_dw_128 :
4415           GCCBuiltin<"__builtin_ia32_pmovusdw128_mask">,
4416           Intrinsic<[llvm_v8i16_ty],
4417                     [llvm_v4i32_ty, llvm_v8i16_ty, llvm_i8_ty],
4418                     [IntrNoMem]>;
4419   def int_x86_avx512_mask_pmovus_dw_mem_128 :
4420           GCCBuiltin<"__builtin_ia32_pmovusdw128mem_mask">,
4421           Intrinsic<[],
4422                     [llvm_ptr_ty, llvm_v4i32_ty, llvm_i8_ty],
4423                     [IntrArgMemOnly]>;
4424   def int_x86_avx512_mask_pmov_dw_256 :
4425           GCCBuiltin<"__builtin_ia32_pmovdw256_mask">,
4426           Intrinsic<[llvm_v8i16_ty],
4427                     [llvm_v8i32_ty, llvm_v8i16_ty, llvm_i8_ty],
4428                     [IntrNoMem]>;
4429   def int_x86_avx512_mask_pmov_dw_mem_256 :
4430           GCCBuiltin<"__builtin_ia32_pmovdw256mem_mask">,
4431           Intrinsic<[],
4432                     [llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty],
4433                     [IntrArgMemOnly]>;
4434   def int_x86_avx512_mask_pmovs_dw_256 :
4435           GCCBuiltin<"__builtin_ia32_pmovsdw256_mask">,
4436           Intrinsic<[llvm_v8i16_ty],
4437                     [llvm_v8i32_ty, llvm_v8i16_ty, llvm_i8_ty],
4438                     [IntrNoMem]>;
4439   def int_x86_avx512_mask_pmovs_dw_mem_256 :
4440           GCCBuiltin<"__builtin_ia32_pmovsdw256mem_mask">,
4441           Intrinsic<[],
4442                     [llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty],
4443                     [IntrArgMemOnly]>;
4444   def int_x86_avx512_mask_pmovus_dw_256 :
4445           GCCBuiltin<"__builtin_ia32_pmovusdw256_mask">,
4446           Intrinsic<[llvm_v8i16_ty],
4447                     [llvm_v8i32_ty, llvm_v8i16_ty, llvm_i8_ty],
4448                     [IntrNoMem]>;
4449   def int_x86_avx512_mask_pmovus_dw_mem_256 :
4450           GCCBuiltin<"__builtin_ia32_pmovusdw256mem_mask">,
4451           Intrinsic<[],
4452                     [llvm_ptr_ty, llvm_v8i32_ty, llvm_i8_ty],
4453                     [IntrArgMemOnly]>;
4454   def int_x86_avx512_mask_pmov_dw_512 :
4455           Intrinsic<[llvm_v16i16_ty],
4456                     [llvm_v16i32_ty, llvm_v16i16_ty, llvm_i16_ty],
4457                     [IntrNoMem]>;
4458   def int_x86_avx512_mask_pmov_dw_mem_512 :
4459           GCCBuiltin<"__builtin_ia32_pmovdw512mem_mask">,
4460           Intrinsic<[],
4461                     [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
4462                     [IntrArgMemOnly]>;
4463   def int_x86_avx512_mask_pmovs_dw_512 :
4464           GCCBuiltin<"__builtin_ia32_pmovsdw512_mask">,
4465           Intrinsic<[llvm_v16i16_ty],
4466                     [llvm_v16i32_ty, llvm_v16i16_ty, llvm_i16_ty],
4467                     [IntrNoMem]>;
4468   def int_x86_avx512_mask_pmovs_dw_mem_512 :
4469           GCCBuiltin<"__builtin_ia32_pmovsdw512mem_mask">,
4470           Intrinsic<[],
4471                     [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
4472                     [IntrArgMemOnly]>;
4473   def int_x86_avx512_mask_pmovus_dw_512 :
4474           GCCBuiltin<"__builtin_ia32_pmovusdw512_mask">,
4475           Intrinsic<[llvm_v16i16_ty],
4476                     [llvm_v16i32_ty, llvm_v16i16_ty, llvm_i16_ty],
4477                     [IntrNoMem]>;
4478   def int_x86_avx512_mask_pmovus_dw_mem_512 :
4479           GCCBuiltin<"__builtin_ia32_pmovusdw512mem_mask">,
4480           Intrinsic<[],
4481                     [llvm_ptr_ty, llvm_v16i32_ty, llvm_i16_ty],
4482                     [IntrArgMemOnly]>;
4483   def int_x86_avx512_mask_pmov_wb_128 :
4484           GCCBuiltin<"__builtin_ia32_pmovwb128_mask">,
4485           Intrinsic<[llvm_v16i8_ty],
4486                     [llvm_v8i16_ty, llvm_v16i8_ty, llvm_i8_ty],
4487                     [IntrNoMem]>;
4488   def int_x86_avx512_mask_pmov_wb_mem_128 :
4489           GCCBuiltin<"__builtin_ia32_pmovwb128mem_mask">,
4490           Intrinsic<[],
4491                     [llvm_ptr_ty, llvm_v8i16_ty, llvm_i8_ty],
4492                     [IntrArgMemOnly]>;
4493   def int_x86_avx512_mask_pmovs_wb_128 :
4494           GCCBuiltin<"__builtin_ia32_pmovswb128_mask">,
4495           Intrinsic<[llvm_v16i8_ty],
4496                     [llvm_v8i16_ty, llvm_v16i8_ty, llvm_i8_ty],
4497                     [IntrNoMem]>;
4498   def int_x86_avx512_mask_pmovs_wb_mem_128 :
4499           GCCBuiltin<"__builtin_ia32_pmovswb128mem_mask">,
4500           Intrinsic<[],
4501                     [llvm_ptr_ty, llvm_v8i16_ty, llvm_i8_ty],
4502                     [IntrArgMemOnly]>;
4503   def int_x86_avx512_mask_pmovus_wb_128 :
4504           GCCBuiltin<"__builtin_ia32_pmovuswb128_mask">,
4505           Intrinsic<[llvm_v16i8_ty],
4506                     [llvm_v8i16_ty, llvm_v16i8_ty, llvm_i8_ty],
4507                     [IntrNoMem]>;
4508   def int_x86_avx512_mask_pmovus_wb_mem_128 :
4509           GCCBuiltin<"__builtin_ia32_pmovuswb128mem_mask">,
4510           Intrinsic<[],
4511                     [llvm_ptr_ty, llvm_v8i16_ty, llvm_i8_ty],
4512                     [IntrArgMemOnly]>;
4513   def int_x86_avx512_mask_pmov_wb_mem_256 :
4514           GCCBuiltin<"__builtin_ia32_pmovwb256mem_mask">,
4515           Intrinsic<[],
4516                     [llvm_ptr_ty, llvm_v16i16_ty, llvm_i16_ty],
4517                     [IntrArgMemOnly]>;
4518   def int_x86_avx512_mask_pmovs_wb_256 :
4519           GCCBuiltin<"__builtin_ia32_pmovswb256_mask">,
4520           Intrinsic<[llvm_v16i8_ty],
4521                     [llvm_v16i16_ty, llvm_v16i8_ty, llvm_i16_ty],
4522                     [IntrNoMem]>;
4523   def int_x86_avx512_mask_pmovs_wb_mem_256 :
4524           GCCBuiltin<"__builtin_ia32_pmovswb256mem_mask">,
4525           Intrinsic<[],
4526                     [llvm_ptr_ty, llvm_v16i16_ty, llvm_i16_ty],
4527                     [IntrArgMemOnly]>;
4528   def int_x86_avx512_mask_pmovus_wb_256 :
4529           GCCBuiltin<"__builtin_ia32_pmovuswb256_mask">,
4530           Intrinsic<[llvm_v16i8_ty],
4531                     [llvm_v16i16_ty, llvm_v16i8_ty, llvm_i16_ty],
4532                     [IntrNoMem]>;
4533   def int_x86_avx512_mask_pmovus_wb_mem_256 :
4534           GCCBuiltin<"__builtin_ia32_pmovuswb256mem_mask">,
4535           Intrinsic<[],
4536                     [llvm_ptr_ty, llvm_v16i16_ty, llvm_i16_ty],
4537                     [IntrArgMemOnly]>;
4538   def int_x86_avx512_mask_pmov_wb_mem_512 :
4539           GCCBuiltin<"__builtin_ia32_pmovwb512mem_mask">,
4540           Intrinsic<[],
4541                     [llvm_ptr_ty, llvm_v32i16_ty, llvm_i32_ty],
4542                     [IntrArgMemOnly]>;
4543   def int_x86_avx512_mask_pmovs_wb_512 :
4544           GCCBuiltin<"__builtin_ia32_pmovswb512_mask">,
4545           Intrinsic<[llvm_v32i8_ty],
4546                     [llvm_v32i16_ty, llvm_v32i8_ty, llvm_i32_ty],
4547                     [IntrNoMem]>;
4548   def int_x86_avx512_mask_pmovs_wb_mem_512 :
4549           GCCBuiltin<"__builtin_ia32_pmovswb512mem_mask">,
4550           Intrinsic<[],
4551                     [llvm_ptr_ty, llvm_v32i16_ty, llvm_i32_ty],
4552                     [IntrArgMemOnly]>;
4553   def int_x86_avx512_mask_pmovus_wb_512 :
4554           GCCBuiltin<"__builtin_ia32_pmovuswb512_mask">,
4555           Intrinsic<[llvm_v32i8_ty],
4556                     [llvm_v32i16_ty, llvm_v32i8_ty, llvm_i32_ty],
4557                     [IntrNoMem]>;
4558   def int_x86_avx512_mask_pmovus_wb_mem_512 :
4559           GCCBuiltin<"__builtin_ia32_pmovuswb512mem_mask">,
4560           Intrinsic<[],
4561                     [llvm_ptr_ty, llvm_v32i16_ty, llvm_i32_ty],
4562                     [IntrArgMemOnly]>;
4565 // Bitwise ternary logic
4566 let TargetPrefix = "x86" in {
4567   def int_x86_avx512_pternlog_d_128 :
4568           GCCBuiltin<"__builtin_ia32_pternlogd128">,
4569           Intrinsic<[llvm_v4i32_ty],
4570                     [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty, llvm_i32_ty],
4571                     [IntrNoMem]>;
4573   def int_x86_avx512_pternlog_d_256 :
4574           GCCBuiltin<"__builtin_ia32_pternlogd256">,
4575           Intrinsic<[llvm_v8i32_ty],
4576                     [llvm_v8i32_ty, llvm_v8i32_ty, llvm_v8i32_ty, llvm_i32_ty],
4577                     [IntrNoMem]>;
4579   def int_x86_avx512_pternlog_d_512 :
4580           GCCBuiltin<"__builtin_ia32_pternlogd512">,
4581           Intrinsic<[llvm_v16i32_ty],
4582                     [llvm_v16i32_ty, llvm_v16i32_ty, llvm_v16i32_ty,
4583                      llvm_i32_ty], [IntrNoMem]>;
4585   def int_x86_avx512_pternlog_q_128 :
4586           GCCBuiltin<"__builtin_ia32_pternlogq128">,
4587           Intrinsic<[llvm_v2i64_ty],
4588                     [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty, llvm_i32_ty],
4589                     [IntrNoMem]>;
4591   def int_x86_avx512_pternlog_q_256 :
4592           GCCBuiltin<"__builtin_ia32_pternlogq256">,
4593           Intrinsic<[llvm_v4i64_ty],
4594                     [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty, llvm_i32_ty],
4595                     [IntrNoMem]>;
4597   def int_x86_avx512_pternlog_q_512 :
4598           GCCBuiltin<"__builtin_ia32_pternlogq512">,
4599           Intrinsic<[llvm_v8i64_ty],
4600                     [llvm_v8i64_ty, llvm_v8i64_ty, llvm_v8i64_ty, llvm_i32_ty],
4601                     [IntrNoMem]>;
4604 // Misc.
4605 let TargetPrefix = "x86" in {
4606   // NOTE: These comparison intrinsics are not used by clang as long as the
4607   //       distinction in signaling behaviour is not implemented.
4608   def int_x86_avx512_cmp_ps_512 :
4609               Intrinsic<[llvm_v16i1_ty], [llvm_v16f32_ty, llvm_v16f32_ty,
4610                          llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
4611   def int_x86_avx512_cmp_pd_512 :
4612               Intrinsic<[llvm_v8i1_ty], [llvm_v8f64_ty, llvm_v8f64_ty,
4613                          llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
4614   def int_x86_avx512_cmp_ps_256 :
4615               Intrinsic<[llvm_v8i1_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
4616                          llvm_i32_ty], [IntrNoMem]>;
4617   def int_x86_avx512_cmp_pd_256 :
4618               Intrinsic<[llvm_v4i1_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
4619                          llvm_i32_ty], [IntrNoMem]>;
4620   def int_x86_avx512_cmp_ps_128 :
4621             Intrinsic<[llvm_v4i1_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
4622                        llvm_i32_ty], [IntrNoMem]>;
4623   def int_x86_avx512_cmp_pd_128 :
4624             Intrinsic<[llvm_v2i1_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
4625                        llvm_i32_ty], [IntrNoMem]>;
4627   def int_x86_avx512_mask_cmp_ss :
4628         GCCBuiltin<"__builtin_ia32_cmpss_mask">,
4629               Intrinsic<[llvm_i8_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
4630                          llvm_i32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
4631   def int_x86_avx512_mask_cmp_sd :
4632         GCCBuiltin<"__builtin_ia32_cmpsd_mask">,
4633               Intrinsic<[llvm_i8_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
4634                          llvm_i32_ty, llvm_i8_ty, llvm_i32_ty], [IntrNoMem]>;
4637 //===----------------------------------------------------------------------===//
4638 // SHA intrinsics
4639 let TargetPrefix = "x86" in {
4640   def int_x86_sha1rnds4 : GCCBuiltin<"__builtin_ia32_sha1rnds4">,
4641         Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty, llvm_i8_ty],
4642                   [IntrNoMem]>;
4643   def int_x86_sha1nexte : GCCBuiltin<"__builtin_ia32_sha1nexte">,
4644       Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
4645   def int_x86_sha1msg1 : GCCBuiltin<"__builtin_ia32_sha1msg1">,
4646       Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
4647   def int_x86_sha1msg2 : GCCBuiltin<"__builtin_ia32_sha1msg2">,
4648       Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
4649   def int_x86_sha256rnds2 : GCCBuiltin<"__builtin_ia32_sha256rnds2">,
4650       Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
4651                 [IntrNoMem]>;
4652   def int_x86_sha256msg1 : GCCBuiltin<"__builtin_ia32_sha256msg1">,
4653       Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
4654   def int_x86_sha256msg2 : GCCBuiltin<"__builtin_ia32_sha256msg2">,
4655       Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>;
4658 //===----------------------------------------------------------------------===//
4659 // Thread synchronization ops with timer.
4660 let TargetPrefix = "x86" in {
4661   def int_x86_monitorx
4662       : GCCBuiltin<"__builtin_ia32_monitorx">,
4663         Intrinsic<[], [ llvm_ptr_ty, llvm_i32_ty, llvm_i32_ty ], []>;
4664   def int_x86_mwaitx
4665       : GCCBuiltin<"__builtin_ia32_mwaitx">,
4666         Intrinsic<[], [ llvm_i32_ty, llvm_i32_ty, llvm_i32_ty ], []>;
4669 //===----------------------------------------------------------------------===//
4670 // Cache-line zero
4671 let TargetPrefix = "x86" in {
4672   def int_x86_clzero : GCCBuiltin<"__builtin_ia32_clzero">,
4673       Intrinsic<[], [llvm_ptr_ty], []>;
4676 //===----------------------------------------------------------------------===//
4677 // Cache write back intrinsics
4679 let TargetPrefix = "x86" in {
4680   // Write back and invalidate
4681   def int_x86_wbinvd : GCCBuiltin<"__builtin_ia32_wbinvd">,
4682       Intrinsic<[], [], []>;
4684   // Write back no-invalidate
4685   def int_x86_wbnoinvd : GCCBuiltin<"__builtin_ia32_wbnoinvd">,
4686       Intrinsic<[], [], []>;
4689 //===----------------------------------------------------------------------===//
4690 // Cache-line demote
4692 let TargetPrefix = "x86" in {
4693   def int_x86_cldemote : GCCBuiltin<"__builtin_ia32_cldemote">,
4694       Intrinsic<[], [llvm_ptr_ty], []>;
4697 //===----------------------------------------------------------------------===//
4698 // Wait and pause enhancements
4699 let TargetPrefix = "x86" in {
4700   def int_x86_umonitor : GCCBuiltin<"__builtin_ia32_umonitor">,
4701               Intrinsic<[], [llvm_ptr_ty], []>;
4702   def int_x86_umwait : GCCBuiltin<"__builtin_ia32_umwait">,
4703               Intrinsic<[llvm_i8_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
4704   def int_x86_tpause : GCCBuiltin<"__builtin_ia32_tpause">,
4705               Intrinsic<[llvm_i8_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty], []>;
4708 //===----------------------------------------------------------------------===//
4709 // Direct Move Instructions
4711 let TargetPrefix = "x86" in {
4712   def int_x86_directstore32 : GCCBuiltin<"__builtin_ia32_directstore_u32">,
4713       Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty], []>;
4714   def int_x86_directstore64 : GCCBuiltin<"__builtin_ia32_directstore_u64">,
4715       Intrinsic<[], [llvm_ptr_ty, llvm_i64_ty], []>;
4716   def int_x86_movdir64b : GCCBuiltin<"__builtin_ia32_movdir64b">,
4717       Intrinsic<[], [llvm_ptr_ty, llvm_ptr_ty], []>;
4720 //===----------------------------------------------------------------------===//
4721 // PTWrite - Write data to processor trace pocket
4723 let TargetPrefix = "x86" in {
4724   def int_x86_ptwrite32 : GCCBuiltin<"__builtin_ia32_ptwrite32">,
4725               Intrinsic<[], [llvm_i32_ty], []>;
4726   def int_x86_ptwrite64 : GCCBuiltin<"__builtin_ia32_ptwrite64">,
4727               Intrinsic<[], [llvm_i64_ty], []>;
4730 //===----------------------------------------------------------------------===//
4731 // INVPCID - Invalidate Process-Context Identifier
4733 let TargetPrefix = "x86" in {
4734   def int_x86_invpcid : GCCBuiltin<"__builtin_ia32_invpcid">,
4735               Intrinsic<[], [llvm_i32_ty, llvm_ptr_ty], []>;