]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/Target/GenericOpcodes.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / Target / GenericOpcodes.td
1 //===-- GenericOpcodes.td - Opcodes used with GlobalISel ---*- tablegen -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the generic opcodes used with GlobalISel.
11 // After instruction selection, these opcodes should not appear.
12 //
13 //===----------------------------------------------------------------------===//
14
15 //------------------------------------------------------------------------------
16 // Unary ops.
17 //------------------------------------------------------------------------------
18
19 class GenericInstruction : StandardPseudoInstruction;
20
21 // Extend the underlying scalar type of an operation, leaving the high bits
22 // unspecified.
23 def G_ANYEXT : GenericInstruction {
24   let OutOperandList = (outs type0:$dst);
25   let InOperandList = (ins type1:$src);
26   let hasSideEffects = 0;
27 }
28
29 // Sign extend the underlying scalar type of an operation, copying the sign bit
30 // into the newly-created space.
31 def G_SEXT : GenericInstruction {
32   let OutOperandList = (outs type0:$dst);
33   let InOperandList = (ins type1:$src);
34   let hasSideEffects = 0;
35 }
36
37 // Zero extend the underlying scalar type of an operation, putting zero bits
38 // into the newly-created space.
39 def G_ZEXT : GenericInstruction {
40   let OutOperandList = (outs type0:$dst);
41   let InOperandList = (ins type1:$src);
42   let hasSideEffects = 0;
43 }
44
45
46 // Truncate the underlying scalar type of an operation. This is equivalent to
47 // G_EXTRACT for scalar types, but acts elementwise on vectors.
48 def G_TRUNC : GenericInstruction {
49   let OutOperandList = (outs type0:$dst);
50   let InOperandList = (ins type1:$src);
51   let hasSideEffects = 0;
52 }
53
54 def G_IMPLICIT_DEF : GenericInstruction {
55   let OutOperandList = (outs type0:$dst);
56   let InOperandList = (ins);
57   let hasSideEffects = 0;
58 }
59
60 def G_PHI : GenericInstruction {
61   let OutOperandList = (outs type0:$dst);
62   let InOperandList = (ins variable_ops);
63   let hasSideEffects = 0;
64 }
65
66 def G_FRAME_INDEX : GenericInstruction {
67   let OutOperandList = (outs type0:$dst);
68   let InOperandList = (ins unknown:$src2);
69   let hasSideEffects = 0;
70 }
71
72 def G_GLOBAL_VALUE : GenericInstruction {
73   let OutOperandList = (outs type0:$dst);
74   let InOperandList = (ins unknown:$src);
75   let hasSideEffects = 0;
76 }
77
78 def G_INTTOPTR : GenericInstruction {
79   let OutOperandList = (outs type0:$dst);
80   let InOperandList = (ins type1:$src);
81   let hasSideEffects = 0;
82 }
83
84 def G_PTRTOINT : GenericInstruction {
85   let OutOperandList = (outs type0:$dst);
86   let InOperandList = (ins type1:$src);
87   let hasSideEffects = 0;
88 }
89
90 def G_BITCAST : GenericInstruction {
91   let OutOperandList = (outs type0:$dst);
92   let InOperandList = (ins type1:$src);
93   let hasSideEffects = 0;
94 }
95
96 def G_CONSTANT : GenericInstruction {
97   let OutOperandList = (outs type0:$dst);
98   let InOperandList = (ins unknown:$imm);
99   let hasSideEffects = 0;
100 }
101
102 def G_FCONSTANT : GenericInstruction {
103   let OutOperandList = (outs type0:$dst);
104   let InOperandList = (ins unknown:$imm);
105   let hasSideEffects = 0;
106 }
107
108 def G_VASTART : GenericInstruction {
109   let OutOperandList = (outs);
110   let InOperandList = (ins type0:$list);
111   let hasSideEffects = 0;
112   let mayStore = 1;
113 }
114
115 def G_VAARG : GenericInstruction {
116   let OutOperandList = (outs type0:$val);
117   let InOperandList = (ins type1:$list, unknown:$align);
118   let hasSideEffects = 0;
119   let mayLoad = 1;
120   let mayStore = 1;
121 }
122
123 def G_CTLZ : GenericInstruction {
124   let OutOperandList = (outs type0:$dst);
125   let InOperandList = (ins type0:$src);
126   let hasSideEffects = 0;
127 }
128
129 def G_CTLZ_ZERO_UNDEF : GenericInstruction {
130   let OutOperandList = (outs type0:$dst);
131   let InOperandList = (ins type0:$src);
132   let hasSideEffects = 0;
133 }
134
135 def G_CTTZ : GenericInstruction {
136   let OutOperandList = (outs type0:$dst);
137   let InOperandList = (ins type0:$src);
138   let hasSideEffects = 0;
139 }
140
141 def G_CTTZ_ZERO_UNDEF : GenericInstruction {
142   let OutOperandList = (outs type0:$dst);
143   let InOperandList = (ins type0:$src);
144   let hasSideEffects = 0;
145 }
146
147 def G_CTPOP : GenericInstruction {
148   let OutOperandList = (outs type0:$dst);
149   let InOperandList = (ins type0:$src);
150   let hasSideEffects = 0;
151 }
152
153 def G_BSWAP : GenericInstruction {
154   let OutOperandList = (outs type0:$dst);
155   let InOperandList = (ins type0:$src);
156   let hasSideEffects = 0;
157 }
158
159 def G_ADDRSPACE_CAST : GenericInstruction {
160   let OutOperandList = (outs type0:$dst);
161   let InOperandList = (ins type1:$src);
162   let hasSideEffects = 0;
163 }
164
165 def G_BLOCK_ADDR : GenericInstruction {
166   let OutOperandList = (outs type0:$dst);
167   let InOperandList = (ins unknown:$ba);
168   let hasSideEffects = 0;
169 }
170
171 //------------------------------------------------------------------------------
172 // Binary ops.
173 //------------------------------------------------------------------------------
174
175 // Generic addition.
176 def G_ADD : GenericInstruction {
177   let OutOperandList = (outs type0:$dst);
178   let InOperandList = (ins type0:$src1, type0:$src2);
179   let hasSideEffects = 0;
180   let isCommutable = 1;
181 }
182
183 // Generic subtraction.
184 def G_SUB : GenericInstruction {
185   let OutOperandList = (outs type0:$dst);
186   let InOperandList = (ins type0:$src1, type0:$src2);
187   let hasSideEffects = 0;
188   let isCommutable = 0;
189 }
190
191 // Generic multiplication.
192 def G_MUL : GenericInstruction {
193   let OutOperandList = (outs type0:$dst);
194   let InOperandList = (ins type0:$src1, type0:$src2);
195   let hasSideEffects = 0;
196   let isCommutable = 1;
197 }
198
199 // Generic signed division.
200 def G_SDIV : GenericInstruction {
201   let OutOperandList = (outs type0:$dst);
202   let InOperandList = (ins type0:$src1, type0:$src2);
203   let hasSideEffects = 0;
204   let isCommutable = 0;
205 }
206
207 // Generic unsigned division.
208 def G_UDIV : GenericInstruction {
209   let OutOperandList = (outs type0:$dst);
210   let InOperandList = (ins type0:$src1, type0:$src2);
211   let hasSideEffects = 0;
212   let isCommutable = 0;
213 }
214
215 // Generic signed remainder.
216 def G_SREM : GenericInstruction {
217   let OutOperandList = (outs type0:$dst);
218   let InOperandList = (ins type0:$src1, type0:$src2);
219   let hasSideEffects = 0;
220   let isCommutable = 0;
221 }
222
223 // Generic unsigned remainder.
224 def G_UREM : GenericInstruction {
225   let OutOperandList = (outs type0:$dst);
226   let InOperandList = (ins type0:$src1, type0:$src2);
227   let hasSideEffects = 0;
228   let isCommutable = 0;
229 }
230
231 // Generic bitwise and.
232 def G_AND : GenericInstruction {
233   let OutOperandList = (outs type0:$dst);
234   let InOperandList = (ins type0:$src1, type0:$src2);
235   let hasSideEffects = 0;
236   let isCommutable = 1;
237 }
238
239 // Generic bitwise or.
240 def G_OR : GenericInstruction {
241   let OutOperandList = (outs type0:$dst);
242   let InOperandList = (ins type0:$src1, type0:$src2);
243   let hasSideEffects = 0;
244   let isCommutable = 1;
245 }
246
247 // Generic bitwise xor.
248 def G_XOR : GenericInstruction {
249   let OutOperandList = (outs type0:$dst);
250   let InOperandList = (ins type0:$src1, type0:$src2);
251   let hasSideEffects = 0;
252   let isCommutable = 1;
253 }
254
255 // Generic left-shift.
256 def G_SHL : GenericInstruction {
257   let OutOperandList = (outs type0:$dst);
258   let InOperandList = (ins type0:$src1, type0:$src2);
259   let hasSideEffects = 0;
260 }
261
262 // Generic logical right-shift.
263 def G_LSHR : GenericInstruction {
264   let OutOperandList = (outs type0:$dst);
265   let InOperandList = (ins type0:$src1, type0:$src2);
266   let hasSideEffects = 0;
267 }
268
269 // Generic arithmetic right-shift.
270 def G_ASHR : GenericInstruction {
271   let OutOperandList = (outs type0:$dst);
272   let InOperandList = (ins type0:$src1, type0:$src2);
273   let hasSideEffects = 0;
274 }
275
276 // Generic integer comparison.
277 def G_ICMP : GenericInstruction {
278   let OutOperandList = (outs type0:$dst);
279   let InOperandList = (ins unknown:$tst, type1:$src1, type1:$src2);
280   let hasSideEffects = 0;
281 }
282
283 // Generic floating-point comparison.
284 def G_FCMP : GenericInstruction {
285   let OutOperandList = (outs type0:$dst);
286   let InOperandList = (ins unknown:$tst, type1:$src1, type1:$src2);
287   let hasSideEffects = 0;
288 }
289
290 // Generic select
291 def G_SELECT : GenericInstruction {
292   let OutOperandList = (outs type0:$dst);
293   let InOperandList = (ins type1:$tst, type0:$src1, type0:$src2);
294   let hasSideEffects = 0;
295 }
296
297 // Generic pointer offset.
298 def G_GEP : GenericInstruction {
299   let OutOperandList = (outs type0:$dst);
300   let InOperandList = (ins type0:$src1, type1:$src2);
301   let hasSideEffects = 0;
302 }
303
304 def G_PTR_MASK : GenericInstruction {
305   let OutOperandList = (outs type0:$dst);
306   let InOperandList = (ins type0:$src, unknown:$bits);
307   let hasSideEffects = 0;
308 }
309
310 //------------------------------------------------------------------------------
311 // Overflow ops
312 //------------------------------------------------------------------------------
313
314 // Generic unsigned addition producing a carry flag.
315 def G_UADDO : GenericInstruction {
316   let OutOperandList = (outs type0:$dst, type1:$carry_out);
317   let InOperandList = (ins type0:$src1, type0:$src2);
318   let hasSideEffects = 0;
319   let isCommutable = 1;
320 }
321
322 // Generic unsigned addition consuming and producing a carry flag.
323 def G_UADDE : GenericInstruction {
324   let OutOperandList = (outs type0:$dst, type1:$carry_out);
325   let InOperandList = (ins type0:$src1, type0:$src2, type1:$carry_in);
326   let hasSideEffects = 0;
327 }
328
329 // Generic signed addition producing a carry flag.
330 def G_SADDO : GenericInstruction {
331   let OutOperandList = (outs type0:$dst, type1:$carry_out);
332   let InOperandList = (ins type0:$src1, type0:$src2);
333   let hasSideEffects = 0;
334   let isCommutable = 1;
335 }
336
337 // Generic signed addition consuming and producing a carry flag.
338 def G_SADDE : GenericInstruction {
339   let OutOperandList = (outs type0:$dst, type1:$carry_out);
340   let InOperandList = (ins type0:$src1, type0:$src2, type1:$carry_in);
341   let hasSideEffects = 0;
342 }
343
344 // Generic unsigned subtraction producing a carry flag.
345 def G_USUBO : GenericInstruction {
346   let OutOperandList = (outs type0:$dst, type1:$carry_out);
347   let InOperandList = (ins type0:$src1, type0:$src2);
348   let hasSideEffects = 0;
349 }
350 // Generic unsigned subtraction consuming and producing a carry flag.
351 def G_USUBE : GenericInstruction {
352   let OutOperandList = (outs type0:$dst, type1:$carry_out);
353   let InOperandList = (ins type0:$src1, type0:$src2, type1:$carry_in);
354   let hasSideEffects = 0;
355 }
356
357 // Generic signed subtraction producing a carry flag.
358 def G_SSUBO : GenericInstruction {
359   let OutOperandList = (outs type0:$dst, type1:$carry_out);
360   let InOperandList = (ins type0:$src1, type0:$src2);
361   let hasSideEffects = 0;
362 }
363
364 // Generic signed subtraction consuming and producing a carry flag.
365 def G_SSUBE : GenericInstruction {
366   let OutOperandList = (outs type0:$dst, type1:$carry_out);
367   let InOperandList = (ins type0:$src1, type0:$src2, type1:$carry_in);
368   let hasSideEffects = 0;
369 }
370
371 // Generic unsigned multiplication producing a carry flag.
372 def G_UMULO : GenericInstruction {
373   let OutOperandList = (outs type0:$dst, type1:$carry_out);
374   let InOperandList = (ins type0:$src1, type0:$src2);
375   let hasSideEffects = 0;
376   let isCommutable = 1;
377 }
378
379 // Generic signed multiplication producing a carry flag.
380 def G_SMULO : GenericInstruction {
381   let OutOperandList = (outs type0:$dst, type1:$carry_out);
382   let InOperandList = (ins type0:$src1, type0:$src2);
383   let hasSideEffects = 0;
384   let isCommutable = 1;
385 }
386
387 // Multiply two numbers at twice the incoming bit width (unsigned) and return
388 // the high half of the result.
389 def G_UMULH : GenericInstruction {
390   let OutOperandList = (outs type0:$dst);
391   let InOperandList = (ins type0:$src1, type0:$src2);
392   let hasSideEffects = 0;
393   let isCommutable = 1;
394 }
395
396 // Multiply two numbers at twice the incoming bit width (signed) and return
397 // the high half of the result.
398 def G_SMULH : GenericInstruction {
399   let OutOperandList = (outs type0:$dst);
400   let InOperandList = (ins type0:$src1, type0:$src2);
401   let hasSideEffects = 0;
402   let isCommutable = 1;
403 }
404
405 //------------------------------------------------------------------------------
406 // Floating Point Unary Ops.
407 //------------------------------------------------------------------------------
408
409 def G_FNEG : GenericInstruction {
410   let OutOperandList = (outs type0:$dst);
411   let InOperandList = (ins type0:$src);
412   let hasSideEffects = 0;
413 }
414
415 def G_FPEXT : GenericInstruction {
416   let OutOperandList = (outs type0:$dst);
417   let InOperandList = (ins type1:$src);
418   let hasSideEffects = 0;
419 }
420
421 def G_FPTRUNC : GenericInstruction {
422   let OutOperandList = (outs type0:$dst);
423   let InOperandList = (ins type1:$src);
424   let hasSideEffects = 0;
425 }
426
427 def G_FPTOSI : GenericInstruction {
428   let OutOperandList = (outs type0:$dst);
429   let InOperandList = (ins type1:$src);
430   let hasSideEffects = 0;
431 }
432
433 def G_FPTOUI : GenericInstruction {
434   let OutOperandList = (outs type0:$dst);
435   let InOperandList = (ins type1:$src);
436   let hasSideEffects = 0;
437 }
438
439 def G_SITOFP : GenericInstruction {
440   let OutOperandList = (outs type0:$dst);
441   let InOperandList = (ins type1:$src);
442   let hasSideEffects = 0;
443 }
444
445 def G_UITOFP : GenericInstruction {
446   let OutOperandList = (outs type0:$dst);
447   let InOperandList = (ins type1:$src);
448   let hasSideEffects = 0;
449 }
450
451 def G_FABS : GenericInstruction {
452   let OutOperandList = (outs type0:$dst);
453   let InOperandList = (ins type0:$src);
454   let hasSideEffects = 0;
455 }
456
457 //------------------------------------------------------------------------------
458 // Floating Point Binary ops.
459 //------------------------------------------------------------------------------
460
461 // Generic FP addition.
462 def G_FADD : GenericInstruction {
463   let OutOperandList = (outs type0:$dst);
464   let InOperandList = (ins type0:$src1, type0:$src2);
465   let hasSideEffects = 0;
466   let isCommutable = 1;
467 }
468
469 // Generic FP subtraction.
470 def G_FSUB : GenericInstruction {
471   let OutOperandList = (outs type0:$dst);
472   let InOperandList = (ins type0:$src1, type0:$src2);
473   let hasSideEffects = 0;
474   let isCommutable = 0;
475 }
476
477 // Generic FP multiplication.
478 def G_FMUL : GenericInstruction {
479   let OutOperandList = (outs type0:$dst);
480   let InOperandList = (ins type0:$src1, type0:$src2);
481   let hasSideEffects = 0;
482   let isCommutable = 1;
483 }
484
485 // Generic fused multiply-add instruction.
486 // Behaves like llvm fma intrinsic ie src1 * src2 + src3
487 def G_FMA : GenericInstruction {
488   let OutOperandList = (outs type0:$dst);
489   let InOperandList = (ins type0:$src1, type0:$src2, type0:$src3);
490   let hasSideEffects = 0;
491   let isCommutable = 0;
492 }
493
494 // Generic FP division.
495 def G_FDIV : GenericInstruction {
496   let OutOperandList = (outs type0:$dst);
497   let InOperandList = (ins type0:$src1, type0:$src2);
498   let hasSideEffects = 0;
499 }
500
501 // Generic FP remainder.
502 def G_FREM : GenericInstruction {
503   let OutOperandList = (outs type0:$dst);
504   let InOperandList = (ins type0:$src1, type0:$src2);
505   let hasSideEffects = 0;
506 }
507
508 // Floating point exponentiation.
509 def G_FPOW : GenericInstruction {
510   let OutOperandList = (outs type0:$dst);
511   let InOperandList = (ins type0:$src1, type0:$src2);
512   let hasSideEffects = 0;
513 }
514
515 // Floating point base-e exponential of a value.
516 def G_FEXP : GenericInstruction {
517   let OutOperandList = (outs type0:$dst);
518   let InOperandList = (ins type0:$src1);
519   let hasSideEffects = 0;
520 }
521
522 // Floating point base-2 exponential of a value.
523 def G_FEXP2 : GenericInstruction {
524   let OutOperandList = (outs type0:$dst);
525   let InOperandList = (ins type0:$src1);
526   let hasSideEffects = 0;
527 }
528
529 // Floating point base-2 logarithm of a value.
530 def G_FLOG : GenericInstruction {
531   let OutOperandList = (outs type0:$dst);
532   let InOperandList = (ins type0:$src1);
533   let hasSideEffects = 0;
534 }
535
536 // Floating point base-2 logarithm of a value.
537 def G_FLOG2 : GenericInstruction {
538   let OutOperandList = (outs type0:$dst);
539   let InOperandList = (ins type0:$src1);
540   let hasSideEffects = 0;
541 }
542
543 // Floating point base-10 logarithm of a value.
544 def G_FLOG10 : GenericInstruction {
545   let OutOperandList = (outs type0:$dst);
546   let InOperandList = (ins type0:$src1);
547   let hasSideEffects = 0;
548 }
549
550 // Floating point ceiling of a value.
551 def G_FCEIL : GenericInstruction {
552   let OutOperandList = (outs type0:$dst);
553   let InOperandList = (ins type0:$src1);
554   let hasSideEffects = 0;
555 }
556
557 //------------------------------------------------------------------------------
558 // Opcodes for LLVM Intrinsics
559 //------------------------------------------------------------------------------
560 def G_INTRINSIC_TRUNC : GenericInstruction {
561   let OutOperandList = (outs type0:$dst);
562   let InOperandList = (ins type0:$src1);
563   let hasSideEffects = 0;
564 }
565
566 def G_INTRINSIC_ROUND : GenericInstruction {
567   let OutOperandList = (outs type0:$dst);
568   let InOperandList = (ins type0:$src1);
569   let hasSideEffects = 0;
570 }
571
572 //------------------------------------------------------------------------------
573 // Memory ops
574 //------------------------------------------------------------------------------
575
576 // Generic load. Expects a MachineMemOperand in addition to explicit operands.
577 def G_LOAD : GenericInstruction {
578   let OutOperandList = (outs type0:$dst);
579   let InOperandList = (ins ptype1:$addr);
580   let hasSideEffects = 0;
581   let mayLoad = 1;
582 }
583
584 // Generic sign-extended load. Expects a MachineMemOperand in addition to explicit operands.
585 def G_SEXTLOAD : GenericInstruction {
586   let OutOperandList = (outs type0:$dst);
587   let InOperandList = (ins ptype1:$addr);
588   let hasSideEffects = 0;
589   let mayLoad = 1;
590 }
591
592 // Generic zero-extended load. Expects a MachineMemOperand in addition to explicit operands.
593 def G_ZEXTLOAD : GenericInstruction {
594   let OutOperandList = (outs type0:$dst);
595   let InOperandList = (ins ptype1:$addr);
596   let hasSideEffects = 0;
597   let mayLoad = 1;
598 }
599
600 // Generic store. Expects a MachineMemOperand in addition to explicit operands.
601 def G_STORE : GenericInstruction {
602   let OutOperandList = (outs);
603   let InOperandList = (ins type0:$src, ptype1:$addr);
604   let hasSideEffects = 0;
605   let mayStore = 1;
606 }
607
608 // Generic atomic cmpxchg with internal success check. Expects a
609 // MachineMemOperand in addition to explicit operands.
610 def G_ATOMIC_CMPXCHG_WITH_SUCCESS : GenericInstruction {
611   let OutOperandList = (outs type0:$oldval, type1:$success);
612   let InOperandList = (ins type2:$addr, type0:$cmpval, type0:$newval);
613   let hasSideEffects = 0;
614   let mayLoad = 1;
615   let mayStore = 1;
616 }
617
618 // Generic atomic cmpxchg. Expects a MachineMemOperand in addition to explicit
619 // operands.
620 def G_ATOMIC_CMPXCHG : GenericInstruction {
621   let OutOperandList = (outs type0:$oldval);
622   let InOperandList = (ins ptype1:$addr, type0:$cmpval, type0:$newval);
623   let hasSideEffects = 0;
624   let mayLoad = 1;
625   let mayStore = 1;
626 }
627
628 // Generic atomicrmw. Expects a MachineMemOperand in addition to explicit
629 // operands.
630 class G_ATOMICRMW_OP : GenericInstruction {
631   let OutOperandList = (outs type0:$oldval);
632   let InOperandList = (ins ptype1:$addr, type0:$val);
633   let hasSideEffects = 0;
634   let mayLoad = 1;
635   let mayStore = 1;
636 }
637
638 def G_ATOMICRMW_XCHG : G_ATOMICRMW_OP;
639 def G_ATOMICRMW_ADD : G_ATOMICRMW_OP;
640 def G_ATOMICRMW_SUB : G_ATOMICRMW_OP;
641 def G_ATOMICRMW_AND : G_ATOMICRMW_OP;
642 def G_ATOMICRMW_NAND : G_ATOMICRMW_OP;
643 def G_ATOMICRMW_OR : G_ATOMICRMW_OP;
644 def G_ATOMICRMW_XOR : G_ATOMICRMW_OP;
645 def G_ATOMICRMW_MAX : G_ATOMICRMW_OP;
646 def G_ATOMICRMW_MIN : G_ATOMICRMW_OP;
647 def G_ATOMICRMW_UMAX : G_ATOMICRMW_OP;
648 def G_ATOMICRMW_UMIN : G_ATOMICRMW_OP;
649
650 //------------------------------------------------------------------------------
651 // Variadic ops
652 //------------------------------------------------------------------------------
653
654 // Extract a register of the specified size, starting from the block given by
655 // index. This will almost certainly be mapped to sub-register COPYs after
656 // register banks have been selected.
657 def G_EXTRACT : GenericInstruction {
658   let OutOperandList = (outs type0:$res);
659   let InOperandList = (ins type1:$src, unknown:$offset);
660   let hasSideEffects = 0;
661 }
662
663 // Extract multiple registers specified size, starting from blocks given by
664 // indexes. This will almost certainly be mapped to sub-register COPYs after
665 // register banks have been selected.
666 // The output operands are always ordered from lowest bits to highest:
667 //   %bits_0_7:(s8), %bits_8_15:(s8),
668 //       %bits_16_23:(s8), %bits_24_31:(s8) = G_UNMERGE_VALUES %0:(s32)
669 def G_UNMERGE_VALUES : GenericInstruction {
670   let OutOperandList = (outs type0:$dst0, variable_ops);
671   let InOperandList = (ins type1:$src);
672   let hasSideEffects = 0;
673 }
674
675 // Insert a smaller register into a larger one at the specified bit-index.
676 def G_INSERT : GenericInstruction {
677   let OutOperandList = (outs type0:$dst);
678   let InOperandList = (ins type0:$src, type1:$op, unknown:$offset);
679   let hasSideEffects = 0;
680 }
681
682 // Concatenate multiple registers of the same size into a wider register.
683 // The input operands are always ordered from lowest bits to highest:
684 //   %0:(s32) = G_MERGE_VALUES %bits_0_7:(s8), %bits_8_15:(s8),
685 //                             %bits_16_23:(s8), %bits_24_31:(s8)
686 def G_MERGE_VALUES : GenericInstruction {
687   let OutOperandList = (outs type0:$dst);
688   let InOperandList = (ins type1:$src0, variable_ops);
689   let hasSideEffects = 0;
690 }
691
692 /// Create a vector from multiple scalar registers.
693 def G_BUILD_VECTOR : GenericInstruction {
694   let OutOperandList = (outs type0:$dst);
695   let InOperandList = (ins type1:$src0, variable_ops);
696   let hasSideEffects = 0;
697 }
698
699 /// Like G_BUILD_VECTOR, but truncates the larger operand types to fit the
700 /// destination vector elt type.
701 def G_BUILD_VECTOR_TRUNC : GenericInstruction {
702   let OutOperandList = (outs type0:$dst);
703   let InOperandList = (ins type1:$src0, variable_ops);
704   let hasSideEffects = 0;
705 }
706
707 /// Create a vector by concatenating vectors together.
708 def G_CONCAT_VECTORS : GenericInstruction {
709   let OutOperandList = (outs type0:$dst);
710   let InOperandList = (ins type1:$src0, variable_ops);
711   let hasSideEffects = 0;
712 }
713
714 // Intrinsic without side effects.
715 def G_INTRINSIC : GenericInstruction {
716   let OutOperandList = (outs);
717   let InOperandList = (ins unknown:$intrin, variable_ops);
718   let hasSideEffects = 0;
719 }
720
721 // Intrinsic with side effects.
722 def G_INTRINSIC_W_SIDE_EFFECTS : GenericInstruction {
723   let OutOperandList = (outs);
724   let InOperandList = (ins unknown:$intrin, variable_ops);
725   let hasSideEffects = 1;
726   let mayLoad = 1;
727   let mayStore = 1;
728 }
729
730 //------------------------------------------------------------------------------
731 // Branches.
732 //------------------------------------------------------------------------------
733
734 // Generic unconditional branch.
735 def G_BR : GenericInstruction {
736   let OutOperandList = (outs);
737   let InOperandList = (ins unknown:$src1);
738   let hasSideEffects = 0;
739   let isBranch = 1;
740   let isTerminator = 1;
741   let isBarrier = 1;
742 }
743
744 // Generic conditional branch.
745 def G_BRCOND : GenericInstruction {
746   let OutOperandList = (outs);
747   let InOperandList = (ins type0:$tst, unknown:$truebb);
748   let hasSideEffects = 0;
749   let isBranch = 1;
750   let isTerminator = 1;
751 }
752
753 // Generic indirect branch.
754 def G_BRINDIRECT : GenericInstruction {
755   let OutOperandList = (outs);
756   let InOperandList = (ins type0:$src1);
757   let hasSideEffects = 0;
758   let isBranch = 1;
759   let isTerminator = 1;
760 }
761
762 //------------------------------------------------------------------------------
763 // Vector ops
764 //------------------------------------------------------------------------------
765
766 // Generic insertelement.
767 def G_INSERT_VECTOR_ELT : GenericInstruction {
768   let OutOperandList = (outs type0:$dst);
769   let InOperandList = (ins type0:$src, type1:$elt, type2:$idx);
770   let hasSideEffects = 0;
771 }
772
773 // Generic extractelement.
774 def G_EXTRACT_VECTOR_ELT : GenericInstruction {
775   let OutOperandList = (outs type0:$dst);
776   let InOperandList = (ins type1:$src, type2:$idx);
777   let hasSideEffects = 0;
778 }
779
780 // Generic shufflevector.
781 def G_SHUFFLE_VECTOR: GenericInstruction {
782   let OutOperandList = (outs type0:$dst);
783   let InOperandList = (ins type1:$v1, type1:$v2, type2:$mask);
784   let hasSideEffects = 0;
785 }
786
787 // TODO: Add the other generic opcodes.