TargetOpcodes.def 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  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. // NOTE: NO INCLUDE GUARD DESIRED!
  13. /// HANDLE_TARGET_OPCODE defines an opcode and its associated enum value.
  14. ///
  15. #ifndef HANDLE_TARGET_OPCODE
  16. #define HANDLE_TARGET_OPCODE(OPC, NUM)
  17. #endif
  18. /// HANDLE_TARGET_OPCODE_MARKER defines an alternative identifier for an opcode.
  19. ///
  20. #ifndef HANDLE_TARGET_OPCODE_MARKER
  21. #define HANDLE_TARGET_OPCODE_MARKER(IDENT, OPC)
  22. #endif
  23. /// Every instruction defined here must also appear in Target.td.
  24. ///
  25. HANDLE_TARGET_OPCODE(PHI)
  26. HANDLE_TARGET_OPCODE(INLINEASM)
  27. HANDLE_TARGET_OPCODE(INLINEASM_BR)
  28. HANDLE_TARGET_OPCODE(CFI_INSTRUCTION)
  29. HANDLE_TARGET_OPCODE(EH_LABEL)
  30. HANDLE_TARGET_OPCODE(GC_LABEL)
  31. HANDLE_TARGET_OPCODE(ANNOTATION_LABEL)
  32. /// KILL - This instruction is a noop that is used only to adjust the
  33. /// liveness of registers. This can be useful when dealing with
  34. /// sub-registers.
  35. HANDLE_TARGET_OPCODE(KILL)
  36. /// EXTRACT_SUBREG - This instruction takes two operands: a register
  37. /// that has subregisters, and a subregister index. It returns the
  38. /// extracted subregister value. This is commonly used to implement
  39. /// truncation operations on target architectures which support it.
  40. HANDLE_TARGET_OPCODE(EXTRACT_SUBREG)
  41. /// INSERT_SUBREG - This instruction takes three operands: a register that
  42. /// has subregisters, a register providing an insert value, and a
  43. /// subregister index. It returns the value of the first register with the
  44. /// value of the second register inserted. The first register is often
  45. /// defined by an IMPLICIT_DEF, because it is commonly used to implement
  46. /// anyext operations on target architectures which support it.
  47. HANDLE_TARGET_OPCODE(INSERT_SUBREG)
  48. /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
  49. HANDLE_TARGET_OPCODE(IMPLICIT_DEF)
  50. /// SUBREG_TO_REG - Assert the value of bits in a super register.
  51. /// The result of this instruction is the value of the second operand inserted
  52. /// into the subregister specified by the third operand. All other bits are
  53. /// assumed to be equal to the bits in the immediate integer constant in the
  54. /// first operand. This instruction just communicates information; No code
  55. /// should be generated.
  56. /// This is typically used after an instruction where the write to a subregister
  57. /// implicitly cleared the bits in the super registers.
  58. HANDLE_TARGET_OPCODE(SUBREG_TO_REG)
  59. /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain
  60. /// register-to-register copy into a specific register class. This is only
  61. /// used between instruction selection and MachineInstr creation, before
  62. /// virtual registers have been created for all the instructions, and it's
  63. /// only needed in cases where the register classes implied by the
  64. /// instructions are insufficient. It is emitted as a COPY MachineInstr.
  65. HANDLE_TARGET_OPCODE(COPY_TO_REGCLASS)
  66. /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
  67. HANDLE_TARGET_OPCODE(DBG_VALUE)
  68. /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic with a variadic
  69. /// list of locations
  70. HANDLE_TARGET_OPCODE(DBG_VALUE_LIST)
  71. /// DBG_INSTR_REF - A mapping of llvm.dbg.value referring to the instruction
  72. /// that defines the value, rather than a virtual register.
  73. HANDLE_TARGET_OPCODE(DBG_INSTR_REF)
  74. /// DBG_PHI - remainder of a PHI, identifies a program point where values
  75. /// merge under control flow.
  76. HANDLE_TARGET_OPCODE(DBG_PHI)
  77. /// DBG_LABEL - a mapping of the llvm.dbg.label intrinsic
  78. HANDLE_TARGET_OPCODE(DBG_LABEL)
  79. /// REG_SEQUENCE - This variadic instruction is used to form a register that
  80. /// represents a consecutive sequence of sub-registers. It's used as a
  81. /// register coalescing / allocation aid and must be eliminated before code
  82. /// emission.
  83. // In SDNode form, the first operand encodes the register class created by
  84. // the REG_SEQUENCE, while each subsequent pair names a vreg + subreg index
  85. // pair. Once it has been lowered to a MachineInstr, the regclass operand
  86. // is no longer present.
  87. /// e.g. v1027 = REG_SEQUENCE v1024, 3, v1025, 4, v1026, 5
  88. /// After register coalescing references of v1024 should be replace with
  89. /// v1027:3, v1025 with v1027:4, etc.
  90. HANDLE_TARGET_OPCODE(REG_SEQUENCE)
  91. /// COPY - Target-independent register copy. This instruction can also be
  92. /// used to copy between subregisters of virtual registers.
  93. HANDLE_TARGET_OPCODE(COPY)
  94. /// BUNDLE - This instruction represents an instruction bundle. Instructions
  95. /// which immediately follow a BUNDLE instruction which are marked with
  96. /// 'InsideBundle' flag are inside the bundle.
  97. HANDLE_TARGET_OPCODE(BUNDLE)
  98. /// Lifetime markers.
  99. HANDLE_TARGET_OPCODE(LIFETIME_START)
  100. HANDLE_TARGET_OPCODE(LIFETIME_END)
  101. /// Pseudo probe
  102. HANDLE_TARGET_OPCODE(PSEUDO_PROBE)
  103. /// Arithmetic fence.
  104. HANDLE_TARGET_OPCODE(ARITH_FENCE)
  105. /// A Stackmap instruction captures the location of live variables at its
  106. /// position in the instruction stream. It is followed by a shadow of bytes
  107. /// that must lie within the function and not contain another stackmap.
  108. HANDLE_TARGET_OPCODE(STACKMAP)
  109. /// FEntry all - This is a marker instruction which gets translated into a raw fentry call.
  110. HANDLE_TARGET_OPCODE(FENTRY_CALL)
  111. /// Patchable call instruction - this instruction represents a call to a
  112. /// constant address, followed by a series of NOPs. It is intended to
  113. /// support optimizations for dynamic languages (such as javascript) that
  114. /// rewrite calls to runtimes with more efficient code sequences.
  115. /// This also implies a stack map.
  116. HANDLE_TARGET_OPCODE(PATCHPOINT)
  117. /// This pseudo-instruction loads the stack guard value. Targets which need
  118. /// to prevent the stack guard value or address from being spilled to the
  119. /// stack should override TargetLowering::emitLoadStackGuardNode and
  120. /// additionally expand this pseudo after register allocation.
  121. HANDLE_TARGET_OPCODE(LOAD_STACK_GUARD)
  122. /// These are used to support call sites that must have the stack adjusted
  123. /// before the call (e.g. to initialize an argument passed by value).
  124. /// See llvm.call.preallocated.{setup,arg} in the LangRef for more details.
  125. HANDLE_TARGET_OPCODE(PREALLOCATED_SETUP)
  126. HANDLE_TARGET_OPCODE(PREALLOCATED_ARG)
  127. /// Call instruction with associated vm state for deoptimization and list
  128. /// of live pointers for relocation by the garbage collector. It is
  129. /// intended to support garbage collection with fully precise relocating
  130. /// collectors and deoptimizations in either the callee or caller.
  131. HANDLE_TARGET_OPCODE(STATEPOINT)
  132. /// Instruction that records the offset of a local stack allocation passed to
  133. /// llvm.localescape. It has two arguments: the symbol for the label and the
  134. /// frame index of the local stack allocation.
  135. HANDLE_TARGET_OPCODE(LOCAL_ESCAPE)
  136. /// Wraps a machine instruction which can fault, bundled with associated
  137. /// information on how to handle such a fault.
  138. /// For example loading instruction that may page fault, bundled with associated
  139. /// information on how to handle such a page fault. It is intended to support
  140. /// "zero cost" null checks in managed languages by allowing LLVM to fold
  141. /// comparisons into existing memory operations.
  142. HANDLE_TARGET_OPCODE(FAULTING_OP)
  143. /// Wraps a machine instruction to add patchability constraints. An
  144. /// instruction wrapped in PATCHABLE_OP has to either have a minimum
  145. /// size or be preceded with a nop of that size. The first operand is
  146. /// an immediate denoting the minimum size of the instruction, the
  147. /// second operand is an immediate denoting the opcode of the original
  148. /// instruction. The rest of the operands are the operands of the
  149. /// original instruction.
  150. HANDLE_TARGET_OPCODE(PATCHABLE_OP)
  151. /// This is a marker instruction which gets translated into a nop sled, useful
  152. /// for inserting instrumentation instructions at runtime.
  153. HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_ENTER)
  154. /// Wraps a return instruction and its operands to enable adding nop sleds
  155. /// either before or after the return. The nop sleds are useful for inserting
  156. /// instrumentation instructions at runtime.
  157. /// The patch here replaces the return instruction.
  158. HANDLE_TARGET_OPCODE(PATCHABLE_RET)
  159. /// This is a marker instruction which gets translated into a nop sled, useful
  160. /// for inserting instrumentation instructions at runtime.
  161. /// The patch here prepends the return instruction.
  162. /// The same thing as in x86_64 is not possible for ARM because it has multiple
  163. /// return instructions. Furthermore, CPU allows parametrized and even
  164. /// conditional return instructions. In the current ARM implementation we are
  165. /// making use of the fact that currently LLVM doesn't seem to generate
  166. /// conditional return instructions.
  167. /// On ARM, the same instruction can be used for popping multiple registers
  168. /// from the stack and returning (it just pops pc register too), and LLVM
  169. /// generates it sometimes. So we can't insert the sled between this stack
  170. /// adjustment and the return without splitting the original instruction into 2
  171. /// instructions. So on ARM, rather than jumping into the exit trampoline, we
  172. /// call it, it does the tracing, preserves the stack and returns.
  173. HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_EXIT)
  174. /// Wraps a tail call instruction and its operands to enable adding nop sleds
  175. /// either before or after the tail exit. We use this as a disambiguation from
  176. /// PATCHABLE_RET which specifically only works for return instructions.
  177. HANDLE_TARGET_OPCODE(PATCHABLE_TAIL_CALL)
  178. /// Wraps a logging call and its arguments with nop sleds. At runtime, this can
  179. /// be patched to insert instrumentation instructions.
  180. HANDLE_TARGET_OPCODE(PATCHABLE_EVENT_CALL)
  181. /// Wraps a typed logging call and its argument with nop sleds. At runtime, this
  182. /// can be patched to insert instrumentation instructions.
  183. HANDLE_TARGET_OPCODE(PATCHABLE_TYPED_EVENT_CALL)
  184. HANDLE_TARGET_OPCODE(ICALL_BRANCH_FUNNEL)
  185. /// The following generic opcodes are not supposed to appear after ISel.
  186. /// This is something we might want to relax, but for now, this is convenient
  187. /// to produce diagnostics.
  188. /// Instructions which should not exist past instruction selection, but do not
  189. /// generate code. These instructions only act as optimization hints.
  190. HANDLE_TARGET_OPCODE(G_ASSERT_SEXT)
  191. HANDLE_TARGET_OPCODE(G_ASSERT_ZEXT)
  192. HANDLE_TARGET_OPCODE(G_ASSERT_ALIGN)
  193. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPTIMIZATION_HINT_START,
  194. G_ASSERT_SEXT)
  195. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPTIMIZATION_HINT_END,
  196. G_ASSERT_ALIGN)
  197. /// Generic ADD instruction. This is an integer add.
  198. HANDLE_TARGET_OPCODE(G_ADD)
  199. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_START, G_ADD)
  200. /// Generic SUB instruction. This is an integer sub.
  201. HANDLE_TARGET_OPCODE(G_SUB)
  202. // Generic multiply instruction.
  203. HANDLE_TARGET_OPCODE(G_MUL)
  204. // Generic signed division instruction.
  205. HANDLE_TARGET_OPCODE(G_SDIV)
  206. // Generic unsigned division instruction.
  207. HANDLE_TARGET_OPCODE(G_UDIV)
  208. // Generic signed remainder instruction.
  209. HANDLE_TARGET_OPCODE(G_SREM)
  210. // Generic unsigned remainder instruction.
  211. HANDLE_TARGET_OPCODE(G_UREM)
  212. // Generic signed divrem instruction.
  213. HANDLE_TARGET_OPCODE(G_SDIVREM)
  214. // Generic unsigned divrem instruction.
  215. HANDLE_TARGET_OPCODE(G_UDIVREM)
  216. /// Generic bitwise and instruction.
  217. HANDLE_TARGET_OPCODE(G_AND)
  218. /// Generic bitwise or instruction.
  219. HANDLE_TARGET_OPCODE(G_OR)
  220. /// Generic bitwise exclusive-or instruction.
  221. HANDLE_TARGET_OPCODE(G_XOR)
  222. HANDLE_TARGET_OPCODE(G_IMPLICIT_DEF)
  223. /// Generic PHI instruction with types.
  224. HANDLE_TARGET_OPCODE(G_PHI)
  225. /// Generic instruction to materialize the address of an alloca or other
  226. /// stack-based object.
  227. HANDLE_TARGET_OPCODE(G_FRAME_INDEX)
  228. /// Generic reference to global value.
  229. HANDLE_TARGET_OPCODE(G_GLOBAL_VALUE)
  230. /// Generic instruction to extract blocks of bits from the register given
  231. /// (typically a sub-register COPY after instruction selection).
  232. HANDLE_TARGET_OPCODE(G_EXTRACT)
  233. HANDLE_TARGET_OPCODE(G_UNMERGE_VALUES)
  234. /// Generic instruction to insert blocks of bits from the registers given into
  235. /// the source.
  236. HANDLE_TARGET_OPCODE(G_INSERT)
  237. /// Generic instruction to paste a variable number of components together into a
  238. /// larger register.
  239. HANDLE_TARGET_OPCODE(G_MERGE_VALUES)
  240. /// Generic instruction to create a vector value from a number of scalar
  241. /// components.
  242. HANDLE_TARGET_OPCODE(G_BUILD_VECTOR)
  243. /// Generic instruction to create a vector value from a number of scalar
  244. /// components, which have types larger than the result vector elt type.
  245. HANDLE_TARGET_OPCODE(G_BUILD_VECTOR_TRUNC)
  246. /// Generic instruction to create a vector by concatenating multiple vectors.
  247. HANDLE_TARGET_OPCODE(G_CONCAT_VECTORS)
  248. /// Generic pointer to int conversion.
  249. HANDLE_TARGET_OPCODE(G_PTRTOINT)
  250. /// Generic int to pointer conversion.
  251. HANDLE_TARGET_OPCODE(G_INTTOPTR)
  252. /// Generic bitcast. The source and destination types must be different, or a
  253. /// COPY is the relevant instruction.
  254. HANDLE_TARGET_OPCODE(G_BITCAST)
  255. /// Generic freeze.
  256. HANDLE_TARGET_OPCODE(G_FREEZE)
  257. /// INTRINSIC trunc intrinsic.
  258. HANDLE_TARGET_OPCODE(G_INTRINSIC_TRUNC)
  259. /// INTRINSIC round intrinsic.
  260. HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUND)
  261. /// INTRINSIC round to integer intrinsic.
  262. HANDLE_TARGET_OPCODE(G_INTRINSIC_LRINT)
  263. /// INTRINSIC roundeven intrinsic.
  264. HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUNDEVEN)
  265. /// INTRINSIC readcyclecounter
  266. HANDLE_TARGET_OPCODE(G_READCYCLECOUNTER)
  267. /// Generic load (including anyext load)
  268. HANDLE_TARGET_OPCODE(G_LOAD)
  269. /// Generic signext load
  270. HANDLE_TARGET_OPCODE(G_SEXTLOAD)
  271. /// Generic zeroext load
  272. HANDLE_TARGET_OPCODE(G_ZEXTLOAD)
  273. /// Generic indexed load (including anyext load)
  274. HANDLE_TARGET_OPCODE(G_INDEXED_LOAD)
  275. /// Generic indexed signext load
  276. HANDLE_TARGET_OPCODE(G_INDEXED_SEXTLOAD)
  277. /// Generic indexed zeroext load
  278. HANDLE_TARGET_OPCODE(G_INDEXED_ZEXTLOAD)
  279. /// Generic store.
  280. HANDLE_TARGET_OPCODE(G_STORE)
  281. /// Generic indexed store.
  282. HANDLE_TARGET_OPCODE(G_INDEXED_STORE)
  283. /// Generic atomic cmpxchg with internal success check.
  284. HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG_WITH_SUCCESS)
  285. /// Generic atomic cmpxchg.
  286. HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG)
  287. /// Generic atomicrmw.
  288. HANDLE_TARGET_OPCODE(G_ATOMICRMW_XCHG)
  289. HANDLE_TARGET_OPCODE(G_ATOMICRMW_ADD)
  290. HANDLE_TARGET_OPCODE(G_ATOMICRMW_SUB)
  291. HANDLE_TARGET_OPCODE(G_ATOMICRMW_AND)
  292. HANDLE_TARGET_OPCODE(G_ATOMICRMW_NAND)
  293. HANDLE_TARGET_OPCODE(G_ATOMICRMW_OR)
  294. HANDLE_TARGET_OPCODE(G_ATOMICRMW_XOR)
  295. HANDLE_TARGET_OPCODE(G_ATOMICRMW_MAX)
  296. HANDLE_TARGET_OPCODE(G_ATOMICRMW_MIN)
  297. HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMAX)
  298. HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMIN)
  299. HANDLE_TARGET_OPCODE(G_ATOMICRMW_FADD)
  300. HANDLE_TARGET_OPCODE(G_ATOMICRMW_FSUB)
  301. // Generic atomic fence
  302. HANDLE_TARGET_OPCODE(G_FENCE)
  303. /// Generic conditional branch instruction.
  304. HANDLE_TARGET_OPCODE(G_BRCOND)
  305. /// Generic indirect branch instruction.
  306. HANDLE_TARGET_OPCODE(G_BRINDIRECT)
  307. /// Generic intrinsic use (without side effects).
  308. HANDLE_TARGET_OPCODE(G_INTRINSIC)
  309. /// Generic intrinsic use (with side effects).
  310. HANDLE_TARGET_OPCODE(G_INTRINSIC_W_SIDE_EFFECTS)
  311. /// Generic extension allowing rubbish in high bits.
  312. HANDLE_TARGET_OPCODE(G_ANYEXT)
  313. /// Generic instruction to discard the high bits of a register. This differs
  314. /// from (G_EXTRACT val, 0) on its action on vectors: G_TRUNC will truncate
  315. /// each element individually, G_EXTRACT will typically discard the high
  316. /// elements of the vector.
  317. HANDLE_TARGET_OPCODE(G_TRUNC)
  318. /// Generic integer constant.
  319. HANDLE_TARGET_OPCODE(G_CONSTANT)
  320. /// Generic floating constant.
  321. HANDLE_TARGET_OPCODE(G_FCONSTANT)
  322. /// Generic va_start instruction. Stores to its one pointer operand.
  323. HANDLE_TARGET_OPCODE(G_VASTART)
  324. /// Generic va_start instruction. Stores to its one pointer operand.
  325. HANDLE_TARGET_OPCODE(G_VAARG)
  326. // Generic sign extend
  327. HANDLE_TARGET_OPCODE(G_SEXT)
  328. HANDLE_TARGET_OPCODE(G_SEXT_INREG)
  329. // Generic zero extend
  330. HANDLE_TARGET_OPCODE(G_ZEXT)
  331. // Generic left-shift
  332. HANDLE_TARGET_OPCODE(G_SHL)
  333. // Generic logical right-shift
  334. HANDLE_TARGET_OPCODE(G_LSHR)
  335. // Generic arithmetic right-shift
  336. HANDLE_TARGET_OPCODE(G_ASHR)
  337. // Generic funnel left shift
  338. HANDLE_TARGET_OPCODE(G_FSHL)
  339. // Generic funnel right shift
  340. HANDLE_TARGET_OPCODE(G_FSHR)
  341. // Generic right rotate
  342. HANDLE_TARGET_OPCODE(G_ROTR)
  343. // Generic left rotate
  344. HANDLE_TARGET_OPCODE(G_ROTL)
  345. /// Generic integer-base comparison, also applicable to vectors of integers.
  346. HANDLE_TARGET_OPCODE(G_ICMP)
  347. /// Generic floating-point comparison, also applicable to vectors.
  348. HANDLE_TARGET_OPCODE(G_FCMP)
  349. /// Generic select.
  350. HANDLE_TARGET_OPCODE(G_SELECT)
  351. /// Generic unsigned add instruction, consuming the normal operands and
  352. /// producing the result and a carry flag.
  353. HANDLE_TARGET_OPCODE(G_UADDO)
  354. /// Generic unsigned add instruction, consuming the normal operands plus a carry
  355. /// flag, and similarly producing the result and a carry flag.
  356. HANDLE_TARGET_OPCODE(G_UADDE)
  357. /// Generic unsigned sub instruction, consuming the normal operands and
  358. /// producing the result and a carry flag.
  359. HANDLE_TARGET_OPCODE(G_USUBO)
  360. /// Generic unsigned subtract instruction, consuming the normal operands plus a
  361. /// carry flag, and similarly producing the result and a carry flag.
  362. HANDLE_TARGET_OPCODE(G_USUBE)
  363. /// Generic signed add instruction, producing the result and a signed overflow
  364. /// flag.
  365. HANDLE_TARGET_OPCODE(G_SADDO)
  366. /// Generic signed add instruction, consuming the normal operands plus a carry
  367. /// flag, and similarly producing the result and a carry flag.
  368. HANDLE_TARGET_OPCODE(G_SADDE)
  369. /// Generic signed subtract instruction, producing the result and a signed
  370. /// overflow flag.
  371. HANDLE_TARGET_OPCODE(G_SSUBO)
  372. /// Generic signed sub instruction, consuming the normal operands plus a carry
  373. /// flag, and similarly producing the result and a carry flag.
  374. HANDLE_TARGET_OPCODE(G_SSUBE)
  375. /// Generic unsigned multiply instruction, producing the result and a signed
  376. /// overflow flag.
  377. HANDLE_TARGET_OPCODE(G_UMULO)
  378. /// Generic signed multiply instruction, producing the result and a signed
  379. /// overflow flag.
  380. HANDLE_TARGET_OPCODE(G_SMULO)
  381. // Multiply two numbers at twice the incoming bit width (unsigned) and return
  382. // the high half of the result.
  383. HANDLE_TARGET_OPCODE(G_UMULH)
  384. // Multiply two numbers at twice the incoming bit width (signed) and return
  385. // the high half of the result.
  386. HANDLE_TARGET_OPCODE(G_SMULH)
  387. /// Generic saturating unsigned addition.
  388. HANDLE_TARGET_OPCODE(G_UADDSAT)
  389. /// Generic saturating signed addition.
  390. HANDLE_TARGET_OPCODE(G_SADDSAT)
  391. /// Generic saturating unsigned subtraction.
  392. HANDLE_TARGET_OPCODE(G_USUBSAT)
  393. /// Generic saturating signed subtraction.
  394. HANDLE_TARGET_OPCODE(G_SSUBSAT)
  395. /// Generic saturating unsigned left shift.
  396. HANDLE_TARGET_OPCODE(G_USHLSAT)
  397. /// Generic saturating signed left shift.
  398. HANDLE_TARGET_OPCODE(G_SSHLSAT)
  399. // Perform signed fixed point multiplication
  400. HANDLE_TARGET_OPCODE(G_SMULFIX)
  401. // Perform unsigned fixed point multiplication
  402. HANDLE_TARGET_OPCODE(G_UMULFIX)
  403. // Perform signed, saturating fixed point multiplication
  404. HANDLE_TARGET_OPCODE(G_SMULFIXSAT)
  405. // Perform unsigned, saturating fixed point multiplication
  406. HANDLE_TARGET_OPCODE(G_UMULFIXSAT)
  407. // Perform signed fixed point division
  408. HANDLE_TARGET_OPCODE(G_SDIVFIX)
  409. // Perform unsigned fixed point division
  410. HANDLE_TARGET_OPCODE(G_UDIVFIX)
  411. // Perform signed, saturating fixed point division
  412. HANDLE_TARGET_OPCODE(G_SDIVFIXSAT)
  413. // Perform unsigned, saturating fixed point division
  414. HANDLE_TARGET_OPCODE(G_UDIVFIXSAT)
  415. /// Generic FP addition.
  416. HANDLE_TARGET_OPCODE(G_FADD)
  417. /// Generic FP subtraction.
  418. HANDLE_TARGET_OPCODE(G_FSUB)
  419. /// Generic FP multiplication.
  420. HANDLE_TARGET_OPCODE(G_FMUL)
  421. /// Generic FMA multiplication. Behaves like llvm fma intrinsic
  422. HANDLE_TARGET_OPCODE(G_FMA)
  423. /// Generic FP multiply and add. Behaves as separate fmul and fadd.
  424. HANDLE_TARGET_OPCODE(G_FMAD)
  425. /// Generic FP division.
  426. HANDLE_TARGET_OPCODE(G_FDIV)
  427. /// Generic FP remainder.
  428. HANDLE_TARGET_OPCODE(G_FREM)
  429. /// Generic FP exponentiation.
  430. HANDLE_TARGET_OPCODE(G_FPOW)
  431. /// Generic FP exponentiation, with an integer exponent.
  432. HANDLE_TARGET_OPCODE(G_FPOWI)
  433. /// Generic base-e exponential of a value.
  434. HANDLE_TARGET_OPCODE(G_FEXP)
  435. /// Generic base-2 exponential of a value.
  436. HANDLE_TARGET_OPCODE(G_FEXP2)
  437. /// Floating point base-e logarithm of a value.
  438. HANDLE_TARGET_OPCODE(G_FLOG)
  439. /// Floating point base-2 logarithm of a value.
  440. HANDLE_TARGET_OPCODE(G_FLOG2)
  441. /// Floating point base-10 logarithm of a value.
  442. HANDLE_TARGET_OPCODE(G_FLOG10)
  443. /// Generic FP negation.
  444. HANDLE_TARGET_OPCODE(G_FNEG)
  445. /// Generic FP extension.
  446. HANDLE_TARGET_OPCODE(G_FPEXT)
  447. /// Generic float to signed-int conversion
  448. HANDLE_TARGET_OPCODE(G_FPTRUNC)
  449. /// Generic float to signed-int conversion
  450. HANDLE_TARGET_OPCODE(G_FPTOSI)
  451. /// Generic float to unsigned-int conversion
  452. HANDLE_TARGET_OPCODE(G_FPTOUI)
  453. /// Generic signed-int to float conversion
  454. HANDLE_TARGET_OPCODE(G_SITOFP)
  455. /// Generic unsigned-int to float conversion
  456. HANDLE_TARGET_OPCODE(G_UITOFP)
  457. /// Generic FP absolute value.
  458. HANDLE_TARGET_OPCODE(G_FABS)
  459. /// FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This does
  460. /// not require that X and Y have the same type, just that they are both
  461. /// floating point. X and the result must have the same type. FCOPYSIGN(f32,
  462. /// f64) is allowed.
  463. HANDLE_TARGET_OPCODE(G_FCOPYSIGN)
  464. /// Generic FP canonicalize value.
  465. HANDLE_TARGET_OPCODE(G_FCANONICALIZE)
  466. /// FP min/max matching libm's fmin/fmax
  467. HANDLE_TARGET_OPCODE(G_FMINNUM)
  468. HANDLE_TARGET_OPCODE(G_FMAXNUM)
  469. /// FP min/max matching IEEE-754 2008's minnum/maxnum semantics.
  470. HANDLE_TARGET_OPCODE(G_FMINNUM_IEEE)
  471. HANDLE_TARGET_OPCODE(G_FMAXNUM_IEEE)
  472. /// FP min/max matching IEEE-754 2018 draft semantics.
  473. HANDLE_TARGET_OPCODE(G_FMINIMUM)
  474. HANDLE_TARGET_OPCODE(G_FMAXIMUM)
  475. /// Generic pointer offset
  476. HANDLE_TARGET_OPCODE(G_PTR_ADD)
  477. /// Clear the specified bits in a pointer.
  478. HANDLE_TARGET_OPCODE(G_PTRMASK)
  479. /// Generic signed integer minimum.
  480. HANDLE_TARGET_OPCODE(G_SMIN)
  481. /// Generic signed integer maximum.
  482. HANDLE_TARGET_OPCODE(G_SMAX)
  483. /// Generic unsigned integer maximum.
  484. HANDLE_TARGET_OPCODE(G_UMIN)
  485. /// Generic unsigned integer maximum.
  486. HANDLE_TARGET_OPCODE(G_UMAX)
  487. /// Generic integer absolute value.
  488. HANDLE_TARGET_OPCODE(G_ABS)
  489. HANDLE_TARGET_OPCODE(G_LROUND)
  490. HANDLE_TARGET_OPCODE(G_LLROUND)
  491. /// Generic BRANCH instruction. This is an unconditional branch.
  492. HANDLE_TARGET_OPCODE(G_BR)
  493. /// Generic branch to jump table entry.
  494. HANDLE_TARGET_OPCODE(G_BRJT)
  495. /// Generic insertelement.
  496. HANDLE_TARGET_OPCODE(G_INSERT_VECTOR_ELT)
  497. /// Generic extractelement.
  498. HANDLE_TARGET_OPCODE(G_EXTRACT_VECTOR_ELT)
  499. /// Generic shufflevector.
  500. HANDLE_TARGET_OPCODE(G_SHUFFLE_VECTOR)
  501. /// Generic count trailing zeroes.
  502. HANDLE_TARGET_OPCODE(G_CTTZ)
  503. /// Same as above, undefined for zero inputs.
  504. HANDLE_TARGET_OPCODE(G_CTTZ_ZERO_UNDEF)
  505. /// Generic count leading zeroes.
  506. HANDLE_TARGET_OPCODE(G_CTLZ)
  507. /// Same as above, undefined for zero inputs.
  508. HANDLE_TARGET_OPCODE(G_CTLZ_ZERO_UNDEF)
  509. /// Generic count bits.
  510. HANDLE_TARGET_OPCODE(G_CTPOP)
  511. /// Generic byte swap.
  512. HANDLE_TARGET_OPCODE(G_BSWAP)
  513. /// Generic bit reverse.
  514. HANDLE_TARGET_OPCODE(G_BITREVERSE)
  515. /// Floating point ceil.
  516. HANDLE_TARGET_OPCODE(G_FCEIL)
  517. /// Floating point cosine.
  518. HANDLE_TARGET_OPCODE(G_FCOS)
  519. /// Floating point sine.
  520. HANDLE_TARGET_OPCODE(G_FSIN)
  521. /// Floating point square root.
  522. HANDLE_TARGET_OPCODE(G_FSQRT)
  523. /// Floating point floor.
  524. HANDLE_TARGET_OPCODE(G_FFLOOR)
  525. /// Floating point round to next integer.
  526. HANDLE_TARGET_OPCODE(G_FRINT)
  527. /// Floating point round to nearest integer.
  528. HANDLE_TARGET_OPCODE(G_FNEARBYINT)
  529. /// Generic AddressSpaceCast.
  530. HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST)
  531. /// Generic block address
  532. HANDLE_TARGET_OPCODE(G_BLOCK_ADDR)
  533. /// Generic jump table address
  534. HANDLE_TARGET_OPCODE(G_JUMP_TABLE)
  535. /// Generic dynamic stack allocation.
  536. HANDLE_TARGET_OPCODE(G_DYN_STACKALLOC)
  537. /// Strict floating point instructions.
  538. HANDLE_TARGET_OPCODE(G_STRICT_FADD)
  539. HANDLE_TARGET_OPCODE(G_STRICT_FSUB)
  540. HANDLE_TARGET_OPCODE(G_STRICT_FMUL)
  541. HANDLE_TARGET_OPCODE(G_STRICT_FDIV)
  542. HANDLE_TARGET_OPCODE(G_STRICT_FREM)
  543. HANDLE_TARGET_OPCODE(G_STRICT_FMA)
  544. HANDLE_TARGET_OPCODE(G_STRICT_FSQRT)
  545. /// read_register intrinsic
  546. HANDLE_TARGET_OPCODE(G_READ_REGISTER)
  547. /// write_register intrinsic
  548. HANDLE_TARGET_OPCODE(G_WRITE_REGISTER)
  549. /// llvm.memcpy intrinsic
  550. HANDLE_TARGET_OPCODE(G_MEMCPY)
  551. /// llvm.memcpy.inline intrinsic
  552. HANDLE_TARGET_OPCODE(G_MEMCPY_INLINE)
  553. /// llvm.memmove intrinsic
  554. HANDLE_TARGET_OPCODE(G_MEMMOVE)
  555. /// llvm.memset intrinsic
  556. HANDLE_TARGET_OPCODE(G_MEMSET)
  557. HANDLE_TARGET_OPCODE(G_BZERO)
  558. /// Vector reductions
  559. HANDLE_TARGET_OPCODE(G_VECREDUCE_SEQ_FADD)
  560. HANDLE_TARGET_OPCODE(G_VECREDUCE_SEQ_FMUL)
  561. HANDLE_TARGET_OPCODE(G_VECREDUCE_FADD)
  562. HANDLE_TARGET_OPCODE(G_VECREDUCE_FMUL)
  563. HANDLE_TARGET_OPCODE(G_VECREDUCE_FMAX)
  564. HANDLE_TARGET_OPCODE(G_VECREDUCE_FMIN)
  565. HANDLE_TARGET_OPCODE(G_VECREDUCE_ADD)
  566. HANDLE_TARGET_OPCODE(G_VECREDUCE_MUL)
  567. HANDLE_TARGET_OPCODE(G_VECREDUCE_AND)
  568. HANDLE_TARGET_OPCODE(G_VECREDUCE_OR)
  569. HANDLE_TARGET_OPCODE(G_VECREDUCE_XOR)
  570. HANDLE_TARGET_OPCODE(G_VECREDUCE_SMAX)
  571. HANDLE_TARGET_OPCODE(G_VECREDUCE_SMIN)
  572. HANDLE_TARGET_OPCODE(G_VECREDUCE_UMAX)
  573. HANDLE_TARGET_OPCODE(G_VECREDUCE_UMIN)
  574. HANDLE_TARGET_OPCODE(G_SBFX)
  575. HANDLE_TARGET_OPCODE(G_UBFX)
  576. /// Marker for the end of the generic opcode.
  577. /// This is used to check if an opcode is in the range of the
  578. /// generic opcodes.
  579. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_END, G_UBFX)
  580. /// BUILTIN_OP_END - This must be the last enum value in this list.
  581. /// The target-specific post-isel opcode values start here.
  582. HANDLE_TARGET_OPCODE_MARKER(GENERIC_OP_END, PRE_ISEL_GENERIC_OPCODE_END)