• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\
2|*                                                                            *|
3|* "Fast" Instruction Selector for the PPC target                             *|
4|*                                                                            *|
5|* Automatically generated file, do not edit!                                 *|
6|*                                                                            *|
7\*===----------------------------------------------------------------------===*/
8
9
10// FastEmit Immediate Predicate functions.
11static bool Predicate_imm32SExt16(int64_t Imm) {
12
13  // imm32SExt16 predicate - True if the i32 immediate fits in a 16-bit
14  // sign extended field.  Used by instructions like 'addi'.
15  return (int32_t)Imm == (short)Imm;
16
17}
18static bool Predicate_imm64SExt16(int64_t Imm) {
19
20  // imm64SExt16 predicate - True if the i64 immediate fits in a 16-bit
21  // sign extended field.  Used by instructions like 'addi'.
22  return (int64_t)Imm == (short)Imm;
23
24}
25static bool Predicate_immSExt5NonZero(int64_t Imm) {
26 return Imm && isInt<5>(Imm);
27}
28
29
30// FastEmit functions for ISD::READCYCLECOUNTER.
31
32unsigned fastEmit_ISD_READCYCLECOUNTER_MVT_i64_(MVT RetVT) {
33  if (RetVT.SimpleTy != MVT::i64)
34    return 0;
35  return fastEmitInst_(PPC::MFTB8, &PPC::G8RCRegClass);
36}
37
38unsigned fastEmit_ISD_READCYCLECOUNTER_(MVT VT, MVT RetVT) {
39  switch (VT.SimpleTy) {
40  case MVT::i64: return fastEmit_ISD_READCYCLECOUNTER_MVT_i64_(RetVT);
41  default: return 0;
42  }
43}
44
45// FastEmit functions for PPCISD::MFFS.
46
47unsigned fastEmit_PPCISD_MFFS_MVT_f64_(MVT RetVT) {
48  if (RetVT.SimpleTy != MVT::f64)
49    return 0;
50  if ((PPCSubTarget->hasFPU())) {
51    return fastEmitInst_(PPC::MFFS, &PPC::F8RCRegClass);
52  }
53  return 0;
54}
55
56unsigned fastEmit_PPCISD_MFFS_(MVT VT, MVT RetVT) {
57  switch (VT.SimpleTy) {
58  case MVT::f64: return fastEmit_PPCISD_MFFS_MVT_f64_(RetVT);
59  default: return 0;
60  }
61}
62
63// FastEmit functions for PPCISD::PPC32_GOT.
64
65unsigned fastEmit_PPCISD_PPC32_GOT_MVT_i32_(MVT RetVT) {
66  if (RetVT.SimpleTy != MVT::i32)
67    return 0;
68  return fastEmitInst_(PPC::PPC32GOT, &PPC::GPRCRegClass);
69}
70
71unsigned fastEmit_PPCISD_PPC32_GOT_(MVT VT, MVT RetVT) {
72  switch (VT.SimpleTy) {
73  case MVT::i32: return fastEmit_PPCISD_PPC32_GOT_MVT_i32_(RetVT);
74  default: return 0;
75  }
76}
77
78// Top-level FastEmit function.
79
80unsigned fastEmit_(MVT VT, MVT RetVT, unsigned Opcode) override {
81  switch (Opcode) {
82  case ISD::READCYCLECOUNTER: return fastEmit_ISD_READCYCLECOUNTER_(VT, RetVT);
83  case PPCISD::MFFS: return fastEmit_PPCISD_MFFS_(VT, RetVT);
84  case PPCISD::PPC32_GOT: return fastEmit_PPCISD_PPC32_GOT_(VT, RetVT);
85  default: return 0;
86  }
87}
88
89// FastEmit functions for ISD::BITCAST.
90
91unsigned fastEmit_ISD_BITCAST_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
92  if (RetVT.SimpleTy != MVT::f64)
93    return 0;
94  if ((PPCSubTarget->hasDirectMove()) && (PPCSubTarget->hasVSX())) {
95    return fastEmitInst_r(PPC::MTVSRD, &PPC::VSFRCRegClass, Op0, Op0IsKill);
96  }
97  return 0;
98}
99
100unsigned fastEmit_ISD_BITCAST_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
101  if (RetVT.SimpleTy != MVT::i64)
102    return 0;
103  if ((PPCSubTarget->hasDirectMove()) && (PPCSubTarget->hasVSX())) {
104    return fastEmitInst_r(PPC::MFVSRD, &PPC::G8RCRegClass, Op0, Op0IsKill);
105  }
106  return 0;
107}
108
109unsigned fastEmit_ISD_BITCAST_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
110  switch (VT.SimpleTy) {
111  case MVT::i64: return fastEmit_ISD_BITCAST_MVT_i64_r(RetVT, Op0, Op0IsKill);
112  case MVT::f64: return fastEmit_ISD_BITCAST_MVT_f64_r(RetVT, Op0, Op0IsKill);
113  default: return 0;
114  }
115}
116
117// FastEmit functions for ISD::BSWAP.
118
119unsigned fastEmit_ISD_BSWAP_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
120  if (RetVT.SimpleTy != MVT::v4i32)
121    return 0;
122  if ((PPCSubTarget->hasP9Vector())) {
123    return fastEmitInst_r(PPC::XXBRW, &PPC::VSRCRegClass, Op0, Op0IsKill);
124  }
125  return 0;
126}
127
128unsigned fastEmit_ISD_BSWAP_MVT_v2i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
129  if (RetVT.SimpleTy != MVT::v2i64)
130    return 0;
131  if ((PPCSubTarget->hasP9Vector())) {
132    return fastEmitInst_r(PPC::XXBRD, &PPC::VSRCRegClass, Op0, Op0IsKill);
133  }
134  return 0;
135}
136
137unsigned fastEmit_ISD_BSWAP_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
138  switch (VT.SimpleTy) {
139  case MVT::v4i32: return fastEmit_ISD_BSWAP_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
140  case MVT::v2i64: return fastEmit_ISD_BSWAP_MVT_v2i64_r(RetVT, Op0, Op0IsKill);
141  default: return 0;
142  }
143}
144
145// FastEmit functions for ISD::CTLZ.
146
147unsigned fastEmit_ISD_CTLZ_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
148  if (RetVT.SimpleTy != MVT::i32)
149    return 0;
150  return fastEmitInst_r(PPC::CNTLZW, &PPC::GPRCRegClass, Op0, Op0IsKill);
151}
152
153unsigned fastEmit_ISD_CTLZ_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
154  if (RetVT.SimpleTy != MVT::i64)
155    return 0;
156  return fastEmitInst_r(PPC::CNTLZD, &PPC::G8RCRegClass, Op0, Op0IsKill);
157}
158
159unsigned fastEmit_ISD_CTLZ_MVT_v16i8_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
160  if (RetVT.SimpleTy != MVT::v16i8)
161    return 0;
162  if ((PPCSubTarget->hasP8Altivec())) {
163    return fastEmitInst_r(PPC::VCLZB, &PPC::VRRCRegClass, Op0, Op0IsKill);
164  }
165  return 0;
166}
167
168unsigned fastEmit_ISD_CTLZ_MVT_v8i16_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
169  if (RetVT.SimpleTy != MVT::v8i16)
170    return 0;
171  if ((PPCSubTarget->hasP8Altivec())) {
172    return fastEmitInst_r(PPC::VCLZH, &PPC::VRRCRegClass, Op0, Op0IsKill);
173  }
174  return 0;
175}
176
177unsigned fastEmit_ISD_CTLZ_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
178  if (RetVT.SimpleTy != MVT::v4i32)
179    return 0;
180  if ((PPCSubTarget->hasP8Altivec())) {
181    return fastEmitInst_r(PPC::VCLZW, &PPC::VRRCRegClass, Op0, Op0IsKill);
182  }
183  return 0;
184}
185
186unsigned fastEmit_ISD_CTLZ_MVT_v2i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
187  if (RetVT.SimpleTy != MVT::v2i64)
188    return 0;
189  if ((PPCSubTarget->hasP8Altivec())) {
190    return fastEmitInst_r(PPC::VCLZD, &PPC::VRRCRegClass, Op0, Op0IsKill);
191  }
192  return 0;
193}
194
195unsigned fastEmit_ISD_CTLZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
196  switch (VT.SimpleTy) {
197  case MVT::i32: return fastEmit_ISD_CTLZ_MVT_i32_r(RetVT, Op0, Op0IsKill);
198  case MVT::i64: return fastEmit_ISD_CTLZ_MVT_i64_r(RetVT, Op0, Op0IsKill);
199  case MVT::v16i8: return fastEmit_ISD_CTLZ_MVT_v16i8_r(RetVT, Op0, Op0IsKill);
200  case MVT::v8i16: return fastEmit_ISD_CTLZ_MVT_v8i16_r(RetVT, Op0, Op0IsKill);
201  case MVT::v4i32: return fastEmit_ISD_CTLZ_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
202  case MVT::v2i64: return fastEmit_ISD_CTLZ_MVT_v2i64_r(RetVT, Op0, Op0IsKill);
203  default: return 0;
204  }
205}
206
207// FastEmit functions for ISD::CTPOP.
208
209unsigned fastEmit_ISD_CTPOP_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
210  if (RetVT.SimpleTy != MVT::i32)
211    return 0;
212  return fastEmitInst_r(PPC::POPCNTW, &PPC::GPRCRegClass, Op0, Op0IsKill);
213}
214
215unsigned fastEmit_ISD_CTPOP_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
216  if (RetVT.SimpleTy != MVT::i64)
217    return 0;
218  return fastEmitInst_r(PPC::POPCNTD, &PPC::G8RCRegClass, Op0, Op0IsKill);
219}
220
221unsigned fastEmit_ISD_CTPOP_MVT_v16i8_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
222  if (RetVT.SimpleTy != MVT::v16i8)
223    return 0;
224  if ((PPCSubTarget->hasP8Altivec())) {
225    return fastEmitInst_r(PPC::VPOPCNTB, &PPC::VRRCRegClass, Op0, Op0IsKill);
226  }
227  return 0;
228}
229
230unsigned fastEmit_ISD_CTPOP_MVT_v8i16_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
231  if (RetVT.SimpleTy != MVT::v8i16)
232    return 0;
233  if ((PPCSubTarget->hasP8Altivec())) {
234    return fastEmitInst_r(PPC::VPOPCNTH, &PPC::VRRCRegClass, Op0, Op0IsKill);
235  }
236  return 0;
237}
238
239unsigned fastEmit_ISD_CTPOP_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
240  if (RetVT.SimpleTy != MVT::v4i32)
241    return 0;
242  if ((PPCSubTarget->hasP8Altivec())) {
243    return fastEmitInst_r(PPC::VPOPCNTW, &PPC::VRRCRegClass, Op0, Op0IsKill);
244  }
245  return 0;
246}
247
248unsigned fastEmit_ISD_CTPOP_MVT_v2i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
249  if (RetVT.SimpleTy != MVT::v2i64)
250    return 0;
251  if ((PPCSubTarget->hasP8Altivec())) {
252    return fastEmitInst_r(PPC::VPOPCNTD, &PPC::VRRCRegClass, Op0, Op0IsKill);
253  }
254  return 0;
255}
256
257unsigned fastEmit_ISD_CTPOP_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
258  switch (VT.SimpleTy) {
259  case MVT::i32: return fastEmit_ISD_CTPOP_MVT_i32_r(RetVT, Op0, Op0IsKill);
260  case MVT::i64: return fastEmit_ISD_CTPOP_MVT_i64_r(RetVT, Op0, Op0IsKill);
261  case MVT::v16i8: return fastEmit_ISD_CTPOP_MVT_v16i8_r(RetVT, Op0, Op0IsKill);
262  case MVT::v8i16: return fastEmit_ISD_CTPOP_MVT_v8i16_r(RetVT, Op0, Op0IsKill);
263  case MVT::v4i32: return fastEmit_ISD_CTPOP_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
264  case MVT::v2i64: return fastEmit_ISD_CTPOP_MVT_v2i64_r(RetVT, Op0, Op0IsKill);
265  default: return 0;
266  }
267}
268
269// FastEmit functions for ISD::CTTZ.
270
271unsigned fastEmit_ISD_CTTZ_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
272  if (RetVT.SimpleTy != MVT::i32)
273    return 0;
274  if ((PPCSubTarget->isISA3_0())) {
275    return fastEmitInst_r(PPC::CNTTZW, &PPC::GPRCRegClass, Op0, Op0IsKill);
276  }
277  return 0;
278}
279
280unsigned fastEmit_ISD_CTTZ_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
281  if (RetVT.SimpleTy != MVT::i64)
282    return 0;
283  if ((PPCSubTarget->isISA3_0())) {
284    return fastEmitInst_r(PPC::CNTTZD, &PPC::G8RCRegClass, Op0, Op0IsKill);
285  }
286  return 0;
287}
288
289unsigned fastEmit_ISD_CTTZ_MVT_v16i8_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
290  if (RetVT.SimpleTy != MVT::v16i8)
291    return 0;
292  if ((PPCSubTarget->hasP9Altivec())) {
293    return fastEmitInst_r(PPC::VCTZB, &PPC::VRRCRegClass, Op0, Op0IsKill);
294  }
295  return 0;
296}
297
298unsigned fastEmit_ISD_CTTZ_MVT_v8i16_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
299  if (RetVT.SimpleTy != MVT::v8i16)
300    return 0;
301  if ((PPCSubTarget->hasP9Altivec())) {
302    return fastEmitInst_r(PPC::VCTZH, &PPC::VRRCRegClass, Op0, Op0IsKill);
303  }
304  return 0;
305}
306
307unsigned fastEmit_ISD_CTTZ_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
308  if (RetVT.SimpleTy != MVT::v4i32)
309    return 0;
310  if ((PPCSubTarget->hasP9Altivec())) {
311    return fastEmitInst_r(PPC::VCTZW, &PPC::VRRCRegClass, Op0, Op0IsKill);
312  }
313  return 0;
314}
315
316unsigned fastEmit_ISD_CTTZ_MVT_v2i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
317  if (RetVT.SimpleTy != MVT::v2i64)
318    return 0;
319  if ((PPCSubTarget->hasP9Altivec())) {
320    return fastEmitInst_r(PPC::VCTZD, &PPC::VRRCRegClass, Op0, Op0IsKill);
321  }
322  return 0;
323}
324
325unsigned fastEmit_ISD_CTTZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
326  switch (VT.SimpleTy) {
327  case MVT::i32: return fastEmit_ISD_CTTZ_MVT_i32_r(RetVT, Op0, Op0IsKill);
328  case MVT::i64: return fastEmit_ISD_CTTZ_MVT_i64_r(RetVT, Op0, Op0IsKill);
329  case MVT::v16i8: return fastEmit_ISD_CTTZ_MVT_v16i8_r(RetVT, Op0, Op0IsKill);
330  case MVT::v8i16: return fastEmit_ISD_CTTZ_MVT_v8i16_r(RetVT, Op0, Op0IsKill);
331  case MVT::v4i32: return fastEmit_ISD_CTTZ_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
332  case MVT::v2i64: return fastEmit_ISD_CTTZ_MVT_v2i64_r(RetVT, Op0, Op0IsKill);
333  default: return 0;
334  }
335}
336
337// FastEmit functions for ISD::FABS.
338
339unsigned fastEmit_ISD_FABS_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
340  if (RetVT.SimpleTy != MVT::f32)
341    return 0;
342  if ((PPCSubTarget->hasSPE())) {
343    return fastEmitInst_r(PPC::EFSABS, &PPC::GPRCRegClass, Op0, Op0IsKill);
344  }
345  if ((PPCSubTarget->hasFPU())) {
346    return fastEmitInst_r(PPC::FABSS, &PPC::F4RCRegClass, Op0, Op0IsKill);
347  }
348  return 0;
349}
350
351unsigned fastEmit_ISD_FABS_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
352  if (RetVT.SimpleTy != MVT::f64)
353    return 0;
354  if ((PPCSubTarget->hasVSX())) {
355    return fastEmitInst_r(PPC::XSABSDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
356  }
357  if ((PPCSubTarget->hasSPE())) {
358    return fastEmitInst_r(PPC::EFDABS, &PPC::SPERCRegClass, Op0, Op0IsKill);
359  }
360  if ((PPCSubTarget->hasFPU())) {
361    return fastEmitInst_r(PPC::FABSD, &PPC::F8RCRegClass, Op0, Op0IsKill);
362  }
363  return 0;
364}
365
366unsigned fastEmit_ISD_FABS_MVT_f128_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
367  if (RetVT.SimpleTy != MVT::f128)
368    return 0;
369  if ((PPCSubTarget->hasP9Vector())) {
370    return fastEmitInst_r(PPC::XSABSQP, &PPC::VRRCRegClass, Op0, Op0IsKill);
371  }
372  return 0;
373}
374
375unsigned fastEmit_ISD_FABS_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
376  if (RetVT.SimpleTy != MVT::v4f32)
377    return 0;
378  if ((PPCSubTarget->hasVSX())) {
379    return fastEmitInst_r(PPC::XVABSSP, &PPC::VSRCRegClass, Op0, Op0IsKill);
380  }
381  if ((PPCSubTarget->hasQPX())) {
382    return fastEmitInst_r(PPC::QVFABSs, &PPC::QSRCRegClass, Op0, Op0IsKill);
383  }
384  return 0;
385}
386
387unsigned fastEmit_ISD_FABS_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
388  if (RetVT.SimpleTy != MVT::v2f64)
389    return 0;
390  if ((PPCSubTarget->hasVSX())) {
391    return fastEmitInst_r(PPC::XVABSDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
392  }
393  return 0;
394}
395
396unsigned fastEmit_ISD_FABS_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
397  if (RetVT.SimpleTy != MVT::v4f64)
398    return 0;
399  if ((PPCSubTarget->hasQPX())) {
400    return fastEmitInst_r(PPC::QVFABS, &PPC::QFRCRegClass, Op0, Op0IsKill);
401  }
402  return 0;
403}
404
405unsigned fastEmit_ISD_FABS_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
406  switch (VT.SimpleTy) {
407  case MVT::f32: return fastEmit_ISD_FABS_MVT_f32_r(RetVT, Op0, Op0IsKill);
408  case MVT::f64: return fastEmit_ISD_FABS_MVT_f64_r(RetVT, Op0, Op0IsKill);
409  case MVT::f128: return fastEmit_ISD_FABS_MVT_f128_r(RetVT, Op0, Op0IsKill);
410  case MVT::v4f32: return fastEmit_ISD_FABS_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
411  case MVT::v2f64: return fastEmit_ISD_FABS_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
412  case MVT::v4f64: return fastEmit_ISD_FABS_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
413  default: return 0;
414  }
415}
416
417// FastEmit functions for ISD::FCEIL.
418
419unsigned fastEmit_ISD_FCEIL_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
420  if (RetVT.SimpleTy != MVT::f32)
421    return 0;
422  if ((PPCSubTarget->hasFPU())) {
423    return fastEmitInst_r(PPC::FRIPS, &PPC::F4RCRegClass, Op0, Op0IsKill);
424  }
425  return 0;
426}
427
428unsigned fastEmit_ISD_FCEIL_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
429  if (RetVT.SimpleTy != MVT::f64)
430    return 0;
431  if ((PPCSubTarget->hasVSX())) {
432    return fastEmitInst_r(PPC::XSRDPIP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
433  }
434  if ((PPCSubTarget->hasFPU())) {
435    return fastEmitInst_r(PPC::FRIPD, &PPC::F8RCRegClass, Op0, Op0IsKill);
436  }
437  return 0;
438}
439
440unsigned fastEmit_ISD_FCEIL_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
441  if (RetVT.SimpleTy != MVT::v4f32)
442    return 0;
443  if ((PPCSubTarget->hasVSX())) {
444    return fastEmitInst_r(PPC::XVRSPIP, &PPC::VSRCRegClass, Op0, Op0IsKill);
445  }
446  if ((PPCSubTarget->hasAltivec())) {
447    return fastEmitInst_r(PPC::VRFIP, &PPC::VRRCRegClass, Op0, Op0IsKill);
448  }
449  if ((PPCSubTarget->hasQPX())) {
450    return fastEmitInst_r(PPC::QVFRIPs, &PPC::QSRCRegClass, Op0, Op0IsKill);
451  }
452  return 0;
453}
454
455unsigned fastEmit_ISD_FCEIL_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
456  if (RetVT.SimpleTy != MVT::v2f64)
457    return 0;
458  if ((PPCSubTarget->hasVSX())) {
459    return fastEmitInst_r(PPC::XVRDPIP, &PPC::VSRCRegClass, Op0, Op0IsKill);
460  }
461  return 0;
462}
463
464unsigned fastEmit_ISD_FCEIL_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
465  if (RetVT.SimpleTy != MVT::v4f64)
466    return 0;
467  if ((PPCSubTarget->hasQPX())) {
468    return fastEmitInst_r(PPC::QVFRIP, &PPC::QFRCRegClass, Op0, Op0IsKill);
469  }
470  return 0;
471}
472
473unsigned fastEmit_ISD_FCEIL_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
474  switch (VT.SimpleTy) {
475  case MVT::f32: return fastEmit_ISD_FCEIL_MVT_f32_r(RetVT, Op0, Op0IsKill);
476  case MVT::f64: return fastEmit_ISD_FCEIL_MVT_f64_r(RetVT, Op0, Op0IsKill);
477  case MVT::v4f32: return fastEmit_ISD_FCEIL_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
478  case MVT::v2f64: return fastEmit_ISD_FCEIL_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
479  case MVT::v4f64: return fastEmit_ISD_FCEIL_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
480  default: return 0;
481  }
482}
483
484// FastEmit functions for ISD::FFLOOR.
485
486unsigned fastEmit_ISD_FFLOOR_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
487  if (RetVT.SimpleTy != MVT::f32)
488    return 0;
489  if ((PPCSubTarget->hasFPU())) {
490    return fastEmitInst_r(PPC::FRIMS, &PPC::F4RCRegClass, Op0, Op0IsKill);
491  }
492  return 0;
493}
494
495unsigned fastEmit_ISD_FFLOOR_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
496  if (RetVT.SimpleTy != MVT::f64)
497    return 0;
498  if ((PPCSubTarget->hasVSX())) {
499    return fastEmitInst_r(PPC::XSRDPIM, &PPC::VSFRCRegClass, Op0, Op0IsKill);
500  }
501  if ((PPCSubTarget->hasFPU())) {
502    return fastEmitInst_r(PPC::FRIMD, &PPC::F8RCRegClass, Op0, Op0IsKill);
503  }
504  return 0;
505}
506
507unsigned fastEmit_ISD_FFLOOR_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
508  if (RetVT.SimpleTy != MVT::v4f32)
509    return 0;
510  if ((PPCSubTarget->hasVSX())) {
511    return fastEmitInst_r(PPC::XVRSPIM, &PPC::VSRCRegClass, Op0, Op0IsKill);
512  }
513  if ((PPCSubTarget->hasAltivec())) {
514    return fastEmitInst_r(PPC::VRFIM, &PPC::VRRCRegClass, Op0, Op0IsKill);
515  }
516  if ((PPCSubTarget->hasQPX())) {
517    return fastEmitInst_r(PPC::QVFRIMs, &PPC::QSRCRegClass, Op0, Op0IsKill);
518  }
519  return 0;
520}
521
522unsigned fastEmit_ISD_FFLOOR_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
523  if (RetVT.SimpleTy != MVT::v2f64)
524    return 0;
525  if ((PPCSubTarget->hasVSX())) {
526    return fastEmitInst_r(PPC::XVRDPIM, &PPC::VSRCRegClass, Op0, Op0IsKill);
527  }
528  return 0;
529}
530
531unsigned fastEmit_ISD_FFLOOR_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
532  if (RetVT.SimpleTy != MVT::v4f64)
533    return 0;
534  if ((PPCSubTarget->hasQPX())) {
535    return fastEmitInst_r(PPC::QVFRIM, &PPC::QFRCRegClass, Op0, Op0IsKill);
536  }
537  return 0;
538}
539
540unsigned fastEmit_ISD_FFLOOR_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
541  switch (VT.SimpleTy) {
542  case MVT::f32: return fastEmit_ISD_FFLOOR_MVT_f32_r(RetVT, Op0, Op0IsKill);
543  case MVT::f64: return fastEmit_ISD_FFLOOR_MVT_f64_r(RetVT, Op0, Op0IsKill);
544  case MVT::v4f32: return fastEmit_ISD_FFLOOR_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
545  case MVT::v2f64: return fastEmit_ISD_FFLOOR_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
546  case MVT::v4f64: return fastEmit_ISD_FFLOOR_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
547  default: return 0;
548  }
549}
550
551// FastEmit functions for ISD::FNEARBYINT.
552
553unsigned fastEmit_ISD_FNEARBYINT_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
554  if (RetVT.SimpleTy != MVT::f64)
555    return 0;
556  if ((PPCSubTarget->hasVSX())) {
557    return fastEmitInst_r(PPC::XSRDPIC, &PPC::VSFRCRegClass, Op0, Op0IsKill);
558  }
559  return 0;
560}
561
562unsigned fastEmit_ISD_FNEARBYINT_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
563  if (RetVT.SimpleTy != MVT::v4f32)
564    return 0;
565  if ((PPCSubTarget->hasVSX())) {
566    return fastEmitInst_r(PPC::XVRSPIC, &PPC::VSRCRegClass, Op0, Op0IsKill);
567  }
568  if ((PPCSubTarget->hasAltivec())) {
569    return fastEmitInst_r(PPC::VRFIN, &PPC::VRRCRegClass, Op0, Op0IsKill);
570  }
571  return 0;
572}
573
574unsigned fastEmit_ISD_FNEARBYINT_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
575  if (RetVT.SimpleTy != MVT::v2f64)
576    return 0;
577  if ((PPCSubTarget->hasVSX())) {
578    return fastEmitInst_r(PPC::XVRDPIC, &PPC::VSRCRegClass, Op0, Op0IsKill);
579  }
580  return 0;
581}
582
583unsigned fastEmit_ISD_FNEARBYINT_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
584  switch (VT.SimpleTy) {
585  case MVT::f64: return fastEmit_ISD_FNEARBYINT_MVT_f64_r(RetVT, Op0, Op0IsKill);
586  case MVT::v4f32: return fastEmit_ISD_FNEARBYINT_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
587  case MVT::v2f64: return fastEmit_ISD_FNEARBYINT_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
588  default: return 0;
589  }
590}
591
592// FastEmit functions for ISD::FNEG.
593
594unsigned fastEmit_ISD_FNEG_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
595  if (RetVT.SimpleTy != MVT::f32)
596    return 0;
597  if ((PPCSubTarget->hasSPE())) {
598    return fastEmitInst_r(PPC::EFSNEG, &PPC::GPRCRegClass, Op0, Op0IsKill);
599  }
600  if ((PPCSubTarget->hasFPU())) {
601    return fastEmitInst_r(PPC::FNEGS, &PPC::F4RCRegClass, Op0, Op0IsKill);
602  }
603  return 0;
604}
605
606unsigned fastEmit_ISD_FNEG_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
607  if (RetVT.SimpleTy != MVT::f64)
608    return 0;
609  if ((PPCSubTarget->hasVSX())) {
610    return fastEmitInst_r(PPC::XSNEGDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
611  }
612  if ((PPCSubTarget->hasSPE())) {
613    return fastEmitInst_r(PPC::EFDNEG, &PPC::SPERCRegClass, Op0, Op0IsKill);
614  }
615  if ((PPCSubTarget->hasFPU())) {
616    return fastEmitInst_r(PPC::FNEGD, &PPC::F8RCRegClass, Op0, Op0IsKill);
617  }
618  return 0;
619}
620
621unsigned fastEmit_ISD_FNEG_MVT_f128_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
622  if (RetVT.SimpleTy != MVT::f128)
623    return 0;
624  if ((PPCSubTarget->hasP9Vector())) {
625    return fastEmitInst_r(PPC::XSNEGQP, &PPC::VRRCRegClass, Op0, Op0IsKill);
626  }
627  return 0;
628}
629
630unsigned fastEmit_ISD_FNEG_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
631  if (RetVT.SimpleTy != MVT::v4f32)
632    return 0;
633  if ((PPCSubTarget->hasVSX())) {
634    return fastEmitInst_r(PPC::XVNEGSP, &PPC::VSRCRegClass, Op0, Op0IsKill);
635  }
636  if ((PPCSubTarget->hasQPX())) {
637    return fastEmitInst_r(PPC::QVFNEGs, &PPC::QSRCRegClass, Op0, Op0IsKill);
638  }
639  return 0;
640}
641
642unsigned fastEmit_ISD_FNEG_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
643  if (RetVT.SimpleTy != MVT::v2f64)
644    return 0;
645  if ((PPCSubTarget->hasVSX())) {
646    return fastEmitInst_r(PPC::XVNEGDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
647  }
648  return 0;
649}
650
651unsigned fastEmit_ISD_FNEG_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
652  if (RetVT.SimpleTy != MVT::v4f64)
653    return 0;
654  if ((PPCSubTarget->hasQPX())) {
655    return fastEmitInst_r(PPC::QVFNEG, &PPC::QFRCRegClass, Op0, Op0IsKill);
656  }
657  return 0;
658}
659
660unsigned fastEmit_ISD_FNEG_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
661  switch (VT.SimpleTy) {
662  case MVT::f32: return fastEmit_ISD_FNEG_MVT_f32_r(RetVT, Op0, Op0IsKill);
663  case MVT::f64: return fastEmit_ISD_FNEG_MVT_f64_r(RetVT, Op0, Op0IsKill);
664  case MVT::f128: return fastEmit_ISD_FNEG_MVT_f128_r(RetVT, Op0, Op0IsKill);
665  case MVT::v4f32: return fastEmit_ISD_FNEG_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
666  case MVT::v2f64: return fastEmit_ISD_FNEG_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
667  case MVT::v4f64: return fastEmit_ISD_FNEG_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
668  default: return 0;
669  }
670}
671
672// FastEmit functions for ISD::FP_EXTEND.
673
674unsigned fastEmit_ISD_FP_EXTEND_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
675  if (RetVT.SimpleTy != MVT::f64)
676    return 0;
677  if ((PPCSubTarget->hasSPE())) {
678    return fastEmitInst_r(PPC::EFDCFS, &PPC::SPERCRegClass, Op0, Op0IsKill);
679  }
680  return 0;
681}
682
683unsigned fastEmit_ISD_FP_EXTEND_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
684  if (RetVT.SimpleTy != MVT::f128)
685    return 0;
686  if ((PPCSubTarget->hasP9Vector())) {
687    return fastEmitInst_r(PPC::XSCVDPQP, &PPC::VRRCRegClass, Op0, Op0IsKill);
688  }
689  return 0;
690}
691
692unsigned fastEmit_ISD_FP_EXTEND_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
693  switch (VT.SimpleTy) {
694  case MVT::f32: return fastEmit_ISD_FP_EXTEND_MVT_f32_r(RetVT, Op0, Op0IsKill);
695  case MVT::f64: return fastEmit_ISD_FP_EXTEND_MVT_f64_r(RetVT, Op0, Op0IsKill);
696  default: return 0;
697  }
698}
699
700// FastEmit functions for ISD::FP_ROUND.
701
702unsigned fastEmit_ISD_FP_ROUND_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
703  if (RetVT.SimpleTy != MVT::f32)
704    return 0;
705  if ((PPCSubTarget->hasSPE())) {
706    return fastEmitInst_r(PPC::EFSCFD, &PPC::GPRCRegClass, Op0, Op0IsKill);
707  }
708  if ((PPCSubTarget->hasFPU())) {
709    return fastEmitInst_r(PPC::FRSP, &PPC::F4RCRegClass, Op0, Op0IsKill);
710  }
711  return 0;
712}
713
714unsigned fastEmit_ISD_FP_ROUND_MVT_f128_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
715  if (RetVT.SimpleTy != MVT::f64)
716    return 0;
717  if ((PPCSubTarget->hasP9Vector())) {
718    return fastEmitInst_r(PPC::XSCVQPDP, &PPC::VFRCRegClass, Op0, Op0IsKill);
719  }
720  return 0;
721}
722
723unsigned fastEmit_ISD_FP_ROUND_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
724  switch (VT.SimpleTy) {
725  case MVT::f64: return fastEmit_ISD_FP_ROUND_MVT_f64_r(RetVT, Op0, Op0IsKill);
726  case MVT::f128: return fastEmit_ISD_FP_ROUND_MVT_f128_r(RetVT, Op0, Op0IsKill);
727  default: return 0;
728  }
729}
730
731// FastEmit functions for ISD::FP_TO_SINT.
732
733unsigned fastEmit_ISD_FP_TO_SINT_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
734  if (RetVT.SimpleTy != MVT::i32)
735    return 0;
736  if ((PPCSubTarget->hasSPE())) {
737    return fastEmitInst_r(PPC::EFSCTSIZ, &PPC::GPRCRegClass, Op0, Op0IsKill);
738  }
739  return 0;
740}
741
742unsigned fastEmit_ISD_FP_TO_SINT_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
743  if (RetVT.SimpleTy != MVT::i32)
744    return 0;
745  if ((PPCSubTarget->hasSPE())) {
746    return fastEmitInst_r(PPC::EFDCTSIZ, &PPC::GPRCRegClass, Op0, Op0IsKill);
747  }
748  return 0;
749}
750
751unsigned fastEmit_ISD_FP_TO_SINT_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
752  if (RetVT.SimpleTy != MVT::v4i32)
753    return 0;
754  if ((PPCSubTarget->hasVSX())) {
755    return fastEmitInst_r(PPC::XVCVSPSXWS, &PPC::VSRCRegClass, Op0, Op0IsKill);
756  }
757  if ((PPCSubTarget->hasAltivec())) {
758    return fastEmitInst_r(PPC::VCTSXS_0, &PPC::VRRCRegClass, Op0, Op0IsKill);
759  }
760  return 0;
761}
762
763unsigned fastEmit_ISD_FP_TO_SINT_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
764  if (RetVT.SimpleTy != MVT::v2i64)
765    return 0;
766  if ((PPCSubTarget->hasVSX())) {
767    return fastEmitInst_r(PPC::XVCVDPSXDS, &PPC::VSRCRegClass, Op0, Op0IsKill);
768  }
769  return 0;
770}
771
772unsigned fastEmit_ISD_FP_TO_SINT_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
773  switch (VT.SimpleTy) {
774  case MVT::f32: return fastEmit_ISD_FP_TO_SINT_MVT_f32_r(RetVT, Op0, Op0IsKill);
775  case MVT::f64: return fastEmit_ISD_FP_TO_SINT_MVT_f64_r(RetVT, Op0, Op0IsKill);
776  case MVT::v4f32: return fastEmit_ISD_FP_TO_SINT_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
777  case MVT::v2f64: return fastEmit_ISD_FP_TO_SINT_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
778  default: return 0;
779  }
780}
781
782// FastEmit functions for ISD::FP_TO_UINT.
783
784unsigned fastEmit_ISD_FP_TO_UINT_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
785  if (RetVT.SimpleTy != MVT::i32)
786    return 0;
787  if ((PPCSubTarget->hasSPE())) {
788    return fastEmitInst_r(PPC::EFSCTUIZ, &PPC::GPRCRegClass, Op0, Op0IsKill);
789  }
790  return 0;
791}
792
793unsigned fastEmit_ISD_FP_TO_UINT_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
794  if (RetVT.SimpleTy != MVT::i32)
795    return 0;
796  if ((PPCSubTarget->hasSPE())) {
797    return fastEmitInst_r(PPC::EFDCTUIZ, &PPC::GPRCRegClass, Op0, Op0IsKill);
798  }
799  return 0;
800}
801
802unsigned fastEmit_ISD_FP_TO_UINT_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
803  if (RetVT.SimpleTy != MVT::v4i32)
804    return 0;
805  if ((PPCSubTarget->hasVSX())) {
806    return fastEmitInst_r(PPC::XVCVSPUXWS, &PPC::VSRCRegClass, Op0, Op0IsKill);
807  }
808  if ((PPCSubTarget->hasAltivec())) {
809    return fastEmitInst_r(PPC::VCTUXS_0, &PPC::VRRCRegClass, Op0, Op0IsKill);
810  }
811  return 0;
812}
813
814unsigned fastEmit_ISD_FP_TO_UINT_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
815  if (RetVT.SimpleTy != MVT::v2i64)
816    return 0;
817  if ((PPCSubTarget->hasVSX())) {
818    return fastEmitInst_r(PPC::XVCVDPUXDS, &PPC::VSRCRegClass, Op0, Op0IsKill);
819  }
820  return 0;
821}
822
823unsigned fastEmit_ISD_FP_TO_UINT_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
824  switch (VT.SimpleTy) {
825  case MVT::f32: return fastEmit_ISD_FP_TO_UINT_MVT_f32_r(RetVT, Op0, Op0IsKill);
826  case MVT::f64: return fastEmit_ISD_FP_TO_UINT_MVT_f64_r(RetVT, Op0, Op0IsKill);
827  case MVT::v4f32: return fastEmit_ISD_FP_TO_UINT_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
828  case MVT::v2f64: return fastEmit_ISD_FP_TO_UINT_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
829  default: return 0;
830  }
831}
832
833// FastEmit functions for ISD::FROUND.
834
835unsigned fastEmit_ISD_FROUND_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
836  if (RetVT.SimpleTy != MVT::f32)
837    return 0;
838  if ((PPCSubTarget->hasFPU())) {
839    return fastEmitInst_r(PPC::FRINS, &PPC::F4RCRegClass, Op0, Op0IsKill);
840  }
841  return 0;
842}
843
844unsigned fastEmit_ISD_FROUND_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
845  if (RetVT.SimpleTy != MVT::f64)
846    return 0;
847  if ((PPCSubTarget->hasVSX())) {
848    return fastEmitInst_r(PPC::XSRDPI, &PPC::VSFRCRegClass, Op0, Op0IsKill);
849  }
850  if ((PPCSubTarget->hasFPU())) {
851    return fastEmitInst_r(PPC::FRIND, &PPC::F8RCRegClass, Op0, Op0IsKill);
852  }
853  return 0;
854}
855
856unsigned fastEmit_ISD_FROUND_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
857  if (RetVT.SimpleTy != MVT::v4f32)
858    return 0;
859  if ((PPCSubTarget->hasVSX())) {
860    return fastEmitInst_r(PPC::XVRSPI, &PPC::VSRCRegClass, Op0, Op0IsKill);
861  }
862  if ((PPCSubTarget->hasQPX())) {
863    return fastEmitInst_r(PPC::QVFRINs, &PPC::QSRCRegClass, Op0, Op0IsKill);
864  }
865  return 0;
866}
867
868unsigned fastEmit_ISD_FROUND_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
869  if (RetVT.SimpleTy != MVT::v2f64)
870    return 0;
871  if ((PPCSubTarget->hasVSX())) {
872    return fastEmitInst_r(PPC::XVRDPI, &PPC::VSRCRegClass, Op0, Op0IsKill);
873  }
874  return 0;
875}
876
877unsigned fastEmit_ISD_FROUND_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
878  if (RetVT.SimpleTy != MVT::v4f64)
879    return 0;
880  if ((PPCSubTarget->hasQPX())) {
881    return fastEmitInst_r(PPC::QVFRIN, &PPC::QFRCRegClass, Op0, Op0IsKill);
882  }
883  return 0;
884}
885
886unsigned fastEmit_ISD_FROUND_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
887  switch (VT.SimpleTy) {
888  case MVT::f32: return fastEmit_ISD_FROUND_MVT_f32_r(RetVT, Op0, Op0IsKill);
889  case MVT::f64: return fastEmit_ISD_FROUND_MVT_f64_r(RetVT, Op0, Op0IsKill);
890  case MVT::v4f32: return fastEmit_ISD_FROUND_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
891  case MVT::v2f64: return fastEmit_ISD_FROUND_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
892  case MVT::v4f64: return fastEmit_ISD_FROUND_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
893  default: return 0;
894  }
895}
896
897// FastEmit functions for ISD::FSQRT.
898
899unsigned fastEmit_ISD_FSQRT_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
900  if (RetVT.SimpleTy != MVT::f32)
901    return 0;
902  if ((PPCSubTarget->hasP8Vector())) {
903    return fastEmitInst_r(PPC::XSSQRTSP, &PPC::VSSRCRegClass, Op0, Op0IsKill);
904  }
905  if ((PPCSubTarget->hasFPU())) {
906    return fastEmitInst_r(PPC::FSQRTS, &PPC::F4RCRegClass, Op0, Op0IsKill);
907  }
908  return 0;
909}
910
911unsigned fastEmit_ISD_FSQRT_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
912  if (RetVT.SimpleTy != MVT::f64)
913    return 0;
914  if ((PPCSubTarget->hasVSX())) {
915    return fastEmitInst_r(PPC::XSSQRTDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
916  }
917  if ((PPCSubTarget->hasFPU())) {
918    return fastEmitInst_r(PPC::FSQRT, &PPC::F8RCRegClass, Op0, Op0IsKill);
919  }
920  return 0;
921}
922
923unsigned fastEmit_ISD_FSQRT_MVT_f128_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
924  if (RetVT.SimpleTy != MVT::f128)
925    return 0;
926  if ((PPCSubTarget->hasP9Vector())) {
927    return fastEmitInst_r(PPC::XSSQRTQP, &PPC::VRRCRegClass, Op0, Op0IsKill);
928  }
929  return 0;
930}
931
932unsigned fastEmit_ISD_FSQRT_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
933  if (RetVT.SimpleTy != MVT::v4f32)
934    return 0;
935  if ((PPCSubTarget->hasVSX())) {
936    return fastEmitInst_r(PPC::XVSQRTSP, &PPC::VSRCRegClass, Op0, Op0IsKill);
937  }
938  return 0;
939}
940
941unsigned fastEmit_ISD_FSQRT_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
942  if (RetVT.SimpleTy != MVT::v2f64)
943    return 0;
944  if ((PPCSubTarget->hasVSX())) {
945    return fastEmitInst_r(PPC::XVSQRTDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
946  }
947  return 0;
948}
949
950unsigned fastEmit_ISD_FSQRT_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
951  switch (VT.SimpleTy) {
952  case MVT::f32: return fastEmit_ISD_FSQRT_MVT_f32_r(RetVT, Op0, Op0IsKill);
953  case MVT::f64: return fastEmit_ISD_FSQRT_MVT_f64_r(RetVT, Op0, Op0IsKill);
954  case MVT::f128: return fastEmit_ISD_FSQRT_MVT_f128_r(RetVT, Op0, Op0IsKill);
955  case MVT::v4f32: return fastEmit_ISD_FSQRT_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
956  case MVT::v2f64: return fastEmit_ISD_FSQRT_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
957  default: return 0;
958  }
959}
960
961// FastEmit functions for ISD::FTRUNC.
962
963unsigned fastEmit_ISD_FTRUNC_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
964  if (RetVT.SimpleTy != MVT::f32)
965    return 0;
966  if ((PPCSubTarget->hasFPU())) {
967    return fastEmitInst_r(PPC::FRIZS, &PPC::F4RCRegClass, Op0, Op0IsKill);
968  }
969  return 0;
970}
971
972unsigned fastEmit_ISD_FTRUNC_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
973  if (RetVT.SimpleTy != MVT::f64)
974    return 0;
975  if ((PPCSubTarget->hasVSX())) {
976    return fastEmitInst_r(PPC::XSRDPIZ, &PPC::VSFRCRegClass, Op0, Op0IsKill);
977  }
978  if ((PPCSubTarget->hasFPU())) {
979    return fastEmitInst_r(PPC::FRIZD, &PPC::F8RCRegClass, Op0, Op0IsKill);
980  }
981  return 0;
982}
983
984unsigned fastEmit_ISD_FTRUNC_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
985  if (RetVT.SimpleTy != MVT::v4f32)
986    return 0;
987  if ((PPCSubTarget->hasVSX())) {
988    return fastEmitInst_r(PPC::XVRSPIZ, &PPC::VSRCRegClass, Op0, Op0IsKill);
989  }
990  if ((PPCSubTarget->hasAltivec())) {
991    return fastEmitInst_r(PPC::VRFIZ, &PPC::VRRCRegClass, Op0, Op0IsKill);
992  }
993  if ((PPCSubTarget->hasQPX())) {
994    return fastEmitInst_r(PPC::QVFRIZs, &PPC::QSRCRegClass, Op0, Op0IsKill);
995  }
996  return 0;
997}
998
999unsigned fastEmit_ISD_FTRUNC_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1000  if (RetVT.SimpleTy != MVT::v2f64)
1001    return 0;
1002  if ((PPCSubTarget->hasVSX())) {
1003    return fastEmitInst_r(PPC::XVRDPIZ, &PPC::VSRCRegClass, Op0, Op0IsKill);
1004  }
1005  return 0;
1006}
1007
1008unsigned fastEmit_ISD_FTRUNC_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1009  if (RetVT.SimpleTy != MVT::v4f64)
1010    return 0;
1011  if ((PPCSubTarget->hasQPX())) {
1012    return fastEmitInst_r(PPC::QVFRIZ, &PPC::QFRCRegClass, Op0, Op0IsKill);
1013  }
1014  return 0;
1015}
1016
1017unsigned fastEmit_ISD_FTRUNC_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1018  switch (VT.SimpleTy) {
1019  case MVT::f32: return fastEmit_ISD_FTRUNC_MVT_f32_r(RetVT, Op0, Op0IsKill);
1020  case MVT::f64: return fastEmit_ISD_FTRUNC_MVT_f64_r(RetVT, Op0, Op0IsKill);
1021  case MVT::v4f32: return fastEmit_ISD_FTRUNC_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
1022  case MVT::v2f64: return fastEmit_ISD_FTRUNC_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
1023  case MVT::v4f64: return fastEmit_ISD_FTRUNC_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
1024  default: return 0;
1025  }
1026}
1027
1028// FastEmit functions for ISD::SCALAR_TO_VECTOR.
1029
1030unsigned fastEmit_ISD_SCALAR_TO_VECTOR_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1031  if (RetVT.SimpleTy != MVT::v4i32)
1032    return 0;
1033  if ((PPCSubTarget->hasP9Vector())) {
1034    return fastEmitInst_r(PPC::MTVSRWS, &PPC::VSRCRegClass, Op0, Op0IsKill);
1035  }
1036  return 0;
1037}
1038
1039unsigned fastEmit_ISD_SCALAR_TO_VECTOR_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1040  if (RetVT.SimpleTy != MVT::v4f32)
1041    return 0;
1042  if ((PPCSubTarget->hasP8Vector()) && (!PPCSubTarget->isLittleEndian())) {
1043    return fastEmitInst_r(PPC::XSCVDPSPN, &PPC::VSRCRegClass, Op0, Op0IsKill);
1044  }
1045  return 0;
1046}
1047
1048unsigned fastEmit_ISD_SCALAR_TO_VECTOR_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1049  switch (VT.SimpleTy) {
1050  case MVT::i32: return fastEmit_ISD_SCALAR_TO_VECTOR_MVT_i32_r(RetVT, Op0, Op0IsKill);
1051  case MVT::f32: return fastEmit_ISD_SCALAR_TO_VECTOR_MVT_f32_r(RetVT, Op0, Op0IsKill);
1052  default: return 0;
1053  }
1054}
1055
1056// FastEmit functions for ISD::SIGN_EXTEND.
1057
1058unsigned fastEmit_ISD_SIGN_EXTEND_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1059  if (RetVT.SimpleTy != MVT::i64)
1060    return 0;
1061  return fastEmitInst_r(PPC::EXTSW_32_64, &PPC::G8RCRegClass, Op0, Op0IsKill);
1062}
1063
1064unsigned fastEmit_ISD_SIGN_EXTEND_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1065  switch (VT.SimpleTy) {
1066  case MVT::i32: return fastEmit_ISD_SIGN_EXTEND_MVT_i32_r(RetVT, Op0, Op0IsKill);
1067  default: return 0;
1068  }
1069}
1070
1071// FastEmit functions for ISD::SINT_TO_FP.
1072
1073unsigned fastEmit_ISD_SINT_TO_FP_MVT_i32_MVT_f32_r(unsigned Op0, bool Op0IsKill) {
1074  if ((PPCSubTarget->hasSPE())) {
1075    return fastEmitInst_r(PPC::EFSCFSI, &PPC::GPRCRegClass, Op0, Op0IsKill);
1076  }
1077  return 0;
1078}
1079
1080unsigned fastEmit_ISD_SINT_TO_FP_MVT_i32_MVT_f64_r(unsigned Op0, bool Op0IsKill) {
1081  if ((PPCSubTarget->hasSPE())) {
1082    return fastEmitInst_r(PPC::EFDCFSI, &PPC::SPERCRegClass, Op0, Op0IsKill);
1083  }
1084  return 0;
1085}
1086
1087unsigned fastEmit_ISD_SINT_TO_FP_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1088switch (RetVT.SimpleTy) {
1089  case MVT::f32: return fastEmit_ISD_SINT_TO_FP_MVT_i32_MVT_f32_r(Op0, Op0IsKill);
1090  case MVT::f64: return fastEmit_ISD_SINT_TO_FP_MVT_i32_MVT_f64_r(Op0, Op0IsKill);
1091  default: return 0;
1092}
1093}
1094
1095unsigned fastEmit_ISD_SINT_TO_FP_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1096  if (RetVT.SimpleTy != MVT::v4f32)
1097    return 0;
1098  if ((PPCSubTarget->hasVSX())) {
1099    return fastEmitInst_r(PPC::XVCVSXWSP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1100  }
1101  if ((PPCSubTarget->hasAltivec())) {
1102    return fastEmitInst_r(PPC::VCFSX_0, &PPC::VRRCRegClass, Op0, Op0IsKill);
1103  }
1104  return 0;
1105}
1106
1107unsigned fastEmit_ISD_SINT_TO_FP_MVT_v2i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1108  if (RetVT.SimpleTy != MVT::v2f64)
1109    return 0;
1110  if ((PPCSubTarget->hasVSX())) {
1111    return fastEmitInst_r(PPC::XVCVSXDDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1112  }
1113  return 0;
1114}
1115
1116unsigned fastEmit_ISD_SINT_TO_FP_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1117  switch (VT.SimpleTy) {
1118  case MVT::i32: return fastEmit_ISD_SINT_TO_FP_MVT_i32_r(RetVT, Op0, Op0IsKill);
1119  case MVT::v4i32: return fastEmit_ISD_SINT_TO_FP_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
1120  case MVT::v2i64: return fastEmit_ISD_SINT_TO_FP_MVT_v2i64_r(RetVT, Op0, Op0IsKill);
1121  default: return 0;
1122  }
1123}
1124
1125// FastEmit functions for ISD::TRUNCATE.
1126
1127unsigned fastEmit_ISD_TRUNCATE_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1128  if (RetVT.SimpleTy != MVT::i1)
1129    return 0;
1130  return fastEmitInst_r(PPC::ANDI_rec_1_GT_BIT, &PPC::CRBITRCRegClass, Op0, Op0IsKill);
1131}
1132
1133unsigned fastEmit_ISD_TRUNCATE_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1134  if (RetVT.SimpleTy != MVT::i1)
1135    return 0;
1136  return fastEmitInst_r(PPC::ANDI_rec_1_GT_BIT8, &PPC::CRBITRCRegClass, Op0, Op0IsKill);
1137}
1138
1139unsigned fastEmit_ISD_TRUNCATE_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1140  switch (VT.SimpleTy) {
1141  case MVT::i32: return fastEmit_ISD_TRUNCATE_MVT_i32_r(RetVT, Op0, Op0IsKill);
1142  case MVT::i64: return fastEmit_ISD_TRUNCATE_MVT_i64_r(RetVT, Op0, Op0IsKill);
1143  default: return 0;
1144  }
1145}
1146
1147// FastEmit functions for ISD::UINT_TO_FP.
1148
1149unsigned fastEmit_ISD_UINT_TO_FP_MVT_i32_MVT_f32_r(unsigned Op0, bool Op0IsKill) {
1150  if ((PPCSubTarget->hasSPE())) {
1151    return fastEmitInst_r(PPC::EFSCFUI, &PPC::GPRCRegClass, Op0, Op0IsKill);
1152  }
1153  return 0;
1154}
1155
1156unsigned fastEmit_ISD_UINT_TO_FP_MVT_i32_MVT_f64_r(unsigned Op0, bool Op0IsKill) {
1157  if ((PPCSubTarget->hasSPE())) {
1158    return fastEmitInst_r(PPC::EFDCFUI, &PPC::SPERCRegClass, Op0, Op0IsKill);
1159  }
1160  return 0;
1161}
1162
1163unsigned fastEmit_ISD_UINT_TO_FP_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1164switch (RetVT.SimpleTy) {
1165  case MVT::f32: return fastEmit_ISD_UINT_TO_FP_MVT_i32_MVT_f32_r(Op0, Op0IsKill);
1166  case MVT::f64: return fastEmit_ISD_UINT_TO_FP_MVT_i32_MVT_f64_r(Op0, Op0IsKill);
1167  default: return 0;
1168}
1169}
1170
1171unsigned fastEmit_ISD_UINT_TO_FP_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1172  if (RetVT.SimpleTy != MVT::v4f32)
1173    return 0;
1174  if ((PPCSubTarget->hasVSX())) {
1175    return fastEmitInst_r(PPC::XVCVUXWSP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1176  }
1177  if ((PPCSubTarget->hasAltivec())) {
1178    return fastEmitInst_r(PPC::VCFUX_0, &PPC::VRRCRegClass, Op0, Op0IsKill);
1179  }
1180  return 0;
1181}
1182
1183unsigned fastEmit_ISD_UINT_TO_FP_MVT_v2i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1184  if (RetVT.SimpleTy != MVT::v2f64)
1185    return 0;
1186  if ((PPCSubTarget->hasVSX())) {
1187    return fastEmitInst_r(PPC::XVCVUXDDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1188  }
1189  return 0;
1190}
1191
1192unsigned fastEmit_ISD_UINT_TO_FP_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1193  switch (VT.SimpleTy) {
1194  case MVT::i32: return fastEmit_ISD_UINT_TO_FP_MVT_i32_r(RetVT, Op0, Op0IsKill);
1195  case MVT::v4i32: return fastEmit_ISD_UINT_TO_FP_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
1196  case MVT::v2i64: return fastEmit_ISD_UINT_TO_FP_MVT_v2i64_r(RetVT, Op0, Op0IsKill);
1197  default: return 0;
1198  }
1199}
1200
1201// FastEmit functions for PPCISD::FCFID.
1202
1203unsigned fastEmit_PPCISD_FCFID_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1204  if (RetVT.SimpleTy != MVT::f64)
1205    return 0;
1206  if ((PPCSubTarget->hasVSX())) {
1207    return fastEmitInst_r(PPC::XSCVSXDDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1208  }
1209  return fastEmitInst_r(PPC::FCFID, &PPC::F8RCRegClass, Op0, Op0IsKill);
1210}
1211
1212unsigned fastEmit_PPCISD_FCFID_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1213  switch (VT.SimpleTy) {
1214  case MVT::f64: return fastEmit_PPCISD_FCFID_MVT_f64_r(RetVT, Op0, Op0IsKill);
1215  default: return 0;
1216  }
1217}
1218
1219// FastEmit functions for PPCISD::FCFIDS.
1220
1221unsigned fastEmit_PPCISD_FCFIDS_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1222  if (RetVT.SimpleTy != MVT::f32)
1223    return 0;
1224  if ((PPCSubTarget->hasP8Vector())) {
1225    return fastEmitInst_r(PPC::XSCVSXDSP, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1226  }
1227  return fastEmitInst_r(PPC::FCFIDS, &PPC::F4RCRegClass, Op0, Op0IsKill);
1228}
1229
1230unsigned fastEmit_PPCISD_FCFIDS_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1231  switch (VT.SimpleTy) {
1232  case MVT::f64: return fastEmit_PPCISD_FCFIDS_MVT_f64_r(RetVT, Op0, Op0IsKill);
1233  default: return 0;
1234  }
1235}
1236
1237// FastEmit functions for PPCISD::FCFIDU.
1238
1239unsigned fastEmit_PPCISD_FCFIDU_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1240  if (RetVT.SimpleTy != MVT::f64)
1241    return 0;
1242  if ((PPCSubTarget->hasVSX())) {
1243    return fastEmitInst_r(PPC::XSCVUXDDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1244  }
1245  return fastEmitInst_r(PPC::FCFIDU, &PPC::F8RCRegClass, Op0, Op0IsKill);
1246}
1247
1248unsigned fastEmit_PPCISD_FCFIDU_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1249  switch (VT.SimpleTy) {
1250  case MVT::f64: return fastEmit_PPCISD_FCFIDU_MVT_f64_r(RetVT, Op0, Op0IsKill);
1251  default: return 0;
1252  }
1253}
1254
1255// FastEmit functions for PPCISD::FCFIDUS.
1256
1257unsigned fastEmit_PPCISD_FCFIDUS_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1258  if (RetVT.SimpleTy != MVT::f32)
1259    return 0;
1260  if ((PPCSubTarget->hasP8Vector())) {
1261    return fastEmitInst_r(PPC::XSCVUXDSP, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1262  }
1263  return fastEmitInst_r(PPC::FCFIDUS, &PPC::F4RCRegClass, Op0, Op0IsKill);
1264}
1265
1266unsigned fastEmit_PPCISD_FCFIDUS_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1267  switch (VT.SimpleTy) {
1268  case MVT::f64: return fastEmit_PPCISD_FCFIDUS_MVT_f64_r(RetVT, Op0, Op0IsKill);
1269  default: return 0;
1270  }
1271}
1272
1273// FastEmit functions for PPCISD::FCTIDUZ.
1274
1275unsigned fastEmit_PPCISD_FCTIDUZ_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1276  if (RetVT.SimpleTy != MVT::f32)
1277    return 0;
1278  if ((PPCSubTarget->hasVSX())) {
1279    return fastEmitInst_r(PPC::XSCVDPUXDSs, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1280  }
1281  return 0;
1282}
1283
1284unsigned fastEmit_PPCISD_FCTIDUZ_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1285  if (RetVT.SimpleTy != MVT::f64)
1286    return 0;
1287  if ((PPCSubTarget->hasVSX())) {
1288    return fastEmitInst_r(PPC::XSCVDPUXDS, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1289  }
1290  return fastEmitInst_r(PPC::FCTIDUZ, &PPC::F8RCRegClass, Op0, Op0IsKill);
1291}
1292
1293unsigned fastEmit_PPCISD_FCTIDUZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1294  switch (VT.SimpleTy) {
1295  case MVT::f32: return fastEmit_PPCISD_FCTIDUZ_MVT_f32_r(RetVT, Op0, Op0IsKill);
1296  case MVT::f64: return fastEmit_PPCISD_FCTIDUZ_MVT_f64_r(RetVT, Op0, Op0IsKill);
1297  default: return 0;
1298  }
1299}
1300
1301// FastEmit functions for PPCISD::FCTIDZ.
1302
1303unsigned fastEmit_PPCISD_FCTIDZ_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1304  if (RetVT.SimpleTy != MVT::f32)
1305    return 0;
1306  if ((PPCSubTarget->hasVSX())) {
1307    return fastEmitInst_r(PPC::XSCVDPSXDSs, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1308  }
1309  return 0;
1310}
1311
1312unsigned fastEmit_PPCISD_FCTIDZ_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1313  if (RetVT.SimpleTy != MVT::f64)
1314    return 0;
1315  if ((PPCSubTarget->hasVSX())) {
1316    return fastEmitInst_r(PPC::XSCVDPSXDS, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1317  }
1318  return fastEmitInst_r(PPC::FCTIDZ, &PPC::F8RCRegClass, Op0, Op0IsKill);
1319}
1320
1321unsigned fastEmit_PPCISD_FCTIDZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1322  switch (VT.SimpleTy) {
1323  case MVT::f32: return fastEmit_PPCISD_FCTIDZ_MVT_f32_r(RetVT, Op0, Op0IsKill);
1324  case MVT::f64: return fastEmit_PPCISD_FCTIDZ_MVT_f64_r(RetVT, Op0, Op0IsKill);
1325  default: return 0;
1326  }
1327}
1328
1329// FastEmit functions for PPCISD::FCTIWUZ.
1330
1331unsigned fastEmit_PPCISD_FCTIWUZ_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1332  if (RetVT.SimpleTy != MVT::f32)
1333    return 0;
1334  if ((PPCSubTarget->hasVSX())) {
1335    return fastEmitInst_r(PPC::XSCVDPUXWSs, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1336  }
1337  return 0;
1338}
1339
1340unsigned fastEmit_PPCISD_FCTIWUZ_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1341  if (RetVT.SimpleTy != MVT::f64)
1342    return 0;
1343  if ((PPCSubTarget->hasVSX())) {
1344    return fastEmitInst_r(PPC::XSCVDPUXWS, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1345  }
1346  return fastEmitInst_r(PPC::FCTIWUZ, &PPC::F8RCRegClass, Op0, Op0IsKill);
1347}
1348
1349unsigned fastEmit_PPCISD_FCTIWUZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1350  switch (VT.SimpleTy) {
1351  case MVT::f32: return fastEmit_PPCISD_FCTIWUZ_MVT_f32_r(RetVT, Op0, Op0IsKill);
1352  case MVT::f64: return fastEmit_PPCISD_FCTIWUZ_MVT_f64_r(RetVT, Op0, Op0IsKill);
1353  default: return 0;
1354  }
1355}
1356
1357// FastEmit functions for PPCISD::FCTIWZ.
1358
1359unsigned fastEmit_PPCISD_FCTIWZ_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1360  if (RetVT.SimpleTy != MVT::f32)
1361    return 0;
1362  if ((PPCSubTarget->hasVSX())) {
1363    return fastEmitInst_r(PPC::XSCVDPSXWSs, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1364  }
1365  return 0;
1366}
1367
1368unsigned fastEmit_PPCISD_FCTIWZ_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1369  if (RetVT.SimpleTy != MVT::f64)
1370    return 0;
1371  if ((PPCSubTarget->hasVSX())) {
1372    return fastEmitInst_r(PPC::XSCVDPSXWS, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1373  }
1374  if ((PPCSubTarget->hasFPU())) {
1375    return fastEmitInst_r(PPC::FCTIWZ, &PPC::F8RCRegClass, Op0, Op0IsKill);
1376  }
1377  return 0;
1378}
1379
1380unsigned fastEmit_PPCISD_FCTIWZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1381  switch (VT.SimpleTy) {
1382  case MVT::f32: return fastEmit_PPCISD_FCTIWZ_MVT_f32_r(RetVT, Op0, Op0IsKill);
1383  case MVT::f64: return fastEmit_PPCISD_FCTIWZ_MVT_f64_r(RetVT, Op0, Op0IsKill);
1384  default: return 0;
1385  }
1386}
1387
1388// FastEmit functions for PPCISD::FRE.
1389
1390unsigned fastEmit_PPCISD_FRE_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1391  if (RetVT.SimpleTy != MVT::f32)
1392    return 0;
1393  if ((PPCSubTarget->hasP8Vector())) {
1394    return fastEmitInst_r(PPC::XSRESP, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1395  }
1396  if ((PPCSubTarget->hasFPU())) {
1397    return fastEmitInst_r(PPC::FRES, &PPC::F4RCRegClass, Op0, Op0IsKill);
1398  }
1399  return 0;
1400}
1401
1402unsigned fastEmit_PPCISD_FRE_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1403  if (RetVT.SimpleTy != MVT::f64)
1404    return 0;
1405  if ((PPCSubTarget->hasVSX())) {
1406    return fastEmitInst_r(PPC::XSREDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1407  }
1408  if ((PPCSubTarget->hasFPU())) {
1409    return fastEmitInst_r(PPC::FRE, &PPC::F8RCRegClass, Op0, Op0IsKill);
1410  }
1411  return 0;
1412}
1413
1414unsigned fastEmit_PPCISD_FRE_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1415  if (RetVT.SimpleTy != MVT::v4f32)
1416    return 0;
1417  if ((PPCSubTarget->hasVSX())) {
1418    return fastEmitInst_r(PPC::XVRESP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1419  }
1420  if ((PPCSubTarget->hasAltivec())) {
1421    return fastEmitInst_r(PPC::VREFP, &PPC::VRRCRegClass, Op0, Op0IsKill);
1422  }
1423  if ((PPCSubTarget->hasQPX())) {
1424    return fastEmitInst_r(PPC::QVFRESs, &PPC::QSRCRegClass, Op0, Op0IsKill);
1425  }
1426  return 0;
1427}
1428
1429unsigned fastEmit_PPCISD_FRE_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1430  if (RetVT.SimpleTy != MVT::v2f64)
1431    return 0;
1432  if ((PPCSubTarget->hasVSX())) {
1433    return fastEmitInst_r(PPC::XVREDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1434  }
1435  return 0;
1436}
1437
1438unsigned fastEmit_PPCISD_FRE_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1439  if (RetVT.SimpleTy != MVT::v4f64)
1440    return 0;
1441  if ((PPCSubTarget->hasQPX())) {
1442    return fastEmitInst_r(PPC::QVFRE, &PPC::QFRCRegClass, Op0, Op0IsKill);
1443  }
1444  return 0;
1445}
1446
1447unsigned fastEmit_PPCISD_FRE_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1448  switch (VT.SimpleTy) {
1449  case MVT::f32: return fastEmit_PPCISD_FRE_MVT_f32_r(RetVT, Op0, Op0IsKill);
1450  case MVT::f64: return fastEmit_PPCISD_FRE_MVT_f64_r(RetVT, Op0, Op0IsKill);
1451  case MVT::v4f32: return fastEmit_PPCISD_FRE_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
1452  case MVT::v2f64: return fastEmit_PPCISD_FRE_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
1453  case MVT::v4f64: return fastEmit_PPCISD_FRE_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
1454  default: return 0;
1455  }
1456}
1457
1458// FastEmit functions for PPCISD::FRSQRTE.
1459
1460unsigned fastEmit_PPCISD_FRSQRTE_MVT_f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1461  if (RetVT.SimpleTy != MVT::f32)
1462    return 0;
1463  if ((PPCSubTarget->hasP8Vector())) {
1464    return fastEmitInst_r(PPC::XSRSQRTESP, &PPC::VSSRCRegClass, Op0, Op0IsKill);
1465  }
1466  if ((PPCSubTarget->hasFPU())) {
1467    return fastEmitInst_r(PPC::FRSQRTES, &PPC::F4RCRegClass, Op0, Op0IsKill);
1468  }
1469  return 0;
1470}
1471
1472unsigned fastEmit_PPCISD_FRSQRTE_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1473  if (RetVT.SimpleTy != MVT::f64)
1474    return 0;
1475  if ((PPCSubTarget->hasVSX())) {
1476    return fastEmitInst_r(PPC::XSRSQRTEDP, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1477  }
1478  if ((PPCSubTarget->hasFPU())) {
1479    return fastEmitInst_r(PPC::FRSQRTE, &PPC::F8RCRegClass, Op0, Op0IsKill);
1480  }
1481  return 0;
1482}
1483
1484unsigned fastEmit_PPCISD_FRSQRTE_MVT_v4f32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1485  if (RetVT.SimpleTy != MVT::v4f32)
1486    return 0;
1487  if ((PPCSubTarget->hasVSX())) {
1488    return fastEmitInst_r(PPC::XVRSQRTESP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1489  }
1490  if ((PPCSubTarget->hasAltivec())) {
1491    return fastEmitInst_r(PPC::VRSQRTEFP, &PPC::VRRCRegClass, Op0, Op0IsKill);
1492  }
1493  if ((PPCSubTarget->hasQPX())) {
1494    return fastEmitInst_r(PPC::QVFRSQRTESs, &PPC::QSRCRegClass, Op0, Op0IsKill);
1495  }
1496  return 0;
1497}
1498
1499unsigned fastEmit_PPCISD_FRSQRTE_MVT_v2f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1500  if (RetVT.SimpleTy != MVT::v2f64)
1501    return 0;
1502  if ((PPCSubTarget->hasVSX())) {
1503    return fastEmitInst_r(PPC::XVRSQRTEDP, &PPC::VSRCRegClass, Op0, Op0IsKill);
1504  }
1505  return 0;
1506}
1507
1508unsigned fastEmit_PPCISD_FRSQRTE_MVT_v4f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1509  if (RetVT.SimpleTy != MVT::v4f64)
1510    return 0;
1511  if ((PPCSubTarget->hasQPX())) {
1512    return fastEmitInst_r(PPC::QVFRSQRTE, &PPC::QFRCRegClass, Op0, Op0IsKill);
1513  }
1514  return 0;
1515}
1516
1517unsigned fastEmit_PPCISD_FRSQRTE_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1518  switch (VT.SimpleTy) {
1519  case MVT::f32: return fastEmit_PPCISD_FRSQRTE_MVT_f32_r(RetVT, Op0, Op0IsKill);
1520  case MVT::f64: return fastEmit_PPCISD_FRSQRTE_MVT_f64_r(RetVT, Op0, Op0IsKill);
1521  case MVT::v4f32: return fastEmit_PPCISD_FRSQRTE_MVT_v4f32_r(RetVT, Op0, Op0IsKill);
1522  case MVT::v2f64: return fastEmit_PPCISD_FRSQRTE_MVT_v2f64_r(RetVT, Op0, Op0IsKill);
1523  case MVT::v4f64: return fastEmit_PPCISD_FRSQRTE_MVT_v4f64_r(RetVT, Op0, Op0IsKill);
1524  default: return 0;
1525  }
1526}
1527
1528// FastEmit functions for PPCISD::MFVSR.
1529
1530unsigned fastEmit_PPCISD_MFVSR_MVT_f64_MVT_i32_r(unsigned Op0, bool Op0IsKill) {
1531  if ((PPCSubTarget->hasDirectMove())) {
1532    return fastEmitInst_r(PPC::MFVSRWZ, &PPC::GPRCRegClass, Op0, Op0IsKill);
1533  }
1534  return 0;
1535}
1536
1537unsigned fastEmit_PPCISD_MFVSR_MVT_f64_MVT_i64_r(unsigned Op0, bool Op0IsKill) {
1538  if ((PPCSubTarget->hasDirectMove())) {
1539    return fastEmitInst_r(PPC::MFVSRD, &PPC::G8RCRegClass, Op0, Op0IsKill);
1540  }
1541  return 0;
1542}
1543
1544unsigned fastEmit_PPCISD_MFVSR_MVT_f64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1545switch (RetVT.SimpleTy) {
1546  case MVT::i32: return fastEmit_PPCISD_MFVSR_MVT_f64_MVT_i32_r(Op0, Op0IsKill);
1547  case MVT::i64: return fastEmit_PPCISD_MFVSR_MVT_f64_MVT_i64_r(Op0, Op0IsKill);
1548  default: return 0;
1549}
1550}
1551
1552unsigned fastEmit_PPCISD_MFVSR_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1553  switch (VT.SimpleTy) {
1554  case MVT::f64: return fastEmit_PPCISD_MFVSR_MVT_f64_r(RetVT, Op0, Op0IsKill);
1555  default: return 0;
1556  }
1557}
1558
1559// FastEmit functions for PPCISD::MTCTR.
1560
1561unsigned fastEmit_PPCISD_MTCTR_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1562  if (RetVT.SimpleTy != MVT::isVoid)
1563    return 0;
1564  return fastEmitInst_r(PPC::MTCTR, &PPC::GPRCRegClass, Op0, Op0IsKill);
1565}
1566
1567unsigned fastEmit_PPCISD_MTCTR_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1568  if (RetVT.SimpleTy != MVT::isVoid)
1569    return 0;
1570  return fastEmitInst_r(PPC::MTCTR8, &PPC::G8RCRegClass, Op0, Op0IsKill);
1571}
1572
1573unsigned fastEmit_PPCISD_MTCTR_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1574  switch (VT.SimpleTy) {
1575  case MVT::i32: return fastEmit_PPCISD_MTCTR_MVT_i32_r(RetVT, Op0, Op0IsKill);
1576  case MVT::i64: return fastEmit_PPCISD_MTCTR_MVT_i64_r(RetVT, Op0, Op0IsKill);
1577  default: return 0;
1578  }
1579}
1580
1581// FastEmit functions for PPCISD::MTVSRA.
1582
1583unsigned fastEmit_PPCISD_MTVSRA_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1584  if (RetVT.SimpleTy != MVT::f64)
1585    return 0;
1586  if ((PPCSubTarget->hasDirectMove())) {
1587    return fastEmitInst_r(PPC::MTVSRWA, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1588  }
1589  return 0;
1590}
1591
1592unsigned fastEmit_PPCISD_MTVSRA_MVT_i64_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1593  if (RetVT.SimpleTy != MVT::f64)
1594    return 0;
1595  if ((PPCSubTarget->hasDirectMove())) {
1596    return fastEmitInst_r(PPC::MTVSRD, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1597  }
1598  return 0;
1599}
1600
1601unsigned fastEmit_PPCISD_MTVSRA_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1602  switch (VT.SimpleTy) {
1603  case MVT::i32: return fastEmit_PPCISD_MTVSRA_MVT_i32_r(RetVT, Op0, Op0IsKill);
1604  case MVT::i64: return fastEmit_PPCISD_MTVSRA_MVT_i64_r(RetVT, Op0, Op0IsKill);
1605  default: return 0;
1606  }
1607}
1608
1609// FastEmit functions for PPCISD::MTVSRZ.
1610
1611unsigned fastEmit_PPCISD_MTVSRZ_MVT_i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1612  if (RetVT.SimpleTy != MVT::f64)
1613    return 0;
1614  if ((PPCSubTarget->hasDirectMove())) {
1615    return fastEmitInst_r(PPC::MTVSRWZ, &PPC::VSFRCRegClass, Op0, Op0IsKill);
1616  }
1617  return 0;
1618}
1619
1620unsigned fastEmit_PPCISD_MTVSRZ_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1621  switch (VT.SimpleTy) {
1622  case MVT::i32: return fastEmit_PPCISD_MTVSRZ_MVT_i32_r(RetVT, Op0, Op0IsKill);
1623  default: return 0;
1624  }
1625}
1626
1627// FastEmit functions for PPCISD::SExtVElems.
1628
1629unsigned fastEmit_PPCISD_SExtVElems_MVT_v16i8_MVT_v4i32_r(unsigned Op0, bool Op0IsKill) {
1630  if ((PPCSubTarget->hasP9Altivec())) {
1631    return fastEmitInst_r(PPC::VEXTSB2W, &PPC::VRRCRegClass, Op0, Op0IsKill);
1632  }
1633  return 0;
1634}
1635
1636unsigned fastEmit_PPCISD_SExtVElems_MVT_v16i8_MVT_v2i64_r(unsigned Op0, bool Op0IsKill) {
1637  if ((PPCSubTarget->hasP9Altivec())) {
1638    return fastEmitInst_r(PPC::VEXTSB2D, &PPC::VRRCRegClass, Op0, Op0IsKill);
1639  }
1640  return 0;
1641}
1642
1643unsigned fastEmit_PPCISD_SExtVElems_MVT_v16i8_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1644switch (RetVT.SimpleTy) {
1645  case MVT::v4i32: return fastEmit_PPCISD_SExtVElems_MVT_v16i8_MVT_v4i32_r(Op0, Op0IsKill);
1646  case MVT::v2i64: return fastEmit_PPCISD_SExtVElems_MVT_v16i8_MVT_v2i64_r(Op0, Op0IsKill);
1647  default: return 0;
1648}
1649}
1650
1651unsigned fastEmit_PPCISD_SExtVElems_MVT_v8i16_MVT_v4i32_r(unsigned Op0, bool Op0IsKill) {
1652  if ((PPCSubTarget->hasP9Altivec())) {
1653    return fastEmitInst_r(PPC::VEXTSH2W, &PPC::VRRCRegClass, Op0, Op0IsKill);
1654  }
1655  return 0;
1656}
1657
1658unsigned fastEmit_PPCISD_SExtVElems_MVT_v8i16_MVT_v2i64_r(unsigned Op0, bool Op0IsKill) {
1659  if ((PPCSubTarget->hasP9Altivec())) {
1660    return fastEmitInst_r(PPC::VEXTSH2D, &PPC::VRRCRegClass, Op0, Op0IsKill);
1661  }
1662  return 0;
1663}
1664
1665unsigned fastEmit_PPCISD_SExtVElems_MVT_v8i16_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1666switch (RetVT.SimpleTy) {
1667  case MVT::v4i32: return fastEmit_PPCISD_SExtVElems_MVT_v8i16_MVT_v4i32_r(Op0, Op0IsKill);
1668  case MVT::v2i64: return fastEmit_PPCISD_SExtVElems_MVT_v8i16_MVT_v2i64_r(Op0, Op0IsKill);
1669  default: return 0;
1670}
1671}
1672
1673unsigned fastEmit_PPCISD_SExtVElems_MVT_v4i32_r(MVT RetVT, unsigned Op0, bool Op0IsKill) {
1674  if (RetVT.SimpleTy != MVT::v2i64)
1675    return 0;
1676  if ((PPCSubTarget->hasP9Altivec())) {
1677    return fastEmitInst_r(PPC::VEXTSW2D, &PPC::VRRCRegClass, Op0, Op0IsKill);
1678  }
1679  return 0;
1680}
1681
1682unsigned fastEmit_PPCISD_SExtVElems_r(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill) {
1683  switch (VT.SimpleTy) {
1684  case MVT::v16i8: return fastEmit_PPCISD_SExtVElems_MVT_v16i8_r(RetVT, Op0, Op0IsKill);
1685  case MVT::v8i16: return fastEmit_PPCISD_SExtVElems_MVT_v8i16_r(RetVT, Op0, Op0IsKill);
1686  case MVT::v4i32: return fastEmit_PPCISD_SExtVElems_MVT_v4i32_r(RetVT, Op0, Op0IsKill);
1687  default: return 0;
1688  }
1689}
1690
1691// Top-level FastEmit function.
1692
1693unsigned fastEmit_r(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill) override {
1694  switch (Opcode) {
1695  case ISD::BITCAST: return fastEmit_ISD_BITCAST_r(VT, RetVT, Op0, Op0IsKill);
1696  case ISD::BSWAP: return fastEmit_ISD_BSWAP_r(VT, RetVT, Op0, Op0IsKill);
1697  case ISD::CTLZ: return fastEmit_ISD_CTLZ_r(VT, RetVT, Op0, Op0IsKill);
1698  case ISD::CTPOP: return fastEmit_ISD_CTPOP_r(VT, RetVT, Op0, Op0IsKill);
1699  case ISD::CTTZ: return fastEmit_ISD_CTTZ_r(VT, RetVT, Op0, Op0IsKill);
1700  case ISD::FABS: return fastEmit_ISD_FABS_r(VT, RetVT, Op0, Op0IsKill);
1701  case ISD::FCEIL: return fastEmit_ISD_FCEIL_r(VT, RetVT, Op0, Op0IsKill);
1702  case ISD::FFLOOR: return fastEmit_ISD_FFLOOR_r(VT, RetVT, Op0, Op0IsKill);
1703  case ISD::FNEARBYINT: return fastEmit_ISD_FNEARBYINT_r(VT, RetVT, Op0, Op0IsKill);
1704  case ISD::FNEG: return fastEmit_ISD_FNEG_r(VT, RetVT, Op0, Op0IsKill);
1705  case ISD::FP_EXTEND: return fastEmit_ISD_FP_EXTEND_r(VT, RetVT, Op0, Op0IsKill);
1706  case ISD::FP_ROUND: return fastEmit_ISD_FP_ROUND_r(VT, RetVT, Op0, Op0IsKill);
1707  case ISD::FP_TO_SINT: return fastEmit_ISD_FP_TO_SINT_r(VT, RetVT, Op0, Op0IsKill);
1708  case ISD::FP_TO_UINT: return fastEmit_ISD_FP_TO_UINT_r(VT, RetVT, Op0, Op0IsKill);
1709  case ISD::FROUND: return fastEmit_ISD_FROUND_r(VT, RetVT, Op0, Op0IsKill);
1710  case ISD::FSQRT: return fastEmit_ISD_FSQRT_r(VT, RetVT, Op0, Op0IsKill);
1711  case ISD::FTRUNC: return fastEmit_ISD_FTRUNC_r(VT, RetVT, Op0, Op0IsKill);
1712  case ISD::SCALAR_TO_VECTOR: return fastEmit_ISD_SCALAR_TO_VECTOR_r(VT, RetVT, Op0, Op0IsKill);
1713  case ISD::SIGN_EXTEND: return fastEmit_ISD_SIGN_EXTEND_r(VT, RetVT, Op0, Op0IsKill);
1714  case ISD::SINT_TO_FP: return fastEmit_ISD_SINT_TO_FP_r(VT, RetVT, Op0, Op0IsKill);
1715  case ISD::TRUNCATE: return fastEmit_ISD_TRUNCATE_r(VT, RetVT, Op0, Op0IsKill);
1716  case ISD::UINT_TO_FP: return fastEmit_ISD_UINT_TO_FP_r(VT, RetVT, Op0, Op0IsKill);
1717  case PPCISD::FCFID: return fastEmit_PPCISD_FCFID_r(VT, RetVT, Op0, Op0IsKill);
1718  case PPCISD::FCFIDS: return fastEmit_PPCISD_FCFIDS_r(VT, RetVT, Op0, Op0IsKill);
1719  case PPCISD::FCFIDU: return fastEmit_PPCISD_FCFIDU_r(VT, RetVT, Op0, Op0IsKill);
1720  case PPCISD::FCFIDUS: return fastEmit_PPCISD_FCFIDUS_r(VT, RetVT, Op0, Op0IsKill);
1721  case PPCISD::FCTIDUZ: return fastEmit_PPCISD_FCTIDUZ_r(VT, RetVT, Op0, Op0IsKill);
1722  case PPCISD::FCTIDZ: return fastEmit_PPCISD_FCTIDZ_r(VT, RetVT, Op0, Op0IsKill);
1723  case PPCISD::FCTIWUZ: return fastEmit_PPCISD_FCTIWUZ_r(VT, RetVT, Op0, Op0IsKill);
1724  case PPCISD::FCTIWZ: return fastEmit_PPCISD_FCTIWZ_r(VT, RetVT, Op0, Op0IsKill);
1725  case PPCISD::FRE: return fastEmit_PPCISD_FRE_r(VT, RetVT, Op0, Op0IsKill);
1726  case PPCISD::FRSQRTE: return fastEmit_PPCISD_FRSQRTE_r(VT, RetVT, Op0, Op0IsKill);
1727  case PPCISD::MFVSR: return fastEmit_PPCISD_MFVSR_r(VT, RetVT, Op0, Op0IsKill);
1728  case PPCISD::MTCTR: return fastEmit_PPCISD_MTCTR_r(VT, RetVT, Op0, Op0IsKill);
1729  case PPCISD::MTVSRA: return fastEmit_PPCISD_MTVSRA_r(VT, RetVT, Op0, Op0IsKill);
1730  case PPCISD::MTVSRZ: return fastEmit_PPCISD_MTVSRZ_r(VT, RetVT, Op0, Op0IsKill);
1731  case PPCISD::SExtVElems: return fastEmit_PPCISD_SExtVElems_r(VT, RetVT, Op0, Op0IsKill);
1732  default: return 0;
1733  }
1734}
1735
1736// FastEmit functions for ISD::ADD.
1737
1738unsigned fastEmit_ISD_ADD_MVT_i1_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1739  if (RetVT.SimpleTy != MVT::i1)
1740    return 0;
1741  return fastEmitInst_rr(PPC::CRXOR, &PPC::CRBITRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1742}
1743
1744unsigned fastEmit_ISD_ADD_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1745  if (RetVT.SimpleTy != MVT::i32)
1746    return 0;
1747  return fastEmitInst_rr(PPC::ADD4, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1748}
1749
1750unsigned fastEmit_ISD_ADD_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1751  if (RetVT.SimpleTy != MVT::i64)
1752    return 0;
1753  return fastEmitInst_rr(PPC::ADD8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1754}
1755
1756unsigned fastEmit_ISD_ADD_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1757  if (RetVT.SimpleTy != MVT::v16i8)
1758    return 0;
1759  if ((PPCSubTarget->hasAltivec())) {
1760    return fastEmitInst_rr(PPC::VADDUBM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1761  }
1762  return 0;
1763}
1764
1765unsigned fastEmit_ISD_ADD_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1766  if (RetVT.SimpleTy != MVT::v8i16)
1767    return 0;
1768  if ((PPCSubTarget->hasAltivec())) {
1769    return fastEmitInst_rr(PPC::VADDUHM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1770  }
1771  return 0;
1772}
1773
1774unsigned fastEmit_ISD_ADD_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1775  if (RetVT.SimpleTy != MVT::v4i32)
1776    return 0;
1777  if ((PPCSubTarget->hasAltivec())) {
1778    return fastEmitInst_rr(PPC::VADDUWM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1779  }
1780  return 0;
1781}
1782
1783unsigned fastEmit_ISD_ADD_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1784  if (RetVT.SimpleTy != MVT::v2i64)
1785    return 0;
1786  if ((PPCSubTarget->hasP8Altivec())) {
1787    return fastEmitInst_rr(PPC::VADDUDM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1788  }
1789  return 0;
1790}
1791
1792unsigned fastEmit_ISD_ADD_MVT_v1i128_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1793  if (RetVT.SimpleTy != MVT::v1i128)
1794    return 0;
1795  if ((PPCSubTarget->hasP8Altivec())) {
1796    return fastEmitInst_rr(PPC::VADDUQM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1797  }
1798  return 0;
1799}
1800
1801unsigned fastEmit_ISD_ADD_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1802  switch (VT.SimpleTy) {
1803  case MVT::i1: return fastEmit_ISD_ADD_MVT_i1_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1804  case MVT::i32: return fastEmit_ISD_ADD_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1805  case MVT::i64: return fastEmit_ISD_ADD_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1806  case MVT::v16i8: return fastEmit_ISD_ADD_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1807  case MVT::v8i16: return fastEmit_ISD_ADD_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1808  case MVT::v4i32: return fastEmit_ISD_ADD_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1809  case MVT::v2i64: return fastEmit_ISD_ADD_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1810  case MVT::v1i128: return fastEmit_ISD_ADD_MVT_v1i128_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1811  default: return 0;
1812  }
1813}
1814
1815// FastEmit functions for ISD::ADDC.
1816
1817unsigned fastEmit_ISD_ADDC_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1818  if (RetVT.SimpleTy != MVT::i32)
1819    return 0;
1820  return fastEmitInst_rr(PPC::ADDC, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1821}
1822
1823unsigned fastEmit_ISD_ADDC_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1824  if (RetVT.SimpleTy != MVT::i64)
1825    return 0;
1826  return fastEmitInst_rr(PPC::ADDC8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1827}
1828
1829unsigned fastEmit_ISD_ADDC_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1830  switch (VT.SimpleTy) {
1831  case MVT::i32: return fastEmit_ISD_ADDC_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1832  case MVT::i64: return fastEmit_ISD_ADDC_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1833  default: return 0;
1834  }
1835}
1836
1837// FastEmit functions for ISD::ADDE.
1838
1839unsigned fastEmit_ISD_ADDE_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1840  if (RetVT.SimpleTy != MVT::i32)
1841    return 0;
1842  return fastEmitInst_rr(PPC::ADDE, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1843}
1844
1845unsigned fastEmit_ISD_ADDE_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1846  if (RetVT.SimpleTy != MVT::i64)
1847    return 0;
1848  return fastEmitInst_rr(PPC::ADDE8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1849}
1850
1851unsigned fastEmit_ISD_ADDE_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1852  switch (VT.SimpleTy) {
1853  case MVT::i32: return fastEmit_ISD_ADDE_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1854  case MVT::i64: return fastEmit_ISD_ADDE_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1855  default: return 0;
1856  }
1857}
1858
1859// FastEmit functions for ISD::AND.
1860
1861unsigned fastEmit_ISD_AND_MVT_i1_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1862  if (RetVT.SimpleTy != MVT::i1)
1863    return 0;
1864  return fastEmitInst_rr(PPC::CRAND, &PPC::CRBITRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1865}
1866
1867unsigned fastEmit_ISD_AND_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1868  if (RetVT.SimpleTy != MVT::i32)
1869    return 0;
1870  return fastEmitInst_rr(PPC::AND, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1871}
1872
1873unsigned fastEmit_ISD_AND_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1874  if (RetVT.SimpleTy != MVT::i64)
1875    return 0;
1876  return fastEmitInst_rr(PPC::AND8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1877}
1878
1879unsigned fastEmit_ISD_AND_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1880  if (RetVT.SimpleTy != MVT::v4i32)
1881    return 0;
1882  if ((PPCSubTarget->hasVSX())) {
1883    return fastEmitInst_rr(PPC::XXLAND, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1884  }
1885  if ((PPCSubTarget->hasAltivec())) {
1886    return fastEmitInst_rr(PPC::VAND, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1887  }
1888  return 0;
1889}
1890
1891unsigned fastEmit_ISD_AND_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1892  switch (VT.SimpleTy) {
1893  case MVT::i1: return fastEmit_ISD_AND_MVT_i1_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1894  case MVT::i32: return fastEmit_ISD_AND_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1895  case MVT::i64: return fastEmit_ISD_AND_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1896  case MVT::v4i32: return fastEmit_ISD_AND_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1897  default: return 0;
1898  }
1899}
1900
1901// FastEmit functions for ISD::BUILD_VECTOR.
1902
1903unsigned fastEmit_ISD_BUILD_VECTOR_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1904  if (RetVT.SimpleTy != MVT::v2i64)
1905    return 0;
1906  if ((PPCSubTarget->hasDirectMove()) && (!PPCSubTarget->isLittleEndian()) && (PPCSubTarget->isISA3_0())) {
1907    return fastEmitInst_rr(PPC::MTVSRDD, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1908  }
1909  return 0;
1910}
1911
1912unsigned fastEmit_ISD_BUILD_VECTOR_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1913  switch (VT.SimpleTy) {
1914  case MVT::i64: return fastEmit_ISD_BUILD_VECTOR_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1915  default: return 0;
1916  }
1917}
1918
1919// FastEmit functions for ISD::FADD.
1920
1921unsigned fastEmit_ISD_FADD_MVT_f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1922  if (RetVT.SimpleTy != MVT::f32)
1923    return 0;
1924  if ((PPCSubTarget->hasP8Vector())) {
1925    return fastEmitInst_rr(PPC::XSADDSP, &PPC::VSSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1926  }
1927  if ((PPCSubTarget->hasSPE())) {
1928    return fastEmitInst_rr(PPC::EFSADD, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1929  }
1930  if ((PPCSubTarget->hasFPU())) {
1931    return fastEmitInst_rr(PPC::FADDS, &PPC::F4RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1932  }
1933  return 0;
1934}
1935
1936unsigned fastEmit_ISD_FADD_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1937  if (RetVT.SimpleTy != MVT::f64)
1938    return 0;
1939  if ((PPCSubTarget->hasVSX())) {
1940    return fastEmitInst_rr(PPC::XSADDDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1941  }
1942  if ((PPCSubTarget->hasSPE())) {
1943    return fastEmitInst_rr(PPC::EFDADD, &PPC::SPERCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1944  }
1945  if ((PPCSubTarget->hasFPU())) {
1946    return fastEmitInst_rr(PPC::FADD, &PPC::F8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1947  }
1948  return 0;
1949}
1950
1951unsigned fastEmit_ISD_FADD_MVT_f128_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1952  if (RetVT.SimpleTy != MVT::f128)
1953    return 0;
1954  if ((PPCSubTarget->hasP9Vector())) {
1955    return fastEmitInst_rr(PPC::XSADDQP, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1956  }
1957  return 0;
1958}
1959
1960unsigned fastEmit_ISD_FADD_MVT_v4f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1961  if (RetVT.SimpleTy != MVT::v4f32)
1962    return 0;
1963  if ((PPCSubTarget->hasVSX())) {
1964    return fastEmitInst_rr(PPC::XVADDSP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1965  }
1966  if ((PPCSubTarget->hasQPX())) {
1967    return fastEmitInst_rr(PPC::QVFADDSs, &PPC::QSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1968  }
1969  if ((PPCSubTarget->hasAltivec())) {
1970    return fastEmitInst_rr(PPC::VADDFP, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1971  }
1972  return 0;
1973}
1974
1975unsigned fastEmit_ISD_FADD_MVT_v2f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1976  if (RetVT.SimpleTy != MVT::v2f64)
1977    return 0;
1978  if ((PPCSubTarget->hasVSX())) {
1979    return fastEmitInst_rr(PPC::XVADDDP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1980  }
1981  return 0;
1982}
1983
1984unsigned fastEmit_ISD_FADD_MVT_v4f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1985  if (RetVT.SimpleTy != MVT::v4f64)
1986    return 0;
1987  if ((PPCSubTarget->hasQPX())) {
1988    return fastEmitInst_rr(PPC::QVFADD, &PPC::QFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
1989  }
1990  return 0;
1991}
1992
1993unsigned fastEmit_ISD_FADD_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
1994  switch (VT.SimpleTy) {
1995  case MVT::f32: return fastEmit_ISD_FADD_MVT_f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1996  case MVT::f64: return fastEmit_ISD_FADD_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1997  case MVT::f128: return fastEmit_ISD_FADD_MVT_f128_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1998  case MVT::v4f32: return fastEmit_ISD_FADD_MVT_v4f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
1999  case MVT::v2f64: return fastEmit_ISD_FADD_MVT_v2f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2000  case MVT::v4f64: return fastEmit_ISD_FADD_MVT_v4f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2001  default: return 0;
2002  }
2003}
2004
2005// FastEmit functions for ISD::FDIV.
2006
2007unsigned fastEmit_ISD_FDIV_MVT_f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2008  if (RetVT.SimpleTy != MVT::f32)
2009    return 0;
2010  if ((PPCSubTarget->hasP8Vector())) {
2011    return fastEmitInst_rr(PPC::XSDIVSP, &PPC::VSSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2012  }
2013  if ((PPCSubTarget->hasSPE())) {
2014    return fastEmitInst_rr(PPC::EFSDIV, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2015  }
2016  if ((PPCSubTarget->hasFPU())) {
2017    return fastEmitInst_rr(PPC::FDIVS, &PPC::F4RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2018  }
2019  return 0;
2020}
2021
2022unsigned fastEmit_ISD_FDIV_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2023  if (RetVT.SimpleTy != MVT::f64)
2024    return 0;
2025  if ((PPCSubTarget->hasVSX())) {
2026    return fastEmitInst_rr(PPC::XSDIVDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2027  }
2028  if ((PPCSubTarget->hasSPE())) {
2029    return fastEmitInst_rr(PPC::EFDDIV, &PPC::SPERCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2030  }
2031  if ((PPCSubTarget->hasFPU())) {
2032    return fastEmitInst_rr(PPC::FDIV, &PPC::F8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2033  }
2034  return 0;
2035}
2036
2037unsigned fastEmit_ISD_FDIV_MVT_f128_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2038  if (RetVT.SimpleTy != MVT::f128)
2039    return 0;
2040  if ((PPCSubTarget->hasP9Vector())) {
2041    return fastEmitInst_rr(PPC::XSDIVQP, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2042  }
2043  return 0;
2044}
2045
2046unsigned fastEmit_ISD_FDIV_MVT_v4f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2047  if (RetVT.SimpleTy != MVT::v4f32)
2048    return 0;
2049  if ((PPCSubTarget->hasVSX())) {
2050    return fastEmitInst_rr(PPC::XVDIVSP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2051  }
2052  return 0;
2053}
2054
2055unsigned fastEmit_ISD_FDIV_MVT_v2f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2056  if (RetVT.SimpleTy != MVT::v2f64)
2057    return 0;
2058  if ((PPCSubTarget->hasVSX())) {
2059    return fastEmitInst_rr(PPC::XVDIVDP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2060  }
2061  return 0;
2062}
2063
2064unsigned fastEmit_ISD_FDIV_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2065  switch (VT.SimpleTy) {
2066  case MVT::f32: return fastEmit_ISD_FDIV_MVT_f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2067  case MVT::f64: return fastEmit_ISD_FDIV_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2068  case MVT::f128: return fastEmit_ISD_FDIV_MVT_f128_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2069  case MVT::v4f32: return fastEmit_ISD_FDIV_MVT_v4f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2070  case MVT::v2f64: return fastEmit_ISD_FDIV_MVT_v2f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2071  default: return 0;
2072  }
2073}
2074
2075// FastEmit functions for ISD::FMAXNUM.
2076
2077unsigned fastEmit_ISD_FMAXNUM_MVT_v4f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2078  if (RetVT.SimpleTy != MVT::v4f32)
2079    return 0;
2080  if ((PPCSubTarget->hasVSX())) {
2081    return fastEmitInst_rr(PPC::XVMAXSP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2082  }
2083  return 0;
2084}
2085
2086unsigned fastEmit_ISD_FMAXNUM_MVT_v2f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2087  if (RetVT.SimpleTy != MVT::v2f64)
2088    return 0;
2089  if ((PPCSubTarget->hasVSX())) {
2090    return fastEmitInst_rr(PPC::XVMAXDP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2091  }
2092  return 0;
2093}
2094
2095unsigned fastEmit_ISD_FMAXNUM_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2096  switch (VT.SimpleTy) {
2097  case MVT::v4f32: return fastEmit_ISD_FMAXNUM_MVT_v4f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2098  case MVT::v2f64: return fastEmit_ISD_FMAXNUM_MVT_v2f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2099  default: return 0;
2100  }
2101}
2102
2103// FastEmit functions for ISD::FMAXNUM_IEEE.
2104
2105unsigned fastEmit_ISD_FMAXNUM_IEEE_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2106  if (RetVT.SimpleTy != MVT::f64)
2107    return 0;
2108  if ((PPCSubTarget->hasVSX())) {
2109    return fastEmitInst_rr(PPC::XSMAXDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2110  }
2111  return 0;
2112}
2113
2114unsigned fastEmit_ISD_FMAXNUM_IEEE_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2115  switch (VT.SimpleTy) {
2116  case MVT::f64: return fastEmit_ISD_FMAXNUM_IEEE_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2117  default: return 0;
2118  }
2119}
2120
2121// FastEmit functions for ISD::FMINNUM.
2122
2123unsigned fastEmit_ISD_FMINNUM_MVT_v4f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2124  if (RetVT.SimpleTy != MVT::v4f32)
2125    return 0;
2126  if ((PPCSubTarget->hasVSX())) {
2127    return fastEmitInst_rr(PPC::XVMINSP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2128  }
2129  return 0;
2130}
2131
2132unsigned fastEmit_ISD_FMINNUM_MVT_v2f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2133  if (RetVT.SimpleTy != MVT::v2f64)
2134    return 0;
2135  if ((PPCSubTarget->hasVSX())) {
2136    return fastEmitInst_rr(PPC::XVMINDP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2137  }
2138  return 0;
2139}
2140
2141unsigned fastEmit_ISD_FMINNUM_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2142  switch (VT.SimpleTy) {
2143  case MVT::v4f32: return fastEmit_ISD_FMINNUM_MVT_v4f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2144  case MVT::v2f64: return fastEmit_ISD_FMINNUM_MVT_v2f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2145  default: return 0;
2146  }
2147}
2148
2149// FastEmit functions for ISD::FMINNUM_IEEE.
2150
2151unsigned fastEmit_ISD_FMINNUM_IEEE_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2152  if (RetVT.SimpleTy != MVT::f64)
2153    return 0;
2154  if ((PPCSubTarget->hasVSX())) {
2155    return fastEmitInst_rr(PPC::XSMINDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2156  }
2157  return 0;
2158}
2159
2160unsigned fastEmit_ISD_FMINNUM_IEEE_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2161  switch (VT.SimpleTy) {
2162  case MVT::f64: return fastEmit_ISD_FMINNUM_IEEE_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2163  default: return 0;
2164  }
2165}
2166
2167// FastEmit functions for ISD::FMUL.
2168
2169unsigned fastEmit_ISD_FMUL_MVT_f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2170  if (RetVT.SimpleTy != MVT::f32)
2171    return 0;
2172  if ((PPCSubTarget->hasP8Vector())) {
2173    return fastEmitInst_rr(PPC::XSMULSP, &PPC::VSSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2174  }
2175  if ((PPCSubTarget->hasSPE())) {
2176    return fastEmitInst_rr(PPC::EFSMUL, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2177  }
2178  if ((PPCSubTarget->hasFPU())) {
2179    return fastEmitInst_rr(PPC::FMULS, &PPC::F4RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2180  }
2181  return 0;
2182}
2183
2184unsigned fastEmit_ISD_FMUL_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2185  if (RetVT.SimpleTy != MVT::f64)
2186    return 0;
2187  if ((PPCSubTarget->hasVSX())) {
2188    return fastEmitInst_rr(PPC::XSMULDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2189  }
2190  if ((PPCSubTarget->hasSPE())) {
2191    return fastEmitInst_rr(PPC::EFDMUL, &PPC::SPERCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2192  }
2193  if ((PPCSubTarget->hasFPU())) {
2194    return fastEmitInst_rr(PPC::FMUL, &PPC::F8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2195  }
2196  return 0;
2197}
2198
2199unsigned fastEmit_ISD_FMUL_MVT_f128_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2200  if (RetVT.SimpleTy != MVT::f128)
2201    return 0;
2202  if ((PPCSubTarget->hasP9Vector())) {
2203    return fastEmitInst_rr(PPC::XSMULQP, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2204  }
2205  return 0;
2206}
2207
2208unsigned fastEmit_ISD_FMUL_MVT_v4f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2209  if (RetVT.SimpleTy != MVT::v4f32)
2210    return 0;
2211  if ((PPCSubTarget->hasVSX())) {
2212    return fastEmitInst_rr(PPC::XVMULSP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2213  }
2214  if ((PPCSubTarget->hasQPX())) {
2215    return fastEmitInst_rr(PPC::QVFMULSs, &PPC::QSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2216  }
2217  return 0;
2218}
2219
2220unsigned fastEmit_ISD_FMUL_MVT_v2f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2221  if (RetVT.SimpleTy != MVT::v2f64)
2222    return 0;
2223  if ((PPCSubTarget->hasVSX())) {
2224    return fastEmitInst_rr(PPC::XVMULDP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2225  }
2226  return 0;
2227}
2228
2229unsigned fastEmit_ISD_FMUL_MVT_v4f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2230  if (RetVT.SimpleTy != MVT::v4f64)
2231    return 0;
2232  if ((PPCSubTarget->hasQPX())) {
2233    return fastEmitInst_rr(PPC::QVFMUL, &PPC::QFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2234  }
2235  return 0;
2236}
2237
2238unsigned fastEmit_ISD_FMUL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2239  switch (VT.SimpleTy) {
2240  case MVT::f32: return fastEmit_ISD_FMUL_MVT_f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2241  case MVT::f64: return fastEmit_ISD_FMUL_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2242  case MVT::f128: return fastEmit_ISD_FMUL_MVT_f128_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2243  case MVT::v4f32: return fastEmit_ISD_FMUL_MVT_v4f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2244  case MVT::v2f64: return fastEmit_ISD_FMUL_MVT_v2f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2245  case MVT::v4f64: return fastEmit_ISD_FMUL_MVT_v4f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2246  default: return 0;
2247  }
2248}
2249
2250// FastEmit functions for ISD::FSUB.
2251
2252unsigned fastEmit_ISD_FSUB_MVT_f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2253  if (RetVT.SimpleTy != MVT::f32)
2254    return 0;
2255  if ((PPCSubTarget->hasP8Vector())) {
2256    return fastEmitInst_rr(PPC::XSSUBSP, &PPC::VSSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2257  }
2258  if ((PPCSubTarget->hasSPE())) {
2259    return fastEmitInst_rr(PPC::EFSSUB, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2260  }
2261  if ((PPCSubTarget->hasFPU())) {
2262    return fastEmitInst_rr(PPC::FSUBS, &PPC::F4RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2263  }
2264  return 0;
2265}
2266
2267unsigned fastEmit_ISD_FSUB_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2268  if (RetVT.SimpleTy != MVT::f64)
2269    return 0;
2270  if ((PPCSubTarget->hasVSX())) {
2271    return fastEmitInst_rr(PPC::XSSUBDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2272  }
2273  if ((PPCSubTarget->hasSPE())) {
2274    return fastEmitInst_rr(PPC::EFDSUB, &PPC::SPERCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2275  }
2276  if ((PPCSubTarget->hasFPU())) {
2277    return fastEmitInst_rr(PPC::FSUB, &PPC::F8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2278  }
2279  return 0;
2280}
2281
2282unsigned fastEmit_ISD_FSUB_MVT_f128_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2283  if (RetVT.SimpleTy != MVT::f128)
2284    return 0;
2285  if ((PPCSubTarget->hasP9Vector())) {
2286    return fastEmitInst_rr(PPC::XSSUBQP, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2287  }
2288  return 0;
2289}
2290
2291unsigned fastEmit_ISD_FSUB_MVT_v4f32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2292  if (RetVT.SimpleTy != MVT::v4f32)
2293    return 0;
2294  if ((PPCSubTarget->hasVSX())) {
2295    return fastEmitInst_rr(PPC::XVSUBSP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2296  }
2297  if ((PPCSubTarget->hasQPX())) {
2298    return fastEmitInst_rr(PPC::QVFSUBSs, &PPC::QSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2299  }
2300  if ((PPCSubTarget->hasAltivec())) {
2301    return fastEmitInst_rr(PPC::VSUBFP, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2302  }
2303  return 0;
2304}
2305
2306unsigned fastEmit_ISD_FSUB_MVT_v2f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2307  if (RetVT.SimpleTy != MVT::v2f64)
2308    return 0;
2309  if ((PPCSubTarget->hasVSX())) {
2310    return fastEmitInst_rr(PPC::XVSUBDP, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2311  }
2312  return 0;
2313}
2314
2315unsigned fastEmit_ISD_FSUB_MVT_v4f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2316  if (RetVT.SimpleTy != MVT::v4f64)
2317    return 0;
2318  if ((PPCSubTarget->hasQPX())) {
2319    return fastEmitInst_rr(PPC::QVFSUB, &PPC::QFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2320  }
2321  return 0;
2322}
2323
2324unsigned fastEmit_ISD_FSUB_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2325  switch (VT.SimpleTy) {
2326  case MVT::f32: return fastEmit_ISD_FSUB_MVT_f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2327  case MVT::f64: return fastEmit_ISD_FSUB_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2328  case MVT::f128: return fastEmit_ISD_FSUB_MVT_f128_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2329  case MVT::v4f32: return fastEmit_ISD_FSUB_MVT_v4f32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2330  case MVT::v2f64: return fastEmit_ISD_FSUB_MVT_v2f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2331  case MVT::v4f64: return fastEmit_ISD_FSUB_MVT_v4f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2332  default: return 0;
2333  }
2334}
2335
2336// FastEmit functions for ISD::MUL.
2337
2338unsigned fastEmit_ISD_MUL_MVT_i1_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2339  if (RetVT.SimpleTy != MVT::i1)
2340    return 0;
2341  return fastEmitInst_rr(PPC::CRAND, &PPC::CRBITRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2342}
2343
2344unsigned fastEmit_ISD_MUL_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2345  if (RetVT.SimpleTy != MVT::i32)
2346    return 0;
2347  return fastEmitInst_rr(PPC::MULLW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2348}
2349
2350unsigned fastEmit_ISD_MUL_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2351  if (RetVT.SimpleTy != MVT::i64)
2352    return 0;
2353  return fastEmitInst_rr(PPC::MULLD, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2354}
2355
2356unsigned fastEmit_ISD_MUL_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2357  if (RetVT.SimpleTy != MVT::v4i32)
2358    return 0;
2359  if ((PPCSubTarget->hasP8Altivec())) {
2360    return fastEmitInst_rr(PPC::VMULUWM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2361  }
2362  return 0;
2363}
2364
2365unsigned fastEmit_ISD_MUL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2366  switch (VT.SimpleTy) {
2367  case MVT::i1: return fastEmit_ISD_MUL_MVT_i1_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2368  case MVT::i32: return fastEmit_ISD_MUL_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2369  case MVT::i64: return fastEmit_ISD_MUL_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2370  case MVT::v4i32: return fastEmit_ISD_MUL_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2371  default: return 0;
2372  }
2373}
2374
2375// FastEmit functions for ISD::MULHS.
2376
2377unsigned fastEmit_ISD_MULHS_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2378  if (RetVT.SimpleTy != MVT::i32)
2379    return 0;
2380  return fastEmitInst_rr(PPC::MULHW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2381}
2382
2383unsigned fastEmit_ISD_MULHS_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2384  if (RetVT.SimpleTy != MVT::i64)
2385    return 0;
2386  return fastEmitInst_rr(PPC::MULHD, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2387}
2388
2389unsigned fastEmit_ISD_MULHS_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2390  switch (VT.SimpleTy) {
2391  case MVT::i32: return fastEmit_ISD_MULHS_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2392  case MVT::i64: return fastEmit_ISD_MULHS_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2393  default: return 0;
2394  }
2395}
2396
2397// FastEmit functions for ISD::MULHU.
2398
2399unsigned fastEmit_ISD_MULHU_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2400  if (RetVT.SimpleTy != MVT::i32)
2401    return 0;
2402  return fastEmitInst_rr(PPC::MULHWU, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2403}
2404
2405unsigned fastEmit_ISD_MULHU_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2406  if (RetVT.SimpleTy != MVT::i64)
2407    return 0;
2408  return fastEmitInst_rr(PPC::MULHDU, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2409}
2410
2411unsigned fastEmit_ISD_MULHU_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2412  switch (VT.SimpleTy) {
2413  case MVT::i32: return fastEmit_ISD_MULHU_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2414  case MVT::i64: return fastEmit_ISD_MULHU_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2415  default: return 0;
2416  }
2417}
2418
2419// FastEmit functions for ISD::OR.
2420
2421unsigned fastEmit_ISD_OR_MVT_i1_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2422  if (RetVT.SimpleTy != MVT::i1)
2423    return 0;
2424  return fastEmitInst_rr(PPC::CROR, &PPC::CRBITRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2425}
2426
2427unsigned fastEmit_ISD_OR_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2428  if (RetVT.SimpleTy != MVT::i32)
2429    return 0;
2430  return fastEmitInst_rr(PPC::OR, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2431}
2432
2433unsigned fastEmit_ISD_OR_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2434  if (RetVT.SimpleTy != MVT::i64)
2435    return 0;
2436  return fastEmitInst_rr(PPC::OR8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2437}
2438
2439unsigned fastEmit_ISD_OR_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2440  if (RetVT.SimpleTy != MVT::v4i32)
2441    return 0;
2442  if ((PPCSubTarget->hasVSX())) {
2443    return fastEmitInst_rr(PPC::XXLOR, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2444  }
2445  if ((PPCSubTarget->hasAltivec())) {
2446    return fastEmitInst_rr(PPC::VOR, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2447  }
2448  return 0;
2449}
2450
2451unsigned fastEmit_ISD_OR_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2452  switch (VT.SimpleTy) {
2453  case MVT::i1: return fastEmit_ISD_OR_MVT_i1_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2454  case MVT::i32: return fastEmit_ISD_OR_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2455  case MVT::i64: return fastEmit_ISD_OR_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2456  case MVT::v4i32: return fastEmit_ISD_OR_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2457  default: return 0;
2458  }
2459}
2460
2461// FastEmit functions for ISD::ROTL.
2462
2463unsigned fastEmit_ISD_ROTL_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2464  if (RetVT.SimpleTy != MVT::v16i8)
2465    return 0;
2466  if ((PPCSubTarget->hasAltivec())) {
2467    return fastEmitInst_rr(PPC::VRLB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2468  }
2469  return 0;
2470}
2471
2472unsigned fastEmit_ISD_ROTL_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2473  if (RetVT.SimpleTy != MVT::v8i16)
2474    return 0;
2475  if ((PPCSubTarget->hasAltivec())) {
2476    return fastEmitInst_rr(PPC::VRLH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2477  }
2478  return 0;
2479}
2480
2481unsigned fastEmit_ISD_ROTL_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2482  if (RetVT.SimpleTy != MVT::v4i32)
2483    return 0;
2484  if ((PPCSubTarget->hasAltivec())) {
2485    return fastEmitInst_rr(PPC::VRLW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2486  }
2487  return 0;
2488}
2489
2490unsigned fastEmit_ISD_ROTL_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2491  if (RetVT.SimpleTy != MVT::v2i64)
2492    return 0;
2493  if ((PPCSubTarget->hasP8Altivec())) {
2494    return fastEmitInst_rr(PPC::VRLD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2495  }
2496  return 0;
2497}
2498
2499unsigned fastEmit_ISD_ROTL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2500  switch (VT.SimpleTy) {
2501  case MVT::v16i8: return fastEmit_ISD_ROTL_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2502  case MVT::v8i16: return fastEmit_ISD_ROTL_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2503  case MVT::v4i32: return fastEmit_ISD_ROTL_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2504  case MVT::v2i64: return fastEmit_ISD_ROTL_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2505  default: return 0;
2506  }
2507}
2508
2509// FastEmit functions for ISD::SDIV.
2510
2511unsigned fastEmit_ISD_SDIV_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2512  if (RetVT.SimpleTy != MVT::i32)
2513    return 0;
2514  return fastEmitInst_rr(PPC::DIVW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2515}
2516
2517unsigned fastEmit_ISD_SDIV_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2518  if (RetVT.SimpleTy != MVT::i64)
2519    return 0;
2520  return fastEmitInst_rr(PPC::DIVD, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2521}
2522
2523unsigned fastEmit_ISD_SDIV_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2524  switch (VT.SimpleTy) {
2525  case MVT::i32: return fastEmit_ISD_SDIV_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2526  case MVT::i64: return fastEmit_ISD_SDIV_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2527  default: return 0;
2528  }
2529}
2530
2531// FastEmit functions for ISD::SHL.
2532
2533unsigned fastEmit_ISD_SHL_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2534  if (RetVT.SimpleTy != MVT::i32)
2535    return 0;
2536  return fastEmitInst_rr(PPC::SLW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2537}
2538
2539unsigned fastEmit_ISD_SHL_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2540  if (RetVT.SimpleTy != MVT::v16i8)
2541    return 0;
2542  if ((PPCSubTarget->hasAltivec())) {
2543    return fastEmitInst_rr(PPC::VSLB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2544  }
2545  return 0;
2546}
2547
2548unsigned fastEmit_ISD_SHL_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2549  if (RetVT.SimpleTy != MVT::v8i16)
2550    return 0;
2551  if ((PPCSubTarget->hasAltivec())) {
2552    return fastEmitInst_rr(PPC::VSLH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2553  }
2554  return 0;
2555}
2556
2557unsigned fastEmit_ISD_SHL_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2558  if (RetVT.SimpleTy != MVT::v4i32)
2559    return 0;
2560  if ((PPCSubTarget->hasAltivec())) {
2561    return fastEmitInst_rr(PPC::VSLW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2562  }
2563  return 0;
2564}
2565
2566unsigned fastEmit_ISD_SHL_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2567  if (RetVT.SimpleTy != MVT::v2i64)
2568    return 0;
2569  if ((PPCSubTarget->hasP8Altivec())) {
2570    return fastEmitInst_rr(PPC::VSLD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2571  }
2572  return 0;
2573}
2574
2575unsigned fastEmit_ISD_SHL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2576  switch (VT.SimpleTy) {
2577  case MVT::i32: return fastEmit_ISD_SHL_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2578  case MVT::v16i8: return fastEmit_ISD_SHL_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2579  case MVT::v8i16: return fastEmit_ISD_SHL_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2580  case MVT::v4i32: return fastEmit_ISD_SHL_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2581  case MVT::v2i64: return fastEmit_ISD_SHL_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2582  default: return 0;
2583  }
2584}
2585
2586// FastEmit functions for ISD::SMAX.
2587
2588unsigned fastEmit_ISD_SMAX_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2589  if (RetVT.SimpleTy != MVT::v16i8)
2590    return 0;
2591  if ((PPCSubTarget->hasAltivec())) {
2592    return fastEmitInst_rr(PPC::VMAXSB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2593  }
2594  return 0;
2595}
2596
2597unsigned fastEmit_ISD_SMAX_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2598  if (RetVT.SimpleTy != MVT::v8i16)
2599    return 0;
2600  if ((PPCSubTarget->hasAltivec())) {
2601    return fastEmitInst_rr(PPC::VMAXSH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2602  }
2603  return 0;
2604}
2605
2606unsigned fastEmit_ISD_SMAX_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2607  if (RetVT.SimpleTy != MVT::v4i32)
2608    return 0;
2609  if ((PPCSubTarget->hasAltivec())) {
2610    return fastEmitInst_rr(PPC::VMAXSW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2611  }
2612  return 0;
2613}
2614
2615unsigned fastEmit_ISD_SMAX_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2616  switch (VT.SimpleTy) {
2617  case MVT::v16i8: return fastEmit_ISD_SMAX_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2618  case MVT::v8i16: return fastEmit_ISD_SMAX_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2619  case MVT::v4i32: return fastEmit_ISD_SMAX_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2620  default: return 0;
2621  }
2622}
2623
2624// FastEmit functions for ISD::SMIN.
2625
2626unsigned fastEmit_ISD_SMIN_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2627  if (RetVT.SimpleTy != MVT::v16i8)
2628    return 0;
2629  if ((PPCSubTarget->hasAltivec())) {
2630    return fastEmitInst_rr(PPC::VMINSB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2631  }
2632  return 0;
2633}
2634
2635unsigned fastEmit_ISD_SMIN_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2636  if (RetVT.SimpleTy != MVT::v8i16)
2637    return 0;
2638  if ((PPCSubTarget->hasAltivec())) {
2639    return fastEmitInst_rr(PPC::VMINSH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2640  }
2641  return 0;
2642}
2643
2644unsigned fastEmit_ISD_SMIN_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2645  if (RetVT.SimpleTy != MVT::v4i32)
2646    return 0;
2647  if ((PPCSubTarget->hasAltivec())) {
2648    return fastEmitInst_rr(PPC::VMINSW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2649  }
2650  return 0;
2651}
2652
2653unsigned fastEmit_ISD_SMIN_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2654  switch (VT.SimpleTy) {
2655  case MVT::v16i8: return fastEmit_ISD_SMIN_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2656  case MVT::v8i16: return fastEmit_ISD_SMIN_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2657  case MVT::v4i32: return fastEmit_ISD_SMIN_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2658  default: return 0;
2659  }
2660}
2661
2662// FastEmit functions for ISD::SRA.
2663
2664unsigned fastEmit_ISD_SRA_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2665  if (RetVT.SimpleTy != MVT::i32)
2666    return 0;
2667  return fastEmitInst_rr(PPC::SRAW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2668}
2669
2670unsigned fastEmit_ISD_SRA_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2671  if (RetVT.SimpleTy != MVT::v16i8)
2672    return 0;
2673  if ((PPCSubTarget->hasAltivec())) {
2674    return fastEmitInst_rr(PPC::VSRAB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2675  }
2676  return 0;
2677}
2678
2679unsigned fastEmit_ISD_SRA_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2680  if (RetVT.SimpleTy != MVT::v8i16)
2681    return 0;
2682  if ((PPCSubTarget->hasAltivec())) {
2683    return fastEmitInst_rr(PPC::VSRAH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2684  }
2685  return 0;
2686}
2687
2688unsigned fastEmit_ISD_SRA_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2689  if (RetVT.SimpleTy != MVT::v4i32)
2690    return 0;
2691  if ((PPCSubTarget->hasAltivec())) {
2692    return fastEmitInst_rr(PPC::VSRAW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2693  }
2694  return 0;
2695}
2696
2697unsigned fastEmit_ISD_SRA_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2698  if (RetVT.SimpleTy != MVT::v2i64)
2699    return 0;
2700  if ((PPCSubTarget->hasP8Altivec())) {
2701    return fastEmitInst_rr(PPC::VSRAD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2702  }
2703  return 0;
2704}
2705
2706unsigned fastEmit_ISD_SRA_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2707  switch (VT.SimpleTy) {
2708  case MVT::i32: return fastEmit_ISD_SRA_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2709  case MVT::v16i8: return fastEmit_ISD_SRA_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2710  case MVT::v8i16: return fastEmit_ISD_SRA_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2711  case MVT::v4i32: return fastEmit_ISD_SRA_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2712  case MVT::v2i64: return fastEmit_ISD_SRA_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2713  default: return 0;
2714  }
2715}
2716
2717// FastEmit functions for ISD::SREM.
2718
2719unsigned fastEmit_ISD_SREM_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2720  if (RetVT.SimpleTy != MVT::i32)
2721    return 0;
2722  if ((PPCSubTarget->isISA3_0())) {
2723    return fastEmitInst_rr(PPC::MODSW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2724  }
2725  return 0;
2726}
2727
2728unsigned fastEmit_ISD_SREM_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2729  if (RetVT.SimpleTy != MVT::i64)
2730    return 0;
2731  if ((PPCSubTarget->isISA3_0())) {
2732    return fastEmitInst_rr(PPC::MODSD, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2733  }
2734  return 0;
2735}
2736
2737unsigned fastEmit_ISD_SREM_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2738  switch (VT.SimpleTy) {
2739  case MVT::i32: return fastEmit_ISD_SREM_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2740  case MVT::i64: return fastEmit_ISD_SREM_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2741  default: return 0;
2742  }
2743}
2744
2745// FastEmit functions for ISD::SRL.
2746
2747unsigned fastEmit_ISD_SRL_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2748  if (RetVT.SimpleTy != MVT::i32)
2749    return 0;
2750  return fastEmitInst_rr(PPC::SRW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2751}
2752
2753unsigned fastEmit_ISD_SRL_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2754  if (RetVT.SimpleTy != MVT::v16i8)
2755    return 0;
2756  if ((PPCSubTarget->hasAltivec())) {
2757    return fastEmitInst_rr(PPC::VSRB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2758  }
2759  return 0;
2760}
2761
2762unsigned fastEmit_ISD_SRL_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2763  if (RetVT.SimpleTy != MVT::v8i16)
2764    return 0;
2765  if ((PPCSubTarget->hasAltivec())) {
2766    return fastEmitInst_rr(PPC::VSRH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2767  }
2768  return 0;
2769}
2770
2771unsigned fastEmit_ISD_SRL_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2772  if (RetVT.SimpleTy != MVT::v4i32)
2773    return 0;
2774  if ((PPCSubTarget->hasAltivec())) {
2775    return fastEmitInst_rr(PPC::VSRW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2776  }
2777  return 0;
2778}
2779
2780unsigned fastEmit_ISD_SRL_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2781  if (RetVT.SimpleTy != MVT::v2i64)
2782    return 0;
2783  if ((PPCSubTarget->hasP8Altivec())) {
2784    return fastEmitInst_rr(PPC::VSRD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2785  }
2786  return 0;
2787}
2788
2789unsigned fastEmit_ISD_SRL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2790  switch (VT.SimpleTy) {
2791  case MVT::i32: return fastEmit_ISD_SRL_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2792  case MVT::v16i8: return fastEmit_ISD_SRL_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2793  case MVT::v8i16: return fastEmit_ISD_SRL_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2794  case MVT::v4i32: return fastEmit_ISD_SRL_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2795  case MVT::v2i64: return fastEmit_ISD_SRL_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2796  default: return 0;
2797  }
2798}
2799
2800// FastEmit functions for ISD::SUB.
2801
2802unsigned fastEmit_ISD_SUB_MVT_i1_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2803  if (RetVT.SimpleTy != MVT::i1)
2804    return 0;
2805  return fastEmitInst_rr(PPC::CRXOR, &PPC::CRBITRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2806}
2807
2808unsigned fastEmit_ISD_SUB_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2809  if (RetVT.SimpleTy != MVT::v16i8)
2810    return 0;
2811  if ((PPCSubTarget->hasAltivec())) {
2812    return fastEmitInst_rr(PPC::VSUBUBM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2813  }
2814  return 0;
2815}
2816
2817unsigned fastEmit_ISD_SUB_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2818  if (RetVT.SimpleTy != MVT::v8i16)
2819    return 0;
2820  if ((PPCSubTarget->hasAltivec())) {
2821    return fastEmitInst_rr(PPC::VSUBUHM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2822  }
2823  return 0;
2824}
2825
2826unsigned fastEmit_ISD_SUB_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2827  if (RetVT.SimpleTy != MVT::v4i32)
2828    return 0;
2829  if ((PPCSubTarget->hasAltivec())) {
2830    return fastEmitInst_rr(PPC::VSUBUWM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2831  }
2832  return 0;
2833}
2834
2835unsigned fastEmit_ISD_SUB_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2836  if (RetVT.SimpleTy != MVT::v2i64)
2837    return 0;
2838  if ((PPCSubTarget->hasP8Altivec())) {
2839    return fastEmitInst_rr(PPC::VSUBUDM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2840  }
2841  return 0;
2842}
2843
2844unsigned fastEmit_ISD_SUB_MVT_v1i128_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2845  if (RetVT.SimpleTy != MVT::v1i128)
2846    return 0;
2847  if ((PPCSubTarget->hasP8Altivec())) {
2848    return fastEmitInst_rr(PPC::VSUBUQM, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2849  }
2850  return 0;
2851}
2852
2853unsigned fastEmit_ISD_SUB_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2854  switch (VT.SimpleTy) {
2855  case MVT::i1: return fastEmit_ISD_SUB_MVT_i1_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2856  case MVT::v16i8: return fastEmit_ISD_SUB_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2857  case MVT::v8i16: return fastEmit_ISD_SUB_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2858  case MVT::v4i32: return fastEmit_ISD_SUB_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2859  case MVT::v2i64: return fastEmit_ISD_SUB_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2860  case MVT::v1i128: return fastEmit_ISD_SUB_MVT_v1i128_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2861  default: return 0;
2862  }
2863}
2864
2865// FastEmit functions for ISD::UDIV.
2866
2867unsigned fastEmit_ISD_UDIV_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2868  if (RetVT.SimpleTy != MVT::i32)
2869    return 0;
2870  return fastEmitInst_rr(PPC::DIVWU, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2871}
2872
2873unsigned fastEmit_ISD_UDIV_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2874  if (RetVT.SimpleTy != MVT::i64)
2875    return 0;
2876  return fastEmitInst_rr(PPC::DIVDU, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2877}
2878
2879unsigned fastEmit_ISD_UDIV_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2880  switch (VT.SimpleTy) {
2881  case MVT::i32: return fastEmit_ISD_UDIV_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2882  case MVT::i64: return fastEmit_ISD_UDIV_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2883  default: return 0;
2884  }
2885}
2886
2887// FastEmit functions for ISD::UMAX.
2888
2889unsigned fastEmit_ISD_UMAX_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2890  if (RetVT.SimpleTy != MVT::v16i8)
2891    return 0;
2892  if ((PPCSubTarget->hasAltivec())) {
2893    return fastEmitInst_rr(PPC::VMAXUB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2894  }
2895  return 0;
2896}
2897
2898unsigned fastEmit_ISD_UMAX_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2899  if (RetVT.SimpleTy != MVT::v8i16)
2900    return 0;
2901  if ((PPCSubTarget->hasAltivec())) {
2902    return fastEmitInst_rr(PPC::VMAXUH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2903  }
2904  return 0;
2905}
2906
2907unsigned fastEmit_ISD_UMAX_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2908  if (RetVT.SimpleTy != MVT::v4i32)
2909    return 0;
2910  if ((PPCSubTarget->hasAltivec())) {
2911    return fastEmitInst_rr(PPC::VMAXUW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2912  }
2913  return 0;
2914}
2915
2916unsigned fastEmit_ISD_UMAX_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2917  switch (VT.SimpleTy) {
2918  case MVT::v16i8: return fastEmit_ISD_UMAX_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2919  case MVT::v8i16: return fastEmit_ISD_UMAX_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2920  case MVT::v4i32: return fastEmit_ISD_UMAX_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2921  default: return 0;
2922  }
2923}
2924
2925// FastEmit functions for ISD::UMIN.
2926
2927unsigned fastEmit_ISD_UMIN_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2928  if (RetVT.SimpleTy != MVT::v16i8)
2929    return 0;
2930  if ((PPCSubTarget->hasAltivec())) {
2931    return fastEmitInst_rr(PPC::VMINUB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2932  }
2933  return 0;
2934}
2935
2936unsigned fastEmit_ISD_UMIN_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2937  if (RetVT.SimpleTy != MVT::v8i16)
2938    return 0;
2939  if ((PPCSubTarget->hasAltivec())) {
2940    return fastEmitInst_rr(PPC::VMINUH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2941  }
2942  return 0;
2943}
2944
2945unsigned fastEmit_ISD_UMIN_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2946  if (RetVT.SimpleTy != MVT::v4i32)
2947    return 0;
2948  if ((PPCSubTarget->hasAltivec())) {
2949    return fastEmitInst_rr(PPC::VMINUW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2950  }
2951  return 0;
2952}
2953
2954unsigned fastEmit_ISD_UMIN_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2955  switch (VT.SimpleTy) {
2956  case MVT::v16i8: return fastEmit_ISD_UMIN_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2957  case MVT::v8i16: return fastEmit_ISD_UMIN_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2958  case MVT::v4i32: return fastEmit_ISD_UMIN_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2959  default: return 0;
2960  }
2961}
2962
2963// FastEmit functions for ISD::UREM.
2964
2965unsigned fastEmit_ISD_UREM_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2966  if (RetVT.SimpleTy != MVT::i32)
2967    return 0;
2968  if ((PPCSubTarget->isISA3_0())) {
2969    return fastEmitInst_rr(PPC::MODUW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2970  }
2971  return 0;
2972}
2973
2974unsigned fastEmit_ISD_UREM_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2975  if (RetVT.SimpleTy != MVT::i64)
2976    return 0;
2977  if ((PPCSubTarget->isISA3_0())) {
2978    return fastEmitInst_rr(PPC::MODUD, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2979  }
2980  return 0;
2981}
2982
2983unsigned fastEmit_ISD_UREM_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2984  switch (VT.SimpleTy) {
2985  case MVT::i32: return fastEmit_ISD_UREM_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2986  case MVT::i64: return fastEmit_ISD_UREM_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
2987  default: return 0;
2988  }
2989}
2990
2991// FastEmit functions for ISD::XOR.
2992
2993unsigned fastEmit_ISD_XOR_MVT_i1_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
2994  if (RetVT.SimpleTy != MVT::i1)
2995    return 0;
2996  return fastEmitInst_rr(PPC::CRXOR, &PPC::CRBITRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
2997}
2998
2999unsigned fastEmit_ISD_XOR_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3000  if (RetVT.SimpleTy != MVT::i32)
3001    return 0;
3002  return fastEmitInst_rr(PPC::XOR, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3003}
3004
3005unsigned fastEmit_ISD_XOR_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3006  if (RetVT.SimpleTy != MVT::i64)
3007    return 0;
3008  return fastEmitInst_rr(PPC::XOR8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3009}
3010
3011unsigned fastEmit_ISD_XOR_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3012  if (RetVT.SimpleTy != MVT::v4i32)
3013    return 0;
3014  if ((PPCSubTarget->hasVSX())) {
3015    return fastEmitInst_rr(PPC::XXLXOR, &PPC::VSRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3016  }
3017  if ((PPCSubTarget->hasAltivec())) {
3018    return fastEmitInst_rr(PPC::VXOR, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3019  }
3020  return 0;
3021}
3022
3023unsigned fastEmit_ISD_XOR_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3024  switch (VT.SimpleTy) {
3025  case MVT::i1: return fastEmit_ISD_XOR_MVT_i1_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3026  case MVT::i32: return fastEmit_ISD_XOR_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3027  case MVT::i64: return fastEmit_ISD_XOR_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3028  case MVT::v4i32: return fastEmit_ISD_XOR_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3029  default: return 0;
3030  }
3031}
3032
3033// FastEmit functions for PPCISD::CMPB.
3034
3035unsigned fastEmit_PPCISD_CMPB_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3036  if (RetVT.SimpleTy != MVT::i32)
3037    return 0;
3038  return fastEmitInst_rr(PPC::CMPB, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3039}
3040
3041unsigned fastEmit_PPCISD_CMPB_MVT_i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3042  if (RetVT.SimpleTy != MVT::i64)
3043    return 0;
3044  return fastEmitInst_rr(PPC::CMPB8, &PPC::G8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3045}
3046
3047unsigned fastEmit_PPCISD_CMPB_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3048  switch (VT.SimpleTy) {
3049  case MVT::i32: return fastEmit_PPCISD_CMPB_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3050  case MVT::i64: return fastEmit_PPCISD_CMPB_MVT_i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3051  default: return 0;
3052  }
3053}
3054
3055// FastEmit functions for PPCISD::FADDRTZ.
3056
3057unsigned fastEmit_PPCISD_FADDRTZ_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3058  if (RetVT.SimpleTy != MVT::f64)
3059    return 0;
3060  if ((PPCSubTarget->hasFPU())) {
3061    return fastEmitInst_rr(PPC::FADDrtz, &PPC::F8RCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3062  }
3063  return 0;
3064}
3065
3066unsigned fastEmit_PPCISD_FADDRTZ_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3067  switch (VT.SimpleTy) {
3068  case MVT::f64: return fastEmit_PPCISD_FADDRTZ_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3069  default: return 0;
3070  }
3071}
3072
3073// FastEmit functions for PPCISD::SHL.
3074
3075unsigned fastEmit_PPCISD_SHL_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3076  if (RetVT.SimpleTy != MVT::i32)
3077    return 0;
3078  return fastEmitInst_rr(PPC::SLW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3079}
3080
3081unsigned fastEmit_PPCISD_SHL_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3082  if (RetVT.SimpleTy != MVT::v16i8)
3083    return 0;
3084  if ((PPCSubTarget->hasAltivec())) {
3085    return fastEmitInst_rr(PPC::VSLB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3086  }
3087  return 0;
3088}
3089
3090unsigned fastEmit_PPCISD_SHL_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3091  if (RetVT.SimpleTy != MVT::v8i16)
3092    return 0;
3093  if ((PPCSubTarget->hasAltivec())) {
3094    return fastEmitInst_rr(PPC::VSLH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3095  }
3096  return 0;
3097}
3098
3099unsigned fastEmit_PPCISD_SHL_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3100  if (RetVT.SimpleTy != MVT::v4i32)
3101    return 0;
3102  if ((PPCSubTarget->hasAltivec())) {
3103    return fastEmitInst_rr(PPC::VSLW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3104  }
3105  return 0;
3106}
3107
3108unsigned fastEmit_PPCISD_SHL_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3109  if (RetVT.SimpleTy != MVT::v2i64)
3110    return 0;
3111  if ((PPCSubTarget->hasP8Altivec())) {
3112    return fastEmitInst_rr(PPC::VSLD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3113  }
3114  return 0;
3115}
3116
3117unsigned fastEmit_PPCISD_SHL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3118  switch (VT.SimpleTy) {
3119  case MVT::i32: return fastEmit_PPCISD_SHL_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3120  case MVT::v16i8: return fastEmit_PPCISD_SHL_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3121  case MVT::v8i16: return fastEmit_PPCISD_SHL_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3122  case MVT::v4i32: return fastEmit_PPCISD_SHL_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3123  case MVT::v2i64: return fastEmit_PPCISD_SHL_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3124  default: return 0;
3125  }
3126}
3127
3128// FastEmit functions for PPCISD::SRA.
3129
3130unsigned fastEmit_PPCISD_SRA_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3131  if (RetVT.SimpleTy != MVT::i32)
3132    return 0;
3133  return fastEmitInst_rr(PPC::SRAW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3134}
3135
3136unsigned fastEmit_PPCISD_SRA_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3137  if (RetVT.SimpleTy != MVT::v16i8)
3138    return 0;
3139  if ((PPCSubTarget->hasAltivec())) {
3140    return fastEmitInst_rr(PPC::VSRAB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3141  }
3142  return 0;
3143}
3144
3145unsigned fastEmit_PPCISD_SRA_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3146  if (RetVT.SimpleTy != MVT::v8i16)
3147    return 0;
3148  if ((PPCSubTarget->hasAltivec())) {
3149    return fastEmitInst_rr(PPC::VSRAH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3150  }
3151  return 0;
3152}
3153
3154unsigned fastEmit_PPCISD_SRA_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3155  if (RetVT.SimpleTy != MVT::v4i32)
3156    return 0;
3157  if ((PPCSubTarget->hasAltivec())) {
3158    return fastEmitInst_rr(PPC::VSRAW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3159  }
3160  return 0;
3161}
3162
3163unsigned fastEmit_PPCISD_SRA_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3164  if (RetVT.SimpleTy != MVT::v2i64)
3165    return 0;
3166  if ((PPCSubTarget->hasP8Altivec())) {
3167    return fastEmitInst_rr(PPC::VSRAD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3168  }
3169  return 0;
3170}
3171
3172unsigned fastEmit_PPCISD_SRA_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3173  switch (VT.SimpleTy) {
3174  case MVT::i32: return fastEmit_PPCISD_SRA_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3175  case MVT::v16i8: return fastEmit_PPCISD_SRA_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3176  case MVT::v8i16: return fastEmit_PPCISD_SRA_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3177  case MVT::v4i32: return fastEmit_PPCISD_SRA_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3178  case MVT::v2i64: return fastEmit_PPCISD_SRA_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3179  default: return 0;
3180  }
3181}
3182
3183// FastEmit functions for PPCISD::SRL.
3184
3185unsigned fastEmit_PPCISD_SRL_MVT_i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3186  if (RetVT.SimpleTy != MVT::i32)
3187    return 0;
3188  return fastEmitInst_rr(PPC::SRW, &PPC::GPRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3189}
3190
3191unsigned fastEmit_PPCISD_SRL_MVT_v16i8_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3192  if (RetVT.SimpleTy != MVT::v16i8)
3193    return 0;
3194  if ((PPCSubTarget->hasAltivec())) {
3195    return fastEmitInst_rr(PPC::VSRB, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3196  }
3197  return 0;
3198}
3199
3200unsigned fastEmit_PPCISD_SRL_MVT_v8i16_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3201  if (RetVT.SimpleTy != MVT::v8i16)
3202    return 0;
3203  if ((PPCSubTarget->hasAltivec())) {
3204    return fastEmitInst_rr(PPC::VSRH, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3205  }
3206  return 0;
3207}
3208
3209unsigned fastEmit_PPCISD_SRL_MVT_v4i32_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3210  if (RetVT.SimpleTy != MVT::v4i32)
3211    return 0;
3212  if ((PPCSubTarget->hasAltivec())) {
3213    return fastEmitInst_rr(PPC::VSRW, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3214  }
3215  return 0;
3216}
3217
3218unsigned fastEmit_PPCISD_SRL_MVT_v2i64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3219  if (RetVT.SimpleTy != MVT::v2i64)
3220    return 0;
3221  if ((PPCSubTarget->hasP8Altivec())) {
3222    return fastEmitInst_rr(PPC::VSRD, &PPC::VRRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3223  }
3224  return 0;
3225}
3226
3227unsigned fastEmit_PPCISD_SRL_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3228  switch (VT.SimpleTy) {
3229  case MVT::i32: return fastEmit_PPCISD_SRL_MVT_i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3230  case MVT::v16i8: return fastEmit_PPCISD_SRL_MVT_v16i8_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3231  case MVT::v8i16: return fastEmit_PPCISD_SRL_MVT_v8i16_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3232  case MVT::v4i32: return fastEmit_PPCISD_SRL_MVT_v4i32_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3233  case MVT::v2i64: return fastEmit_PPCISD_SRL_MVT_v2i64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3234  default: return 0;
3235  }
3236}
3237
3238// FastEmit functions for PPCISD::XSMAXCDP.
3239
3240unsigned fastEmit_PPCISD_XSMAXCDP_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3241  if (RetVT.SimpleTy != MVT::f64)
3242    return 0;
3243  if ((PPCSubTarget->hasP9Vector())) {
3244    return fastEmitInst_rr(PPC::XSMAXCDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3245  }
3246  return 0;
3247}
3248
3249unsigned fastEmit_PPCISD_XSMAXCDP_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3250  switch (VT.SimpleTy) {
3251  case MVT::f64: return fastEmit_PPCISD_XSMAXCDP_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3252  default: return 0;
3253  }
3254}
3255
3256// FastEmit functions for PPCISD::XSMINCDP.
3257
3258unsigned fastEmit_PPCISD_XSMINCDP_MVT_f64_rr(MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3259  if (RetVT.SimpleTy != MVT::f64)
3260    return 0;
3261  if ((PPCSubTarget->hasP9Vector())) {
3262    return fastEmitInst_rr(PPC::XSMINCDP, &PPC::VSFRCRegClass, Op0, Op0IsKill, Op1, Op1IsKill);
3263  }
3264  return 0;
3265}
3266
3267unsigned fastEmit_PPCISD_XSMINCDP_rr(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) {
3268  switch (VT.SimpleTy) {
3269  case MVT::f64: return fastEmit_PPCISD_XSMINCDP_MVT_f64_rr(RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3270  default: return 0;
3271  }
3272}
3273
3274// Top-level FastEmit function.
3275
3276unsigned fastEmit_rr(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, unsigned Op1, bool Op1IsKill) override {
3277  switch (Opcode) {
3278  case ISD::ADD: return fastEmit_ISD_ADD_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3279  case ISD::ADDC: return fastEmit_ISD_ADDC_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3280  case ISD::ADDE: return fastEmit_ISD_ADDE_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3281  case ISD::AND: return fastEmit_ISD_AND_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3282  case ISD::BUILD_VECTOR: return fastEmit_ISD_BUILD_VECTOR_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3283  case ISD::FADD: return fastEmit_ISD_FADD_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3284  case ISD::FDIV: return fastEmit_ISD_FDIV_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3285  case ISD::FMAXNUM: return fastEmit_ISD_FMAXNUM_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3286  case ISD::FMAXNUM_IEEE: return fastEmit_ISD_FMAXNUM_IEEE_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3287  case ISD::FMINNUM: return fastEmit_ISD_FMINNUM_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3288  case ISD::FMINNUM_IEEE: return fastEmit_ISD_FMINNUM_IEEE_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3289  case ISD::FMUL: return fastEmit_ISD_FMUL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3290  case ISD::FSUB: return fastEmit_ISD_FSUB_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3291  case ISD::MUL: return fastEmit_ISD_MUL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3292  case ISD::MULHS: return fastEmit_ISD_MULHS_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3293  case ISD::MULHU: return fastEmit_ISD_MULHU_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3294  case ISD::OR: return fastEmit_ISD_OR_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3295  case ISD::ROTL: return fastEmit_ISD_ROTL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3296  case ISD::SDIV: return fastEmit_ISD_SDIV_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3297  case ISD::SHL: return fastEmit_ISD_SHL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3298  case ISD::SMAX: return fastEmit_ISD_SMAX_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3299  case ISD::SMIN: return fastEmit_ISD_SMIN_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3300  case ISD::SRA: return fastEmit_ISD_SRA_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3301  case ISD::SREM: return fastEmit_ISD_SREM_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3302  case ISD::SRL: return fastEmit_ISD_SRL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3303  case ISD::SUB: return fastEmit_ISD_SUB_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3304  case ISD::UDIV: return fastEmit_ISD_UDIV_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3305  case ISD::UMAX: return fastEmit_ISD_UMAX_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3306  case ISD::UMIN: return fastEmit_ISD_UMIN_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3307  case ISD::UREM: return fastEmit_ISD_UREM_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3308  case ISD::XOR: return fastEmit_ISD_XOR_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3309  case PPCISD::CMPB: return fastEmit_PPCISD_CMPB_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3310  case PPCISD::FADDRTZ: return fastEmit_PPCISD_FADDRTZ_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3311  case PPCISD::SHL: return fastEmit_PPCISD_SHL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3312  case PPCISD::SRA: return fastEmit_PPCISD_SRA_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3313  case PPCISD::SRL: return fastEmit_PPCISD_SRL_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3314  case PPCISD::XSMAXCDP: return fastEmit_PPCISD_XSMAXCDP_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3315  case PPCISD::XSMINCDP: return fastEmit_PPCISD_XSMINCDP_rr(VT, RetVT, Op0, Op0IsKill, Op1, Op1IsKill);
3316  default: return 0;
3317  }
3318}
3319
3320// FastEmit functions for ISD::SRA.
3321
3322unsigned fastEmit_ISD_SRA_MVT_i32_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3323  if (RetVT.SimpleTy != MVT::i32)
3324    return 0;
3325  return fastEmitInst_ri(PPC::SRAWI, &PPC::GPRCRegClass, Op0, Op0IsKill, imm1);
3326}
3327
3328unsigned fastEmit_ISD_SRA_MVT_i64_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3329  if (RetVT.SimpleTy != MVT::i64)
3330    return 0;
3331  return fastEmitInst_ri(PPC::SRADI, &PPC::G8RCRegClass, Op0, Op0IsKill, imm1);
3332}
3333
3334unsigned fastEmit_ISD_SRA_ri(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3335  switch (VT.SimpleTy) {
3336  case MVT::i32: return fastEmit_ISD_SRA_MVT_i32_ri(RetVT, Op0, Op0IsKill, imm1);
3337  case MVT::i64: return fastEmit_ISD_SRA_MVT_i64_ri(RetVT, Op0, Op0IsKill, imm1);
3338  default: return 0;
3339  }
3340}
3341
3342// FastEmit functions for PPCISD::EXTSWSLI.
3343
3344unsigned fastEmit_PPCISD_EXTSWSLI_MVT_i32_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3345  if (RetVT.SimpleTy != MVT::i64)
3346    return 0;
3347  if ((PPCSubTarget->isISA3_0())) {
3348    return fastEmitInst_ri(PPC::EXTSWSLI_32_64, &PPC::G8RCRegClass, Op0, Op0IsKill, imm1);
3349  }
3350  return 0;
3351}
3352
3353unsigned fastEmit_PPCISD_EXTSWSLI_ri(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3354  switch (VT.SimpleTy) {
3355  case MVT::i32: return fastEmit_PPCISD_EXTSWSLI_MVT_i32_ri(RetVT, Op0, Op0IsKill, imm1);
3356  default: return 0;
3357  }
3358}
3359
3360// FastEmit functions for PPCISD::QVESPLATI.
3361
3362unsigned fastEmit_PPCISD_QVESPLATI_MVT_v4i1_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3363  if (RetVT.SimpleTy != MVT::v4i1)
3364    return 0;
3365  if ((PPCSubTarget->hasQPX())) {
3366    return fastEmitInst_ri(PPC::QVESPLATIb, &PPC::QBRCRegClass, Op0, Op0IsKill, imm1);
3367  }
3368  return 0;
3369}
3370
3371unsigned fastEmit_PPCISD_QVESPLATI_MVT_v4f32_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3372  if (RetVT.SimpleTy != MVT::v4f32)
3373    return 0;
3374  if ((PPCSubTarget->hasQPX())) {
3375    return fastEmitInst_ri(PPC::QVESPLATIs, &PPC::QSRCRegClass, Op0, Op0IsKill, imm1);
3376  }
3377  return 0;
3378}
3379
3380unsigned fastEmit_PPCISD_QVESPLATI_MVT_v4f64_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3381  if (RetVT.SimpleTy != MVT::v4f64)
3382    return 0;
3383  if ((PPCSubTarget->hasQPX())) {
3384    return fastEmitInst_ri(PPC::QVESPLATI, &PPC::QFRCRegClass, Op0, Op0IsKill, imm1);
3385  }
3386  return 0;
3387}
3388
3389unsigned fastEmit_PPCISD_QVESPLATI_ri(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3390  switch (VT.SimpleTy) {
3391  case MVT::v4i1: return fastEmit_PPCISD_QVESPLATI_MVT_v4i1_ri(RetVT, Op0, Op0IsKill, imm1);
3392  case MVT::v4f32: return fastEmit_PPCISD_QVESPLATI_MVT_v4f32_ri(RetVT, Op0, Op0IsKill, imm1);
3393  case MVT::v4f64: return fastEmit_PPCISD_QVESPLATI_MVT_v4f64_ri(RetVT, Op0, Op0IsKill, imm1);
3394  default: return 0;
3395  }
3396}
3397
3398// FastEmit functions for PPCISD::TC_RETURN.
3399
3400unsigned fastEmit_PPCISD_TC_RETURN_MVT_i32_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3401  if (RetVT.SimpleTy != MVT::isVoid)
3402    return 0;
3403  return fastEmitInst_ri(PPC::TCRETURNri, &PPC::CTRRCRegClass, Op0, Op0IsKill, imm1);
3404}
3405
3406unsigned fastEmit_PPCISD_TC_RETURN_MVT_i64_ri(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3407  if (RetVT.SimpleTy != MVT::isVoid)
3408    return 0;
3409  return fastEmitInst_ri(PPC::TCRETURNri8, &PPC::CTRRC8RegClass, Op0, Op0IsKill, imm1);
3410}
3411
3412unsigned fastEmit_PPCISD_TC_RETURN_ri(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3413  switch (VT.SimpleTy) {
3414  case MVT::i32: return fastEmit_PPCISD_TC_RETURN_MVT_i32_ri(RetVT, Op0, Op0IsKill, imm1);
3415  case MVT::i64: return fastEmit_PPCISD_TC_RETURN_MVT_i64_ri(RetVT, Op0, Op0IsKill, imm1);
3416  default: return 0;
3417  }
3418}
3419
3420// Top-level FastEmit function.
3421
3422unsigned fastEmit_ri(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, uint64_t imm1) override {
3423  if (VT == MVT::i32 && Predicate_imm32SExt16(imm1))
3424    if (unsigned Reg = fastEmit_ri_Predicate_imm32SExt16(VT, RetVT, Opcode, Op0, Op0IsKill, imm1))
3425      return Reg;
3426
3427  if (VT == MVT::i64 && Predicate_imm64SExt16(imm1))
3428    if (unsigned Reg = fastEmit_ri_Predicate_imm64SExt16(VT, RetVT, Opcode, Op0, Op0IsKill, imm1))
3429      return Reg;
3430
3431  switch (Opcode) {
3432  case ISD::SRA: return fastEmit_ISD_SRA_ri(VT, RetVT, Op0, Op0IsKill, imm1);
3433  case PPCISD::EXTSWSLI: return fastEmit_PPCISD_EXTSWSLI_ri(VT, RetVT, Op0, Op0IsKill, imm1);
3434  case PPCISD::QVESPLATI: return fastEmit_PPCISD_QVESPLATI_ri(VT, RetVT, Op0, Op0IsKill, imm1);
3435  case PPCISD::TC_RETURN: return fastEmit_PPCISD_TC_RETURN_ri(VT, RetVT, Op0, Op0IsKill, imm1);
3436  default: return 0;
3437  }
3438}
3439
3440// FastEmit functions for ISD::ADD.
3441
3442unsigned fastEmit_ISD_ADD_MVT_i32_ri_Predicate_imm32SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3443  if (RetVT.SimpleTy != MVT::i32)
3444    return 0;
3445  return fastEmitInst_ri(PPC::ADDI, &PPC::GPRCRegClass, Op0, Op0IsKill, imm1);
3446}
3447
3448unsigned fastEmit_ISD_ADD_ri_Predicate_imm32SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3449  switch (VT.SimpleTy) {
3450  case MVT::i32: return fastEmit_ISD_ADD_MVT_i32_ri_Predicate_imm32SExt16(RetVT, Op0, Op0IsKill, imm1);
3451  default: return 0;
3452  }
3453}
3454
3455// FastEmit functions for ISD::ADDC.
3456
3457unsigned fastEmit_ISD_ADDC_MVT_i32_ri_Predicate_imm32SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3458  if (RetVT.SimpleTy != MVT::i32)
3459    return 0;
3460  return fastEmitInst_ri(PPC::ADDIC, &PPC::GPRCRegClass, Op0, Op0IsKill, imm1);
3461}
3462
3463unsigned fastEmit_ISD_ADDC_ri_Predicate_imm32SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3464  switch (VT.SimpleTy) {
3465  case MVT::i32: return fastEmit_ISD_ADDC_MVT_i32_ri_Predicate_imm32SExt16(RetVT, Op0, Op0IsKill, imm1);
3466  default: return 0;
3467  }
3468}
3469
3470// FastEmit functions for ISD::MUL.
3471
3472unsigned fastEmit_ISD_MUL_MVT_i32_ri_Predicate_imm32SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3473  if (RetVT.SimpleTy != MVT::i32)
3474    return 0;
3475  return fastEmitInst_ri(PPC::MULLI, &PPC::GPRCRegClass, Op0, Op0IsKill, imm1);
3476}
3477
3478unsigned fastEmit_ISD_MUL_ri_Predicate_imm32SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3479  switch (VT.SimpleTy) {
3480  case MVT::i32: return fastEmit_ISD_MUL_MVT_i32_ri_Predicate_imm32SExt16(RetVT, Op0, Op0IsKill, imm1);
3481  default: return 0;
3482  }
3483}
3484
3485// FastEmit functions for PPCISD::XXSPLT.
3486
3487unsigned fastEmit_PPCISD_XXSPLT_MVT_v4i32_ri_Predicate_imm32SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3488  if (RetVT.SimpleTy != MVT::v4i32)
3489    return 0;
3490  if ((PPCSubTarget->hasVSX())) {
3491    return fastEmitInst_ri(PPC::XXSPLTW, &PPC::VSRCRegClass, Op0, Op0IsKill, imm1);
3492  }
3493  return 0;
3494}
3495
3496unsigned fastEmit_PPCISD_XXSPLT_ri_Predicate_imm32SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3497  switch (VT.SimpleTy) {
3498  case MVT::v4i32: return fastEmit_PPCISD_XXSPLT_MVT_v4i32_ri_Predicate_imm32SExt16(RetVT, Op0, Op0IsKill, imm1);
3499  default: return 0;
3500  }
3501}
3502
3503// Top-level FastEmit function.
3504
3505unsigned fastEmit_ri_Predicate_imm32SExt16(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3506  switch (Opcode) {
3507  case ISD::ADD: return fastEmit_ISD_ADD_ri_Predicate_imm32SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3508  case ISD::ADDC: return fastEmit_ISD_ADDC_ri_Predicate_imm32SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3509  case ISD::MUL: return fastEmit_ISD_MUL_ri_Predicate_imm32SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3510  case PPCISD::XXSPLT: return fastEmit_PPCISD_XXSPLT_ri_Predicate_imm32SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3511  default: return 0;
3512  }
3513}
3514
3515// FastEmit functions for ISD::ADD.
3516
3517unsigned fastEmit_ISD_ADD_MVT_i64_ri_Predicate_imm64SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3518  if (RetVT.SimpleTy != MVT::i64)
3519    return 0;
3520  return fastEmitInst_ri(PPC::ADDI8, &PPC::G8RCRegClass, Op0, Op0IsKill, imm1);
3521}
3522
3523unsigned fastEmit_ISD_ADD_ri_Predicate_imm64SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3524  switch (VT.SimpleTy) {
3525  case MVT::i64: return fastEmit_ISD_ADD_MVT_i64_ri_Predicate_imm64SExt16(RetVT, Op0, Op0IsKill, imm1);
3526  default: return 0;
3527  }
3528}
3529
3530// FastEmit functions for ISD::ADDC.
3531
3532unsigned fastEmit_ISD_ADDC_MVT_i64_ri_Predicate_imm64SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3533  if (RetVT.SimpleTy != MVT::i64)
3534    return 0;
3535  return fastEmitInst_ri(PPC::ADDIC8, &PPC::G8RCRegClass, Op0, Op0IsKill, imm1);
3536}
3537
3538unsigned fastEmit_ISD_ADDC_ri_Predicate_imm64SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3539  switch (VT.SimpleTy) {
3540  case MVT::i64: return fastEmit_ISD_ADDC_MVT_i64_ri_Predicate_imm64SExt16(RetVT, Op0, Op0IsKill, imm1);
3541  default: return 0;
3542  }
3543}
3544
3545// FastEmit functions for ISD::MUL.
3546
3547unsigned fastEmit_ISD_MUL_MVT_i64_ri_Predicate_imm64SExt16(MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3548  if (RetVT.SimpleTy != MVT::i64)
3549    return 0;
3550  return fastEmitInst_ri(PPC::MULLI8, &PPC::G8RCRegClass, Op0, Op0IsKill, imm1);
3551}
3552
3553unsigned fastEmit_ISD_MUL_ri_Predicate_imm64SExt16(MVT VT, MVT RetVT, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3554  switch (VT.SimpleTy) {
3555  case MVT::i64: return fastEmit_ISD_MUL_MVT_i64_ri_Predicate_imm64SExt16(RetVT, Op0, Op0IsKill, imm1);
3556  default: return 0;
3557  }
3558}
3559
3560// Top-level FastEmit function.
3561
3562unsigned fastEmit_ri_Predicate_imm64SExt16(MVT VT, MVT RetVT, unsigned Opcode, unsigned Op0, bool Op0IsKill, uint64_t imm1) {
3563  switch (Opcode) {
3564  case ISD::ADD: return fastEmit_ISD_ADD_ri_Predicate_imm64SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3565  case ISD::ADDC: return fastEmit_ISD_ADDC_ri_Predicate_imm64SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3566  case ISD::MUL: return fastEmit_ISD_MUL_ri_Predicate_imm64SExt16(VT, RetVT, Op0, Op0IsKill, imm1);
3567  default: return 0;
3568  }
3569}
3570
3571