• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//===-- X86InstrFragmentsSIMD.td - x86 SIMD ISA ------------*- tablegen -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file provides pattern fragments useful for SIMD instructions.
11//
12//===----------------------------------------------------------------------===//
13
14//===----------------------------------------------------------------------===//
15// MMX Pattern Fragments
16//===----------------------------------------------------------------------===//
17
18def load_mmx : PatFrag<(ops node:$ptr), (x86mmx (load node:$ptr))>;
19def bc_mmx  : PatFrag<(ops node:$in), (x86mmx  (bitconvert node:$in))>;
20
21//===----------------------------------------------------------------------===//
22// SSE specific DAG Nodes.
23//===----------------------------------------------------------------------===//
24
25def SDTX86FPShiftOp : SDTypeProfile<1, 2, [ SDTCisSameAs<0, 1>,
26                                            SDTCisFP<0>, SDTCisInt<2> ]>;
27def SDTX86VFCMP : SDTypeProfile<1, 3, [SDTCisInt<0>, SDTCisSameAs<1, 2>,
28                                       SDTCisFP<1>, SDTCisVT<3, i8>]>;
29
30def X86umin    : SDNode<"X86ISD::UMIN",      SDTIntBinOp>;
31def X86umax    : SDNode<"X86ISD::UMAX",      SDTIntBinOp>;
32def X86smin    : SDNode<"X86ISD::SMIN",      SDTIntBinOp>;
33def X86smax    : SDNode<"X86ISD::SMAX",      SDTIntBinOp>;
34
35def X86fmin    : SDNode<"X86ISD::FMIN",      SDTFPBinOp>;
36def X86fmax    : SDNode<"X86ISD::FMAX",      SDTFPBinOp>;
37
38// Commutative and Associative FMIN and FMAX.
39def X86fminc    : SDNode<"X86ISD::FMINC", SDTFPBinOp,
40    [SDNPCommutative, SDNPAssociative]>;
41def X86fmaxc    : SDNode<"X86ISD::FMAXC", SDTFPBinOp,
42    [SDNPCommutative, SDNPAssociative]>;
43
44def X86fand    : SDNode<"X86ISD::FAND",      SDTFPBinOp,
45                        [SDNPCommutative, SDNPAssociative]>;
46def X86for     : SDNode<"X86ISD::FOR",       SDTFPBinOp,
47                        [SDNPCommutative, SDNPAssociative]>;
48def X86fxor    : SDNode<"X86ISD::FXOR",      SDTFPBinOp,
49                        [SDNPCommutative, SDNPAssociative]>;
50def X86frsqrt  : SDNode<"X86ISD::FRSQRT",    SDTFPUnaryOp>;
51def X86frcp    : SDNode<"X86ISD::FRCP",      SDTFPUnaryOp>;
52def X86fsrl    : SDNode<"X86ISD::FSRL",      SDTX86FPShiftOp>;
53def X86fgetsign: SDNode<"X86ISD::FGETSIGNx86",SDTFPToIntOp>;
54def X86fhadd   : SDNode<"X86ISD::FHADD",     SDTFPBinOp>;
55def X86fhsub   : SDNode<"X86ISD::FHSUB",     SDTFPBinOp>;
56def X86hadd    : SDNode<"X86ISD::HADD",      SDTIntBinOp>;
57def X86hsub    : SDNode<"X86ISD::HSUB",      SDTIntBinOp>;
58def X86comi    : SDNode<"X86ISD::COMI",      SDTX86CmpTest>;
59def X86ucomi   : SDNode<"X86ISD::UCOMI",     SDTX86CmpTest>;
60def X86cmpss   : SDNode<"X86ISD::FSETCCss",    SDTX86Cmpss>;
61def X86cmpsd   : SDNode<"X86ISD::FSETCCsd",    SDTX86Cmpsd>;
62def X86pshufb  : SDNode<"X86ISD::PSHUFB",
63                 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
64                                      SDTCisSameAs<0,2>]>>;
65def X86andnp   : SDNode<"X86ISD::ANDNP",
66                 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
67                                      SDTCisSameAs<0,2>]>>;
68def X86psign   : SDNode<"X86ISD::PSIGN",
69                 SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
70                                      SDTCisSameAs<0,2>]>>;
71def X86pextrb  : SDNode<"X86ISD::PEXTRB",
72                 SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>;
73def X86pextrw  : SDNode<"X86ISD::PEXTRW",
74                 SDTypeProfile<1, 2, [SDTCisVT<0, i32>, SDTCisPtrTy<2>]>>;
75def X86pinsrb  : SDNode<"X86ISD::PINSRB",
76                 SDTypeProfile<1, 3, [SDTCisVT<0, v16i8>, SDTCisSameAs<0,1>,
77                                      SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>;
78def X86pinsrw  : SDNode<"X86ISD::PINSRW",
79                 SDTypeProfile<1, 3, [SDTCisVT<0, v8i16>, SDTCisSameAs<0,1>,
80                                      SDTCisVT<2, i32>, SDTCisPtrTy<3>]>>;
81def X86insrtps : SDNode<"X86ISD::INSERTPS",
82                 SDTypeProfile<1, 3, [SDTCisVT<0, v4f32>, SDTCisSameAs<0,1>,
83                                      SDTCisVT<2, v4f32>, SDTCisPtrTy<3>]>>;
84def X86vzmovl  : SDNode<"X86ISD::VZEXT_MOVL",
85                 SDTypeProfile<1, 1, [SDTCisSameAs<0,1>]>>;
86
87def X86vzmovly  : SDNode<"X86ISD::VZEXT_MOVL",
88                 SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
89                                      SDTCisOpSmallerThanOp<1, 0> ]>>;
90
91def X86vsmovl  : SDNode<"X86ISD::VSEXT_MOVL",
92                 SDTypeProfile<1, 1,
93                 [SDTCisVec<0>, SDTCisInt<1>, SDTCisInt<0>]>>;
94
95def X86vzload  : SDNode<"X86ISD::VZEXT_LOAD", SDTLoad,
96                        [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>;
97
98def X86vzext   : SDNode<"X86ISD::VZEXT",
99                         SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
100                                              SDTCisInt<0>, SDTCisInt<1>]>>;
101
102def X86vsext   : SDNode<"X86ISD::VSEXT",
103                         SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
104                                              SDTCisInt<0>, SDTCisInt<1>]>>;
105
106def X86vfpext  : SDNode<"X86ISD::VFPEXT",
107                        SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
108                                             SDTCisFP<0>, SDTCisFP<1>]>>;
109def X86vfpround: SDNode<"X86ISD::VFPROUND",
110                        SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisVec<1>,
111                                             SDTCisFP<0>, SDTCisFP<1>]>>;
112
113def X86vshldq  : SDNode<"X86ISD::VSHLDQ",    SDTIntShiftOp>;
114def X86vshrdq  : SDNode<"X86ISD::VSRLDQ",    SDTIntShiftOp>;
115def X86cmpp    : SDNode<"X86ISD::CMPP",      SDTX86VFCMP>;
116def X86pcmpeq  : SDNode<"X86ISD::PCMPEQ", SDTIntBinOp, [SDNPCommutative]>;
117def X86pcmpgt  : SDNode<"X86ISD::PCMPGT", SDTIntBinOp>;
118
119def X86vshl    : SDNode<"X86ISD::VSHL",
120                        SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
121                                      SDTCisVec<2>]>>;
122def X86vsrl    : SDNode<"X86ISD::VSRL",
123                        SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
124                                      SDTCisVec<2>]>>;
125def X86vsra    : SDNode<"X86ISD::VSRA",
126                        SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
127                                      SDTCisVec<2>]>>;
128
129def X86vshli   : SDNode<"X86ISD::VSHLI", SDTIntShiftOp>;
130def X86vsrli   : SDNode<"X86ISD::VSRLI", SDTIntShiftOp>;
131def X86vsrai   : SDNode<"X86ISD::VSRAI", SDTIntShiftOp>;
132
133def SDTX86CmpPTest : SDTypeProfile<1, 2, [SDTCisVT<0, i32>,
134                                          SDTCisVec<1>,
135                                          SDTCisSameAs<2, 1>]>;
136def X86subus   : SDNode<"X86ISD::SUBUS", SDTIntBinOp>;
137def X86ptest   : SDNode<"X86ISD::PTEST", SDTX86CmpPTest>;
138def X86testp   : SDNode<"X86ISD::TESTP", SDTX86CmpPTest>;
139
140def X86pmuludq : SDNode<"X86ISD::PMULUDQ",
141                        SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisVec<1>,
142                                      SDTCisSameAs<1,2>]>>;
143
144// Specific shuffle nodes - At some point ISD::VECTOR_SHUFFLE will always get
145// translated into one of the target nodes below during lowering.
146// Note: this is a work in progress...
147def SDTShuff1Op : SDTypeProfile<1, 1, [SDTCisVec<0>, SDTCisSameAs<0,1>]>;
148def SDTShuff2Op : SDTypeProfile<1, 2, [SDTCisVec<0>, SDTCisSameAs<0,1>,
149                                SDTCisSameAs<0,2>]>;
150
151def SDTShuff2OpI : SDTypeProfile<1, 2, [SDTCisVec<0>,
152                                 SDTCisSameAs<0,1>, SDTCisInt<2>]>;
153def SDTShuff3OpI : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
154                                 SDTCisSameAs<0,2>, SDTCisInt<3>]>;
155
156def SDTVBroadcast : SDTypeProfile<1, 1, [SDTCisVec<0>]>;
157def SDTBlend : SDTypeProfile<1, 3, [SDTCisVec<0>, SDTCisSameAs<0,1>,
158                             SDTCisSameAs<1,2>, SDTCisVT<3, i32>]>;
159
160def SDTFma : SDTypeProfile<1, 3, [SDTCisSameAs<0,1>,
161                           SDTCisSameAs<1,2>, SDTCisSameAs<1,3>]>;
162
163def X86PAlignr : SDNode<"X86ISD::PALIGNR", SDTShuff3OpI>;
164
165def X86PShufd  : SDNode<"X86ISD::PSHUFD", SDTShuff2OpI>;
166def X86PShufhw : SDNode<"X86ISD::PSHUFHW", SDTShuff2OpI>;
167def X86PShuflw : SDNode<"X86ISD::PSHUFLW", SDTShuff2OpI>;
168
169def X86Shufp : SDNode<"X86ISD::SHUFP", SDTShuff3OpI>;
170
171def X86Movddup  : SDNode<"X86ISD::MOVDDUP", SDTShuff1Op>;
172def X86Movshdup : SDNode<"X86ISD::MOVSHDUP", SDTShuff1Op>;
173def X86Movsldup : SDNode<"X86ISD::MOVSLDUP", SDTShuff1Op>;
174
175def X86Movsd : SDNode<"X86ISD::MOVSD", SDTShuff2Op>;
176def X86Movss : SDNode<"X86ISD::MOVSS", SDTShuff2Op>;
177
178def X86Movlhps : SDNode<"X86ISD::MOVLHPS", SDTShuff2Op>;
179def X86Movlhpd : SDNode<"X86ISD::MOVLHPD", SDTShuff2Op>;
180def X86Movhlps : SDNode<"X86ISD::MOVHLPS", SDTShuff2Op>;
181
182def X86Movlps : SDNode<"X86ISD::MOVLPS", SDTShuff2Op>;
183def X86Movlpd : SDNode<"X86ISD::MOVLPD", SDTShuff2Op>;
184
185def X86Unpckl : SDNode<"X86ISD::UNPCKL", SDTShuff2Op>;
186def X86Unpckh : SDNode<"X86ISD::UNPCKH", SDTShuff2Op>;
187
188def X86VPermilp  : SDNode<"X86ISD::VPERMILP", SDTShuff2OpI>;
189def X86VPermv    : SDNode<"X86ISD::VPERMV",   SDTShuff2Op>;
190def X86VPermi    : SDNode<"X86ISD::VPERMI",   SDTShuff2OpI>;
191
192def X86VPerm2x128 : SDNode<"X86ISD::VPERM2X128", SDTShuff3OpI>;
193
194def X86VBroadcast : SDNode<"X86ISD::VBROADCAST", SDTVBroadcast>;
195
196def X86Blendi    : SDNode<"X86ISD::BLENDI",   SDTBlend>;
197def X86Fmadd     : SDNode<"X86ISD::FMADD",     SDTFma>;
198def X86Fnmadd    : SDNode<"X86ISD::FNMADD",    SDTFma>;
199def X86Fmsub     : SDNode<"X86ISD::FMSUB",     SDTFma>;
200def X86Fnmsub    : SDNode<"X86ISD::FNMSUB",    SDTFma>;
201def X86Fmaddsub  : SDNode<"X86ISD::FMADDSUB",  SDTFma>;
202def X86Fmsubadd  : SDNode<"X86ISD::FMSUBADD",  SDTFma>;
203
204def SDT_PCMPISTRI : SDTypeProfile<2, 3, [SDTCisVT<0, i32>, SDTCisVT<1, i32>,
205                                         SDTCisVT<2, v16i8>, SDTCisVT<3, v16i8>,
206                                         SDTCisVT<4, i8>]>;
207def SDT_PCMPESTRI : SDTypeProfile<2, 5, [SDTCisVT<0, i32>, SDTCisVT<1, i32>,
208                                         SDTCisVT<2, v16i8>, SDTCisVT<3, i32>,
209                                         SDTCisVT<4, v16i8>, SDTCisVT<5, i32>,
210                                         SDTCisVT<6, i8>]>;
211
212def X86pcmpistri : SDNode<"X86ISD::PCMPISTRI", SDT_PCMPISTRI>;
213def X86pcmpestri : SDNode<"X86ISD::PCMPESTRI", SDT_PCMPESTRI>;
214
215//===----------------------------------------------------------------------===//
216// SSE Complex Patterns
217//===----------------------------------------------------------------------===//
218
219// These are 'extloads' from a scalar to the low element of a vector, zeroing
220// the top elements.  These are used for the SSE 'ss' and 'sd' instruction
221// forms.
222def sse_load_f32 : ComplexPattern<v4f32, 5, "SelectScalarSSELoad", [],
223                                  [SDNPHasChain, SDNPMayLoad, SDNPMemOperand,
224                                   SDNPWantRoot]>;
225def sse_load_f64 : ComplexPattern<v2f64, 5, "SelectScalarSSELoad", [],
226                                  [SDNPHasChain, SDNPMayLoad, SDNPMemOperand,
227                                   SDNPWantRoot]>;
228
229def ssmem : Operand<v4f32> {
230  let PrintMethod = "printf32mem";
231  let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
232  let ParserMatchClass = X86MemAsmOperand;
233  let OperandType = "OPERAND_MEMORY";
234}
235def sdmem : Operand<v2f64> {
236  let PrintMethod = "printf64mem";
237  let MIOperandInfo = (ops ptr_rc, i8imm, ptr_rc_nosp, i32imm, i8imm);
238  let ParserMatchClass = X86MemAsmOperand;
239  let OperandType = "OPERAND_MEMORY";
240}
241
242//===----------------------------------------------------------------------===//
243// SSE pattern fragments
244//===----------------------------------------------------------------------===//
245
246// 128-bit load pattern fragments
247// NOTE: all 128-bit integer vector loads are promoted to v2i64
248def loadv4f32    : PatFrag<(ops node:$ptr), (v4f32 (load node:$ptr))>;
249def loadv2f64    : PatFrag<(ops node:$ptr), (v2f64 (load node:$ptr))>;
250def loadv2i64    : PatFrag<(ops node:$ptr), (v2i64 (load node:$ptr))>;
251
252// 256-bit load pattern fragments
253// NOTE: all 256-bit integer vector loads are promoted to v4i64
254def loadv8f32    : PatFrag<(ops node:$ptr), (v8f32 (load node:$ptr))>;
255def loadv4f64    : PatFrag<(ops node:$ptr), (v4f64 (load node:$ptr))>;
256def loadv4i64    : PatFrag<(ops node:$ptr), (v4i64 (load node:$ptr))>;
257
258// 128-/256-bit extload pattern fragments
259def extloadv2f32 : PatFrag<(ops node:$ptr), (v2f64 (extloadvf32 node:$ptr))>;
260def extloadv4f32 : PatFrag<(ops node:$ptr), (v4f64 (extloadvf32 node:$ptr))>;
261
262// Like 'store', but always requires 128-bit vector alignment.
263def alignedstore : PatFrag<(ops node:$val, node:$ptr),
264                           (store node:$val, node:$ptr), [{
265  return cast<StoreSDNode>(N)->getAlignment() >= 16;
266}]>;
267
268// Like 'store', but always requires 256-bit vector alignment.
269def alignedstore256 : PatFrag<(ops node:$val, node:$ptr),
270                              (store node:$val, node:$ptr), [{
271  return cast<StoreSDNode>(N)->getAlignment() >= 32;
272}]>;
273
274// Like 'load', but always requires 128-bit vector alignment.
275def alignedload : PatFrag<(ops node:$ptr), (load node:$ptr), [{
276  return cast<LoadSDNode>(N)->getAlignment() >= 16;
277}]>;
278
279// Like 'X86vzload', but always requires 128-bit vector alignment.
280def alignedX86vzload : PatFrag<(ops node:$ptr), (X86vzload node:$ptr), [{
281  return cast<MemSDNode>(N)->getAlignment() >= 16;
282}]>;
283
284// Like 'load', but always requires 256-bit vector alignment.
285def alignedload256 : PatFrag<(ops node:$ptr), (load node:$ptr), [{
286  return cast<LoadSDNode>(N)->getAlignment() >= 32;
287}]>;
288
289def alignedloadfsf32 : PatFrag<(ops node:$ptr),
290                               (f32 (alignedload node:$ptr))>;
291def alignedloadfsf64 : PatFrag<(ops node:$ptr),
292                               (f64 (alignedload node:$ptr))>;
293
294// 128-bit aligned load pattern fragments
295// NOTE: all 128-bit integer vector loads are promoted to v2i64
296def alignedloadv4f32 : PatFrag<(ops node:$ptr),
297                               (v4f32 (alignedload node:$ptr))>;
298def alignedloadv2f64 : PatFrag<(ops node:$ptr),
299                               (v2f64 (alignedload node:$ptr))>;
300def alignedloadv2i64 : PatFrag<(ops node:$ptr),
301                               (v2i64 (alignedload node:$ptr))>;
302
303// 256-bit aligned load pattern fragments
304// NOTE: all 256-bit integer vector loads are promoted to v4i64
305def alignedloadv8f32 : PatFrag<(ops node:$ptr),
306                               (v8f32 (alignedload256 node:$ptr))>;
307def alignedloadv4f64 : PatFrag<(ops node:$ptr),
308                               (v4f64 (alignedload256 node:$ptr))>;
309def alignedloadv4i64 : PatFrag<(ops node:$ptr),
310                               (v4i64 (alignedload256 node:$ptr))>;
311
312// Like 'load', but uses special alignment checks suitable for use in
313// memory operands in most SSE instructions, which are required to
314// be naturally aligned on some targets but not on others.  If the subtarget
315// allows unaligned accesses, match any load, though this may require
316// setting a feature bit in the processor (on startup, for example).
317// Opteron 10h and later implement such a feature.
318def memop : PatFrag<(ops node:$ptr), (load node:$ptr), [{
319  return    Subtarget->hasVectorUAMem()
320         || cast<LoadSDNode>(N)->getAlignment() >= 16;
321}]>;
322
323def memopfsf32 : PatFrag<(ops node:$ptr), (f32   (memop node:$ptr))>;
324def memopfsf64 : PatFrag<(ops node:$ptr), (f64   (memop node:$ptr))>;
325
326// 128-bit memop pattern fragments
327// NOTE: all 128-bit integer vector loads are promoted to v2i64
328def memopv4f32 : PatFrag<(ops node:$ptr), (v4f32 (memop node:$ptr))>;
329def memopv2f64 : PatFrag<(ops node:$ptr), (v2f64 (memop node:$ptr))>;
330def memopv2i64 : PatFrag<(ops node:$ptr), (v2i64 (memop node:$ptr))>;
331
332// 256-bit memop pattern fragments
333// NOTE: all 256-bit integer vector loads are promoted to v4i64
334def memopv8f32 : PatFrag<(ops node:$ptr), (v8f32 (memop node:$ptr))>;
335def memopv4f64 : PatFrag<(ops node:$ptr), (v4f64 (memop node:$ptr))>;
336def memopv4i64 : PatFrag<(ops node:$ptr), (v4i64 (memop node:$ptr))>;
337
338// SSSE3 uses MMX registers for some instructions. They aren't aligned on a
339// 16-byte boundary.
340// FIXME: 8 byte alignment for mmx reads is not required
341def memop64 : PatFrag<(ops node:$ptr), (load node:$ptr), [{
342  return cast<LoadSDNode>(N)->getAlignment() >= 8;
343}]>;
344
345def memopmmx  : PatFrag<(ops node:$ptr), (x86mmx  (memop64 node:$ptr))>;
346
347// MOVNT Support
348// Like 'store', but requires the non-temporal bit to be set
349def nontemporalstore : PatFrag<(ops node:$val, node:$ptr),
350                           (st node:$val, node:$ptr), [{
351  if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
352    return ST->isNonTemporal();
353  return false;
354}]>;
355
356def alignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
357                                    (st node:$val, node:$ptr), [{
358  if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
359    return ST->isNonTemporal() && !ST->isTruncatingStore() &&
360           ST->getAddressingMode() == ISD::UNINDEXED &&
361           ST->getAlignment() >= 16;
362  return false;
363}]>;
364
365def unalignednontemporalstore : PatFrag<(ops node:$val, node:$ptr),
366                                      (st node:$val, node:$ptr), [{
367  if (StoreSDNode *ST = dyn_cast<StoreSDNode>(N))
368    return ST->isNonTemporal() &&
369           ST->getAlignment() < 16;
370  return false;
371}]>;
372
373// 128-bit bitconvert pattern fragments
374def bc_v4f32 : PatFrag<(ops node:$in), (v4f32 (bitconvert node:$in))>;
375def bc_v2f64 : PatFrag<(ops node:$in), (v2f64 (bitconvert node:$in))>;
376def bc_v16i8 : PatFrag<(ops node:$in), (v16i8 (bitconvert node:$in))>;
377def bc_v8i16 : PatFrag<(ops node:$in), (v8i16 (bitconvert node:$in))>;
378def bc_v4i32 : PatFrag<(ops node:$in), (v4i32 (bitconvert node:$in))>;
379def bc_v2i64 : PatFrag<(ops node:$in), (v2i64 (bitconvert node:$in))>;
380
381// 256-bit bitconvert pattern fragments
382def bc_v32i8 : PatFrag<(ops node:$in), (v32i8 (bitconvert node:$in))>;
383def bc_v16i16 : PatFrag<(ops node:$in), (v16i16 (bitconvert node:$in))>;
384def bc_v8i32 : PatFrag<(ops node:$in), (v8i32 (bitconvert node:$in))>;
385def bc_v4i64 : PatFrag<(ops node:$in), (v4i64 (bitconvert node:$in))>;
386
387def vzmovl_v2i64 : PatFrag<(ops node:$src),
388                           (bitconvert (v2i64 (X86vzmovl
389                             (v2i64 (scalar_to_vector (loadi64 node:$src))))))>;
390def vzmovl_v4i32 : PatFrag<(ops node:$src),
391                           (bitconvert (v4i32 (X86vzmovl
392                             (v4i32 (scalar_to_vector (loadi32 node:$src))))))>;
393
394def vzload_v2i64 : PatFrag<(ops node:$src),
395                           (bitconvert (v2i64 (X86vzload node:$src)))>;
396
397
398def fp32imm0 : PatLeaf<(f32 fpimm), [{
399  return N->isExactlyValue(+0.0);
400}]>;
401
402// BYTE_imm - Transform bit immediates into byte immediates.
403def BYTE_imm  : SDNodeXForm<imm, [{
404  // Transformation function: imm >> 3
405  return getI32Imm(N->getZExtValue() >> 3);
406}]>;
407
408// EXTRACT_get_vextractf128_imm xform function: convert extract_subvector index
409// to VEXTRACTF128 imm.
410def EXTRACT_get_vextractf128_imm : SDNodeXForm<extract_subvector, [{
411  return getI8Imm(X86::getExtractVEXTRACTF128Immediate(N));
412}]>;
413
414// INSERT_get_vinsertf128_imm xform function: convert insert_subvector index to
415// VINSERTF128 imm.
416def INSERT_get_vinsertf128_imm : SDNodeXForm<insert_subvector, [{
417  return getI8Imm(X86::getInsertVINSERTF128Immediate(N));
418}]>;
419
420def vextractf128_extract : PatFrag<(ops node:$bigvec, node:$index),
421                                   (extract_subvector node:$bigvec,
422                                                      node:$index), [{
423  return X86::isVEXTRACTF128Index(N);
424}], EXTRACT_get_vextractf128_imm>;
425
426def vinsertf128_insert : PatFrag<(ops node:$bigvec, node:$smallvec,
427                                      node:$index),
428                                 (insert_subvector node:$bigvec, node:$smallvec,
429                                                   node:$index), [{
430  return X86::isVINSERTF128Index(N);
431}], INSERT_get_vinsertf128_imm>;
432
433