blob: 399cea9510755d313c5e04dacd3b0f28b852865e [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- 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
19class GenericInstruction : StandardPseudoInstruction;
20
21// Extend the underlying scalar type of an operation, leaving the high bits
22// unspecified.
23def 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.
31def 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.
39def 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.
48def G_TRUNC : GenericInstruction {
49 let OutOperandList = (outs type0:$dst);
50 let InOperandList = (ins type1:$src);
51 let hasSideEffects = 0;
52}
53
54def G_IMPLICIT_DEF : GenericInstruction {
55 let OutOperandList = (outs type0:$dst);
56 let InOperandList = (ins);
57 let hasSideEffects = 0;
58}
59
60def G_PHI : GenericInstruction {
61 let OutOperandList = (outs type0:$dst);
62 let InOperandList = (ins variable_ops);
63 let hasSideEffects = 0;
64}
65
66def G_FRAME_INDEX : GenericInstruction {
67 let OutOperandList = (outs type0:$dst);
68 let InOperandList = (ins unknown:$src2);
69 let hasSideEffects = 0;
70}
71
72def G_GLOBAL_VALUE : GenericInstruction {
73 let OutOperandList = (outs type0:$dst);
74 let InOperandList = (ins unknown:$src);
75 let hasSideEffects = 0;
76}
77
78def G_INTTOPTR : GenericInstruction {
79 let OutOperandList = (outs type0:$dst);
80 let InOperandList = (ins type1:$src);
81 let hasSideEffects = 0;
82}
83
84def G_PTRTOINT : GenericInstruction {
85 let OutOperandList = (outs type0:$dst);
86 let InOperandList = (ins type1:$src);
87 let hasSideEffects = 0;
88}
89
90def G_BITCAST : GenericInstruction {
91 let OutOperandList = (outs type0:$dst);
92 let InOperandList = (ins type1:$src);
93 let hasSideEffects = 0;
94}
95
96def G_CONSTANT : GenericInstruction {
97 let OutOperandList = (outs type0:$dst);
98 let InOperandList = (ins unknown:$imm);
99 let hasSideEffects = 0;
100}
101
102def G_FCONSTANT : GenericInstruction {
103 let OutOperandList = (outs type0:$dst);
104 let InOperandList = (ins unknown:$imm);
105 let hasSideEffects = 0;
106}
107
108def G_VASTART : GenericInstruction {
109 let OutOperandList = (outs);
110 let InOperandList = (ins type0:$list);
111 let hasSideEffects = 0;
112 let mayStore = 1;
113}
114
115def 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
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100123def G_CTLZ : GenericInstruction {
124 let OutOperandList = (outs type0:$dst);
125 let InOperandList = (ins type0:$src);
126 let hasSideEffects = 0;
127}
128
129def G_CTLZ_ZERO_UNDEF : GenericInstruction {
130 let OutOperandList = (outs type0:$dst);
131 let InOperandList = (ins type0:$src);
132 let hasSideEffects = 0;
133}
134
135def G_CTTZ : GenericInstruction {
136 let OutOperandList = (outs type0:$dst);
137 let InOperandList = (ins type0:$src);
138 let hasSideEffects = 0;
139}
140
141def G_CTTZ_ZERO_UNDEF : GenericInstruction {
142 let OutOperandList = (outs type0:$dst);
143 let InOperandList = (ins type0:$src);
144 let hasSideEffects = 0;
145}
146
147def G_CTPOP : GenericInstruction {
148 let OutOperandList = (outs type0:$dst);
149 let InOperandList = (ins type0:$src);
150 let hasSideEffects = 0;
151}
152
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100153def G_BSWAP : GenericInstruction {
154 let OutOperandList = (outs type0:$dst);
155 let InOperandList = (ins type0:$src);
156 let hasSideEffects = 0;
157}
158
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100159def G_ADDRSPACE_CAST : GenericInstruction {
160 let OutOperandList = (outs type0:$dst);
161 let InOperandList = (ins type1:$src);
162 let hasSideEffects = 0;
163}
164
165def G_BLOCK_ADDR : GenericInstruction {
166 let OutOperandList = (outs type0:$dst);
167 let InOperandList = (ins unknown:$ba);
168 let hasSideEffects = 0;
169}
170
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100171//------------------------------------------------------------------------------
172// Binary ops.
173//------------------------------------------------------------------------------
174
175// Generic addition.
176def 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.
184def 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.
192def 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.
200def 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.
208def 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.
216def 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.
224def 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.
232def 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.
240def 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.
248def 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.
256def 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.
263def 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.
270def 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.
277def 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.
284def 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
291def 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.
298def G_GEP : GenericInstruction {
299 let OutOperandList = (outs type0:$dst);
300 let InOperandList = (ins type0:$src1, type1:$src2);
301 let hasSideEffects = 0;
302}
303
304def 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
Andrew Scull0372a572018-11-16 15:47:06 +0000314// Generic unsigned addition producing a carry flag.
315def 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100322// Generic unsigned addition consuming and producing a carry flag.
323def 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.
330def 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
Andrew Scull0372a572018-11-16 15:47:06 +0000337// Generic signed addition consuming and producing a carry flag.
338def 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.
345def 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}
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100350// Generic unsigned subtraction consuming and producing a carry flag.
351def 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
Andrew Scull0372a572018-11-16 15:47:06 +0000357// Generic signed subtraction producing a carry flag.
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100358def 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
Andrew Scull0372a572018-11-16 15:47:06 +0000364// Generic signed subtraction consuming and producing a carry flag.
365def 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100371// Generic unsigned multiplication producing a carry flag.
372def 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.
380def 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.
389def 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.
398def 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
409def G_FNEG : GenericInstruction {
410 let OutOperandList = (outs type0:$dst);
411 let InOperandList = (ins type0:$src);
412 let hasSideEffects = 0;
413}
414
415def G_FPEXT : GenericInstruction {
416 let OutOperandList = (outs type0:$dst);
417 let InOperandList = (ins type1:$src);
418 let hasSideEffects = 0;
419}
420
421def G_FPTRUNC : GenericInstruction {
422 let OutOperandList = (outs type0:$dst);
423 let InOperandList = (ins type1:$src);
424 let hasSideEffects = 0;
425}
426
427def G_FPTOSI : GenericInstruction {
428 let OutOperandList = (outs type0:$dst);
429 let InOperandList = (ins type1:$src);
430 let hasSideEffects = 0;
431}
432
433def G_FPTOUI : GenericInstruction {
434 let OutOperandList = (outs type0:$dst);
435 let InOperandList = (ins type1:$src);
436 let hasSideEffects = 0;
437}
438
439def G_SITOFP : GenericInstruction {
440 let OutOperandList = (outs type0:$dst);
441 let InOperandList = (ins type1:$src);
442 let hasSideEffects = 0;
443}
444
445def G_UITOFP : GenericInstruction {
446 let OutOperandList = (outs type0:$dst);
447 let InOperandList = (ins type1:$src);
448 let hasSideEffects = 0;
449}
450
451def 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.
462def 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.
470def 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.
478def 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
487def 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.
495def 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.
502def 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.
509def 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.
516def 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.
523def 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.
530def 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.
537def G_FLOG2 : GenericInstruction {
538 let OutOperandList = (outs type0:$dst);
539 let InOperandList = (ins type0:$src1);
540 let hasSideEffects = 0;
541}
542
543//------------------------------------------------------------------------------
Andrew Scull0372a572018-11-16 15:47:06 +0000544// Opcodes for LLVM Intrinsics
545//------------------------------------------------------------------------------
546def G_INTRINSIC_TRUNC : GenericInstruction {
547 let OutOperandList = (outs type0:$dst);
548 let InOperandList = (ins type0:$src1);
549 let hasSideEffects = 0;
550}
551
552def G_INTRINSIC_ROUND : GenericInstruction {
553 let OutOperandList = (outs type0:$dst);
554 let InOperandList = (ins type0:$src1);
555 let hasSideEffects = 0;
556}
557
558//------------------------------------------------------------------------------
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100559// Memory ops
560//------------------------------------------------------------------------------
561
562// Generic load. Expects a MachineMemOperand in addition to explicit operands.
563def G_LOAD : GenericInstruction {
564 let OutOperandList = (outs type0:$dst);
565 let InOperandList = (ins ptype1:$addr);
566 let hasSideEffects = 0;
567 let mayLoad = 1;
568}
569
Andrew Scullcdfcccc2018-10-05 20:58:37 +0100570// Generic sign-extended load. Expects a MachineMemOperand in addition to explicit operands.
571def G_SEXTLOAD : GenericInstruction {
572 let OutOperandList = (outs type0:$dst);
573 let InOperandList = (ins ptype1:$addr);
574 let hasSideEffects = 0;
575 let mayLoad = 1;
576}
577
578// Generic zero-extended load. Expects a MachineMemOperand in addition to explicit operands.
579def G_ZEXTLOAD : GenericInstruction {
580 let OutOperandList = (outs type0:$dst);
581 let InOperandList = (ins ptype1:$addr);
582 let hasSideEffects = 0;
583 let mayLoad = 1;
584}
585
Andrew Scull5e1ddfa2018-08-14 10:06:54 +0100586// Generic store. Expects a MachineMemOperand in addition to explicit operands.
587def G_STORE : GenericInstruction {
588 let OutOperandList = (outs);
589 let InOperandList = (ins type0:$src, ptype1:$addr);
590 let hasSideEffects = 0;
591 let mayStore = 1;
592}
593
594// Generic atomic cmpxchg with internal success check. Expects a
595// MachineMemOperand in addition to explicit operands.
596def G_ATOMIC_CMPXCHG_WITH_SUCCESS : GenericInstruction {
597 let OutOperandList = (outs type0:$oldval, type1:$success);
598 let InOperandList = (ins type2:$addr, type0:$cmpval, type0:$newval);
599 let hasSideEffects = 0;
600 let mayLoad = 1;
601 let mayStore = 1;
602}
603
604// Generic atomic cmpxchg. Expects a MachineMemOperand in addition to explicit
605// operands.
606def G_ATOMIC_CMPXCHG : GenericInstruction {
607 let OutOperandList = (outs type0:$oldval);
608 let InOperandList = (ins ptype1:$addr, type0:$cmpval, type0:$newval);
609 let hasSideEffects = 0;
610 let mayLoad = 1;
611 let mayStore = 1;
612}
613
614// Generic atomicrmw. Expects a MachineMemOperand in addition to explicit
615// operands.
616class G_ATOMICRMW_OP : GenericInstruction {
617 let OutOperandList = (outs type0:$oldval);
618 let InOperandList = (ins ptype1:$addr, type0:$val);
619 let hasSideEffects = 0;
620 let mayLoad = 1;
621 let mayStore = 1;
622}
623
624def G_ATOMICRMW_XCHG : G_ATOMICRMW_OP;
625def G_ATOMICRMW_ADD : G_ATOMICRMW_OP;
626def G_ATOMICRMW_SUB : G_ATOMICRMW_OP;
627def G_ATOMICRMW_AND : G_ATOMICRMW_OP;
628def G_ATOMICRMW_NAND : G_ATOMICRMW_OP;
629def G_ATOMICRMW_OR : G_ATOMICRMW_OP;
630def G_ATOMICRMW_XOR : G_ATOMICRMW_OP;
631def G_ATOMICRMW_MAX : G_ATOMICRMW_OP;
632def G_ATOMICRMW_MIN : G_ATOMICRMW_OP;
633def G_ATOMICRMW_UMAX : G_ATOMICRMW_OP;
634def G_ATOMICRMW_UMIN : G_ATOMICRMW_OP;
635
636//------------------------------------------------------------------------------
637// Variadic ops
638//------------------------------------------------------------------------------
639
640// Extract a register of the specified size, starting from the block given by
641// index. This will almost certainly be mapped to sub-register COPYs after
642// register banks have been selected.
643def G_EXTRACT : GenericInstruction {
644 let OutOperandList = (outs type0:$res);
645 let InOperandList = (ins type1:$src, unknown:$offset);
646 let hasSideEffects = 0;
647}
648
649// Extract multiple registers specified size, starting from blocks given by
650// indexes. This will almost certainly be mapped to sub-register COPYs after
651// register banks have been selected.
652def G_UNMERGE_VALUES : GenericInstruction {
653 let OutOperandList = (outs type0:$dst0, variable_ops);
654 let InOperandList = (ins type1:$src);
655 let hasSideEffects = 0;
656}
657
658// Insert a smaller register into a larger one at the specified bit-index.
659def G_INSERT : GenericInstruction {
660 let OutOperandList = (outs type0:$dst);
661 let InOperandList = (ins type0:$src, type1:$op, unknown:$offset);
662 let hasSideEffects = 0;
663}
664
665/// Concatenate multiple registers of the same size into a wider register.
666def G_MERGE_VALUES : GenericInstruction {
667 let OutOperandList = (outs type0:$dst);
668 let InOperandList = (ins type1:$src0, variable_ops);
669 let hasSideEffects = 0;
670}
671
672// Intrinsic without side effects.
673def G_INTRINSIC : GenericInstruction {
674 let OutOperandList = (outs);
675 let InOperandList = (ins unknown:$intrin, variable_ops);
676 let hasSideEffects = 0;
677}
678
679// Intrinsic with side effects.
680def G_INTRINSIC_W_SIDE_EFFECTS : GenericInstruction {
681 let OutOperandList = (outs);
682 let InOperandList = (ins unknown:$intrin, variable_ops);
683 let hasSideEffects = 1;
684 let mayLoad = 1;
685 let mayStore = 1;
686}
687
688//------------------------------------------------------------------------------
689// Branches.
690//------------------------------------------------------------------------------
691
692// Generic unconditional branch.
693def G_BR : GenericInstruction {
694 let OutOperandList = (outs);
695 let InOperandList = (ins unknown:$src1);
696 let hasSideEffects = 0;
697 let isBranch = 1;
698 let isTerminator = 1;
699 let isBarrier = 1;
700}
701
702// Generic conditional branch.
703def G_BRCOND : GenericInstruction {
704 let OutOperandList = (outs);
705 let InOperandList = (ins type0:$tst, unknown:$truebb);
706 let hasSideEffects = 0;
707 let isBranch = 1;
708 let isTerminator = 1;
709}
710
711// Generic indirect branch.
712def G_BRINDIRECT : GenericInstruction {
713 let OutOperandList = (outs);
714 let InOperandList = (ins type0:$src1);
715 let hasSideEffects = 0;
716 let isBranch = 1;
717 let isTerminator = 1;
718}
719
720//------------------------------------------------------------------------------
721// Vector ops
722//------------------------------------------------------------------------------
723
724// Generic insertelement.
725def G_INSERT_VECTOR_ELT : GenericInstruction {
726 let OutOperandList = (outs type0:$dst);
727 let InOperandList = (ins type0:$src, type1:$elt, type2:$idx);
728 let hasSideEffects = 0;
729}
730
731// Generic extractelement.
732def G_EXTRACT_VECTOR_ELT : GenericInstruction {
733 let OutOperandList = (outs type0:$dst);
734 let InOperandList = (ins type1:$src, type2:$idx);
735 let hasSideEffects = 0;
736}
737
738// Generic shufflevector.
739def G_SHUFFLE_VECTOR: GenericInstruction {
740 let OutOperandList = (outs type0:$dst);
741 let InOperandList = (ins type1:$v1, type1:$v2, type2:$mask);
742 let hasSideEffects = 0;
743}
744
745// TODO: Add the other generic opcodes.