1 //===-- X86InstrFragmentsSIMD.td - x86 SIMD ISA ------------*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file provides pattern fragments useful for SIMD instructions.
12 //===----------------------------------------------------------------------===//
14 //===----------------------------------------------------------------------===//
15 // MMX Pattern Fragments
16 //===----------------------------------------------------------------------===//
18 def load_mmx : PatFrag<(ops node:$ptr), (x86mmx (load node:$ptr))>;
19 def bc_mmx : PatFrag<(ops node:$in), (x86mmx (bitconvert node:$in))>;
21 //===----------------------------------------------------------------------===//
22 // SSE specific DAG Nodes.
23 //===----------------------------------------------------------------------===//
25 def SDTX86FPShiftOp : SDTypeProfile<1, 2, [ SDTCisSameAs<0, 1>,
26 SDTCisFP<0>, SDTCisInt<2> ]>;
27 def SDTX86VFCMP : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<1, 2>,
28 SDTCisFP<1>, SDTCisVT<3, i8>]>;
30 def X86umin : SDNode<"X86ISD::UMIN", SDTIntBinOp>;
31 def X86umax : SDNode<"X86ISD::UMAX", SDTIntBinOp>;
32 def X86smin : SDNode<"X86ISD::SMIN", SDTIntBinOp>;
33 def X86smax : SDNode<"X86ISD::SMAX", SDTIntBinOp>;
35 def X86fmin : SDNode<"X86ISD::FMIN", SDTFPBinOp>;
36 def X86fmax : SDNode<"X86ISD::FMAX", SDTFPBinOp>;
38 // Commutative and Associative FMIN and FMAX.
39 def X86fminc : SDNode<"X86ISD::FMINC", SDTFPBinOp,
40 [SDNPCommutative, SDNPAssociative]>;
41 def X86fmaxc : SDNode<"X86ISD::FMAXC", SDTFPBinOp,
42 [SDNPCommutative, SDNPAssociative]>;
44 def X86fand : SDNode<"X86ISD::FAND", SDTFPBinOp,
45 [SDNPCommutative, SDNPAssociative]>;
46 def X86for : SDNode<"X86ISD::FOR", SDTFPBinOp,
47 [SDNPCommutative, SDNPAssociative]>;
48 def X86fxor : SDNode<"X86ISD::FXOR", SDTFPBinOp,
49 [SDNPCommutative, SDNPAssociative]>;
50 def X86fandn : SDNode<"X86ISD::FANDN", SDTFPBinOp,
51 [SDNPCommutative, SDNPAssociative]>;
52 def X86frsqrt : SDNode<"X86ISD::FRSQRT", SDTFPUnaryOp>;
53 def X86frcp : SDNode<"X86ISD::FRCP", SDTFPUnaryOp>;
54 def X86fsrl : SDNode<"X86ISD::FSRL", SDTX86FPShiftOp>;
55 def X86fgetsign: SDNode<"X86ISD::FGETSIGNx86",SDTFPToIntOp>;
56 def X86fhadd : SDNode<"X86ISD::FHADD", SDTFPBinOp>;
57 def X86fhsub : SDNode<"X86ISD::FHSUB", SDTFPBinOp>;
58 def X86hadd : SDNode<"X86ISD::HADD", SDTIntBinOp>;
59 def X86hsub : SDNode<"X86ISD::HSUB", SDTIntBinOp>;
60 def X86comi : SDNode<"X86ISD::COMI", SDTX86CmpTest>;
61 def X86ucomi : SDNode<"X86ISD::UCOMI", SDTX86CmpTest>;
62 def X86cmpss : SDNode<"X86ISD::FSETCCss", SDTX86Cmpss>;
63 def X86cmpsd : SDNode<"X86ISD::FSETCCsd", SDTX86Cmpsd>;
64 def X86pshufb : SDNode<"X86ISD::PSHUFB",
65 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
67 def X86andnp : SDNode<"X86ISD::ANDNP",
68 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
70 def X86psign : SDNode<"X86ISD::PSIGN",
71 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
73 def X86pextrb : SDNode<"X86ISD::PEXTRB",
74 SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>;
75 def X86pextrw : SDNode<"X86ISD::PEXTRW",
76 SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>;
77 def X86pinsrb : SDNode<"X86ISD::PINSRB",
78 SDTypeProfile<1, 3, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>,
79 SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>;
80 def X86pinsrw : SDNode<"X86ISD::PINSRW",
81 SDTypeProfile<1, 3, [SDTCisVT<0, v8i16>, SDTCisSameAs<0,1>,
82 SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>;
83 def X86insrtps : SDNode<"X86ISD::INSERTPS",
84 SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisSameAs<0,1>,
85 SDTCisVT<2, v4f32>, SDTCisPtrTy<3>]>>;
86 def X86vzmovl : SDNode<"X86ISD::VZEXT_MOVL",
87 SDTypeProfile<1, 1, [SDTCisSameAs<0,1>]>>;
89 def X86vzmovly : SDNode<"X86ISD::VZEXT_MOVL",
90 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
91 SDTCisOpSmallerThanOp<1, 0> ]>>;
93 def X86vsmovl : SDNode<"X86ISD::VSEXT_MOVL",
95 [SDTCisVec<0>, SDTCisInt<1>, SDTCisInt<0>]>>;
97 def X86vzload : SDNode<"X86ISD::VZEXT_LOAD", SDTLoad,
98 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
100 def X86vzext : SDNode<"X86ISD::VZEXT",
101 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
102 SDTCisInt<0>, SDTCisInt<1>]>>;
104 def X86vsext : SDNode<"X86ISD::VSEXT",
105 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
106 SDTCisInt<0>, SDTCisInt<1>]>>;
108 def X86vfpext : SDNode<"X86ISD::VFPEXT",
109 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
110 SDTCisFP<0>, SDTCisFP<1>]>>;
111 def X86vfpround: SDNode<"X86ISD::VFPROUND",
112 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
113 SDTCisFP<0>, SDTCisFP<1>]>>;
115 def X86vshldq : SDNode<"X86ISD::VSHLDQ", SDTIntShiftOp>;
116 def X86vshrdq : SDNode<"X86ISD::VSRLDQ", SDTIntShiftOp>;
117 def X86cmpp : SDNode<"X86ISD::CMPP", SDTX86VFCMP>;
118 def X86pcmpeq : SDNode<"X86ISD::PCMPEQ", SDTIntBinOp, [SDNPCommutative]>;
119 def X86pcmpgt : SDNode<"X86ISD::PCMPGT", SDTIntBinOp>;
121 def X86IntCmpMask : SDTypeProfile<1, 2,
122 [SDTCisVec<0>, SDTCisSameAs<1, 2>, SDTCisInt<1>]>;
123 def X86pcmpeqm : SDNode<"X86ISD::PCMPEQM", X86IntCmpMask, [SDNPCommutative]>;
124 def X86pcmpgtm : SDNode<"X86ISD::PCMPGTM", X86IntCmpMask>;
126 def X86CmpMaskCC : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<1, 2>, SDTCisVT<3, i8>]>;
127 def X86cmpm : SDNode<"X86ISD::CMPM", X86CmpMaskCC>;
128 def X86cmpmu : SDNode<"X86ISD::CMPMU", X86CmpMaskCC>;
130 def X86vshl : SDNode<"X86ISD::VSHL",
131 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
133 def X86vsrl : SDNode<"X86ISD::VSRL",
134 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
136 def X86vsra : SDNode<"X86ISD::VSRA",
137 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
140 def X86vshli : SDNode<"X86ISD::VSHLI", SDTIntShiftOp>;
141 def X86vsrli : SDNode<"X86ISD::VSRLI", SDTIntShiftOp>;
142 def X86vsrai : SDNode<"X86ISD::VSRAI", SDTIntShiftOp>;
144 def SDTX86CmpPTest : SDTypeProfile<1, 2, [SDTCisVT<0, i32>,
146 SDTCisSameAs<2, 1>]>;
147 def X86subus : SDNode<"X86ISD::SUBUS", SDTIntBinOp>;
148 def X86ptest : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>;
149 def X86testp : SDNode<"X86ISD::TESTP", SDTX86CmpPTest>;
150 def X86kortest : SDNode<"X86ISD::KORTEST", SDTX86CmpPTest>;
151 def X86ktest : SDNode<"X86ISD::KTEST", SDTX86CmpPTest>;
153 def X86pmuludq : SDNode<"X86ISD::PMULUDQ",
154 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
155 SDTCisSameAs<1,2>]>>;
157 // Specific shuffle nodes - At some point ISD::VECTOR_SHUFFLE will always get
158 // translated into one of the target nodes below during lowering.
159 // Note: this is a work in progress...
160 def SDTShuff1Op : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0,1>]>;
161 def SDTShuff2Op : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
163 def SDTShuff3Op : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
164 SDTCisSameAs<0,2>, SDTCisSameAs<0,3>]>;
166 def SDTShuff2OpI : SDTypeProfile<1, 2, [SDTCisVec<0>,
167 SDTCisSameAs<0,1>, SDTCisInt<2>]>;
168 def SDTShuff3OpI : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
169 SDTCisSameAs<0,2>, SDTCisInt<3>]>;
171 def SDTVBroadcast : SDTypeProfile<1, 1, [SDTCisVec<0>]>;
172 def SDTVBroadcastm : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>]>;
174 def SDTBlend : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
175 SDTCisSameAs<1,2>, SDTCisVT<3, i32>]>;
177 def SDTFma : SDTypeProfile<1, 3, [SDTCisSameAs<0,1>,
178 SDTCisSameAs<1,2>, SDTCisSameAs<1,3>]>;
180 def X86PAlignr : SDNode<"X86ISD::PALIGNR", SDTShuff3OpI>;
182 def X86PShufd : SDNode<"X86ISD::PSHUFD", SDTShuff2OpI>;
183 def X86PShufhw : SDNode<"X86ISD::PSHUFHW", SDTShuff2OpI>;
184 def X86PShuflw : SDNode<"X86ISD::PSHUFLW", SDTShuff2OpI>;
186 def X86Shufp : SDNode<"X86ISD::SHUFP", SDTShuff3OpI>;
188 def X86Movddup : SDNode<"X86ISD::MOVDDUP", SDTShuff1Op>;
189 def X86Movshdup : SDNode<"X86ISD::MOVSHDUP", SDTShuff1Op>;
190 def X86Movsldup : SDNode<"X86ISD::MOVSLDUP", SDTShuff1Op>;
192 def X86Movsd : SDNode<"X86ISD::MOVSD", SDTShuff2Op>;
193 def X86Movss : SDNode<"X86ISD::MOVSS", SDTShuff2Op>;
195 def X86Movlhps : SDNode<"X86ISD::MOVLHPS", SDTShuff2Op>;
196 def X86Movlhpd : SDNode<"X86ISD::MOVLHPD", SDTShuff2Op>;
197 def X86Movhlps : SDNode<"X86ISD::MOVHLPS", SDTShuff2Op>;
199 def X86Movlps : SDNode<"X86ISD::MOVLPS", SDTShuff2Op>;
200 def X86Movlpd : SDNode<"X86ISD::MOVLPD", SDTShuff2Op>;
202 def X86Unpckl : SDNode<"X86ISD::UNPCKL", SDTShuff2Op>;
203 def X86Unpckh : SDNode<"X86ISD::UNPCKH", SDTShuff2Op>;
205 def X86VPermilp : SDNode<"X86ISD::VPERMILP", SDTShuff2OpI>;
206 def X86VPermv : SDNode<"X86ISD::VPERMV", SDTShuff2Op>;
207 def X86VPermi : SDNode<"X86ISD::VPERMI", SDTShuff2OpI>;
208 def X86VPermv3 : SDNode<"X86ISD::VPERMV3", SDTShuff3Op>;
210 def X86VPerm2x128 : SDNode<"X86ISD::VPERM2X128", SDTShuff3OpI>;
212 def X86VBroadcast : SDNode<"X86ISD::VBROADCAST", SDTVBroadcast>;
213 def X86VBroadcastm : SDNode<"X86ISD::VBROADCASTM", SDTVBroadcastm>;
215 def X86Blendi : SDNode<"X86ISD::BLENDI", SDTBlend>;
216 def X86Fmadd : SDNode<"X86ISD::FMADD", SDTFma>;
217 def X86Fnmadd : SDNode<"X86ISD::FNMADD", SDTFma>;
218 def X86Fmsub : SDNode<"X86ISD::FMSUB", SDTFma>;
219 def X86Fnmsub : SDNode<"X86ISD::FNMSUB", SDTFma>;
220 def X86Fmaddsub : SDNode<"X86ISD::FMADDSUB", SDTFma>;
221 def X86Fmsubadd : SDNode<"X86ISD::FMSUBADD", SDTFma>;
223 def SDT_PCMPISTRI : SDTypeProfile<2, 3, [SDTCisVT<0, i32>, SDTCisVT<1, i32>,
224 SDTCisVT<2, v16i8>, SDTCisVT<3, v16i8>,
226 def SDT_PCMPESTRI : SDTypeProfile<2, 5, [SDTCisVT<0, i32>, SDTCisVT<1, i32>,
227 SDTCisVT<2, v16i8>, SDTCisVT<3, i32>,
228 SDTCisVT<4, v16i8>, SDTCisVT<5, i32>,
231 def X86pcmpistri : SDNode<"X86ISD::PCMPISTRI", SDT_PCMPISTRI>;
232 def X86pcmpestri : SDNode<"X86ISD::PCMPESTRI", SDT_PCMPESTRI>;
234 //===----------------------------------------------------------------------===//
235 // SSE Complex Patterns
236 //===----------------------------------------------------------------------===//
238 // These are 'extloads' from a scalar to the low element of a vector, zeroing
239 // the top elements. These are used for the SSE 'ss' and 'sd' instruction
241 def sse_load_f32 : ComplexPattern<v4f32, 5, "SelectScalarSSELoad", [],
242 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand,
244 def sse_load_f64 : ComplexPattern<v2f64, 5, "SelectScalarSSELoad", [],
245 [SDNPHasChain, SDNPMayLoad, SDNPMemOperand,
248 def ssmem : Operand<v4f32> {
249 let PrintMethod = "printf32mem";
250 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
251 let ParserMatchClass = X86MemAsmOperand;
252 let OperandType = "OPERAND_MEMORY";
254 def sdmem : Operand<v2f64> {
255 let PrintMethod = "printf64mem";
256 let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
257 let ParserMatchClass = X86MemAsmOperand;
258 let OperandType = "OPERAND_MEMORY";
261 //===----------------------------------------------------------------------===//
262 // SSE pattern fragments
263 //===----------------------------------------------------------------------===//
265 // 128-bit load pattern fragments
266 // NOTE: all 128-bit integer vector loads are promoted to v2i64
267 def loadv4f32 : PatFrag<(ops node:$ptr), (v4f32 (load node:$ptr))>;
268 def loadv2f64 : PatFrag<(ops node:$ptr), (v2f64 (load node:$ptr))>;
269 def loadv2i64 : PatFrag<(ops node:$ptr), (v2i64 (load node:$ptr))>;
271 // 256-bit load pattern fragments
272 // NOTE: all 256-bit integer vector loads are promoted to v4i64
273 def loadv8f32 : PatFrag<(ops node:$ptr), (v8f32 (load node:$ptr))>;
274 def loadv4f64 : PatFrag<(ops node:$ptr), (v4f64 (load node:$ptr))>;
275 def loadv4i64 : PatFrag<(ops node:$ptr), (v4i64 (load node:$ptr))>;
277 // 512-bit load pattern fragments
278 def loadv16f32 : PatFrag<(ops node:$ptr), (v16f32 (load node:$ptr))>;
279 def loadv8f64 : PatFrag<(ops node:$ptr), (v8f64 (load node:$ptr))>;
280 def loadv8i64 : PatFrag<(ops node:$ptr), (v8i64 (load node:$ptr))>;
282 // 128-/256-/512-bit extload pattern fragments
283 def extloadv2f32 : PatFrag<(ops node:$ptr), (v2f64 (extloadvf32 node:$ptr))>;
284 def extloadv4f32 : PatFrag<(ops node:$ptr), (v4f64 (extloadvf32 node:$ptr))>;
285 def extloadv8f32 : PatFrag<(ops node:$ptr), (v8f64 (extloadvf32 node:$ptr))>;
287 // Like 'store', but always requires 128-bit vector alignment.
288 def alignedstore : PatFrag<(ops node:$val, node:$ptr),
289 (store node:$val, node:$ptr), [{
290 return cast<StoreSDNode>(N)->getAlignment() >= 16;
293 // Like 'store', but always requires 256-bit vector alignment.
294 def alignedstore256 : PatFrag<(ops node:$val, node:$ptr),
295 (store node:$val, node:$ptr), [{
296 return cast<StoreSDNode>(N)->getAlignment() >= 32;
299 // Like 'store', but always requires 512-bit vector alignment.
300 def alignedstore512 : PatFrag<(ops node:$val, node:$ptr),
301 (store node:$val, node:$ptr), [{
302 return cast<StoreSDNode>(N)->getAlignment() >= 64;
305 // Like 'load', but always requires 128-bit vector alignment.
306 def alignedload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
307 return cast<LoadSDNode>(N)->getAlignment() >= 16;
310 // Like 'X86vzload', but always requires 128-bit vector alignment.
311 def alignedX86vzload : PatFrag<(ops node:$ptr), (X86vzload node:$ptr), [{
312 return cast<MemSDNode>(N)->getAlignment() >= 16;
315 // Like 'load', but always requires 256-bit vector alignment.
316 def alignedload256 : PatFrag<(ops node:$ptr), (load node:$ptr), [{
317 return cast<LoadSDNode>(N)->getAlignment() >= 32;
320 // Like 'load', but always requires 512-bit vector alignment.
321 def alignedload512 : PatFrag<(ops node:$ptr), (load node:$ptr), [{
322 return cast<LoadSDNode>(N)->getAlignment() >= 64;
325 def alignedloadfsf32 : PatFrag<(ops node:$ptr),
326 (f32 (alignedload node:$ptr))>;
327 def alignedloadfsf64 : PatFrag<(ops node:$ptr),
328 (f64 (alignedload node:$ptr))>;
330 // 128-bit aligned load pattern fragments
331 // NOTE: all 128-bit integer vector loads are promoted to v2i64
332 def alignedloadv4f32 : PatFrag<(ops node:$ptr),
333 (v4f32 (alignedload node:$ptr))>;
334 def alignedloadv2f64 : PatFrag<(ops node:$ptr),
335 (v2f64 (alignedload node:$ptr))>;
336 def alignedloadv2i64 : PatFrag<(ops node:$ptr),
337 (v2i64 (alignedload node:$ptr))>;
339 // 256-bit aligned load pattern fragments
340 // NOTE: all 256-bit integer vector loads are promoted to v4i64
341 def alignedloadv8f32 : PatFrag<(ops node:$ptr),
342 (v8f32 (alignedload256 node:$ptr))>;
343 def alignedloadv4f64 : PatFrag<(ops node:$ptr),
344 (v4f64 (alignedload256 node:$ptr))>;
345 def alignedloadv4i64 : PatFrag<(ops node:$ptr),
346 (v4i64 (alignedload256 node:$ptr))>;
348 // 512-bit aligned load pattern fragments
349 def alignedloadv16f32 : PatFrag<(ops node:$ptr),
350 (v16f32 (alignedload512 node:$ptr))>;
351 def alignedloadv8f64 : PatFrag<(ops node:$ptr),
352 (v8f64 (alignedload512 node:$ptr))>;
353 def alignedloadv8i64 : PatFrag<(ops node:$ptr),
354 (v8i64 (alignedload512 node:$ptr))>;
356 // Like 'load', but uses special alignment checks suitable for use in
357 // memory operands in most SSE instructions, which are required to
358 // be naturally aligned on some targets but not on others. If the subtarget
359 // allows unaligned accesses, match any load, though this may require
360 // setting a feature bit in the processor (on startup, for example).
361 // Opteron 10h and later implement such a feature.
362 def memop : PatFrag<(ops node:$ptr), (load node:$ptr), [{
363 return Subtarget->hasVectorUAMem()
364 || cast<LoadSDNode>(N)->getAlignment() >= 16;
367 def memopfsf32 : PatFrag<(ops node:$ptr), (f32 (memop node:$ptr))>;
368 def memopfsf64 : PatFrag<(ops node:$ptr), (f64 (memop node:$ptr))>;
370 // 128-bit memop pattern fragments
371 // NOTE: all 128-bit integer vector loads are promoted to v2i64
372 def memopv4f32 : PatFrag<(ops node:$ptr), (v4f32 (memop node:$ptr))>;
373 def memopv2f64 : PatFrag<(ops node:$ptr), (v2f64 (memop node:$ptr))>;
374 def memopv2i64 : PatFrag<(ops node:$ptr), (v2i64 (memop node:$ptr))>;
376 // 256-bit memop pattern fragments
377 // NOTE: all 256-bit integer vector loads are promoted to v4i64
378 def memopv8f32 : PatFrag<(ops node:$ptr), (v8f32 (memop node:$ptr))>;
379 def memopv4f64 : PatFrag<(ops node:$ptr), (v4f64 (memop node:$ptr))>;
380 def memopv4i64 : PatFrag<(ops node:$ptr), (v4i64 (memop node:$ptr))>;
382 // 512-bit memop pattern fragments
383 def memopv16f32 : PatFrag<(ops node:$ptr), (v16f32 (memop node:$ptr))>;
384 def memopv8f64 : PatFrag<(ops node:$ptr), (v8f64 (memop node:$ptr))>;
385 def memopv8i64 : PatFrag<(ops node:$ptr), (v8i64 (memop node:$ptr))>;
387 // SSSE3 uses MMX registers for some instructions. They aren't aligned on a
389 // FIXME: 8 byte alignment for mmx reads is not required
390 def memop64 : PatFrag<(ops node:$ptr), (load node:$ptr), [{
391 return cast<LoadSDNode>(N)->getAlignment() >= 8;
394 def memopmmx : PatFrag<(ops node:$ptr), (x86mmx (memop64 node:$ptr))>;
397 // Like 'store', but requires the non-temporal bit to be set
398 def nontemporalstore : PatFrag<(ops node:$val, node:$ptr),
399 (st node:$val, node:$ptr), [{
400 if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
401 return ST->isNonTemporal();
405 def alignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
406 (st node:$val, node:$ptr), [{
407 if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
408 return ST->isNonTemporal() && !ST->isTruncatingStore() &&
409 ST->getAddressingMode() == ISD::UNINDEXED &&
410 ST->getAlignment() >= 16;
414 def unalignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
415 (st node:$val, node:$ptr), [{
416 if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
417 return ST->isNonTemporal() &&
418 ST->getAlignment() < 16;
422 // 128-bit bitconvert pattern fragments
423 def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>;
424 def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>;
425 def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>;
426 def bc_v8i16 : PatFrag<(ops node:$in), (v8i16 (bitconvert node:$in))>;
427 def bc_v4i32 : PatFrag<(ops node:$in), (v4i32 (bitconvert node:$in))>;
428 def bc_v2i64 : PatFrag<(ops node:$in), (v2i64 (bitconvert node:$in))>;
430 // 256-bit bitconvert pattern fragments
431 def bc_v32i8 : PatFrag<(ops node:$in), (v32i8 (bitconvert node:$in))>;
432 def bc_v16i16 : PatFrag<(ops node:$in), (v16i16 (bitconvert node:$in))>;
433 def bc_v8i32 : PatFrag<(ops node:$in), (v8i32 (bitconvert node:$in))>;
434 def bc_v4i64 : PatFrag<(ops node:$in), (v4i64 (bitconvert node:$in))>;
436 // 512-bit bitconvert pattern fragments
437 def bc_v16i32 : PatFrag<(ops node:$in), (v16i32 (bitconvert node:$in))>;
438 def bc_v8i64 : PatFrag<(ops node:$in), (v8i64 (bitconvert node:$in))>;
441 def vzmovl_v2i64 : PatFrag<(ops node:$src),
442 (bitconvert (v2i64 (X86vzmovl
443 (v2i64 (scalar_to_vector (loadi64 node:$src))))))>;
444 def vzmovl_v4i32 : PatFrag<(ops node:$src),
445 (bitconvert (v4i32 (X86vzmovl
446 (v4i32 (scalar_to_vector (loadi32 node:$src))))))>;
448 def vzload_v2i64 : PatFrag<(ops node:$src),
449 (bitconvert (v2i64 (X86vzload node:$src)))>;
452 def fp32imm0 : PatLeaf<(f32 fpimm), [{
453 return N->isExactlyValue(+0.0);
456 // BYTE_imm - Transform bit immediates into byte immediates.
457 def BYTE_imm : SDNodeXForm<imm, [{
458 // Transformation function: imm >> 3
459 return getI32Imm(N->getZExtValue() >> 3);
462 // EXTRACT_get_vextract128_imm xform function: convert extract_subvector index
463 // to VEXTRACTF128/VEXTRACTI128 imm.
464 def EXTRACT_get_vextract128_imm : SDNodeXForm<extract_subvector, [{
465 return getI8Imm(X86::getExtractVEXTRACT128Immediate(N));
468 // INSERT_get_vinsert128_imm xform function: convert insert_subvector index to
469 // VINSERTF128/VINSERTI128 imm.
470 def INSERT_get_vinsert128_imm : SDNodeXForm<insert_subvector, [{
471 return getI8Imm(X86::getInsertVINSERT128Immediate(N));
474 // EXTRACT_get_vextract256_imm xform function: convert extract_subvector index
475 // to VEXTRACTF64x4 imm.
476 def EXTRACT_get_vextract256_imm : SDNodeXForm<extract_subvector, [{
477 return getI8Imm(X86::getExtractVEXTRACT256Immediate(N));
480 // INSERT_get_vinsert256_imm xform function: convert insert_subvector index to
482 def INSERT_get_vinsert256_imm : SDNodeXForm<insert_subvector, [{
483 return getI8Imm(X86::getInsertVINSERT256Immediate(N));
486 def vextract128_extract : PatFrag<(ops node:$bigvec, node:$index),
487 (extract_subvector node:$bigvec,
489 return X86::isVEXTRACT128Index(N);
490 }], EXTRACT_get_vextract128_imm>;
492 def vinsert128_insert : PatFrag<(ops node:$bigvec, node:$smallvec,
494 (insert_subvector node:$bigvec, node:$smallvec,
496 return X86::isVINSERT128Index(N);
497 }], INSERT_get_vinsert128_imm>;
500 def vextract256_extract : PatFrag<(ops node:$bigvec, node:$index),
501 (extract_subvector node:$bigvec,
503 return X86::isVEXTRACT256Index(N);
504 }], EXTRACT_get_vextract256_imm>;
506 def vinsert256_insert : PatFrag<(ops node:$bigvec, node:$smallvec,
508 (insert_subvector node:$bigvec, node:$smallvec,
510 return X86::isVINSERT256Index(N);
511 }], INSERT_get_vinsert256_imm>;