TargetOpcodes.def 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  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. /// PATCHABLE_OP can be used as second operand to only insert a nop of
  151. /// required size.
  152. HANDLE_TARGET_OPCODE(PATCHABLE_OP)
  153. /// This is a marker instruction which gets translated into a nop sled, useful
  154. /// for inserting instrumentation instructions at runtime.
  155. HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_ENTER)
  156. /// Wraps a return instruction and its operands to enable adding nop sleds
  157. /// either before or after the return. The nop sleds are useful for inserting
  158. /// instrumentation instructions at runtime.
  159. /// The patch here replaces the return instruction.
  160. HANDLE_TARGET_OPCODE(PATCHABLE_RET)
  161. /// This is a marker instruction which gets translated into a nop sled, useful
  162. /// for inserting instrumentation instructions at runtime.
  163. /// The patch here prepends the return instruction.
  164. /// The same thing as in x86_64 is not possible for ARM because it has multiple
  165. /// return instructions. Furthermore, CPU allows parametrized and even
  166. /// conditional return instructions. In the current ARM implementation we are
  167. /// making use of the fact that currently LLVM doesn't seem to generate
  168. /// conditional return instructions.
  169. /// On ARM, the same instruction can be used for popping multiple registers
  170. /// from the stack and returning (it just pops pc register too), and LLVM
  171. /// generates it sometimes. So we can't insert the sled between this stack
  172. /// adjustment and the return without splitting the original instruction into 2
  173. /// instructions. So on ARM, rather than jumping into the exit trampoline, we
  174. /// call it, it does the tracing, preserves the stack and returns.
  175. HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_EXIT)
  176. /// Wraps a tail call instruction and its operands to enable adding nop sleds
  177. /// either before or after the tail exit. We use this as a disambiguation from
  178. /// PATCHABLE_RET which specifically only works for return instructions.
  179. HANDLE_TARGET_OPCODE(PATCHABLE_TAIL_CALL)
  180. /// Wraps a logging call and its arguments with nop sleds. At runtime, this can
  181. /// be patched to insert instrumentation instructions.
  182. HANDLE_TARGET_OPCODE(PATCHABLE_EVENT_CALL)
  183. /// Wraps a typed logging call and its argument with nop sleds. At runtime, this
  184. /// can be patched to insert instrumentation instructions.
  185. HANDLE_TARGET_OPCODE(PATCHABLE_TYPED_EVENT_CALL)
  186. HANDLE_TARGET_OPCODE(ICALL_BRANCH_FUNNEL)
  187. // This is a fence with the singlethread scope. It represents a compiler memory
  188. // barrier, but does not correspond to any generated instruction.
  189. HANDLE_TARGET_OPCODE(MEMBARRIER)
  190. /// The following generic opcodes are not supposed to appear after ISel.
  191. /// This is something we might want to relax, but for now, this is convenient
  192. /// to produce diagnostics.
  193. /// Instructions which should not exist past instruction selection, but do not
  194. /// generate code. These instructions only act as optimization hints.
  195. HANDLE_TARGET_OPCODE(G_ASSERT_SEXT)
  196. HANDLE_TARGET_OPCODE(G_ASSERT_ZEXT)
  197. HANDLE_TARGET_OPCODE(G_ASSERT_ALIGN)
  198. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPTIMIZATION_HINT_START,
  199. G_ASSERT_SEXT)
  200. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPTIMIZATION_HINT_END,
  201. G_ASSERT_ALIGN)
  202. /// Generic ADD instruction. This is an integer add.
  203. HANDLE_TARGET_OPCODE(G_ADD)
  204. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_START, G_ADD)
  205. /// Generic SUB instruction. This is an integer sub.
  206. HANDLE_TARGET_OPCODE(G_SUB)
  207. // Generic multiply instruction.
  208. HANDLE_TARGET_OPCODE(G_MUL)
  209. // Generic signed division instruction.
  210. HANDLE_TARGET_OPCODE(G_SDIV)
  211. // Generic unsigned division instruction.
  212. HANDLE_TARGET_OPCODE(G_UDIV)
  213. // Generic signed remainder instruction.
  214. HANDLE_TARGET_OPCODE(G_SREM)
  215. // Generic unsigned remainder instruction.
  216. HANDLE_TARGET_OPCODE(G_UREM)
  217. // Generic signed divrem instruction.
  218. HANDLE_TARGET_OPCODE(G_SDIVREM)
  219. // Generic unsigned divrem instruction.
  220. HANDLE_TARGET_OPCODE(G_UDIVREM)
  221. /// Generic bitwise and instruction.
  222. HANDLE_TARGET_OPCODE(G_AND)
  223. /// Generic bitwise or instruction.
  224. HANDLE_TARGET_OPCODE(G_OR)
  225. /// Generic bitwise exclusive-or instruction.
  226. HANDLE_TARGET_OPCODE(G_XOR)
  227. HANDLE_TARGET_OPCODE(G_IMPLICIT_DEF)
  228. /// Generic PHI instruction with types.
  229. HANDLE_TARGET_OPCODE(G_PHI)
  230. /// Generic instruction to materialize the address of an alloca or other
  231. /// stack-based object.
  232. HANDLE_TARGET_OPCODE(G_FRAME_INDEX)
  233. /// Generic reference to global value.
  234. HANDLE_TARGET_OPCODE(G_GLOBAL_VALUE)
  235. /// Generic instruction to extract blocks of bits from the register given
  236. /// (typically a sub-register COPY after instruction selection).
  237. HANDLE_TARGET_OPCODE(G_EXTRACT)
  238. HANDLE_TARGET_OPCODE(G_UNMERGE_VALUES)
  239. /// Generic instruction to insert blocks of bits from the registers given into
  240. /// the source.
  241. HANDLE_TARGET_OPCODE(G_INSERT)
  242. /// Generic instruction to paste a variable number of components together into a
  243. /// larger register.
  244. HANDLE_TARGET_OPCODE(G_MERGE_VALUES)
  245. /// Generic instruction to create a vector value from a number of scalar
  246. /// components.
  247. HANDLE_TARGET_OPCODE(G_BUILD_VECTOR)
  248. /// Generic instruction to create a vector value from a number of scalar
  249. /// components, which have types larger than the result vector elt type.
  250. HANDLE_TARGET_OPCODE(G_BUILD_VECTOR_TRUNC)
  251. /// Generic instruction to create a vector by concatenating multiple vectors.
  252. HANDLE_TARGET_OPCODE(G_CONCAT_VECTORS)
  253. /// Generic pointer to int conversion.
  254. HANDLE_TARGET_OPCODE(G_PTRTOINT)
  255. /// Generic int to pointer conversion.
  256. HANDLE_TARGET_OPCODE(G_INTTOPTR)
  257. /// Generic bitcast. The source and destination types must be different, or a
  258. /// COPY is the relevant instruction.
  259. HANDLE_TARGET_OPCODE(G_BITCAST)
  260. /// Generic freeze.
  261. HANDLE_TARGET_OPCODE(G_FREEZE)
  262. // INTRINSIC fptrunc_round intrinsic.
  263. HANDLE_TARGET_OPCODE(G_INTRINSIC_FPTRUNC_ROUND)
  264. /// INTRINSIC trunc intrinsic.
  265. HANDLE_TARGET_OPCODE(G_INTRINSIC_TRUNC)
  266. /// INTRINSIC round intrinsic.
  267. HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUND)
  268. /// INTRINSIC round to integer intrinsic.
  269. HANDLE_TARGET_OPCODE(G_INTRINSIC_LRINT)
  270. /// INTRINSIC roundeven intrinsic.
  271. HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUNDEVEN)
  272. /// INTRINSIC readcyclecounter
  273. HANDLE_TARGET_OPCODE(G_READCYCLECOUNTER)
  274. /// Generic load (including anyext load)
  275. HANDLE_TARGET_OPCODE(G_LOAD)
  276. /// Generic signext load
  277. HANDLE_TARGET_OPCODE(G_SEXTLOAD)
  278. /// Generic zeroext load
  279. HANDLE_TARGET_OPCODE(G_ZEXTLOAD)
  280. /// Generic indexed load (including anyext load)
  281. HANDLE_TARGET_OPCODE(G_INDEXED_LOAD)
  282. /// Generic indexed signext load
  283. HANDLE_TARGET_OPCODE(G_INDEXED_SEXTLOAD)
  284. /// Generic indexed zeroext load
  285. HANDLE_TARGET_OPCODE(G_INDEXED_ZEXTLOAD)
  286. /// Generic store.
  287. HANDLE_TARGET_OPCODE(G_STORE)
  288. /// Generic indexed store.
  289. HANDLE_TARGET_OPCODE(G_INDEXED_STORE)
  290. /// Generic atomic cmpxchg with internal success check.
  291. HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG_WITH_SUCCESS)
  292. /// Generic atomic cmpxchg.
  293. HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG)
  294. /// Generic atomicrmw.
  295. HANDLE_TARGET_OPCODE(G_ATOMICRMW_XCHG)
  296. HANDLE_TARGET_OPCODE(G_ATOMICRMW_ADD)
  297. HANDLE_TARGET_OPCODE(G_ATOMICRMW_SUB)
  298. HANDLE_TARGET_OPCODE(G_ATOMICRMW_AND)
  299. HANDLE_TARGET_OPCODE(G_ATOMICRMW_NAND)
  300. HANDLE_TARGET_OPCODE(G_ATOMICRMW_OR)
  301. HANDLE_TARGET_OPCODE(G_ATOMICRMW_XOR)
  302. HANDLE_TARGET_OPCODE(G_ATOMICRMW_MAX)
  303. HANDLE_TARGET_OPCODE(G_ATOMICRMW_MIN)
  304. HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMAX)
  305. HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMIN)
  306. HANDLE_TARGET_OPCODE(G_ATOMICRMW_FADD)
  307. HANDLE_TARGET_OPCODE(G_ATOMICRMW_FSUB)
  308. HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMAX)
  309. HANDLE_TARGET_OPCODE(G_ATOMICRMW_FMIN)
  310. HANDLE_TARGET_OPCODE(G_ATOMICRMW_UINC_WRAP)
  311. HANDLE_TARGET_OPCODE(G_ATOMICRMW_UDEC_WRAP)
  312. // Marker for start of Generic AtomicRMW opcodes
  313. HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMICRMW_OP_START, G_ATOMICRMW_XCHG)
  314. // Marker for end of Generic AtomicRMW opcodes
  315. HANDLE_TARGET_OPCODE_MARKER(GENERIC_ATOMICRMW_OP_END, G_ATOMICRMW_UDEC_WRAP)
  316. // Generic atomic fence
  317. HANDLE_TARGET_OPCODE(G_FENCE)
  318. /// Generic conditional branch instruction.
  319. HANDLE_TARGET_OPCODE(G_BRCOND)
  320. /// Generic indirect branch instruction.
  321. HANDLE_TARGET_OPCODE(G_BRINDIRECT)
  322. /// Begin an invoke region marker.
  323. HANDLE_TARGET_OPCODE(G_INVOKE_REGION_START)
  324. /// Generic intrinsic use (without side effects).
  325. HANDLE_TARGET_OPCODE(G_INTRINSIC)
  326. /// Generic intrinsic use (with side effects).
  327. HANDLE_TARGET_OPCODE(G_INTRINSIC_W_SIDE_EFFECTS)
  328. /// Generic extension allowing rubbish in high bits.
  329. HANDLE_TARGET_OPCODE(G_ANYEXT)
  330. /// Generic instruction to discard the high bits of a register. This differs
  331. /// from (G_EXTRACT val, 0) on its action on vectors: G_TRUNC will truncate
  332. /// each element individually, G_EXTRACT will typically discard the high
  333. /// elements of the vector.
  334. HANDLE_TARGET_OPCODE(G_TRUNC)
  335. /// Generic integer constant.
  336. HANDLE_TARGET_OPCODE(G_CONSTANT)
  337. /// Generic floating constant.
  338. HANDLE_TARGET_OPCODE(G_FCONSTANT)
  339. /// Generic va_start instruction. Stores to its one pointer operand.
  340. HANDLE_TARGET_OPCODE(G_VASTART)
  341. /// Generic va_start instruction. Stores to its one pointer operand.
  342. HANDLE_TARGET_OPCODE(G_VAARG)
  343. // Generic sign extend
  344. HANDLE_TARGET_OPCODE(G_SEXT)
  345. HANDLE_TARGET_OPCODE(G_SEXT_INREG)
  346. // Generic zero extend
  347. HANDLE_TARGET_OPCODE(G_ZEXT)
  348. // Generic left-shift
  349. HANDLE_TARGET_OPCODE(G_SHL)
  350. // Generic logical right-shift
  351. HANDLE_TARGET_OPCODE(G_LSHR)
  352. // Generic arithmetic right-shift
  353. HANDLE_TARGET_OPCODE(G_ASHR)
  354. // Generic funnel left shift
  355. HANDLE_TARGET_OPCODE(G_FSHL)
  356. // Generic funnel right shift
  357. HANDLE_TARGET_OPCODE(G_FSHR)
  358. // Generic right rotate
  359. HANDLE_TARGET_OPCODE(G_ROTR)
  360. // Generic left rotate
  361. HANDLE_TARGET_OPCODE(G_ROTL)
  362. /// Generic integer-base comparison, also applicable to vectors of integers.
  363. HANDLE_TARGET_OPCODE(G_ICMP)
  364. /// Generic floating-point comparison, also applicable to vectors.
  365. HANDLE_TARGET_OPCODE(G_FCMP)
  366. /// Generic select.
  367. HANDLE_TARGET_OPCODE(G_SELECT)
  368. /// Generic unsigned add instruction, consuming the normal operands and
  369. /// producing the result and a carry flag.
  370. HANDLE_TARGET_OPCODE(G_UADDO)
  371. /// Generic unsigned add instruction, consuming the normal operands plus a carry
  372. /// flag, and similarly producing the result and a carry flag.
  373. HANDLE_TARGET_OPCODE(G_UADDE)
  374. /// Generic unsigned sub instruction, consuming the normal operands and
  375. /// producing the result and a carry flag.
  376. HANDLE_TARGET_OPCODE(G_USUBO)
  377. /// Generic unsigned subtract instruction, consuming the normal operands plus a
  378. /// carry flag, and similarly producing the result and a carry flag.
  379. HANDLE_TARGET_OPCODE(G_USUBE)
  380. /// Generic signed add instruction, producing the result and a signed overflow
  381. /// flag.
  382. HANDLE_TARGET_OPCODE(G_SADDO)
  383. /// Generic signed add instruction, consuming the normal operands plus a carry
  384. /// flag, and similarly producing the result and a carry flag.
  385. HANDLE_TARGET_OPCODE(G_SADDE)
  386. /// Generic signed subtract instruction, producing the result and a signed
  387. /// overflow flag.
  388. HANDLE_TARGET_OPCODE(G_SSUBO)
  389. /// Generic signed sub instruction, consuming the normal operands plus a carry
  390. /// flag, and similarly producing the result and a carry flag.
  391. HANDLE_TARGET_OPCODE(G_SSUBE)
  392. /// Generic unsigned multiply instruction, producing the result and a signed
  393. /// overflow flag.
  394. HANDLE_TARGET_OPCODE(G_UMULO)
  395. /// Generic signed multiply instruction, producing the result and a signed
  396. /// overflow flag.
  397. HANDLE_TARGET_OPCODE(G_SMULO)
  398. // Multiply two numbers at twice the incoming bit width (unsigned) and return
  399. // the high half of the result.
  400. HANDLE_TARGET_OPCODE(G_UMULH)
  401. // Multiply two numbers at twice the incoming bit width (signed) and return
  402. // the high half of the result.
  403. HANDLE_TARGET_OPCODE(G_SMULH)
  404. /// Generic saturating unsigned addition.
  405. HANDLE_TARGET_OPCODE(G_UADDSAT)
  406. /// Generic saturating signed addition.
  407. HANDLE_TARGET_OPCODE(G_SADDSAT)
  408. /// Generic saturating unsigned subtraction.
  409. HANDLE_TARGET_OPCODE(G_USUBSAT)
  410. /// Generic saturating signed subtraction.
  411. HANDLE_TARGET_OPCODE(G_SSUBSAT)
  412. /// Generic saturating unsigned left shift.
  413. HANDLE_TARGET_OPCODE(G_USHLSAT)
  414. /// Generic saturating signed left shift.
  415. HANDLE_TARGET_OPCODE(G_SSHLSAT)
  416. // Perform signed fixed point multiplication
  417. HANDLE_TARGET_OPCODE(G_SMULFIX)
  418. // Perform unsigned fixed point multiplication
  419. HANDLE_TARGET_OPCODE(G_UMULFIX)
  420. // Perform signed, saturating fixed point multiplication
  421. HANDLE_TARGET_OPCODE(G_SMULFIXSAT)
  422. // Perform unsigned, saturating fixed point multiplication
  423. HANDLE_TARGET_OPCODE(G_UMULFIXSAT)
  424. // Perform signed fixed point division
  425. HANDLE_TARGET_OPCODE(G_SDIVFIX)
  426. // Perform unsigned fixed point division
  427. HANDLE_TARGET_OPCODE(G_UDIVFIX)
  428. // Perform signed, saturating fixed point division
  429. HANDLE_TARGET_OPCODE(G_SDIVFIXSAT)
  430. // Perform unsigned, saturating fixed point division
  431. HANDLE_TARGET_OPCODE(G_UDIVFIXSAT)
  432. /// Generic FP addition.
  433. HANDLE_TARGET_OPCODE(G_FADD)
  434. /// Generic FP subtraction.
  435. HANDLE_TARGET_OPCODE(G_FSUB)
  436. /// Generic FP multiplication.
  437. HANDLE_TARGET_OPCODE(G_FMUL)
  438. /// Generic FMA multiplication. Behaves like llvm fma intrinsic
  439. HANDLE_TARGET_OPCODE(G_FMA)
  440. /// Generic FP multiply and add. Behaves as separate fmul and fadd.
  441. HANDLE_TARGET_OPCODE(G_FMAD)
  442. /// Generic FP division.
  443. HANDLE_TARGET_OPCODE(G_FDIV)
  444. /// Generic FP remainder.
  445. HANDLE_TARGET_OPCODE(G_FREM)
  446. /// Generic FP exponentiation.
  447. HANDLE_TARGET_OPCODE(G_FPOW)
  448. /// Generic FP exponentiation, with an integer exponent.
  449. HANDLE_TARGET_OPCODE(G_FPOWI)
  450. /// Generic base-e exponential of a value.
  451. HANDLE_TARGET_OPCODE(G_FEXP)
  452. /// Generic base-2 exponential of a value.
  453. HANDLE_TARGET_OPCODE(G_FEXP2)
  454. /// Floating point base-e logarithm of a value.
  455. HANDLE_TARGET_OPCODE(G_FLOG)
  456. /// Floating point base-2 logarithm of a value.
  457. HANDLE_TARGET_OPCODE(G_FLOG2)
  458. /// Floating point base-10 logarithm of a value.
  459. HANDLE_TARGET_OPCODE(G_FLOG10)
  460. /// Generic FP negation.
  461. HANDLE_TARGET_OPCODE(G_FNEG)
  462. /// Generic FP extension.
  463. HANDLE_TARGET_OPCODE(G_FPEXT)
  464. /// Generic float to signed-int conversion
  465. HANDLE_TARGET_OPCODE(G_FPTRUNC)
  466. /// Generic float to signed-int conversion
  467. HANDLE_TARGET_OPCODE(G_FPTOSI)
  468. /// Generic float to unsigned-int conversion
  469. HANDLE_TARGET_OPCODE(G_FPTOUI)
  470. /// Generic signed-int to float conversion
  471. HANDLE_TARGET_OPCODE(G_SITOFP)
  472. /// Generic unsigned-int to float conversion
  473. HANDLE_TARGET_OPCODE(G_UITOFP)
  474. /// Generic FP absolute value.
  475. HANDLE_TARGET_OPCODE(G_FABS)
  476. /// FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This does
  477. /// not require that X and Y have the same type, just that they are both
  478. /// floating point. X and the result must have the same type. FCOPYSIGN(f32,
  479. /// f64) is allowed.
  480. HANDLE_TARGET_OPCODE(G_FCOPYSIGN)
  481. /// Generic test for floating-point class.
  482. HANDLE_TARGET_OPCODE(G_IS_FPCLASS)
  483. /// Generic FP canonicalize value.
  484. HANDLE_TARGET_OPCODE(G_FCANONICALIZE)
  485. /// FP min/max matching libm's fmin/fmax
  486. HANDLE_TARGET_OPCODE(G_FMINNUM)
  487. HANDLE_TARGET_OPCODE(G_FMAXNUM)
  488. /// FP min/max matching IEEE-754 2008's minnum/maxnum semantics.
  489. HANDLE_TARGET_OPCODE(G_FMINNUM_IEEE)
  490. HANDLE_TARGET_OPCODE(G_FMAXNUM_IEEE)
  491. /// FP min/max matching IEEE-754 2018 draft semantics.
  492. HANDLE_TARGET_OPCODE(G_FMINIMUM)
  493. HANDLE_TARGET_OPCODE(G_FMAXIMUM)
  494. /// Generic pointer offset
  495. HANDLE_TARGET_OPCODE(G_PTR_ADD)
  496. /// Clear the specified bits in a pointer.
  497. HANDLE_TARGET_OPCODE(G_PTRMASK)
  498. /// Generic signed integer minimum.
  499. HANDLE_TARGET_OPCODE(G_SMIN)
  500. /// Generic signed integer maximum.
  501. HANDLE_TARGET_OPCODE(G_SMAX)
  502. /// Generic unsigned integer maximum.
  503. HANDLE_TARGET_OPCODE(G_UMIN)
  504. /// Generic unsigned integer maximum.
  505. HANDLE_TARGET_OPCODE(G_UMAX)
  506. /// Generic integer absolute value.
  507. HANDLE_TARGET_OPCODE(G_ABS)
  508. HANDLE_TARGET_OPCODE(G_LROUND)
  509. HANDLE_TARGET_OPCODE(G_LLROUND)
  510. /// Generic BRANCH instruction. This is an unconditional branch.
  511. HANDLE_TARGET_OPCODE(G_BR)
  512. /// Generic branch to jump table entry.
  513. HANDLE_TARGET_OPCODE(G_BRJT)
  514. /// Generic insertelement.
  515. HANDLE_TARGET_OPCODE(G_INSERT_VECTOR_ELT)
  516. /// Generic extractelement.
  517. HANDLE_TARGET_OPCODE(G_EXTRACT_VECTOR_ELT)
  518. /// Generic shufflevector.
  519. HANDLE_TARGET_OPCODE(G_SHUFFLE_VECTOR)
  520. /// Generic count trailing zeroes.
  521. HANDLE_TARGET_OPCODE(G_CTTZ)
  522. /// Same as above, undefined for zero inputs.
  523. HANDLE_TARGET_OPCODE(G_CTTZ_ZERO_UNDEF)
  524. /// Generic count leading zeroes.
  525. HANDLE_TARGET_OPCODE(G_CTLZ)
  526. /// Same as above, undefined for zero inputs.
  527. HANDLE_TARGET_OPCODE(G_CTLZ_ZERO_UNDEF)
  528. /// Generic count bits.
  529. HANDLE_TARGET_OPCODE(G_CTPOP)
  530. /// Generic byte swap.
  531. HANDLE_TARGET_OPCODE(G_BSWAP)
  532. /// Generic bit reverse.
  533. HANDLE_TARGET_OPCODE(G_BITREVERSE)
  534. /// Floating point ceil.
  535. HANDLE_TARGET_OPCODE(G_FCEIL)
  536. /// Floating point cosine.
  537. HANDLE_TARGET_OPCODE(G_FCOS)
  538. /// Floating point sine.
  539. HANDLE_TARGET_OPCODE(G_FSIN)
  540. /// Floating point square root.
  541. HANDLE_TARGET_OPCODE(G_FSQRT)
  542. /// Floating point floor.
  543. HANDLE_TARGET_OPCODE(G_FFLOOR)
  544. /// Floating point round to next integer.
  545. HANDLE_TARGET_OPCODE(G_FRINT)
  546. /// Floating point round to nearest integer.
  547. HANDLE_TARGET_OPCODE(G_FNEARBYINT)
  548. /// Generic AddressSpaceCast.
  549. HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST)
  550. /// Generic block address
  551. HANDLE_TARGET_OPCODE(G_BLOCK_ADDR)
  552. /// Generic jump table address
  553. HANDLE_TARGET_OPCODE(G_JUMP_TABLE)
  554. /// Generic dynamic stack allocation.
  555. HANDLE_TARGET_OPCODE(G_DYN_STACKALLOC)
  556. /// Strict floating point instructions.
  557. HANDLE_TARGET_OPCODE(G_STRICT_FADD)
  558. HANDLE_TARGET_OPCODE(G_STRICT_FSUB)
  559. HANDLE_TARGET_OPCODE(G_STRICT_FMUL)
  560. HANDLE_TARGET_OPCODE(G_STRICT_FDIV)
  561. HANDLE_TARGET_OPCODE(G_STRICT_FREM)
  562. HANDLE_TARGET_OPCODE(G_STRICT_FMA)
  563. HANDLE_TARGET_OPCODE(G_STRICT_FSQRT)
  564. /// read_register intrinsic
  565. HANDLE_TARGET_OPCODE(G_READ_REGISTER)
  566. /// write_register intrinsic
  567. HANDLE_TARGET_OPCODE(G_WRITE_REGISTER)
  568. /// llvm.memcpy intrinsic
  569. HANDLE_TARGET_OPCODE(G_MEMCPY)
  570. /// llvm.memcpy.inline intrinsic
  571. HANDLE_TARGET_OPCODE(G_MEMCPY_INLINE)
  572. /// llvm.memmove intrinsic
  573. HANDLE_TARGET_OPCODE(G_MEMMOVE)
  574. /// llvm.memset intrinsic
  575. HANDLE_TARGET_OPCODE(G_MEMSET)
  576. HANDLE_TARGET_OPCODE(G_BZERO)
  577. /// Vector reductions
  578. HANDLE_TARGET_OPCODE(G_VECREDUCE_SEQ_FADD)
  579. HANDLE_TARGET_OPCODE(G_VECREDUCE_SEQ_FMUL)
  580. HANDLE_TARGET_OPCODE(G_VECREDUCE_FADD)
  581. HANDLE_TARGET_OPCODE(G_VECREDUCE_FMUL)
  582. HANDLE_TARGET_OPCODE(G_VECREDUCE_FMAX)
  583. HANDLE_TARGET_OPCODE(G_VECREDUCE_FMIN)
  584. HANDLE_TARGET_OPCODE(G_VECREDUCE_ADD)
  585. HANDLE_TARGET_OPCODE(G_VECREDUCE_MUL)
  586. HANDLE_TARGET_OPCODE(G_VECREDUCE_AND)
  587. HANDLE_TARGET_OPCODE(G_VECREDUCE_OR)
  588. HANDLE_TARGET_OPCODE(G_VECREDUCE_XOR)
  589. HANDLE_TARGET_OPCODE(G_VECREDUCE_SMAX)
  590. HANDLE_TARGET_OPCODE(G_VECREDUCE_SMIN)
  591. HANDLE_TARGET_OPCODE(G_VECREDUCE_UMAX)
  592. HANDLE_TARGET_OPCODE(G_VECREDUCE_UMIN)
  593. HANDLE_TARGET_OPCODE(G_SBFX)
  594. HANDLE_TARGET_OPCODE(G_UBFX)
  595. /// Marker for the end of the generic opcode.
  596. /// This is used to check if an opcode is in the range of the
  597. /// generic opcodes.
  598. HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_END, G_UBFX)
  599. /// BUILTIN_OP_END - This must be the last enum value in this list.
  600. /// The target-specific post-isel opcode values start here.
  601. HANDLE_TARGET_OPCODE_MARKER(GENERIC_OP_END, PRE_ISEL_GENERIC_OPCODE_END)