1//===-- llvm/Support/TargetOpcodes.def - Target Indep Opcodes ---*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the target independent instruction opcodes.
10//
11//===----------------------------------------------------------------------===//
12
13// NOTE: NO INCLUDE GUARD DESIRED!
14
15/// HANDLE_TARGET_OPCODE defines an opcode and its associated enum value.
16///
17#ifndef HANDLE_TARGET_OPCODE
18#define HANDLE_TARGET_OPCODE(OPC, NUM)
19#endif
20
21/// HANDLE_TARGET_OPCODE_MARKER defines an alternative identifier for an opcode.
22///
23#ifndef HANDLE_TARGET_OPCODE_MARKER
24#define HANDLE_TARGET_OPCODE_MARKER(IDENT, OPC)
25#endif
26
27/// Every instruction defined here must also appear in Target.td.
28///
29HANDLE_TARGET_OPCODE(PHI)
30HANDLE_TARGET_OPCODE(INLINEASM)
31HANDLE_TARGET_OPCODE(INLINEASM_BR)
32HANDLE_TARGET_OPCODE(CFI_INSTRUCTION)
33HANDLE_TARGET_OPCODE(EH_LABEL)
34HANDLE_TARGET_OPCODE(GC_LABEL)
35HANDLE_TARGET_OPCODE(ANNOTATION_LABEL)
36
37/// KILL - This instruction is a noop that is used only to adjust the
38/// liveness of registers. This can be useful when dealing with
39/// sub-registers.
40HANDLE_TARGET_OPCODE(KILL)
41
42/// EXTRACT_SUBREG - This instruction takes two operands: a register
43/// that has subregisters, and a subregister index. It returns the
44/// extracted subregister value. This is commonly used to implement
45/// truncation operations on target architectures which support it.
46HANDLE_TARGET_OPCODE(EXTRACT_SUBREG)
47
48/// INSERT_SUBREG - This instruction takes three operands: a register that
49/// has subregisters, a register providing an insert value, and a
50/// subregister index. It returns the value of the first register with the
51/// value of the second register inserted. The first register is often
52/// defined by an IMPLICIT_DEF, because it is commonly used to implement
53/// anyext operations on target architectures which support it.
54HANDLE_TARGET_OPCODE(INSERT_SUBREG)
55
56/// IMPLICIT_DEF - Defines a register without a value. Both undef and poison
57/// are selected to it, and each use may observe a different value.
58// TODO: Rename this to POISON once everyone handles it like poison.
59HANDLE_TARGET_OPCODE(IMPLICIT_DEF)
60
61/// Explicit undef initialization used past IMPLICIT_DEF elimination in cases
62/// where an undef operand must be allocated to a different register than an
63/// early-clobber result operand.
64HANDLE_TARGET_OPCODE(INIT_UNDEF)
65
66/// FREEZE - Returns an arbitrary, but fixed value of the same type when the
67/// input is undefined/poison. Otherwise, copies the input.
68HANDLE_TARGET_OPCODE(FREEZE)
69
70/// SUBREG_TO_REG - Expose the value of bits in a super register.
71/// This is typically used after an instruction which writes its result to a
72/// subregister but also, as a side effect, writes some value (often zero) into
73/// a larger super register.
74/// The result of this instruction is the value of the first operand inserted
75/// into the subregister specified by the second operand. All other bits are
76/// left undefined or however they were set by the preceding instruction.
77/// This instruction just communicates information; No code should be generated.
78HANDLE_TARGET_OPCODE(SUBREG_TO_REG)
79
80/// COPY_TO_REGCLASS - This instruction is a placeholder for a plain
81/// register-to-register copy into a specific register class. This is only
82/// used between instruction selection and MachineInstr creation, before
83/// virtual registers have been created for all the instructions, and it's
84/// only needed in cases where the register classes implied by the
85/// instructions are insufficient. It is emitted as a COPY MachineInstr.
86HANDLE_TARGET_OPCODE(COPY_TO_REGCLASS)
87
88/// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
89HANDLE_TARGET_OPCODE(DBG_VALUE)
90
91/// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic with a variadic
92/// list of locations
93HANDLE_TARGET_OPCODE(DBG_VALUE_LIST)
94
95/// DBG_INSTR_REF - A mapping of llvm.dbg.value referring to the instruction
96/// that defines the value, rather than a virtual register.
97HANDLE_TARGET_OPCODE(DBG_INSTR_REF)
98
99/// DBG_PHI - remainder of a PHI, identifies a program point where values
100/// merge under control flow.
101HANDLE_TARGET_OPCODE(DBG_PHI)
102
103/// DBG_LABEL - a mapping of the llvm.dbg.label intrinsic
104HANDLE_TARGET_OPCODE(DBG_LABEL)
105
106/// REG_SEQUENCE - This variadic instruction is used to form a register that
107/// represents a consecutive sequence of sub-registers. It's used as a
108/// register coalescing / allocation aid and must be eliminated before code
109/// emission.
110// In SDNode form, the first operand encodes the register class created by
111// the REG_SEQUENCE, while each subsequent pair names a vreg + subreg index
112// pair. Once it has been lowered to a MachineInstr, the regclass operand
113// is no longer present.
114/// e.g. v1027 = REG_SEQUENCE v1024, 3, v1025, 4, v1026, 5
115/// After register coalescing references of v1024 should be replace with
116/// v1027:3, v1025 with v1027:4, etc.
117HANDLE_TARGET_OPCODE(REG_SEQUENCE)
118
119/// COPY - Target-independent register copy. This instruction can also be
120/// used to copy between subregisters of virtual registers.
121HANDLE_TARGET_OPCODE(COPY)
122
123/// COPY_LANEMASK - Target-independent partial register copy. The laneMask
124/// operand indicates which parts of the source register are copied to the
125/// destination. Other parts of the destination are undefined. It does not
126/// support copy between virtual registers having subregister indices.
127HANDLE_TARGET_OPCODE(COPY_LANEMASK)
128
129/// BUNDLE - This instruction represents an instruction bundle. Instructions
130/// which immediately follow a BUNDLE instruction which are marked with
131/// 'InsideBundle' flag are inside the bundle.
132HANDLE_TARGET_OPCODE(BUNDLE)
133
134/// Lifetime markers.
135HANDLE_TARGET_OPCODE(LIFETIME_START)
136HANDLE_TARGET_OPCODE(LIFETIME_END)
137
138/// Pseudo probe
139HANDLE_TARGET_OPCODE(PSEUDO_PROBE)
140
141/// Arithmetic fence.
142HANDLE_TARGET_OPCODE(ARITH_FENCE)
143
144/// A Stackmap instruction captures the location of live variables at its
145/// position in the instruction stream. It is followed by a shadow of bytes
146/// that must lie within the function and not contain another stackmap.
147HANDLE_TARGET_OPCODE(STACKMAP)
148
149/// FEntry all - This is a marker instruction which gets translated into a raw fentry call.
150HANDLE_TARGET_OPCODE(FENTRY_CALL)
151
152/// Patchable call instruction - this instruction represents a call to a
153/// constant address, followed by a series of NOPs. It is intended to
154/// support optimizations for dynamic languages (such as javascript) that
155/// rewrite calls to runtimes with more efficient code sequences.
156/// This also implies a stack map.
157HANDLE_TARGET_OPCODE(PATCHPOINT)
158
159/// This pseudo-instruction loads the stack guard value. Targets which need
160/// to prevent the stack guard value or address from being spilled to the
161/// stack should override TargetLowering::emitLoadStackGuardNode and
162/// additionally expand this pseudo after register allocation.
163HANDLE_TARGET_OPCODE(LOAD_STACK_GUARD)
164
165/// These are used to support call sites that must have the stack adjusted
166/// before the call (e.g. to initialize an argument passed by value).
167/// See llvm.call.preallocated.{setup,arg} in the LangRef for more details.
168HANDLE_TARGET_OPCODE(PREALLOCATED_SETUP)
169HANDLE_TARGET_OPCODE(PREALLOCATED_ARG)
170
171/// Call instruction with associated vm state for deoptimization and list
172/// of live pointers for relocation by the garbage collector. It is
173/// intended to support garbage collection with fully precise relocating
174/// collectors and deoptimizations in either the callee or caller.
175HANDLE_TARGET_OPCODE(STATEPOINT)
176
177/// Instruction that records the offset of a local stack allocation passed to
178/// llvm.localescape. It has two arguments: the symbol for the label and the
179/// frame index of the local stack allocation.
180HANDLE_TARGET_OPCODE(LOCAL_ESCAPE)
181
182/// Wraps a machine instruction which can fault, bundled with associated
183/// information on how to handle such a fault.
184/// For example loading instruction that may page fault, bundled with associated
185/// information on how to handle such a page fault. It is intended to support
186/// "zero cost" null checks in managed languages by allowing LLVM to fold
187/// comparisons into existing memory operations.
188HANDLE_TARGET_OPCODE(FAULTING_OP)
189
190/// Precedes a machine instruction to add patchability constraints. An
191/// instruction after PATCHABLE_OP has to either have a minimum
192/// size or be preceded with a nop of that size. The first operand is
193/// an immediate denoting the minimum size of the following instruction.
194HANDLE_TARGET_OPCODE(PATCHABLE_OP)
195
196/// This is a marker instruction which gets translated into a nop sled, useful
197/// for inserting instrumentation instructions at runtime.
198HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_ENTER)
199
200/// Wraps a return instruction and its operands to enable adding nop sleds
201/// either before or after the return. The nop sleds are useful for inserting
202/// instrumentation instructions at runtime.
203/// The patch here replaces the return instruction.
204HANDLE_TARGET_OPCODE(PATCHABLE_RET)
205
206/// This is a marker instruction which gets translated into a nop sled, useful
207/// for inserting instrumentation instructions at runtime.
208/// The patch here prepends the return instruction.
209/// The same thing as in x86_64 is not possible for ARM because it has multiple
210/// return instructions. Furthermore, CPU allows parametrized and even
211/// conditional return instructions. In the current ARM implementation we are
212/// making use of the fact that currently LLVM doesn't seem to generate
213/// conditional return instructions.
214/// On ARM, the same instruction can be used for popping multiple registers
215/// from the stack and returning (it just pops pc register too), and LLVM
216/// generates it sometimes. So we can't insert the sled between this stack
217/// adjustment and the return without splitting the original instruction into 2
218/// instructions. So on ARM, rather than jumping into the exit trampoline, we
219/// call it, it does the tracing, preserves the stack and returns.
220HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_EXIT)
221
222/// Wraps a tail call instruction and its operands to enable adding nop sleds
223/// either before or after the tail exit. We use this as a disambiguation from
224/// PATCHABLE_RET which specifically only works for return instructions.
225HANDLE_TARGET_OPCODE(PATCHABLE_TAIL_CALL)
226
227/// Wraps a logging call and its arguments with nop sleds. At runtime, this can
228/// be patched to insert instrumentation instructions.
229HANDLE_TARGET_OPCODE(PATCHABLE_EVENT_CALL)
230
231/// Wraps a typed logging call and its argument with nop sleds. At runtime, this
232/// can be patched to insert instrumentation instructions.
233HANDLE_TARGET_OPCODE(PATCHABLE_TYPED_EVENT_CALL)
234
235HANDLE_TARGET_OPCODE(ICALL_BRANCH_FUNNEL)
236
237/// Represents a use of the operand but generates no code.
238HANDLE_TARGET_OPCODE(FAKE_USE)
239
240// This is a fence with the singlethread scope. It represents a compiler memory
241// barrier, but does not correspond to any generated instruction.
242HANDLE_TARGET_OPCODE(MEMBARRIER)
243
244// Provides information about what jump table the following indirect branch is
245// using.
246HANDLE_TARGET_OPCODE(JUMP_TABLE_DEBUG_INFO)
247
248// Issue a no-op relocation against a given symbol at the current location.
249HANDLE_TARGET_OPCODE(RELOC_NONE)
250
251HANDLE_TARGET_OPCODE(CONVERGENCECTRL_ENTRY)
252HANDLE_TARGET_OPCODE(CONVERGENCECTRL_ANCHOR)
253HANDLE_TARGET_OPCODE(CONVERGENCECTRL_LOOP)
254HANDLE_TARGET_OPCODE(CONVERGENCECTRL_GLUE)
255
256/// The following generic opcodes are not supposed to appear after ISel.
257/// This is something we might want to relax, but for now, this is convenient
258/// to produce diagnostics.
259
260/// Instructions which should not exist past instruction selection, but do not
261/// generate code. These instructions only act as optimization hints.
262HANDLE_TARGET_OPCODE(G_ASSERT_SEXT)
263HANDLE_TARGET_OPCODE(G_ASSERT_ZEXT)
264HANDLE_TARGET_OPCODE(G_ASSERT_ALIGN)
265HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPTIMIZATION_HINT_START,
266 G_ASSERT_SEXT)
267HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPTIMIZATION_HINT_END,
268 G_ASSERT_ALIGN)
269
270/// Generic ADD instruction. This is an integer add.
271HANDLE_TARGET_OPCODE(G_ADD)
272HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_START, G_ADD)
273
274/// Generic SUB instruction. This is an integer sub.
275HANDLE_TARGET_OPCODE(G_SUB)
276
277// Generic multiply instruction.
278HANDLE_TARGET_OPCODE(G_MUL)
279
280// Generic signed division instruction.
281HANDLE_TARGET_OPCODE(G_SDIV)
282
283// Generic unsigned division instruction.
284HANDLE_TARGET_OPCODE(G_UDIV)
285
286// Generic signed remainder instruction.
287HANDLE_TARGET_OPCODE(G_SREM)
288
289// Generic unsigned remainder instruction.
290HANDLE_TARGET_OPCODE(G_UREM)
291
292// Generic signed divrem instruction.
293HANDLE_TARGET_OPCODE(G_SDIVREM)
294
295// Generic unsigned divrem instruction.
296HANDLE_TARGET_OPCODE(G_UDIVREM)
297
298/// Generic bitwise and instruction.
299HANDLE_TARGET_OPCODE(G_AND)
300
301/// Generic bitwise or instruction.
302HANDLE_TARGET_OPCODE(G_OR)
303
304/// Generic bitwise exclusive-or instruction.
305HANDLE_TARGET_OPCODE(G_XOR)
306
307/// Generic absolute difference signed instruction.
308HANDLE_TARGET_OPCODE(G_ABDS)
309
310/// Generic absolute difference unsigned instruction.
311HANDLE_TARGET_OPCODE(G_ABDU)
312
313/// Generic vector average with truncate unsigned instruction.
314HANDLE_TARGET_OPCODE(G_UAVGFLOOR)
315
316/// Generic vector average with round unsigned instruction.
317HANDLE_TARGET_OPCODE(G_UAVGCEIL)
318
319/// Generic vector average with truncate signed instruction.
320HANDLE_TARGET_OPCODE(G_SAVGFLOOR)
321
322/// Generic vector average with round signed instruction.
323HANDLE_TARGET_OPCODE(G_SAVGCEIL)
324
325HANDLE_TARGET_OPCODE(G_IMPLICIT_DEF)
326
327/// Generic PHI instruction with types.
328HANDLE_TARGET_OPCODE(G_PHI)
329
330/// Generic instruction to materialize the address of an alloca or other
331/// stack-based object.
332HANDLE_TARGET_OPCODE(G_FRAME_INDEX)
333
334/// Generic reference to global value.
335HANDLE_TARGET_OPCODE(G_GLOBAL_VALUE)
336
337/// Generic ptrauth-signed reference to global value.
338HANDLE_TARGET_OPCODE(G_PTRAUTH_GLOBAL_VALUE)
339
340/// Generic instruction to materialize the address of an object in the constant
341/// pool.
342HANDLE_TARGET_OPCODE(G_CONSTANT_POOL)
343
344/// Generic instruction to extract blocks of bits from the register given
345/// (typically a sub-register COPY after instruction selection).
346HANDLE_TARGET_OPCODE(G_EXTRACT)
347
348HANDLE_TARGET_OPCODE(G_UNMERGE_VALUES)
349
350/// Generic instruction to insert blocks of bits from the registers given into
351/// the source.
352HANDLE_TARGET_OPCODE(G_INSERT)
353
354/// Generic instruction to paste a variable number of components together into a
355/// larger register.
356HANDLE_TARGET_OPCODE(G_MERGE_VALUES)
357
358/// Generic instruction to create a vector value from a number of scalar
359/// components.
360HANDLE_TARGET_OPCODE(G_BUILD_VECTOR)
361
362/// Generic instruction to create a vector value from a number of scalar
363/// components, which have types larger than the result vector elt type.
364HANDLE_TARGET_OPCODE(G_BUILD_VECTOR_TRUNC)
365
366/// Generic instruction to create a vector by concatenating multiple vectors.
367HANDLE_TARGET_OPCODE(G_CONCAT_VECTORS)
368
369/// Generic pointer to int conversion.
370HANDLE_TARGET_OPCODE(G_PTRTOINT)
371
372/// Generic int to pointer conversion.
373HANDLE_TARGET_OPCODE(G_INTTOPTR)
374
375/// Generic bitcast. The source and destination types must be different, or a
376/// COPY is the relevant instruction.
377HANDLE_TARGET_OPCODE(G_BITCAST)
378
379/// Generic freeze.
380HANDLE_TARGET_OPCODE(G_FREEZE)
381
382/// Constant folding barrier.
383HANDLE_TARGET_OPCODE(G_CONSTANT_FOLD_BARRIER)
384
385// INTRINSIC fptrunc_round intrinsic.
386HANDLE_TARGET_OPCODE(G_INTRINSIC_FPTRUNC_ROUND)
387
388/// INTRINSIC trunc intrinsic.
389HANDLE_TARGET_OPCODE(G_INTRINSIC_TRUNC)
390
391/// INTRINSIC round intrinsic.
392HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUND)
393
394/// INTRINSIC round to integer intrinsic.
395HANDLE_TARGET_OPCODE(G_INTRINSIC_LRINT)
396
397/// INTRINSIC long round to integer intrinsic.
398HANDLE_TARGET_OPCODE(G_INTRINSIC_LLRINT)
399
400/// INTRINSIC roundeven intrinsic.
401HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUNDEVEN)
402
403/// INTRINSIC readcyclecounter
404HANDLE_TARGET_OPCODE(G_READCYCLECOUNTER)
405
406/// INTRINSIC readsteadycounter
407HANDLE_TARGET_OPCODE(G_READSTEADYCOUNTER)
408
409/// Generic load (including anyext load)
410HANDLE_TARGET_OPCODE(G_LOAD)
411
412/// Generic signext load
413HANDLE_TARGET_OPCODE(G_SEXTLOAD)
414
415/// Generic zeroext load
416HANDLE_TARGET_OPCODE(G_ZEXTLOAD)
417
418/// Generic floating-point extending load
419HANDLE_TARGET_OPCODE(G_FPEXTLOAD)
420
421/// Generic indexed load (including anyext load)
422HANDLE_TARGET_OPCODE(G_INDEXED_LOAD)
423
424/// Generic indexed signext load
425HANDLE_TARGET_OPCODE(G_INDEXED_SEXTLOAD)
426
427/// Generic indexed zeroext load
428HANDLE_TARGET_OPCODE(G_INDEXED_ZEXTLOAD)
429
430/// Generic store.
431HANDLE_TARGET_OPCODE(G_STORE)
432
433/// Generic floating-point truncating store
434HANDLE_TARGET_OPCODE(G_FPTRUNCSTORE)
435
436/// Generic indexed store.
437HANDLE_TARGET_OPCODE(G_INDEXED_STORE)
438
439/// Generic atomic cmpxchg with internal success check.
440HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG_WITH_SUCCESS)
441
442/// Generic atomic cmpxchg.
443HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG)
444
445/// Generic atomicrmw.
446HANDLE_TARGET_OPCODE(G_ATOMICRMW_XCHG)
447HANDLE_TARGET_OPCODE(G_ATOMICRMW_ADD)
448HANDLE_TARGET_OPCODE(G_ATOMICRMW_SUB)
449HANDLE_TARGET_OPCODE(G_ATOMICRMW_AND)
450HANDLE_TARGET_OPCODE(G_ATOMICRMW_NAND)
451HANDLE_TARGET_OPCODE(G_ATOMICRMW_OR)
452HANDLE_TARGET_OPCODE(G_ATOMICRMW_XOR)
453HANDLE_TARGET_OPCODE(G_ATOMICRMW_MAX)
454HANDLE_TARGET_OPCODE(G_ATOMICRMW_MIN)
455HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMAX)
456HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMIN)
457HANDLE_TARGET_OPCODE(G_ATOMICRMW_FADD)
458HANDLE_TARGET_OPCODE(G_ATOMICRMW_FSUB)
459HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMAX)
460HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMIN)
461HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMAXIMUM)
462HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMINIMUM)
463HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMAXIMUMNUM)
464HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMINIMUMNUM)
465HANDLE_TARGET_OPCODE(G_ATOMICRMW_UINC_WRAP)
466HANDLE_TARGET_OPCODE(G_ATOMICRMW_UDEC_WRAP)
467HANDLE_TARGET_OPCODE(G_ATOMICRMW_USUB_COND)
468HANDLE_TARGET_OPCODE(G_ATOMICRMW_USUB_SAT)
469
470// Marker for start of Generic AtomicRMW opcodes
471HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMICRMW_OP_START, G_ATOMICRMW_XCHG)
472
473// Marker for end of Generic AtomicRMW opcodes
474HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMICRMW_OP_END, G_ATOMICRMW_USUB_SAT)
475
476// Generic atomic fence
477HANDLE_TARGET_OPCODE(G_FENCE)
478
479/// Generic prefetch
480HANDLE_TARGET_OPCODE(G_PREFETCH)
481
482/// Generic conditional branch instruction.
483HANDLE_TARGET_OPCODE(G_BRCOND)
484
485/// Generic indirect branch instruction.
486HANDLE_TARGET_OPCODE(G_BRINDIRECT)
487
488/// Begin an invoke region marker.
489HANDLE_TARGET_OPCODE(G_INVOKE_REGION_START)
490
491/// Generic intrinsic use (without side effects).
492HANDLE_TARGET_OPCODE(G_INTRINSIC)
493
494/// Generic intrinsic use (with side effects).
495HANDLE_TARGET_OPCODE(G_INTRINSIC_W_SIDE_EFFECTS)
496
497/// Generic intrinsic use (without side effects).
498HANDLE_TARGET_OPCODE(G_INTRINSIC_CONVERGENT)
499
500/// Generic intrinsic use (with side effects).
501HANDLE_TARGET_OPCODE(G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS)
502
503/// Generic extension allowing rubbish in high bits.
504HANDLE_TARGET_OPCODE(G_ANYEXT)
505
506/// Generic instruction to discard the high bits of a register. This differs
507/// from (G_EXTRACT val, 0) on its action on vectors: G_TRUNC will truncate
508/// each element individually, G_EXTRACT will typically discard the high
509/// elements of the vector.
510HANDLE_TARGET_OPCODE(G_TRUNC)
511
512/// Generic instruction to truncate a signed operand to a signed result with saturation.
513HANDLE_TARGET_OPCODE(G_TRUNC_SSAT_S)
514
515/// Generic instruction to truncate a signed operand to an unsigned result with saturation.
516HANDLE_TARGET_OPCODE(G_TRUNC_SSAT_U)
517
518/// Generic instruction to truncate a unsigned operand to an unsigned result with saturation.
519HANDLE_TARGET_OPCODE(G_TRUNC_USAT_U)
520
521/// Generic integer constant.
522HANDLE_TARGET_OPCODE(G_CONSTANT)
523
524/// Generic floating constant.
525HANDLE_TARGET_OPCODE(G_FCONSTANT)
526
527/// Generic va_start instruction. Stores to its one pointer operand.
528HANDLE_TARGET_OPCODE(G_VASTART)
529
530/// Generic va_arg instruction. Stores to its one pointer operand.
531HANDLE_TARGET_OPCODE(G_VAARG)
532
533// Generic sign extend
534HANDLE_TARGET_OPCODE(G_SEXT)
535HANDLE_TARGET_OPCODE(G_SEXT_INREG)
536
537// Generic zero extend
538HANDLE_TARGET_OPCODE(G_ZEXT)
539
540// Generic left-shift
541HANDLE_TARGET_OPCODE(G_SHL)
542
543// Generic logical right-shift
544HANDLE_TARGET_OPCODE(G_LSHR)
545
546// Generic arithmetic right-shift
547HANDLE_TARGET_OPCODE(G_ASHR)
548
549// Generic funnel left shift
550HANDLE_TARGET_OPCODE(G_FSHL)
551
552// Generic funnel right shift
553HANDLE_TARGET_OPCODE(G_FSHR)
554
555// Generic right rotate
556HANDLE_TARGET_OPCODE(G_ROTR)
557
558// Generic left rotate
559HANDLE_TARGET_OPCODE(G_ROTL)
560
561/// Generic integer-base comparison, also applicable to vectors of integers.
562HANDLE_TARGET_OPCODE(G_ICMP)
563
564/// Generic floating-point comparison, also applicable to vectors.
565HANDLE_TARGET_OPCODE(G_FCMP)
566
567/// Generic signed 3-way comparison.
568HANDLE_TARGET_OPCODE(G_SCMP)
569
570/// Generic unsigned 3-way comparison.
571HANDLE_TARGET_OPCODE(G_UCMP)
572
573/// Generic select.
574HANDLE_TARGET_OPCODE(G_SELECT)
575
576/// Generic unsigned add instruction, consuming the normal operands and
577/// producing the result and a carry flag.
578HANDLE_TARGET_OPCODE(G_UADDO)
579
580/// Generic unsigned add instruction, consuming the normal operands plus a carry
581/// flag, and similarly producing the result and a carry flag.
582HANDLE_TARGET_OPCODE(G_UADDE)
583
584/// Generic unsigned sub instruction, consuming the normal operands and
585/// producing the result and a carry flag.
586HANDLE_TARGET_OPCODE(G_USUBO)
587
588/// Generic unsigned subtract instruction, consuming the normal operands plus a
589/// carry flag, and similarly producing the result and a carry flag.
590HANDLE_TARGET_OPCODE(G_USUBE)
591
592/// Generic signed add instruction, producing the result and a signed overflow
593/// flag.
594HANDLE_TARGET_OPCODE(G_SADDO)
595
596/// Generic signed add instruction, consuming the normal operands plus a carry
597/// flag, and similarly producing the result and a carry flag.
598HANDLE_TARGET_OPCODE(G_SADDE)
599
600/// Generic signed subtract instruction, producing the result and a signed
601/// overflow flag.
602HANDLE_TARGET_OPCODE(G_SSUBO)
603
604/// Generic signed sub instruction, consuming the normal operands plus a carry
605/// flag, and similarly producing the result and a carry flag.
606HANDLE_TARGET_OPCODE(G_SSUBE)
607
608/// Generic unsigned multiply instruction, producing the result and a signed
609/// overflow flag.
610HANDLE_TARGET_OPCODE(G_UMULO)
611
612/// Generic signed multiply instruction, producing the result and a signed
613/// overflow flag.
614HANDLE_TARGET_OPCODE(G_SMULO)
615
616// Multiply two numbers at twice the incoming bit width (unsigned) and return
617// the high half of the result.
618HANDLE_TARGET_OPCODE(G_UMULH)
619
620// Multiply two numbers at twice the incoming bit width (signed) and return
621// the high half of the result.
622HANDLE_TARGET_OPCODE(G_SMULH)
623
624/// Generic saturating unsigned addition.
625HANDLE_TARGET_OPCODE(G_UADDSAT)
626
627/// Generic saturating signed addition.
628HANDLE_TARGET_OPCODE(G_SADDSAT)
629
630/// Generic saturating unsigned subtraction.
631HANDLE_TARGET_OPCODE(G_USUBSAT)
632
633/// Generic saturating signed subtraction.
634HANDLE_TARGET_OPCODE(G_SSUBSAT)
635
636/// Generic saturating unsigned left shift.
637HANDLE_TARGET_OPCODE(G_USHLSAT)
638
639/// Generic saturating signed left shift.
640HANDLE_TARGET_OPCODE(G_SSHLSAT)
641
642// Perform signed fixed point multiplication
643HANDLE_TARGET_OPCODE(G_SMULFIX)
644
645// Perform unsigned fixed point multiplication
646HANDLE_TARGET_OPCODE(G_UMULFIX)
647
648// Perform signed, saturating fixed point multiplication
649HANDLE_TARGET_OPCODE(G_SMULFIXSAT)
650
651// Perform unsigned, saturating fixed point multiplication
652HANDLE_TARGET_OPCODE(G_UMULFIXSAT)
653
654// Perform signed fixed point division
655HANDLE_TARGET_OPCODE(G_SDIVFIX)
656
657// Perform unsigned fixed point division
658HANDLE_TARGET_OPCODE(G_UDIVFIX)
659
660// Perform signed, saturating fixed point division
661HANDLE_TARGET_OPCODE(G_SDIVFIXSAT)
662
663// Perform unsigned, saturating fixed point division
664HANDLE_TARGET_OPCODE(G_UDIVFIXSAT)
665
666/// Generic FP addition.
667HANDLE_TARGET_OPCODE(G_FADD)
668
669/// Generic FP subtraction.
670HANDLE_TARGET_OPCODE(G_FSUB)
671
672/// Generic FP multiplication.
673HANDLE_TARGET_OPCODE(G_FMUL)
674
675/// Generic FMA multiplication. Behaves like llvm fma intrinsic
676HANDLE_TARGET_OPCODE(G_FMA)
677
678/// Generic FP multiply and add. Behaves as separate fmul and fadd.
679HANDLE_TARGET_OPCODE(G_FMAD)
680
681/// Generic FP division.
682HANDLE_TARGET_OPCODE(G_FDIV)
683
684/// Generic FP remainder.
685HANDLE_TARGET_OPCODE(G_FREM)
686
687/// Generic FP modf
688HANDLE_TARGET_OPCODE(G_FMODF)
689
690/// Generic FP exponentiation.
691HANDLE_TARGET_OPCODE(G_FPOW)
692
693/// Generic FP exponentiation, with an integer exponent.
694HANDLE_TARGET_OPCODE(G_FPOWI)
695
696/// Generic base-e exponential of a value.
697HANDLE_TARGET_OPCODE(G_FEXP)
698
699/// Generic base-2 exponential of a value.
700HANDLE_TARGET_OPCODE(G_FEXP2)
701
702/// Generic base-10 exponential of a value.
703HANDLE_TARGET_OPCODE(G_FEXP10)
704
705/// Floating point base-e logarithm of a value.
706HANDLE_TARGET_OPCODE(G_FLOG)
707
708/// Floating point base-2 logarithm of a value.
709HANDLE_TARGET_OPCODE(G_FLOG2)
710
711/// Floating point base-10 logarithm of a value.
712HANDLE_TARGET_OPCODE(G_FLOG10)
713
714/// Floating point x * 2^n
715HANDLE_TARGET_OPCODE(G_FLDEXP)
716
717/// Floating point extract fraction and exponent.
718HANDLE_TARGET_OPCODE(G_FFREXP)
719
720/// Generic FP negation.
721HANDLE_TARGET_OPCODE(G_FNEG)
722
723/// Generic FP extension.
724HANDLE_TARGET_OPCODE(G_FPEXT)
725
726/// Generic float to signed-int conversion
727HANDLE_TARGET_OPCODE(G_FPTRUNC)
728
729/// Generic float to signed-int conversion
730HANDLE_TARGET_OPCODE(G_FPTOSI)
731
732/// Generic float to unsigned-int conversion
733HANDLE_TARGET_OPCODE(G_FPTOUI)
734
735/// Generic signed-int to float conversion
736HANDLE_TARGET_OPCODE(G_SITOFP)
737
738/// Generic unsigned-int to float conversion
739HANDLE_TARGET_OPCODE(G_UITOFP)
740
741/// Generic saturating float to signed-int conversion
742HANDLE_TARGET_OPCODE(G_FPTOSI_SAT)
743
744/// Generic saturating float to unsigned-int conversion
745HANDLE_TARGET_OPCODE(G_FPTOUI_SAT)
746
747/// Generic FP absolute value.
748HANDLE_TARGET_OPCODE(G_FABS)
749
750/// FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This does
751/// not require that X and Y have the same type, just that they are both
752/// floating point. X and the result must have the same type. FCOPYSIGN(f32,
753/// f64) is allowed.
754HANDLE_TARGET_OPCODE(G_FCOPYSIGN)
755
756/// Generic test for floating-point class.
757HANDLE_TARGET_OPCODE(G_IS_FPCLASS)
758
759/// Generic FP canonicalize value.
760HANDLE_TARGET_OPCODE(G_FCANONICALIZE)
761
762/// FP min/max matching libm's fmin/fmax
763HANDLE_TARGET_OPCODE(G_FMINNUM)
764HANDLE_TARGET_OPCODE(G_FMAXNUM)
765
766/// FP min/max matching IEEE-754 2008's minnum/maxnum semantics.
767HANDLE_TARGET_OPCODE(G_FMINNUM_IEEE)
768HANDLE_TARGET_OPCODE(G_FMAXNUM_IEEE)
769
770/// FP min/max matching IEEE-754 2018 draft semantics.
771HANDLE_TARGET_OPCODE(G_FMINIMUM)
772HANDLE_TARGET_OPCODE(G_FMAXIMUM)
773HANDLE_TARGET_OPCODE(G_FMINIMUMNUM)
774HANDLE_TARGET_OPCODE(G_FMAXIMUMNUM)
775
776/// Access to FP environment.
777HANDLE_TARGET_OPCODE(G_GET_FPENV)
778HANDLE_TARGET_OPCODE(G_SET_FPENV)
779HANDLE_TARGET_OPCODE(G_RESET_FPENV)
780HANDLE_TARGET_OPCODE(G_GET_FPMODE)
781HANDLE_TARGET_OPCODE(G_SET_FPMODE)
782HANDLE_TARGET_OPCODE(G_RESET_FPMODE)
783
784HANDLE_TARGET_OPCODE(G_GET_ROUNDING)
785HANDLE_TARGET_OPCODE(G_SET_ROUNDING)
786
787/// Generic pointer offset
788HANDLE_TARGET_OPCODE(G_PTR_ADD)
789
790/// Clear the specified bits in a pointer.
791HANDLE_TARGET_OPCODE(G_PTRMASK)
792
793/// Generic signed integer minimum.
794HANDLE_TARGET_OPCODE(G_SMIN)
795
796/// Generic signed integer maximum.
797HANDLE_TARGET_OPCODE(G_SMAX)
798
799/// Generic unsigned integer maximum.
800HANDLE_TARGET_OPCODE(G_UMIN)
801
802/// Generic unsigned integer maximum.
803HANDLE_TARGET_OPCODE(G_UMAX)
804
805/// Generic integer absolute value.
806HANDLE_TARGET_OPCODE(G_ABS)
807
808HANDLE_TARGET_OPCODE(G_LROUND)
809HANDLE_TARGET_OPCODE(G_LLROUND)
810
811/// Generic BRANCH instruction. This is an unconditional branch.
812HANDLE_TARGET_OPCODE(G_BR)
813
814/// Generic branch to jump table entry.
815HANDLE_TARGET_OPCODE(G_BRJT)
816
817/// Generic vscale.
818HANDLE_TARGET_OPCODE(G_VSCALE)
819
820/// Generic insert subvector.
821HANDLE_TARGET_OPCODE(G_INSERT_SUBVECTOR)
822
823/// Generic extract subvector.
824HANDLE_TARGET_OPCODE(G_EXTRACT_SUBVECTOR)
825
826/// Generic insertelement.
827HANDLE_TARGET_OPCODE(G_INSERT_VECTOR_ELT)
828
829/// Generic extractelement.
830HANDLE_TARGET_OPCODE(G_EXTRACT_VECTOR_ELT)
831
832/// Generic shufflevector.
833HANDLE_TARGET_OPCODE(G_SHUFFLE_VECTOR)
834
835/// Generic splatvector.
836HANDLE_TARGET_OPCODE(G_SPLAT_VECTOR)
837
838/// Generic stepvector.
839HANDLE_TARGET_OPCODE(G_STEP_VECTOR)
840
841/// Generic masked compress.
842HANDLE_TARGET_OPCODE(G_VECTOR_COMPRESS)
843
844/// Generic count trailing zeroes.
845HANDLE_TARGET_OPCODE(G_CTTZ)
846
847/// Same as above, poisoned for zero inputs.
848HANDLE_TARGET_OPCODE(G_CTTZ_ZERO_POISON)
849
850/// Generic count leading zeroes.
851HANDLE_TARGET_OPCODE(G_CTLZ)
852
853/// Same as above, poisoned for zero inputs.
854HANDLE_TARGET_OPCODE(G_CTLZ_ZERO_POISON)
855
856/// Generic count extra sign bits.
857HANDLE_TARGET_OPCODE(G_CTLS)
858
859/// Generic count bits.
860HANDLE_TARGET_OPCODE(G_CTPOP)
861
862/// Generic byte swap.
863HANDLE_TARGET_OPCODE(G_BSWAP)
864
865/// Generic bit reverse.
866HANDLE_TARGET_OPCODE(G_BITREVERSE)
867
868// Generic carry-less multiply instruction.
869HANDLE_TARGET_OPCODE(G_CLMUL)
870
871// Generic carry-less multiply high instruction.
872HANDLE_TARGET_OPCODE(G_CLMULH)
873
874// Generic reversed carry-less multiply instruction.
875HANDLE_TARGET_OPCODE(G_CLMULR)
876
877/// Floating point ceil.
878HANDLE_TARGET_OPCODE(G_FCEIL)
879
880/// Floating point cosine.
881HANDLE_TARGET_OPCODE(G_FCOS)
882
883/// Floating point sine.
884HANDLE_TARGET_OPCODE(G_FSIN)
885
886/// Floating point combined sine and cosine.
887HANDLE_TARGET_OPCODE(G_FSINCOS)
888
889/// Floating point tangent.
890HANDLE_TARGET_OPCODE(G_FTAN)
891
892/// Floating point arccosine.
893HANDLE_TARGET_OPCODE(G_FACOS)
894
895/// Floating point arcsine.
896HANDLE_TARGET_OPCODE(G_FASIN)
897
898/// Floating point arctangent.
899HANDLE_TARGET_OPCODE(G_FATAN)
900
901/// Floating point arctangent of y/x.
902HANDLE_TARGET_OPCODE(G_FATAN2)
903
904/// Floating point hyperbolic cosine.
905HANDLE_TARGET_OPCODE(G_FCOSH)
906
907/// Floating point hyperbolic sine.
908HANDLE_TARGET_OPCODE(G_FSINH)
909
910/// Floating point hyperbolic tangent.
911HANDLE_TARGET_OPCODE(G_FTANH)
912
913/// Floating point square root.
914HANDLE_TARGET_OPCODE(G_FSQRT)
915
916/// Floating point floor.
917HANDLE_TARGET_OPCODE(G_FFLOOR)
918
919/// Floating point round to next integer.
920HANDLE_TARGET_OPCODE(G_FRINT)
921
922/// Floating point round to nearest integer.
923HANDLE_TARGET_OPCODE(G_FNEARBYINT)
924
925/// Generic AddressSpaceCast.
926HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST)
927
928/// Generic block address
929HANDLE_TARGET_OPCODE(G_BLOCK_ADDR)
930
931/// Generic jump table address
932HANDLE_TARGET_OPCODE(G_JUMP_TABLE)
933
934/// Generic dynamic stack allocation.
935HANDLE_TARGET_OPCODE(G_DYN_STACKALLOC)
936
937/// Generic stack pointer save.
938HANDLE_TARGET_OPCODE(G_STACKSAVE)
939
940/// Generic stack pointer restore.
941HANDLE_TARGET_OPCODE(G_STACKRESTORE)
942
943/// Strict floating point instructions.
944HANDLE_TARGET_OPCODE(G_STRICT_FADD)
945HANDLE_TARGET_OPCODE(G_STRICT_FSUB)
946HANDLE_TARGET_OPCODE(G_STRICT_FMUL)
947HANDLE_TARGET_OPCODE(G_STRICT_FDIV)
948HANDLE_TARGET_OPCODE(G_STRICT_FREM)
949HANDLE_TARGET_OPCODE(G_STRICT_FMA)
950HANDLE_TARGET_OPCODE(G_STRICT_FSQRT)
951HANDLE_TARGET_OPCODE(G_STRICT_FLDEXP)
952HANDLE_TARGET_OPCODE(G_STRICT_FCMP)
953HANDLE_TARGET_OPCODE(G_STRICT_FCMPS)
954
955/// read_register intrinsic
956HANDLE_TARGET_OPCODE(G_READ_REGISTER)
957
958/// write_register intrinsic
959HANDLE_TARGET_OPCODE(G_WRITE_REGISTER)
960
961/// llvm.memcpy intrinsic
962HANDLE_TARGET_OPCODE(G_MEMCPY)
963
964/// llvm.memcpy.inline intrinsic
965HANDLE_TARGET_OPCODE(G_MEMCPY_INLINE)
966
967/// llvm.memmove intrinsic
968HANDLE_TARGET_OPCODE(G_MEMMOVE)
969
970/// llvm.memset intrinsic
971HANDLE_TARGET_OPCODE(G_MEMSET)
972HANDLE_TARGET_OPCODE(G_BZERO)
973
974/// llvm.memset.inline intrinsic
975HANDLE_TARGET_OPCODE(G_MEMSET_INLINE)
976
977/// llvm.trap, llvm.debugtrap and llvm.ubsantrap intrinsics
978HANDLE_TARGET_OPCODE(G_TRAP)
979HANDLE_TARGET_OPCODE(G_DEBUGTRAP)
980HANDLE_TARGET_OPCODE(G_UBSANTRAP)
981
982/// Vector reductions
983HANDLE_TARGET_OPCODE(G_VECREDUCE_SEQ_FADD)
984HANDLE_TARGET_OPCODE(G_VECREDUCE_SEQ_FMUL)
985HANDLE_TARGET_OPCODE(G_VECREDUCE_FADD)
986HANDLE_TARGET_OPCODE(G_VECREDUCE_FMUL)
987HANDLE_TARGET_OPCODE(G_VECREDUCE_FMAX)
988HANDLE_TARGET_OPCODE(G_VECREDUCE_FMIN)
989HANDLE_TARGET_OPCODE(G_VECREDUCE_FMAXIMUM)
990HANDLE_TARGET_OPCODE(G_VECREDUCE_FMINIMUM)
991HANDLE_TARGET_OPCODE(G_VECREDUCE_FMAXIMUMNUM)
992HANDLE_TARGET_OPCODE(G_VECREDUCE_FMINIMUMNUM)
993HANDLE_TARGET_OPCODE(G_VECREDUCE_ADD)
994HANDLE_TARGET_OPCODE(G_VECREDUCE_MUL)
995HANDLE_TARGET_OPCODE(G_VECREDUCE_AND)
996HANDLE_TARGET_OPCODE(G_VECREDUCE_OR)
997HANDLE_TARGET_OPCODE(G_VECREDUCE_XOR)
998HANDLE_TARGET_OPCODE(G_VECREDUCE_SMAX)
999HANDLE_TARGET_OPCODE(G_VECREDUCE_SMIN)
1000HANDLE_TARGET_OPCODE(G_VECREDUCE_UMAX)
1001HANDLE_TARGET_OPCODE(G_VECREDUCE_UMIN)
1002
1003HANDLE_TARGET_OPCODE(G_SBFX)
1004HANDLE_TARGET_OPCODE(G_UBFX)
1005
1006/// Marker for the end of the generic opcode.
1007/// This is used to check if an opcode is in the range of the
1008/// generic opcodes.
1009HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_END, G_UBFX)
1010
1011/// BUILTIN_OP_END - This must be the last enum value in this list.
1012/// The target-specific post-isel opcode values start here.
1013HANDLE_TARGET_OPCODE_MARKER(GENERIC_OP_END, PRE_ISEL_GENERIC_OPCODE_END)
1014