1207618Srdivacky//===-- llvm/CodeGen/ISDOpcodes.h - CodeGen opcodes -------------*- C++ -*-===// 2207618Srdivacky// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6207618Srdivacky// 7207618Srdivacky//===----------------------------------------------------------------------===// 8207618Srdivacky// 9207618Srdivacky// This file declares codegen opcodes and related utilities. 10207618Srdivacky// 11207618Srdivacky//===----------------------------------------------------------------------===// 12207618Srdivacky 13207618Srdivacky#ifndef LLVM_CODEGEN_ISDOPCODES_H 14207618Srdivacky#define LLVM_CODEGEN_ISDOPCODES_H 15207618Srdivacky 16360784Sdim#include "llvm/CodeGen/ValueTypes.h" 17360784Sdim 18207618Srdivackynamespace llvm { 19207618Srdivacky 20207618Srdivacky/// ISD namespace - This namespace contains an enum which represents all of the 21207618Srdivacky/// SelectionDAG node types and value types. 22207618Srdivacky/// 23207618Srdivackynamespace ISD { 24207618Srdivacky 25207618Srdivacky //===--------------------------------------------------------------------===// 26207618Srdivacky /// ISD::NodeType enum - This enum defines the target-independent operators 27207618Srdivacky /// for a SelectionDAG. 28207618Srdivacky /// 29207618Srdivacky /// Targets may also define target-dependent operator codes for SDNodes. For 30207618Srdivacky /// example, on x86, these are the enum values in the X86ISD namespace. 31207618Srdivacky /// Targets should aim to use target-independent operators to model their 32207618Srdivacky /// instruction sets as much as possible, and only use target-dependent 33207618Srdivacky /// operators when they have special requirements. 34207618Srdivacky /// 35207618Srdivacky /// Finally, during and after selection proper, SNodes may use special 36207618Srdivacky /// operator codes that correspond directly with MachineInstr opcodes. These 37207618Srdivacky /// are used to represent selected instructions. See the isMachineOpcode() 38207618Srdivacky /// and getMachineOpcode() member functions of SDNode. 39207618Srdivacky /// 40207618Srdivacky enum NodeType { 41239462Sdim /// DELETED_NODE - This is an illegal value that is used to catch 42239462Sdim /// errors. This opcode is not a legal opcode for any node. 43207618Srdivacky DELETED_NODE, 44207618Srdivacky 45239462Sdim /// EntryToken - This is the marker used to indicate the start of a region. 46207618Srdivacky EntryToken, 47207618Srdivacky 48239462Sdim /// TokenFactor - This node takes multiple tokens as input and produces a 49239462Sdim /// single token result. This is used to represent the fact that the operand 50239462Sdim /// operators are independent of each other. 51207618Srdivacky TokenFactor, 52207618Srdivacky 53239462Sdim /// AssertSext, AssertZext - These nodes record if a register contains a 54239462Sdim /// value that has already been zero or sign extended from a narrower type. 55239462Sdim /// These nodes take two operands. The first is the node that has already 56239462Sdim /// been extended, and the second is a value type node indicating the width 57239462Sdim /// of the extension 58207618Srdivacky AssertSext, AssertZext, 59207618Srdivacky 60239462Sdim /// Various leaf nodes. 61234353Sdim BasicBlock, VALUETYPE, CONDCODE, Register, RegisterMask, 62207618Srdivacky Constant, ConstantFP, 63207618Srdivacky GlobalAddress, GlobalTLSAddress, FrameIndex, 64207618Srdivacky JumpTable, ConstantPool, ExternalSymbol, BlockAddress, 65207618Srdivacky 66239462Sdim /// The address of the GOT 67207618Srdivacky GLOBAL_OFFSET_TABLE, 68207618Srdivacky 69239462Sdim /// FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and 70239462Sdim /// llvm.returnaddress on the DAG. These nodes take one operand, the index 71239462Sdim /// of the frame or return address to return. An index of zero corresponds 72239462Sdim /// to the current function's frame or return address, an index of one to 73239462Sdim /// the parent's frame or return address, and so on. 74344779Sdim FRAMEADDR, RETURNADDR, ADDROFRETURNADDR, SPONENTRY, 75207618Srdivacky 76288943Sdim /// LOCAL_RECOVER - Represents the llvm.localrecover intrinsic. 77288943Sdim /// Materializes the offset from the local object pointer of another 78288943Sdim /// function to a particular local object passed to llvm.localescape. The 79288943Sdim /// operand is the MCSymbol label used to represent this offset, since 80288943Sdim /// typically the offset is not known until after code generation of the 81288943Sdim /// parent. 82288943Sdim LOCAL_RECOVER, 83280031Sdim 84276479Sdim /// READ_REGISTER, WRITE_REGISTER - This node represents llvm.register on 85276479Sdim /// the DAG, which implements the named register global variables extension. 86276479Sdim READ_REGISTER, 87276479Sdim WRITE_REGISTER, 88276479Sdim 89239462Sdim /// FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to 90239462Sdim /// first (possible) on-stack argument. This is needed for correct stack 91239462Sdim /// adjustment during unwind. 92207618Srdivacky FRAME_TO_ARGS_OFFSET, 93207618Srdivacky 94309124Sdim /// EH_DWARF_CFA - This node represents the pointer to the DWARF Canonical 95309124Sdim /// Frame Address (CFA), generally the value of the stack pointer at the 96309124Sdim /// call site in the previous frame. 97309124Sdim EH_DWARF_CFA, 98309124Sdim 99239462Sdim /// OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents 100239462Sdim /// 'eh_return' gcc dwarf builtin, which is used to return from 101239462Sdim /// exception. The general meaning is: adjust stack by OFFSET and pass 102239462Sdim /// execution to HANDLER. Many platform-related details also :) 103207618Srdivacky EH_RETURN, 104207618Srdivacky 105239462Sdim /// RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer) 106239462Sdim /// This corresponds to the eh.sjlj.setjmp intrinsic. 107239462Sdim /// It takes an input chain and a pointer to the jump buffer as inputs 108239462Sdim /// and returns an outchain. 109208599Srdivacky EH_SJLJ_SETJMP, 110208599Srdivacky 111239462Sdim /// OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer) 112239462Sdim /// This corresponds to the eh.sjlj.longjmp intrinsic. 113239462Sdim /// It takes an input chain and a pointer to the jump buffer as inputs 114239462Sdim /// and returns an outchain. 115208599Srdivacky EH_SJLJ_LONGJMP, 116208599Srdivacky 117296417Sdim /// OUTCHAIN = EH_SJLJ_SETUP_DISPATCH(INCHAIN) 118296417Sdim /// The target initializes the dispatch table here. 119296417Sdim EH_SJLJ_SETUP_DISPATCH, 120296417Sdim 121239462Sdim /// TargetConstant* - Like Constant*, but the DAG does not do any folding, 122239462Sdim /// simplification, or lowering of the constant. They are used for constants 123239462Sdim /// which are known to fit in the immediate fields of their users, or for 124239462Sdim /// carrying magic numbers which are not values which need to be 125239462Sdim /// materialized in registers. 126207618Srdivacky TargetConstant, 127207618Srdivacky TargetConstantFP, 128207618Srdivacky 129239462Sdim /// TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or 130239462Sdim /// anything else with this node, and this is valid in the target-specific 131239462Sdim /// dag, turning into a GlobalAddress operand. 132207618Srdivacky TargetGlobalAddress, 133207618Srdivacky TargetGlobalTLSAddress, 134207618Srdivacky TargetFrameIndex, 135207618Srdivacky TargetJumpTable, 136207618Srdivacky TargetConstantPool, 137207618Srdivacky TargetExternalSymbol, 138207618Srdivacky TargetBlockAddress, 139207618Srdivacky 140288943Sdim MCSymbol, 141288943Sdim 142239462Sdim /// TargetIndex - Like a constant pool entry, but with completely 143239462Sdim /// target-dependent semantics. Holds target flags, a 32-bit index, and a 144239462Sdim /// 64-bit index. Targets can use this however they like. 145239462Sdim TargetIndex, 146239462Sdim 147207618Srdivacky /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...) 148207618Srdivacky /// This node represents a target intrinsic function with no side effects. 149207618Srdivacky /// The first operand is the ID number of the intrinsic from the 150207618Srdivacky /// llvm::Intrinsic namespace. The operands to the intrinsic follow. The 151210299Sed /// node returns the result of the intrinsic. 152207618Srdivacky INTRINSIC_WO_CHAIN, 153207618Srdivacky 154207618Srdivacky /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...) 155207618Srdivacky /// This node represents a target intrinsic function with side effects that 156207618Srdivacky /// returns a result. The first operand is a chain pointer. The second is 157207618Srdivacky /// the ID number of the intrinsic from the llvm::Intrinsic namespace. The 158207618Srdivacky /// operands to the intrinsic follow. The node has two results, the result 159207618Srdivacky /// of the intrinsic and an output chain. 160207618Srdivacky INTRINSIC_W_CHAIN, 161207618Srdivacky 162207618Srdivacky /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...) 163207618Srdivacky /// This node represents a target intrinsic function with side effects that 164207618Srdivacky /// does not return a result. The first operand is a chain pointer. The 165207618Srdivacky /// second is the ID number of the intrinsic from the llvm::Intrinsic 166207618Srdivacky /// namespace. The operands to the intrinsic follow. 167207618Srdivacky INTRINSIC_VOID, 168207618Srdivacky 169239462Sdim /// CopyToReg - This node has three operands: a chain, a register number to 170239462Sdim /// set to this value, and a value. 171207618Srdivacky CopyToReg, 172207618Srdivacky 173239462Sdim /// CopyFromReg - This node indicates that the input value is a virtual or 174239462Sdim /// physical register that is defined outside of the scope of this 175239462Sdim /// SelectionDAG. The register is available from the RegisterSDNode object. 176207618Srdivacky CopyFromReg, 177207618Srdivacky 178239462Sdim /// UNDEF - An undefined node. 179207618Srdivacky UNDEF, 180207618Srdivacky 181239462Sdim /// EXTRACT_ELEMENT - This is used to get the lower or upper (determined by 182239462Sdim /// a Constant, which is required to be operand #1) half of the integer or 183239462Sdim /// float value specified as operand #0. This is only for use before 184239462Sdim /// legalization, for values that will be broken into multiple registers. 185207618Srdivacky EXTRACT_ELEMENT, 186207618Srdivacky 187239462Sdim /// BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways. 188239462Sdim /// Given two values of the same integer value type, this produces a value 189239462Sdim /// twice as big. Like EXTRACT_ELEMENT, this can only be used before 190327952Sdim /// legalization. The lower part of the composite value should be in 191327952Sdim /// element 0 and the upper part should be in element 1. 192207618Srdivacky BUILD_PAIR, 193207618Srdivacky 194239462Sdim /// MERGE_VALUES - This node takes multiple discrete operands and returns 195239462Sdim /// them all as its individual results. This nodes has exactly the same 196239462Sdim /// number of inputs and outputs. This node is useful for some pieces of the 197239462Sdim /// code generator that want to think about a single node with multiple 198239462Sdim /// results, not multiple nodes. 199207618Srdivacky MERGE_VALUES, 200207618Srdivacky 201239462Sdim /// Simple integer binary arithmetic operators. 202207618Srdivacky ADD, SUB, MUL, SDIV, UDIV, SREM, UREM, 203207618Srdivacky 204239462Sdim /// SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing 205239462Sdim /// a signed/unsigned value of type i[2*N], and return the full value as 206239462Sdim /// two results, each of type iN. 207207618Srdivacky SMUL_LOHI, UMUL_LOHI, 208207618Srdivacky 209239462Sdim /// SDIVREM/UDIVREM - Divide two integers and produce both a quotient and 210239462Sdim /// remainder result. 211207618Srdivacky SDIVREM, UDIVREM, 212207618Srdivacky 213239462Sdim /// CARRY_FALSE - This node is used when folding other nodes, 214239462Sdim /// like ADDC/SUBC, which indicate the carry result is always false. 215207618Srdivacky CARRY_FALSE, 216207618Srdivacky 217239462Sdim /// Carry-setting nodes for multiple precision addition and subtraction. 218239462Sdim /// These nodes take two operands of the same value type, and produce two 219239462Sdim /// results. The first result is the normal add or sub result, the second 220239462Sdim /// result is the carry flag result. 221321369Sdim /// FIXME: These nodes are deprecated in favor of ADDCARRY and SUBCARRY. 222321369Sdim /// They are kept around for now to provide a smooth transition path 223321369Sdim /// toward the use of ADDCARRY/SUBCARRY and will eventually be removed. 224207618Srdivacky ADDC, SUBC, 225207618Srdivacky 226239462Sdim /// Carry-using nodes for multiple precision addition and subtraction. These 227239462Sdim /// nodes take three operands: The first two are the normal lhs and rhs to 228239462Sdim /// the add or sub, and the third is the input carry flag. These nodes 229239462Sdim /// produce two results; the normal result of the add or sub, and the output 230239462Sdim /// carry flag. These nodes both read and write a carry flag to allow them 231239462Sdim /// to them to be chained together for add and sub of arbitrarily large 232239462Sdim /// values. 233207618Srdivacky ADDE, SUBE, 234207618Srdivacky 235321369Sdim /// Carry-using nodes for multiple precision addition and subtraction. 236321369Sdim /// These nodes take three operands: The first two are the normal lhs and 237321369Sdim /// rhs to the add or sub, and the third is a boolean indicating if there 238321369Sdim /// is an incoming carry. These nodes produce two results: the normal 239321369Sdim /// result of the add or sub, and the output carry so they can be chained 240321369Sdim /// together. The use of this opcode is preferable to adde/sube if the 241321369Sdim /// target supports it, as the carry is a regular value rather than a 242321369Sdim /// glue, which allows further optimisation. 243321369Sdim ADDCARRY, SUBCARRY, 244321369Sdim 245239462Sdim /// RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition. 246239462Sdim /// These nodes take two operands: the normal LHS and RHS to the add. They 247239462Sdim /// produce two results: the normal result of the add, and a boolean that 248239462Sdim /// indicates if an overflow occurred (*not* a flag, because it may be store 249239462Sdim /// to memory, etc.). If the type of the boolean is not i1 then the high 250239462Sdim /// bits conform to getBooleanContents. 251239462Sdim /// These nodes are generated from llvm.[su]add.with.overflow intrinsics. 252207618Srdivacky SADDO, UADDO, 253207618Srdivacky 254239462Sdim /// Same for subtraction. 255207618Srdivacky SSUBO, USUBO, 256207618Srdivacky 257239462Sdim /// Same for multiplication. 258207618Srdivacky SMULO, UMULO, 259207618Srdivacky 260344779Sdim /// RESULT = [US]ADDSAT(LHS, RHS) - Perform saturation addition on 2 261344779Sdim /// integers with the same bit width (W). If the true value of LHS + RHS 262344779Sdim /// exceeds the largest value that can be represented by W bits, the 263344779Sdim /// resulting value is this maximum value. Otherwise, if this value is less 264344779Sdim /// than the smallest value that can be represented by W bits, the 265344779Sdim /// resulting value is this minimum value. 266344779Sdim SADDSAT, UADDSAT, 267344779Sdim 268344779Sdim /// RESULT = [US]SUBSAT(LHS, RHS) - Perform saturation subtraction on 2 269344779Sdim /// integers with the same bit width (W). If the true value of LHS - RHS 270344779Sdim /// exceeds the largest value that can be represented by W bits, the 271344779Sdim /// resulting value is this maximum value. Otherwise, if this value is less 272344779Sdim /// than the smallest value that can be represented by W bits, the 273344779Sdim /// resulting value is this minimum value. 274344779Sdim SSUBSAT, USUBSAT, 275344779Sdim 276353358Sdim /// RESULT = [US]MULFIX(LHS, RHS, SCALE) - Perform fixed point multiplication on 277344779Sdim /// 2 integers with the same width and scale. SCALE represents the scale of 278344779Sdim /// both operands as fixed point numbers. This SCALE parameter must be a 279344779Sdim /// constant integer. A scale of zero is effectively performing 280344779Sdim /// multiplication on 2 integers. 281353358Sdim SMULFIX, UMULFIX, 282344779Sdim 283353358Sdim /// Same as the corresponding unsaturated fixed point instructions, but the 284353358Sdim /// result is clamped between the min and max values representable by the 285353358Sdim /// bits of the first 2 operands. 286360784Sdim SMULFIXSAT, UMULFIXSAT, 287353358Sdim 288360784Sdim /// RESULT = [US]DIVFIX(LHS, RHS, SCALE) - Perform fixed point division on 289360784Sdim /// 2 integers with the same width and scale. SCALE represents the scale 290360784Sdim /// of both operands as fixed point numbers. This SCALE parameter must be a 291360784Sdim /// constant integer. 292360784Sdim SDIVFIX, UDIVFIX, 293360784Sdim 294239462Sdim /// Simple binary floating point operators. 295288943Sdim FADD, FSUB, FMUL, FDIV, FREM, 296207618Srdivacky 297321369Sdim /// Constrained versions of the binary floating point operators. 298321369Sdim /// These will be lowered to the simple operators before final selection. 299321369Sdim /// They are used to limit optimizations while the DAG is being 300321369Sdim /// optimized. 301321369Sdim STRICT_FADD, STRICT_FSUB, STRICT_FMUL, STRICT_FDIV, STRICT_FREM, 302327952Sdim STRICT_FMA, 303321369Sdim 304321369Sdim /// Constrained versions of libm-equivalent floating point intrinsics. 305321369Sdim /// These will be lowered to the equivalent non-constrained pseudo-op 306321369Sdim /// (or expanded to the equivalent library call) before final selection. 307321369Sdim /// They are used to limit optimizations while the DAG is being optimized. 308321369Sdim STRICT_FSQRT, STRICT_FPOW, STRICT_FPOWI, STRICT_FSIN, STRICT_FCOS, 309321369Sdim STRICT_FEXP, STRICT_FEXP2, STRICT_FLOG, STRICT_FLOG10, STRICT_FLOG2, 310344779Sdim STRICT_FRINT, STRICT_FNEARBYINT, STRICT_FMAXNUM, STRICT_FMINNUM, 311344779Sdim STRICT_FCEIL, STRICT_FFLOOR, STRICT_FROUND, STRICT_FTRUNC, 312360784Sdim STRICT_LROUND, STRICT_LLROUND, STRICT_LRINT, STRICT_LLRINT, 313360784Sdim STRICT_FMAXIMUM, STRICT_FMINIMUM, 314321369Sdim 315360784Sdim /// STRICT_FP_TO_[US]INT - Convert a floating point value to a signed or 316360784Sdim /// unsigned integer. These have the same semantics as fptosi and fptoui 317360784Sdim /// in IR. 318360784Sdim /// They are used to limit optimizations while the DAG is being optimized. 319360784Sdim STRICT_FP_TO_SINT, 320360784Sdim STRICT_FP_TO_UINT, 321360784Sdim 322360784Sdim /// STRICT_[US]INT_TO_FP - Convert a signed or unsigned integer to 323360784Sdim /// a floating point value. These have the same semantics as sitofp and 324360784Sdim /// uitofp in IR. 325360784Sdim /// They are used to limit optimizations while the DAG is being optimized. 326360784Sdim STRICT_SINT_TO_FP, 327360784Sdim STRICT_UINT_TO_FP, 328360784Sdim 329353358Sdim /// X = STRICT_FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating 330353358Sdim /// point type down to the precision of the destination VT. TRUNC is a 331353358Sdim /// flag, which is always an integer that is zero or one. If TRUNC is 0, 332353358Sdim /// this is a normal rounding, if it is 1, this FP_ROUND is known to not 333353358Sdim /// change the value of Y. 334353358Sdim /// 335353358Sdim /// The TRUNC = 1 case is used in cases where we know that the value will 336353358Sdim /// not be modified by the node, because Y is not using any of the extra 337353358Sdim /// precision of source type. This allows certain transformations like 338353358Sdim /// STRICT_FP_EXTEND(STRICT_FP_ROUND(X,1)) -> X which are not safe for 339353358Sdim /// STRICT_FP_EXTEND(STRICT_FP_ROUND(X,0)) because the extra bits aren't 340353358Sdim /// removed. 341353358Sdim /// It is used to limit optimizations while the DAG is being optimized. 342353358Sdim STRICT_FP_ROUND, 343353358Sdim 344353358Sdim /// X = STRICT_FP_EXTEND(Y) - Extend a smaller FP type into a larger FP 345353358Sdim /// type. 346353358Sdim /// It is used to limit optimizations while the DAG is being optimized. 347353358Sdim STRICT_FP_EXTEND, 348353358Sdim 349360784Sdim /// STRICT_FSETCC/STRICT_FSETCCS - Constrained versions of SETCC, used 350360784Sdim /// for floating-point operands only. STRICT_FSETCC performs a quiet 351360784Sdim /// comparison operation, while STRICT_FSETCCS performs a signaling 352360784Sdim /// comparison operation. 353360784Sdim STRICT_FSETCC, STRICT_FSETCCS, 354360784Sdim 355288943Sdim /// FMA - Perform a * b + c with no intermediate rounding step. 356288943Sdim FMA, 357288943Sdim 358288943Sdim /// FMAD - Perform a * b + c, while getting the same result as the 359288943Sdim /// separately rounded operations. 360288943Sdim FMAD, 361288943Sdim 362239462Sdim /// FCOPYSIGN(X, Y) - Return the value of X with the sign of Y. NOTE: This 363288943Sdim /// DAG node does not require that X and Y have the same type, just that 364288943Sdim /// they are both floating point. X and the result must have the same type. 365239462Sdim /// FCOPYSIGN(f32, f64) is allowed. 366207618Srdivacky FCOPYSIGN, 367207618Srdivacky 368239462Sdim /// INT = FGETSIGN(FP) - Return the sign bit of the specified floating point 369239462Sdim /// value as an integer 0/1 value. 370207618Srdivacky FGETSIGN, 371207618Srdivacky 372309124Sdim /// Returns platform specific canonical encoding of a floating point number. 373309124Sdim FCANONICALIZE, 374309124Sdim 375207618Srdivacky /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the 376207618Srdivacky /// specified, possibly variable, elements. The number of elements is 377207618Srdivacky /// required to be a power of two. The types of the operands must all be 378207618Srdivacky /// the same and must match the vector element type, except that integer 379207618Srdivacky /// types are allowed to be larger than the element type, in which case 380207618Srdivacky /// the operands are implicitly truncated. 381207618Srdivacky BUILD_VECTOR, 382207618Srdivacky 383207618Srdivacky /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element 384207618Srdivacky /// at IDX replaced with VAL. If the type of VAL is larger than the vector 385207618Srdivacky /// element type then VAL is truncated before replacement. 386207618Srdivacky INSERT_VECTOR_ELT, 387207618Srdivacky 388207618Srdivacky /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR 389207618Srdivacky /// identified by the (potentially variable) element number IDX. If the 390207618Srdivacky /// return type is an integer type larger than the element type of the 391321369Sdim /// vector, the result is extended to the width of the return type. In 392321369Sdim /// that case, the high bits are undefined. 393207618Srdivacky EXTRACT_VECTOR_ELT, 394207618Srdivacky 395207618Srdivacky /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of 396207618Srdivacky /// vector type with the same length and element type, this produces a 397207618Srdivacky /// concatenated vector result value, with length equal to the sum of the 398207618Srdivacky /// lengths of the input vectors. 399207618Srdivacky CONCAT_VECTORS, 400207618Srdivacky 401218893Sdim /// INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector 402218893Sdim /// with VECTOR2 inserted into VECTOR1 at the (potentially 403218893Sdim /// variable) element number IDX, which must be a multiple of the 404218893Sdim /// VECTOR2 vector length. The elements of VECTOR1 starting at 405218893Sdim /// IDX are overwritten with VECTOR2. Elements IDX through 406218893Sdim /// vector_length(VECTOR2) must be valid VECTOR1 indices. 407218893Sdim INSERT_SUBVECTOR, 408218893Sdim 409207618Srdivacky /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an 410218893Sdim /// vector value) starting with the element number IDX, which must be a 411218893Sdim /// constant multiple of the result vector length. 412207618Srdivacky EXTRACT_SUBVECTOR, 413207618Srdivacky 414218893Sdim /// VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as 415207618Srdivacky /// VEC1/VEC2. A VECTOR_SHUFFLE node also contains an array of constant int 416207618Srdivacky /// values that indicate which value (or undef) each result element will 417218893Sdim /// get. These constant ints are accessible through the 418218893Sdim /// ShuffleVectorSDNode class. This is quite similar to the Altivec 419207618Srdivacky /// 'vperm' instruction, except that the indices must be constants and are 420207618Srdivacky /// in terms of the element size of VEC1/VEC2, not in terms of bytes. 421207618Srdivacky VECTOR_SHUFFLE, 422207618Srdivacky 423207618Srdivacky /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a 424207618Srdivacky /// scalar value into element 0 of the resultant vector type. The top 425207618Srdivacky /// elements 1 to N-1 of the N-element vector are undefined. The type 426207618Srdivacky /// of the operand must match the vector element type, except when they 427207618Srdivacky /// are integer types. In this case the operand is allowed to be wider 428207618Srdivacky /// than the vector element type, and is implicitly truncated to it. 429207618Srdivacky SCALAR_TO_VECTOR, 430207618Srdivacky 431360784Sdim /// SPLAT_VECTOR(VAL) - Returns a vector with the scalar value VAL 432360784Sdim /// duplicated in all lanes. The type of the operand must match the vector 433360784Sdim /// element type, except when they are integer types. In this case the 434360784Sdim /// operand is allowed to be wider than the vector element type, and is 435360784Sdim /// implicitly truncated to it. 436360784Sdim SPLAT_VECTOR, 437360784Sdim 438239462Sdim /// MULHU/MULHS - Multiply high - Multiply two integers of type iN, 439239462Sdim /// producing an unsigned/signed value of type i[2*N], then return the top 440239462Sdim /// part. 441207618Srdivacky MULHU, MULHS, 442207618Srdivacky 443288943Sdim /// [US]{MIN/MAX} - Binary minimum or maximum or signed or unsigned 444288943Sdim /// integers. 445288943Sdim SMIN, SMAX, UMIN, UMAX, 446288943Sdim 447218893Sdim /// Bitwise operators - logical and, logical or, logical xor. 448218893Sdim AND, OR, XOR, 449239462Sdim 450321369Sdim /// ABS - Determine the unsigned absolute value of a signed integer value of 451321369Sdim /// the same bitwidth. 452321369Sdim /// Note: A value of INT_MIN will return INT_MIN, no saturation or overflow 453321369Sdim /// is performed. 454321369Sdim ABS, 455321369Sdim 456218893Sdim /// Shift and rotation operations. After legalization, the type of the 457218893Sdim /// shift amount is known to be TLI.getShiftAmountTy(). Before legalization 458218893Sdim /// the shift amount can be any type, but care must be taken to ensure it is 459218893Sdim /// large enough. TLI.getShiftAmountTy() is i8 on some targets, but before 460218893Sdim /// legalization, types like i1024 can occur and i8 doesn't have enough bits 461249423Sdim /// to represent the shift amount. 462249423Sdim /// When the 1st operand is a vector, the shift amount must be in the same 463249423Sdim /// type. (TLI.getShiftAmountTy() will return the same type when the input 464249423Sdim /// type is a vector.) 465344779Sdim /// For rotates and funnel shifts, the shift amount is treated as an unsigned 466344779Sdim /// amount modulo the element size of the first operand. 467344779Sdim /// 468344779Sdim /// Funnel 'double' shifts take 3 operands, 2 inputs and the shift amount. 469344779Sdim /// fshl(X,Y,Z): (X << (Z % BW)) | (Y >> (BW - (Z % BW))) 470344779Sdim /// fshr(X,Y,Z): (X << (BW - (Z % BW))) | (Y >> (Z % BW)) 471344779Sdim SHL, SRA, SRL, ROTL, ROTR, FSHL, FSHR, 472207618Srdivacky 473218893Sdim /// Byte Swap and Counting operators. 474296417Sdim BSWAP, CTTZ, CTLZ, CTPOP, BITREVERSE, 475207618Srdivacky 476234353Sdim /// Bit counting operators with an undefined result for zero inputs. 477234353Sdim CTTZ_ZERO_UNDEF, CTLZ_ZERO_UNDEF, 478234353Sdim 479239462Sdim /// Select(COND, TRUEVAL, FALSEVAL). If the type of the boolean COND is not 480239462Sdim /// i1 then the high bits must conform to getBooleanContents. 481207618Srdivacky SELECT, 482207618Srdivacky 483239462Sdim /// Select with a vector condition (op #0) and two vector operands (ops #1 484239462Sdim /// and #2), returning a vector result. All vectors have the same length. 485239462Sdim /// Much like the scalar select and setcc, each bit in the condition selects 486239462Sdim /// whether the corresponding result element is taken from op #1 or op #2. 487239462Sdim /// At first, the VSELECT condition is of vXi1 type. Later, targets may 488239462Sdim /// change the condition type in order to match the VSELECT node using a 489239462Sdim /// pattern. The condition follows the BooleanContent format of the target. 490226633Sdim VSELECT, 491226633Sdim 492239462Sdim /// Select with condition operator - This selects between a true value and 493239462Sdim /// a false value (ops #2 and #3) based on the boolean result of comparing 494239462Sdim /// the lhs and rhs (ops #0 and #1) of a conditional expression with the 495239462Sdim /// condition code in op #4, a CondCodeSDNode. 496207618Srdivacky SELECT_CC, 497207618Srdivacky 498239462Sdim /// SetCC operator - This evaluates to a true value iff the condition is 499239462Sdim /// true. If the result value type is not i1 then the high bits conform 500239462Sdim /// to getBooleanContents. The operands to this are the left and right 501239462Sdim /// operands to compare (ops #0, and #1) and the condition code to compare 502239462Sdim /// them with (op #2) as a CondCodeSDNode. If the operands are vector types 503239462Sdim /// then the result type must also be a vector type. 504207618Srdivacky SETCC, 505207618Srdivacky 506321369Sdim /// Like SetCC, ops #0 and #1 are the LHS and RHS operands to compare, but 507321369Sdim /// op #2 is a boolean indicating if there is an incoming carry. This 508321369Sdim /// operator checks the result of "LHS - RHS - Carry", and can be used to 509341825Sdim /// compare two wide integers: 510341825Sdim /// (setcccarry lhshi rhshi (subcarry lhslo rhslo) cc). 511321369Sdim /// Only valid for integers. 512321369Sdim SETCCCARRY, 513321369Sdim 514239462Sdim /// SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded 515296417Sdim /// integer shift operations. The operation ordering is: 516239462Sdim /// [Lo,Hi] = op [LoLHS,HiLHS], Amt 517207618Srdivacky SHL_PARTS, SRA_PARTS, SRL_PARTS, 518207618Srdivacky 519239462Sdim /// Conversion operators. These are all single input single output 520239462Sdim /// operations. For all of these, the result type must be strictly 521239462Sdim /// wider or narrower (depending on the operation) than the source 522239462Sdim /// type. 523207618Srdivacky 524239462Sdim /// SIGN_EXTEND - Used for integer types, replicating the sign bit 525239462Sdim /// into new bits. 526207618Srdivacky SIGN_EXTEND, 527207618Srdivacky 528239462Sdim /// ZERO_EXTEND - Used for integer types, zeroing the new bits. 529207618Srdivacky ZERO_EXTEND, 530207618Srdivacky 531239462Sdim /// ANY_EXTEND - Used for integer types. The high bits are undefined. 532207618Srdivacky ANY_EXTEND, 533207618Srdivacky 534239462Sdim /// TRUNCATE - Completely drop the high bits. 535207618Srdivacky TRUNCATE, 536207618Srdivacky 537239462Sdim /// [SU]INT_TO_FP - These operators convert integers (whose interpreted sign 538239462Sdim /// depends on the first letter) to floating point. 539207618Srdivacky SINT_TO_FP, 540207618Srdivacky UINT_TO_FP, 541207618Srdivacky 542239462Sdim /// SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to 543239462Sdim /// sign extend a small value in a large integer register (e.g. sign 544239462Sdim /// extending the low 8 bits of a 32-bit register to fill the top 24 bits 545239462Sdim /// with the 7th bit). The size of the smaller type is indicated by the 1th 546239462Sdim /// operand, a ValueType node. 547207618Srdivacky SIGN_EXTEND_INREG, 548207618Srdivacky 549276479Sdim /// ANY_EXTEND_VECTOR_INREG(Vector) - This operator represents an 550276479Sdim /// in-register any-extension of the low lanes of an integer vector. The 551276479Sdim /// result type must have fewer elements than the operand type, and those 552276479Sdim /// elements must be larger integer types such that the total size of the 553344779Sdim /// operand type is less than or equal to the size of the result type. Each 554344779Sdim /// of the low operand elements is any-extended into the corresponding, 555344779Sdim /// wider result elements with the high bits becoming undef. 556344779Sdim /// NOTE: The type legalizer prefers to make the operand and result size 557344779Sdim /// the same to allow expansion to shuffle vector during op legalization. 558276479Sdim ANY_EXTEND_VECTOR_INREG, 559276479Sdim 560276479Sdim /// SIGN_EXTEND_VECTOR_INREG(Vector) - This operator represents an 561276479Sdim /// in-register sign-extension of the low lanes of an integer vector. The 562276479Sdim /// result type must have fewer elements than the operand type, and those 563276479Sdim /// elements must be larger integer types such that the total size of the 564344779Sdim /// operand type is less than or equal to the size of the result type. Each 565344779Sdim /// of the low operand elements is sign-extended into the corresponding, 566344779Sdim /// wider result elements. 567344779Sdim /// NOTE: The type legalizer prefers to make the operand and result size 568344779Sdim /// the same to allow expansion to shuffle vector during op legalization. 569276479Sdim SIGN_EXTEND_VECTOR_INREG, 570276479Sdim 571276479Sdim /// ZERO_EXTEND_VECTOR_INREG(Vector) - This operator represents an 572276479Sdim /// in-register zero-extension of the low lanes of an integer vector. The 573276479Sdim /// result type must have fewer elements than the operand type, and those 574276479Sdim /// elements must be larger integer types such that the total size of the 575344779Sdim /// operand type is less than or equal to the size of the result type. Each 576344779Sdim /// of the low operand elements is zero-extended into the corresponding, 577344779Sdim /// wider result elements. 578344779Sdim /// NOTE: The type legalizer prefers to make the operand and result size 579344779Sdim /// the same to allow expansion to shuffle vector during op legalization. 580276479Sdim ZERO_EXTEND_VECTOR_INREG, 581276479Sdim 582207618Srdivacky /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned 583341825Sdim /// integer. These have the same semantics as fptosi and fptoui in IR. If 584341825Sdim /// the FP value cannot fit in the integer type, the results are undefined. 585207618Srdivacky FP_TO_SINT, 586207618Srdivacky FP_TO_UINT, 587207618Srdivacky 588207618Srdivacky /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type 589207618Srdivacky /// down to the precision of the destination VT. TRUNC is a flag, which is 590207618Srdivacky /// always an integer that is zero or one. If TRUNC is 0, this is a 591207618Srdivacky /// normal rounding, if it is 1, this FP_ROUND is known to not change the 592207618Srdivacky /// value of Y. 593207618Srdivacky /// 594207618Srdivacky /// The TRUNC = 1 case is used in cases where we know that the value will 595207618Srdivacky /// not be modified by the node, because Y is not using any of the extra 596207618Srdivacky /// precision of source type. This allows certain transformations like 597207618Srdivacky /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for 598207618Srdivacky /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed. 599207618Srdivacky FP_ROUND, 600207618Srdivacky 601239462Sdim /// FLT_ROUNDS_ - Returns current rounding mode: 602239462Sdim /// -1 Undefined 603239462Sdim /// 0 Round to 0 604239462Sdim /// 1 Round to nearest 605239462Sdim /// 2 Round to +inf 606239462Sdim /// 3 Round to -inf 607207618Srdivacky FLT_ROUNDS_, 608207618Srdivacky 609207618Srdivacky /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type. 610207618Srdivacky FP_EXTEND, 611207618Srdivacky 612239462Sdim /// BITCAST - This operator converts between integer, vector and FP 613239462Sdim /// values, as if the value was stored to memory with one type and loaded 614239462Sdim /// from the same address with the other type (or equivalently for vector 615239462Sdim /// format conversions, etc). The source and result are required to have 616239462Sdim /// the same bit size (e.g. f32 <-> i32). This can also be used for 617239462Sdim /// int-to-int or fp-to-fp conversions, but that is a noop, deleted by 618239462Sdim /// getNode(). 619309124Sdim /// 620309124Sdim /// This operator is subtly different from the bitcast instruction from 621309124Sdim /// LLVM-IR since this node may change the bits in the register. For 622309124Sdim /// example, this occurs on big-endian NEON and big-endian MSA where the 623309124Sdim /// layout of the bits in the register depends on the vector type and this 624309124Sdim /// operator acts as a shuffle operation for some vector type combinations. 625218893Sdim BITCAST, 626207618Srdivacky 627261991Sdim /// ADDRSPACECAST - This operator converts between pointers of different 628261991Sdim /// address spaces. 629261991Sdim ADDRSPACECAST, 630261991Sdim 631276479Sdim /// FP16_TO_FP, FP_TO_FP16 - These operators are used to perform promotions 632276479Sdim /// and truncation for half-precision (16 bit) floating numbers. These nodes 633276479Sdim /// form a semi-softened interface for dealing with f16 (as an i16), which 634276479Sdim /// is often a storage-only type but has native conversions. 635276479Sdim FP16_TO_FP, FP_TO_FP16, 636207618Srdivacky 637353358Sdim /// Perform various unary floating-point operations inspired by libm. For 638353358Sdim /// FPOWI, the result is undefined if if the integer operand doesn't fit 639353358Sdim /// into 32 bits. 640344779Sdim FNEG, FABS, FSQRT, FCBRT, FSIN, FCOS, FPOWI, FPOW, 641207618Srdivacky FLOG, FLOG2, FLOG10, FEXP, FEXP2, 642261991Sdim FCEIL, FTRUNC, FRINT, FNEARBYINT, FROUND, FFLOOR, 643353358Sdim LROUND, LLROUND, LRINT, LLRINT, 644353358Sdim 645296417Sdim /// FMINNUM/FMAXNUM - Perform floating-point minimum or maximum on two 646296417Sdim /// values. 647344779Sdim // 648344779Sdim /// In the case where a single input is a NaN (either signaling or quiet), 649344779Sdim /// the non-NaN input is returned. 650296417Sdim /// 651296417Sdim /// The return value of (FMINNUM 0.0, -0.0) could be either 0.0 or -0.0. 652280031Sdim FMINNUM, FMAXNUM, 653280031Sdim 654344779Sdim /// FMINNUM_IEEE/FMAXNUM_IEEE - Perform floating-point minimum or maximum on 655344779Sdim /// two values, following the IEEE-754 2008 definition. This differs from 656344779Sdim /// FMINNUM/FMAXNUM in the handling of signaling NaNs. If one input is a 657344779Sdim /// signaling NaN, returns a quiet NaN. 658344779Sdim FMINNUM_IEEE, FMAXNUM_IEEE, 659344779Sdim 660344779Sdim /// FMINIMUM/FMAXIMUM - NaN-propagating minimum/maximum that also treat -0.0 661344779Sdim /// as less than 0.0. While FMINNUM_IEEE/FMAXNUM_IEEE follow IEEE 754-2008 662344779Sdim /// semantics, FMINIMUM/FMAXIMUM follow IEEE 754-2018 draft semantics. 663344779Sdim FMINIMUM, FMAXIMUM, 664344779Sdim 665249423Sdim /// FSINCOS - Compute both fsin and fcos as a single operation. 666249423Sdim FSINCOS, 667207618Srdivacky 668239462Sdim /// LOAD and STORE have token chains as their first operand, then the same 669239462Sdim /// operands as an LLVM load/store instruction, then an offset node that 670239462Sdim /// is added / subtracted from the base pointer to form the address (for 671239462Sdim /// indexed memory ops). 672207618Srdivacky LOAD, STORE, 673207618Srdivacky 674239462Sdim /// DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned 675239462Sdim /// to a specified boundary. This node always has two return values: a new 676239462Sdim /// stack pointer value and a chain. The first operand is the token chain, 677239462Sdim /// the second is the number of bytes to allocate, and the third is the 678239462Sdim /// alignment boundary. The size is guaranteed to be a multiple of the 679239462Sdim /// stack alignment, and the alignment is guaranteed to be bigger than the 680239462Sdim /// stack alignment (if required) or 0 to get standard stack alignment. 681207618Srdivacky DYNAMIC_STACKALLOC, 682207618Srdivacky 683239462Sdim /// Control flow instructions. These all have token chains. 684207618Srdivacky 685239462Sdim /// BR - Unconditional branch. The first operand is the chain 686239462Sdim /// operand, the second is the MBB to branch to. 687207618Srdivacky BR, 688207618Srdivacky 689239462Sdim /// BRIND - Indirect branch. The first operand is the chain, the second 690239462Sdim /// is the value to branch to, which must be of the same type as the 691239462Sdim /// target's pointer type. 692207618Srdivacky BRIND, 693207618Srdivacky 694239462Sdim /// BR_JT - Jumptable branch. The first operand is the chain, the second 695239462Sdim /// is the jumptable index, the last one is the jumptable entry index. 696207618Srdivacky BR_JT, 697207618Srdivacky 698239462Sdim /// BRCOND - Conditional branch. The first operand is the chain, the 699239462Sdim /// second is the condition, the third is the block to branch to if the 700239462Sdim /// condition is true. If the type of the condition is not i1, then the 701239462Sdim /// high bits must conform to getBooleanContents. 702207618Srdivacky BRCOND, 703207618Srdivacky 704239462Sdim /// BR_CC - Conditional branch. The behavior is like that of SELECT_CC, in 705239462Sdim /// that the condition is represented as condition code, and two nodes to 706239462Sdim /// compare, rather than as a combined SetCC node. The operands in order 707239462Sdim /// are chain, cc, lhs, rhs, block to branch to if condition is true. 708207618Srdivacky BR_CC, 709207618Srdivacky 710239462Sdim /// INLINEASM - Represents an inline asm block. This node always has two 711239462Sdim /// return values: a chain and a flag result. The inputs are as follows: 712239462Sdim /// Operand #0 : Input chain. 713239462Sdim /// Operand #1 : a ExternalSymbolSDNode with a pointer to the asm string. 714239462Sdim /// Operand #2 : a MDNodeSDNode with the !srcloc metadata. 715239462Sdim /// Operand #3 : HasSideEffect, IsAlignStack bits. 716239462Sdim /// After this, it is followed by a list of operands with this format: 717239462Sdim /// ConstantSDNode: Flags that encode whether it is a mem or not, the 718239462Sdim /// of operands that follow, etc. See InlineAsm.h. 719239462Sdim /// ... however many operands ... 720239462Sdim /// Operand #last: Optional, an incoming flag. 721239462Sdim /// 722239462Sdim /// The variable width operands are required to represent target addressing 723239462Sdim /// modes as a single "operand", even though they may have multiple 724239462Sdim /// SDOperands. 725207618Srdivacky INLINEASM, 726207618Srdivacky 727353358Sdim /// INLINEASM_BR - Terminator version of inline asm. Used by asm-goto. 728353358Sdim INLINEASM_BR, 729353358Sdim 730239462Sdim /// EH_LABEL - Represents a label in mid basic block used to track 731239462Sdim /// locations needed for debug and exception handling tables. These nodes 732239462Sdim /// take a chain as input and return a chain. 733207618Srdivacky EH_LABEL, 734207618Srdivacky 735327952Sdim /// ANNOTATION_LABEL - Represents a mid basic block label used by 736327952Sdim /// annotations. This should remain within the basic block and be ordered 737327952Sdim /// with respect to other call instructions, but loads and stores may float 738327952Sdim /// past it. 739327952Sdim ANNOTATION_LABEL, 740327952Sdim 741296417Sdim /// CATCHPAD - Represents a catchpad instruction. 742296417Sdim CATCHPAD, 743296417Sdim 744296417Sdim /// CATCHRET - Represents a return from a catch block funclet. Used for 745296417Sdim /// MSVC compatible exception handling. Takes a chain operand and a 746296417Sdim /// destination basic block operand. 747296417Sdim CATCHRET, 748296417Sdim 749296417Sdim /// CLEANUPRET - Represents a return from a cleanup block funclet. Used for 750296417Sdim /// MSVC compatible exception handling. Takes only a chain operand. 751296417Sdim CLEANUPRET, 752296417Sdim 753239462Sdim /// STACKSAVE - STACKSAVE has one operand, an input chain. It produces a 754239462Sdim /// value, the same type as the pointer type for the system, and an output 755239462Sdim /// chain. 756207618Srdivacky STACKSAVE, 757207618Srdivacky 758239462Sdim /// STACKRESTORE has two operands, an input chain and a pointer to restore 759239462Sdim /// to it returns an output chain. 760207618Srdivacky STACKRESTORE, 761207618Srdivacky 762239462Sdim /// CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end 763239462Sdim /// of a call sequence, and carry arbitrary information that target might 764239462Sdim /// want to know. The first operand is a chain, the rest are specified by 765239462Sdim /// the target and not touched by the DAG optimizers. 766321369Sdim /// Targets that may use stack to pass call arguments define additional 767321369Sdim /// operands: 768321369Sdim /// - size of the call frame part that must be set up within the 769321369Sdim /// CALLSEQ_START..CALLSEQ_END pair, 770321369Sdim /// - part of the call frame prepared prior to CALLSEQ_START. 771321369Sdim /// Both these parameters must be constants, their sum is the total call 772321369Sdim /// frame size. 773239462Sdim /// CALLSEQ_START..CALLSEQ_END pairs may not be nested. 774207618Srdivacky CALLSEQ_START, // Beginning of a call sequence 775207618Srdivacky CALLSEQ_END, // End of a call sequence 776207618Srdivacky 777239462Sdim /// VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE, 778239462Sdim /// and the alignment. It returns a pair of values: the vaarg value and a 779239462Sdim /// new chain. 780207618Srdivacky VAARG, 781207618Srdivacky 782239462Sdim /// VACOPY - VACOPY has 5 operands: an input chain, a destination pointer, 783239462Sdim /// a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the 784239462Sdim /// source. 785207618Srdivacky VACOPY, 786207618Srdivacky 787239462Sdim /// VAEND, VASTART - VAEND and VASTART have three operands: an input chain, 788239462Sdim /// pointer, and a SRCVALUE. 789207618Srdivacky VAEND, VASTART, 790207618Srdivacky 791239462Sdim /// SRCVALUE - This is a node type that holds a Value* that is used to 792239462Sdim /// make reference to a value in the LLVM IR. 793207618Srdivacky SRCVALUE, 794218893Sdim 795239462Sdim /// MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to 796239462Sdim /// reference metadata in the IR. 797207618Srdivacky MDNODE_SDNODE, 798207618Srdivacky 799239462Sdim /// PCMARKER - This corresponds to the pcmarker intrinsic. 800207618Srdivacky PCMARKER, 801207618Srdivacky 802239462Sdim /// READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic. 803296417Sdim /// It produces a chain and one i64 value. The only operand is a chain. 804296417Sdim /// If i64 is not legal, the result will be expanded into smaller values. 805296417Sdim /// Still, it returns an i64, so targets should set legality for i64. 806296417Sdim /// The result is the content of the architecture-specific cycle 807296417Sdim /// counter-like register (or other high accuracy low latency clock source). 808207618Srdivacky READCYCLECOUNTER, 809207618Srdivacky 810239462Sdim /// HANDLENODE node - Used as a handle for various purposes. 811207618Srdivacky HANDLENODE, 812207618Srdivacky 813239462Sdim /// INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic. It 814239462Sdim /// takes as input a token chain, the pointer to the trampoline, the pointer 815239462Sdim /// to the nested function, the pointer to pass for the 'nest' parameter, a 816239462Sdim /// SRCVALUE for the trampoline and another for the nested function 817239462Sdim /// (allowing targets to access the original Function*). 818239462Sdim /// It produces a token chain as output. 819226633Sdim INIT_TRAMPOLINE, 820207618Srdivacky 821239462Sdim /// ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic. 822239462Sdim /// It takes a pointer to the trampoline and produces a (possibly) new 823239462Sdim /// pointer to the same trampoline with platform-specific adjustments 824239462Sdim /// applied. The pointer it returns points to an executable block of code. 825226633Sdim ADJUST_TRAMPOLINE, 826226633Sdim 827239462Sdim /// TRAP - Trapping instruction 828207618Srdivacky TRAP, 829207618Srdivacky 830239462Sdim /// DEBUGTRAP - Trap intended to get the attention of a debugger. 831239462Sdim DEBUGTRAP, 832239462Sdim 833239462Sdim /// PREFETCH - This corresponds to a prefetch intrinsic. The first operand 834239462Sdim /// is the chain. The other operands are the address to prefetch, 835239462Sdim /// read / write specifier, locality specifier and instruction / data cache 836239462Sdim /// specifier. 837207618Srdivacky PREFETCH, 838207618Srdivacky 839239462Sdim /// OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope) 840239462Sdim /// This corresponds to the fence instruction. It takes an input chain, and 841239462Sdim /// two integer constants: an AtomicOrdering and a SynchronizationScope. 842226633Sdim ATOMIC_FENCE, 843226633Sdim 844239462Sdim /// Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr) 845239462Sdim /// This corresponds to "load atomic" instruction. 846226633Sdim ATOMIC_LOAD, 847226633Sdim 848276479Sdim /// OUTCHAIN = ATOMIC_STORE(INCHAIN, ptr, val) 849239462Sdim /// This corresponds to "store atomic" instruction. 850226633Sdim ATOMIC_STORE, 851226633Sdim 852239462Sdim /// Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap) 853261991Sdim /// For double-word atomic operations: 854261991Sdim /// ValLo, ValHi, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmpLo, cmpHi, 855261991Sdim /// swapLo, swapHi) 856239462Sdim /// This corresponds to the cmpxchg instruction. 857207618Srdivacky ATOMIC_CMP_SWAP, 858207618Srdivacky 859276479Sdim /// Val, Success, OUTCHAIN 860276479Sdim /// = ATOMIC_CMP_SWAP_WITH_SUCCESS(INCHAIN, ptr, cmp, swap) 861276479Sdim /// N.b. this is still a strong cmpxchg operation, so 862276479Sdim /// Success == "Val == cmp". 863276479Sdim ATOMIC_CMP_SWAP_WITH_SUCCESS, 864276479Sdim 865239462Sdim /// Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt) 866239462Sdim /// Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt) 867261991Sdim /// For double-word atomic operations: 868261991Sdim /// ValLo, ValHi, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amtLo, amtHi) 869261991Sdim /// ValLo, ValHi, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amtLo, amtHi) 870239462Sdim /// These correspond to the atomicrmw instruction. 871207618Srdivacky ATOMIC_SWAP, 872207618Srdivacky ATOMIC_LOAD_ADD, 873207618Srdivacky ATOMIC_LOAD_SUB, 874207618Srdivacky ATOMIC_LOAD_AND, 875341825Sdim ATOMIC_LOAD_CLR, 876207618Srdivacky ATOMIC_LOAD_OR, 877207618Srdivacky ATOMIC_LOAD_XOR, 878207618Srdivacky ATOMIC_LOAD_NAND, 879207618Srdivacky ATOMIC_LOAD_MIN, 880207618Srdivacky ATOMIC_LOAD_MAX, 881207618Srdivacky ATOMIC_LOAD_UMIN, 882207618Srdivacky ATOMIC_LOAD_UMAX, 883353358Sdim ATOMIC_LOAD_FADD, 884353358Sdim ATOMIC_LOAD_FSUB, 885207618Srdivacky 886288943Sdim // Masked load and store - consecutive vector load and store operations 887288943Sdim // with additional mask operand that prevents memory accesses to the 888288943Sdim // masked-off lanes. 889344779Sdim // 890344779Sdim // Val, OutChain = MLOAD(BasePtr, Mask, PassThru) 891344779Sdim // OutChain = MSTORE(Value, BasePtr, Mask) 892280031Sdim MLOAD, MSTORE, 893280031Sdim 894288943Sdim // Masked gather and scatter - load and store operations for a vector of 895288943Sdim // random addresses with additional mask operand that prevents memory 896288943Sdim // accesses to the masked-off lanes. 897344779Sdim // 898344779Sdim // Val, OutChain = GATHER(InChain, PassThru, Mask, BasePtr, Index, Scale) 899344779Sdim // OutChain = SCATTER(InChain, Value, Mask, BasePtr, Index, Scale) 900344779Sdim // 901344779Sdim // The Index operand can have more vector elements than the other operands 902344779Sdim // due to type legalization. The extra elements are ignored. 903288943Sdim MGATHER, MSCATTER, 904288943Sdim 905243830Sdim /// This corresponds to the llvm.lifetime.* intrinsics. The first operand 906243830Sdim /// is the chain and the second operand is the alloca pointer. 907243830Sdim LIFETIME_START, LIFETIME_END, 908243830Sdim 909288943Sdim /// GC_TRANSITION_START/GC_TRANSITION_END - These operators mark the 910288943Sdim /// beginning and end of GC transition sequence, and carry arbitrary 911288943Sdim /// information that target might need for lowering. The first operand is 912288943Sdim /// a chain, the rest are specified by the target and not touched by the DAG 913288943Sdim /// optimizers. GC_TRANSITION_START..GC_TRANSITION_END pairs may not be 914288943Sdim /// nested. 915288943Sdim GC_TRANSITION_START, 916288943Sdim GC_TRANSITION_END, 917288943Sdim 918296417Sdim /// GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of 919296417Sdim /// the most recent dynamic alloca. For most targets that would be 0, but 920296417Sdim /// for some others (e.g. PowerPC, PowerPC64) that would be compile-time 921296417Sdim /// known nonzero constant. The only operand here is the chain. 922296417Sdim GET_DYNAMIC_AREA_OFFSET, 923296417Sdim 924321369Sdim /// Generic reduction nodes. These nodes represent horizontal vector 925321369Sdim /// reduction operations, producing a scalar result. 926321369Sdim /// The STRICT variants perform reductions in sequential order. The first 927321369Sdim /// operand is an initial scalar accumulator value, and the second operand 928321369Sdim /// is the vector to reduce. 929321369Sdim VECREDUCE_STRICT_FADD, VECREDUCE_STRICT_FMUL, 930321369Sdim /// These reductions are non-strict, and have a single vector operand. 931321369Sdim VECREDUCE_FADD, VECREDUCE_FMUL, 932353358Sdim /// FMIN/FMAX nodes can have flags, for NaN/NoNaN variants. 933353358Sdim VECREDUCE_FMAX, VECREDUCE_FMIN, 934353358Sdim /// Integer reductions may have a result type larger than the vector element 935353358Sdim /// type. However, the reduction is performed using the vector element type 936353358Sdim /// and the value in the top bits is unspecified. 937321369Sdim VECREDUCE_ADD, VECREDUCE_MUL, 938321369Sdim VECREDUCE_AND, VECREDUCE_OR, VECREDUCE_XOR, 939321369Sdim VECREDUCE_SMAX, VECREDUCE_SMIN, VECREDUCE_UMAX, VECREDUCE_UMIN, 940321369Sdim 941207618Srdivacky /// BUILTIN_OP_END - This must be the last enum value in this list. 942207618Srdivacky /// The target-specific pre-isel opcode values start here. 943207618Srdivacky BUILTIN_OP_END 944207618Srdivacky }; 945207618Srdivacky 946360784Sdim /// FIRST_TARGET_STRICTFP_OPCODE - Target-specific pre-isel operations 947360784Sdim /// which cannot raise FP exceptions should be less than this value. 948360784Sdim /// Those that do must not be less than this value. 949360784Sdim static const int FIRST_TARGET_STRICTFP_OPCODE = BUILTIN_OP_END+400; 950360784Sdim 951207618Srdivacky /// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations 952207618Srdivacky /// which do not reference a specific memory location should be less than 953207618Srdivacky /// this value. Those that do must not be less than this value, and can 954207618Srdivacky /// be used with SelectionDAG::getMemIntrinsicNode. 955360784Sdim static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+500; 956207618Srdivacky 957207618Srdivacky //===--------------------------------------------------------------------===// 958207618Srdivacky /// MemIndexedMode enum - This enum defines the load / store indexed 959207618Srdivacky /// addressing modes. 960207618Srdivacky /// 961207618Srdivacky /// UNINDEXED "Normal" load / store. The effective address is already 962207618Srdivacky /// computed and is available in the base pointer. The offset 963207618Srdivacky /// operand is always undefined. In addition to producing a 964207618Srdivacky /// chain, an unindexed load produces one value (result of the 965207618Srdivacky /// load); an unindexed store does not produce a value. 966207618Srdivacky /// 967207618Srdivacky /// PRE_INC Similar to the unindexed mode where the effective address is 968207618Srdivacky /// PRE_DEC the value of the base pointer add / subtract the offset. 969207618Srdivacky /// It considers the computation as being folded into the load / 970207618Srdivacky /// store operation (i.e. the load / store does the address 971207618Srdivacky /// computation as well as performing the memory transaction). 972207618Srdivacky /// The base operand is always undefined. In addition to 973207618Srdivacky /// producing a chain, pre-indexed load produces two values 974207618Srdivacky /// (result of the load and the result of the address 975207618Srdivacky /// computation); a pre-indexed store produces one value (result 976207618Srdivacky /// of the address computation). 977207618Srdivacky /// 978207618Srdivacky /// POST_INC The effective address is the value of the base pointer. The 979207618Srdivacky /// POST_DEC value of the offset operand is then added to / subtracted 980207618Srdivacky /// from the base after memory transaction. In addition to 981207618Srdivacky /// producing a chain, post-indexed load produces two values 982207618Srdivacky /// (the result of the load and the result of the base +/- offset 983207618Srdivacky /// computation); a post-indexed store produces one value (the 984207618Srdivacky /// the result of the base +/- offset computation). 985207618Srdivacky enum MemIndexedMode { 986207618Srdivacky UNINDEXED = 0, 987207618Srdivacky PRE_INC, 988207618Srdivacky PRE_DEC, 989207618Srdivacky POST_INC, 990321369Sdim POST_DEC 991207618Srdivacky }; 992207618Srdivacky 993321369Sdim static const int LAST_INDEXED_MODE = POST_DEC + 1; 994321369Sdim 995207618Srdivacky //===--------------------------------------------------------------------===// 996360784Sdim /// MemIndexType enum - This enum defines how to interpret MGATHER/SCATTER's 997360784Sdim /// index parameter when calculating addresses. 998360784Sdim /// 999360784Sdim /// SIGNED_SCALED Addr = Base + ((signed)Index * sizeof(element)) 1000360784Sdim /// SIGNED_UNSCALED Addr = Base + (signed)Index 1001360784Sdim /// UNSIGNED_SCALED Addr = Base + ((unsigned)Index * sizeof(element)) 1002360784Sdim /// UNSIGNED_UNSCALED Addr = Base + (unsigned)Index 1003360784Sdim enum MemIndexType { 1004360784Sdim SIGNED_SCALED = 0, 1005360784Sdim SIGNED_UNSCALED, 1006360784Sdim UNSIGNED_SCALED, 1007360784Sdim UNSIGNED_UNSCALED 1008360784Sdim }; 1009360784Sdim 1010360784Sdim static const int LAST_MEM_INDEX_TYPE = UNSIGNED_UNSCALED + 1; 1011360784Sdim 1012360784Sdim //===--------------------------------------------------------------------===// 1013207618Srdivacky /// LoadExtType enum - This enum defines the three variants of LOADEXT 1014207618Srdivacky /// (load with extension). 1015207618Srdivacky /// 1016207618Srdivacky /// SEXTLOAD loads the integer operand and sign extends it to a larger 1017207618Srdivacky /// integer result type. 1018207618Srdivacky /// ZEXTLOAD loads the integer operand and zero extends it to a larger 1019207618Srdivacky /// integer result type. 1020212904Sdim /// EXTLOAD is used for two things: floating point extending loads and 1021212904Sdim /// integer extending loads [the top bits are undefined]. 1022207618Srdivacky enum LoadExtType { 1023207618Srdivacky NON_EXTLOAD = 0, 1024207618Srdivacky EXTLOAD, 1025207618Srdivacky SEXTLOAD, 1026321369Sdim ZEXTLOAD 1027207618Srdivacky }; 1028207618Srdivacky 1029321369Sdim static const int LAST_LOADEXT_TYPE = ZEXTLOAD + 1; 1030321369Sdim 1031280031Sdim NodeType getExtForLoadExtType(bool IsFP, LoadExtType); 1032276479Sdim 1033207618Srdivacky //===--------------------------------------------------------------------===// 1034207618Srdivacky /// ISD::CondCode enum - These are ordered carefully to make the bitfields 1035207618Srdivacky /// below work out, when considering SETFALSE (something that never exists 1036207618Srdivacky /// dynamically) as 0. "U" -> Unsigned (for integer operands) or Unordered 1037207618Srdivacky /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal 1038207618Srdivacky /// to. If the "N" column is 1, the result of the comparison is undefined if 1039207618Srdivacky /// the input is a NAN. 1040207618Srdivacky /// 1041207618Srdivacky /// All of these (except for the 'always folded ops') should be handled for 1042207618Srdivacky /// floating point. For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT, 1043207618Srdivacky /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used. 1044207618Srdivacky /// 1045207618Srdivacky /// Note that these are laid out in a specific order to allow bit-twiddling 1046207618Srdivacky /// to transform conditions. 1047207618Srdivacky enum CondCode { 1048207618Srdivacky // Opcode N U L G E Intuitive operation 1049207618Srdivacky SETFALSE, // 0 0 0 0 Always false (always folded) 1050207618Srdivacky SETOEQ, // 0 0 0 1 True if ordered and equal 1051207618Srdivacky SETOGT, // 0 0 1 0 True if ordered and greater than 1052207618Srdivacky SETOGE, // 0 0 1 1 True if ordered and greater than or equal 1053207618Srdivacky SETOLT, // 0 1 0 0 True if ordered and less than 1054207618Srdivacky SETOLE, // 0 1 0 1 True if ordered and less than or equal 1055207618Srdivacky SETONE, // 0 1 1 0 True if ordered and operands are unequal 1056207618Srdivacky SETO, // 0 1 1 1 True if ordered (no nans) 1057207618Srdivacky SETUO, // 1 0 0 0 True if unordered: isnan(X) | isnan(Y) 1058207618Srdivacky SETUEQ, // 1 0 0 1 True if unordered or equal 1059207618Srdivacky SETUGT, // 1 0 1 0 True if unordered or greater than 1060207618Srdivacky SETUGE, // 1 0 1 1 True if unordered, greater than, or equal 1061207618Srdivacky SETULT, // 1 1 0 0 True if unordered or less than 1062207618Srdivacky SETULE, // 1 1 0 1 True if unordered, less than, or equal 1063207618Srdivacky SETUNE, // 1 1 1 0 True if unordered or not equal 1064207618Srdivacky SETTRUE, // 1 1 1 1 Always true (always folded) 1065207618Srdivacky // Don't care operations: undefined if the input is a nan. 1066207618Srdivacky SETFALSE2, // 1 X 0 0 0 Always false (always folded) 1067207618Srdivacky SETEQ, // 1 X 0 0 1 True if equal 1068207618Srdivacky SETGT, // 1 X 0 1 0 True if greater than 1069207618Srdivacky SETGE, // 1 X 0 1 1 True if greater than or equal 1070207618Srdivacky SETLT, // 1 X 1 0 0 True if less than 1071207618Srdivacky SETLE, // 1 X 1 0 1 True if less than or equal 1072207618Srdivacky SETNE, // 1 X 1 1 0 True if not equal 1073207618Srdivacky SETTRUE2, // 1 X 1 1 1 Always true (always folded) 1074207618Srdivacky 1075207618Srdivacky SETCC_INVALID // Marker value. 1076207618Srdivacky }; 1077207618Srdivacky 1078309124Sdim /// Return true if this is a setcc instruction that performs a signed 1079309124Sdim /// comparison when used with integer operands. 1080207618Srdivacky inline bool isSignedIntSetCC(CondCode Code) { 1081207618Srdivacky return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE; 1082207618Srdivacky } 1083207618Srdivacky 1084309124Sdim /// Return true if this is a setcc instruction that performs an unsigned 1085309124Sdim /// comparison when used with integer operands. 1086207618Srdivacky inline bool isUnsignedIntSetCC(CondCode Code) { 1087207618Srdivacky return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE; 1088207618Srdivacky } 1089207618Srdivacky 1090309124Sdim /// Return true if the specified condition returns true if the two operands to 1091309124Sdim /// the condition are equal. Note that if one of the two operands is a NaN, 1092309124Sdim /// this value is meaningless. 1093207618Srdivacky inline bool isTrueWhenEqual(CondCode Cond) { 1094207618Srdivacky return ((int)Cond & 1) != 0; 1095207618Srdivacky } 1096207618Srdivacky 1097309124Sdim /// This function returns 0 if the condition is always false if an operand is 1098309124Sdim /// a NaN, 1 if the condition is always true if the operand is a NaN, and 2 if 1099309124Sdim /// the condition is undefined if the operand is a NaN. 1100207618Srdivacky inline unsigned getUnorderedFlavor(CondCode Cond) { 1101207618Srdivacky return ((int)Cond >> 3) & 3; 1102207618Srdivacky } 1103207618Srdivacky 1104309124Sdim /// Return the operation corresponding to !(X op Y), where 'op' is a valid 1105309124Sdim /// SetCC operation. 1106360784Sdim CondCode getSetCCInverse(CondCode Operation, EVT Type); 1107207618Srdivacky 1108360784Sdim namespace GlobalISel { 1109360784Sdim /// Return the operation corresponding to !(X op Y), where 'op' is a valid 1110360784Sdim /// SetCC operation. The U bit of the condition code has different meanings 1111360784Sdim /// between floating point and integer comparisons and LLT's don't provide 1112360784Sdim /// this distinction. As such we need to be told whether the comparison is 1113360784Sdim /// floating point or integer-like. Pointers should use integer-like 1114360784Sdim /// comparisons. 1115360784Sdim CondCode getSetCCInverse(CondCode Operation, bool isIntegerLike); 1116360784Sdim } // end namespace GlobalISel 1117360784Sdim 1118309124Sdim /// Return the operation corresponding to (Y op X) when given the operation 1119309124Sdim /// for (X op Y). 1120207618Srdivacky CondCode getSetCCSwappedOperands(CondCode Operation); 1121207618Srdivacky 1122309124Sdim /// Return the result of a logical OR between different comparisons of 1123309124Sdim /// identical values: ((X op1 Y) | (X op2 Y)). This function returns 1124309124Sdim /// SETCC_INVALID if it is not possible to represent the resultant comparison. 1125360784Sdim CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, EVT Type); 1126207618Srdivacky 1127309124Sdim /// Return the result of a logical AND between different comparisons of 1128309124Sdim /// identical values: ((X op1 Y) & (X op2 Y)). This function returns 1129309124Sdim /// SETCC_INVALID if it is not possible to represent the resultant comparison. 1130360784Sdim CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, EVT Type); 1131207618Srdivacky 1132207618Srdivacky} // end llvm::ISD namespace 1133207618Srdivacky 1134207618Srdivacky} // end llvm namespace 1135207618Srdivacky 1136207618Srdivacky#endif 1137