Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- llvm/Support/TargetOpcodes.def - Target Indep Opcodes ---*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 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 | /// |
| 29 | HANDLE_TARGET_OPCODE(PHI) |
| 30 | HANDLE_TARGET_OPCODE(INLINEASM) |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 31 | HANDLE_TARGET_OPCODE(INLINEASM_BR) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 32 | HANDLE_TARGET_OPCODE(CFI_INSTRUCTION) |
| 33 | HANDLE_TARGET_OPCODE(EH_LABEL) |
| 34 | HANDLE_TARGET_OPCODE(GC_LABEL) |
| 35 | HANDLE_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. |
| 40 | HANDLE_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. |
| 46 | HANDLE_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. |
| 54 | HANDLE_TARGET_OPCODE(INSERT_SUBREG) |
| 55 | |
| 56 | /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef. |
| 57 | HANDLE_TARGET_OPCODE(IMPLICIT_DEF) |
| 58 | |
| 59 | /// SUBREG_TO_REG - Assert the value of bits in a super register. |
| 60 | /// The result of this instruction is the value of the second operand inserted |
| 61 | /// into the subregister specified by the third operand. All other bits are |
| 62 | /// assumed to be equal to the bits in the immediate integer constant in the |
| 63 | /// first operand. This instruction just communicates information; No code |
| 64 | /// should be generated. |
| 65 | /// This is typically used after an instruction where the write to a subregister |
| 66 | /// implicitly cleared the bits in the super registers. |
| 67 | HANDLE_TARGET_OPCODE(SUBREG_TO_REG) |
| 68 | |
| 69 | /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain |
| 70 | /// register-to-register copy into a specific register class. This is only |
| 71 | /// used between instruction selection and MachineInstr creation, before |
| 72 | /// virtual registers have been created for all the instructions, and it's |
| 73 | /// only needed in cases where the register classes implied by the |
| 74 | /// instructions are insufficient. It is emitted as a COPY MachineInstr. |
| 75 | HANDLE_TARGET_OPCODE(COPY_TO_REGCLASS) |
| 76 | |
| 77 | /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic |
| 78 | HANDLE_TARGET_OPCODE(DBG_VALUE) |
| 79 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 80 | /// DBG_LABEL - a mapping of the llvm.dbg.label intrinsic |
| 81 | HANDLE_TARGET_OPCODE(DBG_LABEL) |
| 82 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 83 | /// REG_SEQUENCE - This variadic instruction is used to form a register that |
| 84 | /// represents a consecutive sequence of sub-registers. It's used as a |
| 85 | /// register coalescing / allocation aid and must be eliminated before code |
| 86 | /// emission. |
| 87 | // In SDNode form, the first operand encodes the register class created by |
| 88 | // the REG_SEQUENCE, while each subsequent pair names a vreg + subreg index |
| 89 | // pair. Once it has been lowered to a MachineInstr, the regclass operand |
| 90 | // is no longer present. |
| 91 | /// e.g. v1027 = REG_SEQUENCE v1024, 3, v1025, 4, v1026, 5 |
| 92 | /// After register coalescing references of v1024 should be replace with |
| 93 | /// v1027:3, v1025 with v1027:4, etc. |
| 94 | HANDLE_TARGET_OPCODE(REG_SEQUENCE) |
| 95 | |
| 96 | /// COPY - Target-independent register copy. This instruction can also be |
| 97 | /// used to copy between subregisters of virtual registers. |
| 98 | HANDLE_TARGET_OPCODE(COPY) |
| 99 | |
| 100 | /// BUNDLE - This instruction represents an instruction bundle. Instructions |
| 101 | /// which immediately follow a BUNDLE instruction which are marked with |
| 102 | /// 'InsideBundle' flag are inside the bundle. |
| 103 | HANDLE_TARGET_OPCODE(BUNDLE) |
| 104 | |
| 105 | /// Lifetime markers. |
| 106 | HANDLE_TARGET_OPCODE(LIFETIME_START) |
| 107 | HANDLE_TARGET_OPCODE(LIFETIME_END) |
| 108 | |
| 109 | /// A Stackmap instruction captures the location of live variables at its |
| 110 | /// position in the instruction stream. It is followed by a shadow of bytes |
| 111 | /// that must lie within the function and not contain another stackmap. |
| 112 | HANDLE_TARGET_OPCODE(STACKMAP) |
| 113 | |
| 114 | /// FEntry all - This is a marker instruction which gets translated into a raw fentry call. |
| 115 | HANDLE_TARGET_OPCODE(FENTRY_CALL) |
| 116 | |
| 117 | /// Patchable call instruction - this instruction represents a call to a |
| 118 | /// constant address, followed by a series of NOPs. It is intended to |
| 119 | /// support optimizations for dynamic languages (such as javascript) that |
| 120 | /// rewrite calls to runtimes with more efficient code sequences. |
| 121 | /// This also implies a stack map. |
| 122 | HANDLE_TARGET_OPCODE(PATCHPOINT) |
| 123 | |
| 124 | /// This pseudo-instruction loads the stack guard value. Targets which need |
| 125 | /// to prevent the stack guard value or address from being spilled to the |
| 126 | /// stack should override TargetLowering::emitLoadStackGuardNode and |
| 127 | /// additionally expand this pseudo after register allocation. |
| 128 | HANDLE_TARGET_OPCODE(LOAD_STACK_GUARD) |
| 129 | |
| 130 | /// Call instruction with associated vm state for deoptimization and list |
| 131 | /// of live pointers for relocation by the garbage collector. It is |
| 132 | /// intended to support garbage collection with fully precise relocating |
| 133 | /// collectors and deoptimizations in either the callee or caller. |
| 134 | HANDLE_TARGET_OPCODE(STATEPOINT) |
| 135 | |
| 136 | /// Instruction that records the offset of a local stack allocation passed to |
| 137 | /// llvm.localescape. It has two arguments: the symbol for the label and the |
| 138 | /// frame index of the local stack allocation. |
| 139 | HANDLE_TARGET_OPCODE(LOCAL_ESCAPE) |
| 140 | |
| 141 | /// Wraps a machine instruction which can fault, bundled with associated |
| 142 | /// information on how to handle such a fault. |
| 143 | /// For example loading instruction that may page fault, bundled with associated |
| 144 | /// information on how to handle such a page fault. It is intended to support |
| 145 | /// "zero cost" null checks in managed languages by allowing LLVM to fold |
| 146 | /// comparisons into existing memory operations. |
| 147 | HANDLE_TARGET_OPCODE(FAULTING_OP) |
| 148 | |
| 149 | /// Wraps a machine instruction to add patchability constraints. An |
| 150 | /// instruction wrapped in PATCHABLE_OP has to either have a minimum |
| 151 | /// size or be preceded with a nop of that size. The first operand is |
| 152 | /// an immediate denoting the minimum size of the instruction, the |
| 153 | /// second operand is an immediate denoting the opcode of the original |
| 154 | /// instruction. The rest of the operands are the operands of the |
| 155 | /// original instruction. |
| 156 | HANDLE_TARGET_OPCODE(PATCHABLE_OP) |
| 157 | |
| 158 | /// This is a marker instruction which gets translated into a nop sled, useful |
| 159 | /// for inserting instrumentation instructions at runtime. |
| 160 | HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_ENTER) |
| 161 | |
| 162 | /// Wraps a return instruction and its operands to enable adding nop sleds |
| 163 | /// either before or after the return. The nop sleds are useful for inserting |
| 164 | /// instrumentation instructions at runtime. |
| 165 | /// The patch here replaces the return instruction. |
| 166 | HANDLE_TARGET_OPCODE(PATCHABLE_RET) |
| 167 | |
| 168 | /// This is a marker instruction which gets translated into a nop sled, useful |
| 169 | /// for inserting instrumentation instructions at runtime. |
| 170 | /// The patch here prepends the return instruction. |
| 171 | /// The same thing as in x86_64 is not possible for ARM because it has multiple |
| 172 | /// return instructions. Furthermore, CPU allows parametrized and even |
| 173 | /// conditional return instructions. In the current ARM implementation we are |
| 174 | /// making use of the fact that currently LLVM doesn't seem to generate |
| 175 | /// conditional return instructions. |
| 176 | /// On ARM, the same instruction can be used for popping multiple registers |
| 177 | /// from the stack and returning (it just pops pc register too), and LLVM |
| 178 | /// generates it sometimes. So we can't insert the sled between this stack |
| 179 | /// adjustment and the return without splitting the original instruction into 2 |
| 180 | /// instructions. So on ARM, rather than jumping into the exit trampoline, we |
| 181 | /// call it, it does the tracing, preserves the stack and returns. |
| 182 | HANDLE_TARGET_OPCODE(PATCHABLE_FUNCTION_EXIT) |
| 183 | |
| 184 | /// Wraps a tail call instruction and its operands to enable adding nop sleds |
| 185 | /// either before or after the tail exit. We use this as a disambiguation from |
| 186 | /// PATCHABLE_RET which specifically only works for return instructions. |
| 187 | HANDLE_TARGET_OPCODE(PATCHABLE_TAIL_CALL) |
| 188 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 189 | /// Wraps a logging call and its arguments with nop sleds. At runtime, this can |
| 190 | /// be patched to insert instrumentation instructions. |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 191 | HANDLE_TARGET_OPCODE(PATCHABLE_EVENT_CALL) |
| 192 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 193 | /// Wraps a typed logging call and its argument with nop sleds. At runtime, this |
| 194 | /// can be patched to insert instrumentation instructions. |
| 195 | HANDLE_TARGET_OPCODE(PATCHABLE_TYPED_EVENT_CALL) |
| 196 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 197 | HANDLE_TARGET_OPCODE(ICALL_BRANCH_FUNNEL) |
| 198 | |
| 199 | /// The following generic opcodes are not supposed to appear after ISel. |
| 200 | /// This is something we might want to relax, but for now, this is convenient |
| 201 | /// to produce diagnostics. |
| 202 | |
| 203 | /// Generic ADD instruction. This is an integer add. |
| 204 | HANDLE_TARGET_OPCODE(G_ADD) |
| 205 | HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_START, G_ADD) |
| 206 | |
| 207 | /// Generic SUB instruction. This is an integer sub. |
| 208 | HANDLE_TARGET_OPCODE(G_SUB) |
| 209 | |
| 210 | // Generic multiply instruction. |
| 211 | HANDLE_TARGET_OPCODE(G_MUL) |
| 212 | |
| 213 | // Generic signed division instruction. |
| 214 | HANDLE_TARGET_OPCODE(G_SDIV) |
| 215 | |
| 216 | // Generic unsigned division instruction. |
| 217 | HANDLE_TARGET_OPCODE(G_UDIV) |
| 218 | |
| 219 | // Generic signed remainder instruction. |
| 220 | HANDLE_TARGET_OPCODE(G_SREM) |
| 221 | |
| 222 | // Generic unsigned remainder instruction. |
| 223 | HANDLE_TARGET_OPCODE(G_UREM) |
| 224 | |
| 225 | /// Generic bitwise and instruction. |
| 226 | HANDLE_TARGET_OPCODE(G_AND) |
| 227 | |
| 228 | /// Generic bitwise or instruction. |
| 229 | HANDLE_TARGET_OPCODE(G_OR) |
| 230 | |
| 231 | /// Generic bitwise exclusive-or instruction. |
| 232 | HANDLE_TARGET_OPCODE(G_XOR) |
| 233 | |
| 234 | |
| 235 | HANDLE_TARGET_OPCODE(G_IMPLICIT_DEF) |
| 236 | |
| 237 | /// Generic PHI instruction with types. |
| 238 | HANDLE_TARGET_OPCODE(G_PHI) |
| 239 | |
| 240 | /// Generic instruction to materialize the address of an alloca or other |
| 241 | /// stack-based object. |
| 242 | HANDLE_TARGET_OPCODE(G_FRAME_INDEX) |
| 243 | |
| 244 | /// Generic reference to global value. |
| 245 | HANDLE_TARGET_OPCODE(G_GLOBAL_VALUE) |
| 246 | |
| 247 | /// Generic instruction to extract blocks of bits from the register given |
| 248 | /// (typically a sub-register COPY after instruction selection). |
| 249 | HANDLE_TARGET_OPCODE(G_EXTRACT) |
| 250 | |
| 251 | HANDLE_TARGET_OPCODE(G_UNMERGE_VALUES) |
| 252 | |
| 253 | /// Generic instruction to insert blocks of bits from the registers given into |
| 254 | /// the source. |
| 255 | HANDLE_TARGET_OPCODE(G_INSERT) |
| 256 | |
| 257 | /// Generic instruction to paste a variable number of components together into a |
| 258 | /// larger register. |
| 259 | HANDLE_TARGET_OPCODE(G_MERGE_VALUES) |
| 260 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 261 | /// Generic instruction to create a vector value from a number of scalar |
| 262 | /// components. |
| 263 | HANDLE_TARGET_OPCODE(G_BUILD_VECTOR) |
| 264 | |
| 265 | /// Generic instruction to create a vector value from a number of scalar |
| 266 | /// components, which have types larger than the result vector elt type. |
| 267 | HANDLE_TARGET_OPCODE(G_BUILD_VECTOR_TRUNC) |
| 268 | |
| 269 | /// Generic instruction to create a vector by concatenating multiple vectors. |
| 270 | HANDLE_TARGET_OPCODE(G_CONCAT_VECTORS) |
| 271 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 272 | /// Generic pointer to int conversion. |
| 273 | HANDLE_TARGET_OPCODE(G_PTRTOINT) |
| 274 | |
| 275 | /// Generic int to pointer conversion. |
| 276 | HANDLE_TARGET_OPCODE(G_INTTOPTR) |
| 277 | |
| 278 | /// Generic bitcast. The source and destination types must be different, or a |
| 279 | /// COPY is the relevant instruction. |
| 280 | HANDLE_TARGET_OPCODE(G_BITCAST) |
| 281 | |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 282 | /// INTRINSIC trunc intrinsic. |
| 283 | HANDLE_TARGET_OPCODE(G_INTRINSIC_TRUNC) |
| 284 | |
| 285 | /// INTRINSIC round intrinsic. |
| 286 | HANDLE_TARGET_OPCODE(G_INTRINSIC_ROUND) |
| 287 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 288 | /// Generic load (including anyext load) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 289 | HANDLE_TARGET_OPCODE(G_LOAD) |
| 290 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 291 | /// Generic signext load |
| 292 | HANDLE_TARGET_OPCODE(G_SEXTLOAD) |
| 293 | |
| 294 | /// Generic zeroext load |
| 295 | HANDLE_TARGET_OPCODE(G_ZEXTLOAD) |
| 296 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 297 | /// Generic store. |
| 298 | HANDLE_TARGET_OPCODE(G_STORE) |
| 299 | |
| 300 | /// Generic atomic cmpxchg with internal success check. |
| 301 | HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG_WITH_SUCCESS) |
| 302 | |
| 303 | /// Generic atomic cmpxchg. |
| 304 | HANDLE_TARGET_OPCODE(G_ATOMIC_CMPXCHG) |
| 305 | |
| 306 | /// Generic atomicrmw. |
| 307 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_XCHG) |
| 308 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_ADD) |
| 309 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_SUB) |
| 310 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_AND) |
| 311 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_NAND) |
| 312 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_OR) |
| 313 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_XOR) |
| 314 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_MAX) |
| 315 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_MIN) |
| 316 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMAX) |
| 317 | HANDLE_TARGET_OPCODE(G_ATOMICRMW_UMIN) |
| 318 | |
| 319 | /// Generic conditional branch instruction. |
| 320 | HANDLE_TARGET_OPCODE(G_BRCOND) |
| 321 | |
| 322 | /// Generic indirect branch instruction. |
| 323 | HANDLE_TARGET_OPCODE(G_BRINDIRECT) |
| 324 | |
| 325 | /// Generic intrinsic use (without side effects). |
| 326 | HANDLE_TARGET_OPCODE(G_INTRINSIC) |
| 327 | |
| 328 | /// Generic intrinsic use (with side effects). |
| 329 | HANDLE_TARGET_OPCODE(G_INTRINSIC_W_SIDE_EFFECTS) |
| 330 | |
| 331 | /// Generic extension allowing rubbish in high bits. |
| 332 | HANDLE_TARGET_OPCODE(G_ANYEXT) |
| 333 | |
| 334 | /// Generic instruction to discard the high bits of a register. This differs |
| 335 | /// from (G_EXTRACT val, 0) on its action on vectors: G_TRUNC will truncate |
| 336 | /// each element individually, G_EXTRACT will typically discard the high |
| 337 | /// elements of the vector. |
| 338 | HANDLE_TARGET_OPCODE(G_TRUNC) |
| 339 | |
| 340 | /// Generic integer constant. |
| 341 | HANDLE_TARGET_OPCODE(G_CONSTANT) |
| 342 | |
| 343 | /// Generic floating constant. |
| 344 | HANDLE_TARGET_OPCODE(G_FCONSTANT) |
| 345 | |
| 346 | /// Generic va_start instruction. Stores to its one pointer operand. |
| 347 | HANDLE_TARGET_OPCODE(G_VASTART) |
| 348 | |
| 349 | /// Generic va_start instruction. Stores to its one pointer operand. |
| 350 | HANDLE_TARGET_OPCODE(G_VAARG) |
| 351 | |
| 352 | // Generic sign extend |
| 353 | HANDLE_TARGET_OPCODE(G_SEXT) |
| 354 | |
| 355 | // Generic zero extend |
| 356 | HANDLE_TARGET_OPCODE(G_ZEXT) |
| 357 | |
| 358 | // Generic left-shift |
| 359 | HANDLE_TARGET_OPCODE(G_SHL) |
| 360 | |
| 361 | // Generic logical right-shift |
| 362 | HANDLE_TARGET_OPCODE(G_LSHR) |
| 363 | |
| 364 | // Generic arithmetic right-shift |
| 365 | HANDLE_TARGET_OPCODE(G_ASHR) |
| 366 | |
| 367 | /// Generic integer-base comparison, also applicable to vectors of integers. |
| 368 | HANDLE_TARGET_OPCODE(G_ICMP) |
| 369 | |
| 370 | /// Generic floating-point comparison, also applicable to vectors. |
| 371 | HANDLE_TARGET_OPCODE(G_FCMP) |
| 372 | |
| 373 | /// Generic select. |
| 374 | HANDLE_TARGET_OPCODE(G_SELECT) |
| 375 | |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 376 | /// Generic unsigned add instruction, consuming the normal operands and |
| 377 | /// producing the result and a carry flag. |
| 378 | HANDLE_TARGET_OPCODE(G_UADDO) |
| 379 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 380 | /// Generic unsigned add instruction, consuming the normal operands plus a carry |
| 381 | /// flag, and similarly producing the result and a carry flag. |
| 382 | HANDLE_TARGET_OPCODE(G_UADDE) |
| 383 | |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 384 | /// Generic unsigned sub instruction, consuming the normal operands and |
| 385 | /// producing the result and a carry flag. |
| 386 | HANDLE_TARGET_OPCODE(G_USUBO) |
| 387 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 388 | /// Generic unsigned subtract instruction, consuming the normal operands plus a |
| 389 | /// carry flag, and similarly producing the result and a carry flag. |
| 390 | HANDLE_TARGET_OPCODE(G_USUBE) |
| 391 | |
| 392 | /// Generic signed add instruction, producing the result and a signed overflow |
| 393 | /// flag. |
| 394 | HANDLE_TARGET_OPCODE(G_SADDO) |
| 395 | |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 396 | /// Generic signed add instruction, consuming the normal operands plus a carry |
| 397 | /// flag, and similarly producing the result and a carry flag. |
| 398 | HANDLE_TARGET_OPCODE(G_SADDE) |
| 399 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 400 | /// Generic signed subtract instruction, producing the result and a signed |
| 401 | /// overflow flag. |
| 402 | HANDLE_TARGET_OPCODE(G_SSUBO) |
| 403 | |
Andrew Scull | 0372a57 | 2018-11-16 15:47:06 +0000 | [diff] [blame] | 404 | /// Generic signed sub instruction, consuming the normal operands plus a carry |
| 405 | /// flag, and similarly producing the result and a carry flag. |
| 406 | HANDLE_TARGET_OPCODE(G_SSUBE) |
| 407 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 408 | /// Generic unsigned multiply instruction, producing the result and a signed |
| 409 | /// overflow flag. |
| 410 | HANDLE_TARGET_OPCODE(G_UMULO) |
| 411 | |
| 412 | /// Generic signed multiply instruction, producing the result and a signed |
| 413 | /// overflow flag. |
| 414 | HANDLE_TARGET_OPCODE(G_SMULO) |
| 415 | |
| 416 | // Multiply two numbers at twice the incoming bit width (unsigned) and return |
| 417 | // the high half of the result. |
| 418 | HANDLE_TARGET_OPCODE(G_UMULH) |
| 419 | |
| 420 | // Multiply two numbers at twice the incoming bit width (signed) and return |
| 421 | // the high half of the result. |
| 422 | HANDLE_TARGET_OPCODE(G_SMULH) |
| 423 | |
| 424 | /// Generic FP addition. |
| 425 | HANDLE_TARGET_OPCODE(G_FADD) |
| 426 | |
| 427 | /// Generic FP subtraction. |
| 428 | HANDLE_TARGET_OPCODE(G_FSUB) |
| 429 | |
| 430 | /// Generic FP multiplication. |
| 431 | HANDLE_TARGET_OPCODE(G_FMUL) |
| 432 | |
| 433 | /// Generic FMA multiplication. Behaves like llvm fma intrinsic |
| 434 | HANDLE_TARGET_OPCODE(G_FMA) |
| 435 | |
| 436 | /// Generic FP division. |
| 437 | HANDLE_TARGET_OPCODE(G_FDIV) |
| 438 | |
| 439 | /// Generic FP remainder. |
| 440 | HANDLE_TARGET_OPCODE(G_FREM) |
| 441 | |
| 442 | /// Generic FP exponentiation. |
| 443 | HANDLE_TARGET_OPCODE(G_FPOW) |
| 444 | |
| 445 | /// Generic base-e exponential of a value. |
| 446 | HANDLE_TARGET_OPCODE(G_FEXP) |
| 447 | |
| 448 | /// Generic base-2 exponential of a value. |
| 449 | HANDLE_TARGET_OPCODE(G_FEXP2) |
| 450 | |
| 451 | /// Floating point base-e logarithm of a value. |
| 452 | HANDLE_TARGET_OPCODE(G_FLOG) |
| 453 | |
| 454 | /// Floating point base-2 logarithm of a value. |
| 455 | HANDLE_TARGET_OPCODE(G_FLOG2) |
| 456 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 457 | /// Floating point base-10 logarithm of a value. |
| 458 | HANDLE_TARGET_OPCODE(G_FLOG10) |
| 459 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 460 | /// Generic FP negation. |
| 461 | HANDLE_TARGET_OPCODE(G_FNEG) |
| 462 | |
| 463 | /// Generic FP extension. |
| 464 | HANDLE_TARGET_OPCODE(G_FPEXT) |
| 465 | |
| 466 | /// Generic float to signed-int conversion |
| 467 | HANDLE_TARGET_OPCODE(G_FPTRUNC) |
| 468 | |
| 469 | /// Generic float to signed-int conversion |
| 470 | HANDLE_TARGET_OPCODE(G_FPTOSI) |
| 471 | |
| 472 | /// Generic float to unsigned-int conversion |
| 473 | HANDLE_TARGET_OPCODE(G_FPTOUI) |
| 474 | |
| 475 | /// Generic signed-int to float conversion |
| 476 | HANDLE_TARGET_OPCODE(G_SITOFP) |
| 477 | |
| 478 | /// Generic unsigned-int to float conversion |
| 479 | HANDLE_TARGET_OPCODE(G_UITOFP) |
| 480 | |
| 481 | /// Generic FP absolute value. |
| 482 | HANDLE_TARGET_OPCODE(G_FABS) |
| 483 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 484 | /// Generic FP canonicalize value. |
| 485 | HANDLE_TARGET_OPCODE(G_FCANONICALIZE) |
| 486 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 487 | /// Generic pointer offset |
| 488 | HANDLE_TARGET_OPCODE(G_GEP) |
| 489 | |
| 490 | /// Clear the specified number of low bits in a pointer. This rounds the value |
| 491 | /// *down* to the given alignment. |
| 492 | HANDLE_TARGET_OPCODE(G_PTR_MASK) |
| 493 | |
| 494 | /// Generic BRANCH instruction. This is an unconditional branch. |
| 495 | HANDLE_TARGET_OPCODE(G_BR) |
| 496 | |
| 497 | /// Generic insertelement. |
| 498 | HANDLE_TARGET_OPCODE(G_INSERT_VECTOR_ELT) |
| 499 | |
| 500 | /// Generic extractelement. |
| 501 | HANDLE_TARGET_OPCODE(G_EXTRACT_VECTOR_ELT) |
| 502 | |
| 503 | /// Generic shufflevector. |
| 504 | HANDLE_TARGET_OPCODE(G_SHUFFLE_VECTOR) |
| 505 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 506 | /// Generic count trailing zeroes. |
| 507 | HANDLE_TARGET_OPCODE(G_CTTZ) |
| 508 | |
| 509 | /// Same as above, undefined for zero inputs. |
| 510 | HANDLE_TARGET_OPCODE(G_CTTZ_ZERO_UNDEF) |
| 511 | |
| 512 | /// Generic count leading zeroes. |
| 513 | HANDLE_TARGET_OPCODE(G_CTLZ) |
| 514 | |
| 515 | /// Same as above, undefined for zero inputs. |
| 516 | HANDLE_TARGET_OPCODE(G_CTLZ_ZERO_UNDEF) |
| 517 | |
| 518 | /// Generic count bits. |
| 519 | HANDLE_TARGET_OPCODE(G_CTPOP) |
| 520 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 521 | /// Generic byte swap. |
| 522 | HANDLE_TARGET_OPCODE(G_BSWAP) |
| 523 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 524 | /// Floating point ceil. |
| 525 | HANDLE_TARGET_OPCODE(G_FCEIL) |
| 526 | |
| 527 | /// Floating point cosine. |
| 528 | HANDLE_TARGET_OPCODE(G_FCOS) |
| 529 | |
| 530 | /// Floating point sine. |
| 531 | HANDLE_TARGET_OPCODE(G_FSIN) |
| 532 | |
| 533 | /// Floating point square root. |
| 534 | HANDLE_TARGET_OPCODE(G_FSQRT) |
| 535 | |
| 536 | /// Floating point floor. |
| 537 | HANDLE_TARGET_OPCODE(G_FFLOOR) |
| 538 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 539 | /// Generic AddressSpaceCast. |
| 540 | HANDLE_TARGET_OPCODE(G_ADDRSPACE_CAST) |
| 541 | |
| 542 | /// Generic block address |
| 543 | HANDLE_TARGET_OPCODE(G_BLOCK_ADDR) |
| 544 | |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 545 | // TODO: Add more generic opcodes as we move along. |
| 546 | |
| 547 | /// Marker for the end of the generic opcode. |
| 548 | /// This is used to check if an opcode is in the range of the |
| 549 | /// generic opcodes. |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 550 | HANDLE_TARGET_OPCODE_MARKER(PRE_ISEL_GENERIC_OPCODE_END, G_BLOCK_ADDR) |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 551 | |
| 552 | /// BUILTIN_OP_END - This must be the last enum value in this list. |
| 553 | /// The target-specific post-isel opcode values start here. |
| 554 | HANDLE_TARGET_OPCODE_MARKER(GENERIC_OP_END, PRE_ISEL_GENERIC_OPCODE_END) |