14031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//===-- llvm/CodeGen/ISDOpcodes.h - CodeGen opcodes -------------*- C++ -*-===//
24031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
34031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//                     The LLVM Compiler Infrastructure
44031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
54031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman// This file is distributed under the University of Illinois Open Source
64031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman// License. See LICENSE.TXT for details.
74031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
84031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//===----------------------------------------------------------------------===//
94031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
104031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman// This file declares codegen opcodes and related utilities.
114031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//
124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman//===----------------------------------------------------------------------===//
134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman#ifndef LLVM_CODEGEN_ISDOPCODES_H
154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman#define LLVM_CODEGEN_ISDOPCODES_H
164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohmannamespace llvm {
184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman/// ISD namespace - This namespace contains an enum which represents all of the
204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman/// SelectionDAG node types and value types.
214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman///
224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohmannamespace ISD {
234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// ISD::NodeType enum - This enum defines the target-independent operators
264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// for a SelectionDAG.
274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Targets may also define target-dependent operator codes for SDNodes. For
294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// example, on x86, these are the enum values in the X86ISD namespace.
304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Targets should aim to use target-independent operators to model their
314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// instruction sets as much as possible, and only use target-dependent
324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// operators when they have special requirements.
334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
344031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Finally, during and after selection proper, SNodes may use special
354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// operator codes that correspond directly with MachineInstr opcodes. These
364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// are used to represent selected instructions. See the isMachineOpcode()
374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// and getMachineOpcode() member functions of SDNode.
384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum NodeType {
40f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DELETED_NODE - This is an illegal value that is used to catch
41f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// errors.  This opcode is not a legal opcode for any node.
424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    DELETED_NODE,
434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
44f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// EntryToken - This is the marker used to indicate the start of a region.
454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EntryToken,
464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
47f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TokenFactor - This node takes multiple tokens as input and produces a
48f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// single token result. This is used to represent the fact that the operand
49f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operators are independent of each other.
504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TokenFactor,
514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
52f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// AssertSext, AssertZext - These nodes record if a register contains a
53f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value that has already been zero or sign extended from a narrower type.
54f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes take two operands.  The first is the node that has already
55f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// been extended, and the second is a value type node indicating the width
56f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// of the extension
574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    AssertSext, AssertZext,
584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
59f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Various leaf nodes.
609cf37e8b48732fccd4c301ed51aafed7074bd84eJakob Stoklund Olesen    BasicBlock, VALUETYPE, CONDCODE, Register, RegisterMask,
614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    Constant, ConstantFP,
624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    GlobalAddress, GlobalTLSAddress, FrameIndex,
634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    JumpTable, ConstantPool, ExternalSymbol, BlockAddress,
644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
65f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// The address of the GOT
664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    GLOBAL_OFFSET_TABLE,
674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
68f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FRAMEADDR, RETURNADDR - These nodes represent llvm.frameaddress and
69f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// llvm.returnaddress on the DAG.  These nodes take one operand, the index
70f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// of the frame or return address to return.  An index of zero corresponds
71f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to the current function's frame or return address, an index of one to
72f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the parent's frame or return address, and so on.
734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FRAMEADDR, RETURNADDR,
744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
75f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FRAME_TO_ARGS_OFFSET - This node represents offset from frame pointer to
76f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// first (possible) on-stack argument. This is needed for correct stack
77f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// adjustment during unwind.
784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FRAME_TO_ARGS_OFFSET,
794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
80f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, OUTCHAIN = EXCEPTIONADDR(INCHAIN) - This node represents the
81f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// address of the exception block on entry to an landing pad block.
824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXCEPTIONADDR,
834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
84f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, OUTCHAIN = LSDAADDR(INCHAIN) - This node represents the
85f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// address of the Language Specific Data Area for the enclosing function.
864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LSDAADDR,
874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
88f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, OUTCHAIN = EHSELECTION(INCHAIN, EXCEPTION) - This node
89f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// represents the selection index of the exception thrown.
904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EHSELECTION,
914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
92f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = EH_RETURN(INCHAIN, OFFSET, HANDLER) - This node represents
93f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// 'eh_return' gcc dwarf builtin, which is used to return from
94f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// exception. The general meaning is: adjust stack by OFFSET and pass
95f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// execution to HANDLER. Many platform-related details also :)
964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EH_RETURN,
974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
98f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, OUTCHAIN = EH_SJLJ_SETJMP(INCHAIN, buffer)
99f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the eh.sjlj.setjmp intrinsic.
100f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It takes an input chain and a pointer to the jump buffer as inputs
101f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and returns an outchain.
10223ff7cff52702a8bff904d8ab4c9ca67cc19d6caJim Grosbach    EH_SJLJ_SETJMP,
1035eb195153950bc7ebfc30649494a78b2096b5ef8Jim Grosbach
104f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = EH_SJLJ_LONGJMP(INCHAIN, buffer)
105f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the eh.sjlj.longjmp intrinsic.
106f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It takes an input chain and a pointer to the jump buffer as inputs
107f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and returns an outchain.
1085eb195153950bc7ebfc30649494a78b2096b5ef8Jim Grosbach    EH_SJLJ_LONGJMP,
1095eb195153950bc7ebfc30649494a78b2096b5ef8Jim Grosbach
110f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TargetConstant* - Like Constant*, but the DAG does not do any folding,
111f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// simplification, or lowering of the constant. They are used for constants
112f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// which are known to fit in the immediate fields of their users, or for
113f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// carrying magic numbers which are not values which need to be
114f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// materialized in registers.
1154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetConstant,
1164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetConstantFP,
1174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
118f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
119f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// anything else with this node, and this is valid in the target-specific
120f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// dag, turning into a GlobalAddress operand.
1214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetGlobalAddress,
1224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetGlobalTLSAddress,
1234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetFrameIndex,
1244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetJumpTable,
1254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetConstantPool,
1264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetExternalSymbol,
1274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TargetBlockAddress,
1284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
12974500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    /// TargetIndex - Like a constant pool entry, but with completely
13074500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    /// target-dependent semantics. Holds target flags, a 32-bit index, and a
13174500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    /// 64-bit index. Targets can use this however they like.
13274500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen    TargetIndex,
13374500bdba3eae36a1a8a17d8bad0b971b9c212ecJakob Stoklund Olesen
1344031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// RESULT = INTRINSIC_WO_CHAIN(INTRINSICID, arg1, arg2, ...)
1354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// This node represents a target intrinsic function with no side effects.
1364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// The first operand is the ID number of the intrinsic from the
1374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// llvm::Intrinsic namespace.  The operands to the intrinsic follow.  The
1382bff8abbf2c02065556332d50c4e4cf86a09034dJim Grosbach    /// node returns the result of the intrinsic.
1394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INTRINSIC_WO_CHAIN,
1404031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
1414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// RESULT,OUTCHAIN = INTRINSIC_W_CHAIN(INCHAIN, INTRINSICID, arg1, ...)
1424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// This node represents a target intrinsic function with side effects that
1434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// returns a result.  The first operand is a chain pointer.  The second is
1444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the ID number of the intrinsic from the llvm::Intrinsic namespace.  The
1454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// operands to the intrinsic follow.  The node has two results, the result
1464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// of the intrinsic and an output chain.
1474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INTRINSIC_W_CHAIN,
1484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
1494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// OUTCHAIN = INTRINSIC_VOID(INCHAIN, INTRINSICID, arg1, arg2, ...)
1504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// This node represents a target intrinsic function with side effects that
1514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// does not return a result.  The first operand is a chain pointer.  The
1524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// second is the ID number of the intrinsic from the llvm::Intrinsic
1534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// namespace.  The operands to the intrinsic follow.
1544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INTRINSIC_VOID,
1554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
156f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CopyToReg - This node has three operands: a chain, a register number to
157f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// set to this value, and a value.
1584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CopyToReg,
1594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
160f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CopyFromReg - This node indicates that the input value is a virtual or
161f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// physical register that is defined outside of the scope of this
162f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SelectionDAG.  The register is available from the RegisterSDNode object.
1634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CopyFromReg,
1644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
165f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// UNDEF - An undefined node.
1664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    UNDEF,
1674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
168f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// EXTRACT_ELEMENT - This is used to get the lower or upper (determined by
169f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a Constant, which is required to be operand #1) half of the integer or
170f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// float value specified as operand #0.  This is only for use before
171f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// legalization, for values that will be broken into multiple registers.
1724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTRACT_ELEMENT,
1734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
174f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.
175f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Given two values of the same integer value type, this produces a value
176f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// twice as big.  Like EXTRACT_ELEMENT, this can only be used before
177f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// legalization.
1784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BUILD_PAIR,
1794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
180f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// MERGE_VALUES - This node takes multiple discrete operands and returns
181f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// them all as its individual results.  This nodes has exactly the same
182f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// number of inputs and outputs. This node is useful for some pieces of the
183f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// code generator that want to think about a single node with multiple
184f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// results, not multiple nodes.
1854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MERGE_VALUES,
1864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
187f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Simple integer binary arithmetic operators.
1884031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ADD, SUB, MUL, SDIV, UDIV, SREM, UREM,
1894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
190f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SMUL_LOHI/UMUL_LOHI - Multiply two integers of type iN, producing
191f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a signed/unsigned value of type i[2*N], and return the full value as
192f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// two results, each of type iN.
1934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SMUL_LOHI, UMUL_LOHI,
1944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
195f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SDIVREM/UDIVREM - Divide two integers and produce both a quotient and
196f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// remainder result.
1974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SDIVREM, UDIVREM,
1984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
199f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CARRY_FALSE - This node is used when folding other nodes,
200f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// like ADDC/SUBC, which indicate the carry result is always false.
2014031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CARRY_FALSE,
2024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
203f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Carry-setting nodes for multiple precision addition and subtraction.
204f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes take two operands of the same value type, and produce two
205f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// results.  The first result is the normal add or sub result, the second
206f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// result is the carry flag result.
2074031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ADDC, SUBC,
2084031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
209f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Carry-using nodes for multiple precision addition and subtraction. These
210f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// nodes take three operands: The first two are the normal lhs and rhs to
211f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the add or sub, and the third is the input carry flag.  These nodes
212f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// produce two results; the normal result of the add or sub, and the output
213f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// carry flag.  These nodes both read and write a carry flag to allow them
214f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to them to be chained together for add and sub of arbitrarily large
215f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// values.
2164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ADDE, SUBE,
2174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
218f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// RESULT, BOOL = [SU]ADDO(LHS, RHS) - Overflow-aware nodes for addition.
219f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes take two operands: the normal LHS and RHS to the add. They
220f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// produce two results: the normal result of the add, and a boolean that
221f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// indicates if an overflow occurred (*not* a flag, because it may be store
222f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to memory, etc.).  If the type of the boolean is not i1 then the high
223f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// bits conform to getBooleanContents.
224f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These nodes are generated from llvm.[su]add.with.overflow intrinsics.
2254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SADDO, UADDO,
2264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
227f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Same for subtraction.
2284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SSUBO, USUBO,
2294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
230f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Same for multiplication.
2314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SMULO, UMULO,
2324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
233f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Simple binary floating point operators.
23433390848a7eca75301d04a59b89b516d83e19ee0Cameron Zwarich    FADD, FSUB, FMUL, FMA, FDIV, FREM,
2354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
236f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FCOPYSIGN(X, Y) - Return the value of X with the sign of Y.  NOTE: This
237f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DAG node does not require that X and Y have the same type, just that the
238f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// are both floating point.  X and the result must have the same type.
239f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FCOPYSIGN(f32, f64) is allowed.
2404031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FCOPYSIGN,
2414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
242f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// INT = FGETSIGN(FP) - Return the sign bit of the specified floating point
243f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value as an integer 0/1 value.
2444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FGETSIGN,
2454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// BUILD_VECTOR(ELT0, ELT1, ELT2, ELT3,...) - Return a vector with the
2474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// specified, possibly variable, elements.  The number of elements is
2484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// required to be a power of two.  The types of the operands must all be
2494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the same and must match the vector element type, except that integer
2504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// types are allowed to be larger than the element type, in which case
2514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the operands are implicitly truncated.
2524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BUILD_VECTOR,
2534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// INSERT_VECTOR_ELT(VECTOR, VAL, IDX) - Returns VECTOR with the element
2554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// at IDX replaced with VAL.  If the type of VAL is larger than the vector
2564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// element type then VAL is truncated before replacement.
2574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INSERT_VECTOR_ELT,
2584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// EXTRACT_VECTOR_ELT(VECTOR, IDX) - Returns a single element from VECTOR
2604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// identified by the (potentially variable) element number IDX.  If the
2614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// return type is an integer type larger than the element type of the
2624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// vector, the result is extended to the width of the return type.
2634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTRACT_VECTOR_ELT,
2644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// CONCAT_VECTORS(VECTOR0, VECTOR1, ...) - Given a number of values of
2664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// vector type with the same length and element type, this produces a
2674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// concatenated vector result value, with length equal to the sum of the
2684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// lengths of the input vectors.
2694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CONCAT_VECTORS,
2704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
271cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// INSERT_SUBVECTOR(VECTOR1, VECTOR2, IDX) - Returns a vector
272cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// with VECTOR2 inserted into VECTOR1 at the (potentially
273cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// variable) element number IDX, which must be a multiple of the
274cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// VECTOR2 vector length.  The elements of VECTOR1 starting at
275cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// IDX are overwritten with VECTOR2.  Elements IDX through
276cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    /// vector_length(VECTOR2) must be valid VECTOR1 indices.
277cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene    INSERT_SUBVECTOR,
278cfe33c46aa50f04adb0431243e7d25f79b719ac6David Greene
2794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// EXTRACT_SUBVECTOR(VECTOR, IDX) - Returns a subvector from VECTOR (an
2806736e19f4c9af1181cedca54ba6e3a1420454928Bob Wilson    /// vector value) starting with the element number IDX, which must be a
2816736e19f4c9af1181cedca54ba6e3a1420454928Bob Wilson    /// constant multiple of the result vector length.
2824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTRACT_SUBVECTOR,
2834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
284bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    /// VECTOR_SHUFFLE(VEC1, VEC2) - Returns a vector, of the same type as
2854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// VEC1/VEC2.  A VECTOR_SHUFFLE node also contains an array of constant int
2864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// values that indicate which value (or undef) each result element will
287bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    /// get.  These constant ints are accessible through the
288bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    /// ShuffleVectorSDNode class.  This is quite similar to the Altivec
2894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// 'vperm' instruction, except that the indices must be constants and are
2904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// in terms of the element size of VEC1/VEC2, not in terms of bytes.
2914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VECTOR_SHUFFLE,
2924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
2934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// SCALAR_TO_VECTOR(VAL) - This represents the operation of loading a
2944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// scalar value into element 0 of the resultant vector type.  The top
2954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// elements 1 to N-1 of the N-element vector are undefined.  The type
2964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// of the operand must match the vector element type, except when they
2974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// are integer types.  In this case the operand is allowed to be wider
2984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// than the vector element type, and is implicitly truncated to it.
2994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SCALAR_TO_VECTOR,
3004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
301f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// MULHU/MULHS - Multiply high - Multiply two integers of type iN,
302f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// producing an unsigned/signed value of type i[2*N], then return the top
303f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// part.
3044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MULHU, MULHS,
3054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
306e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// Bitwise operators - logical and, logical or, logical xor.
307e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    AND, OR, XOR,
308f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem
309e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// Shift and rotation operations.  After legalization, the type of the
310e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// shift amount is known to be TLI.getShiftAmountTy().  Before legalization
311e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// the shift amount can be any type, but care must be taken to ensure it is
312e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// large enough.  TLI.getShiftAmountTy() is i8 on some targets, but before
313e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// legalization, types like i1024 can occur and i8 doesn't have enough bits
314d8c7ff00191c6e585db96df55748b06cdfa207c8Chris Lattner    /// to represent the shift amount.  By convention, DAGCombine and
315d8c7ff00191c6e585db96df55748b06cdfa207c8Chris Lattner    /// SelectionDAGBuilder forces these shift amounts to i32 for simplicity.
316e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    SHL, SRA, SRL, ROTL, ROTR,
317e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner
318e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    /// Byte Swap and Counting operators.
319e075118489baf15a7cea2e7f155b4799b93d6d02Chris Lattner    BSWAP, CTTZ, CTLZ, CTPOP,
3204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
32163974b2144c87c962effdc0508c27643c8ad98b6Chandler Carruth    /// Bit counting operators with an undefined result for zero inputs.
32263974b2144c87c962effdc0508c27643c8ad98b6Chandler Carruth    CTTZ_ZERO_UNDEF, CTLZ_ZERO_UNDEF,
32363974b2144c87c962effdc0508c27643c8ad98b6Chandler Carruth
324f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Select(COND, TRUEVAL, FALSEVAL).  If the type of the boolean COND is not
325f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// i1 then the high bits must conform to getBooleanContents.
3264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SELECT,
3274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
328f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Select with a vector condition (op #0) and two vector operands (ops #1
329f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and #2), returning a vector result.  All vectors have the same length.
330f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Much like the scalar select and setcc, each bit in the condition selects
331f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// whether the corresponding result element is taken from op #1 or op #2.
332f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// At first, the VSELECT condition is of vXi1 type. Later, targets may
333f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// change the condition type in order to match the VSELECT node using a
334f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// pattern. The condition follows the BooleanContent format of the target.
33528b77e968d2b01fc9da724762bd8ddcd80650e32Duncan Sands    VSELECT,
33628b77e968d2b01fc9da724762bd8ddcd80650e32Duncan Sands
337f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Select with condition operator - This selects between a true value and
338f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a false value (ops #2 and #3) based on the boolean result of comparing
339f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the lhs and rhs (ops #0 and #1) of a conditional expression with the
340f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// condition code in op #4, a CondCodeSDNode.
3414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SELECT_CC,
3424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
343f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SetCC operator - This evaluates to a true value iff the condition is
344f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// true.  If the result value type is not i1 then the high bits conform
345f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to getBooleanContents.  The operands to this are the left and right
346f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operands to compare (ops #0, and #1) and the condition code to compare
347f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// them with (op #2) as a CondCodeSDNode. If the operands are vector types
348f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// then the result type must also be a vector type.
3494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETCC,
3504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
351f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded
352f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// integer shift operations, just like ADD/SUB_PARTS.  The operation
353f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ordering is:
354f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///       [Lo,Hi] = op [LoLHS,HiLHS], Amt
3554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SHL_PARTS, SRA_PARTS, SRL_PARTS,
3564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
357f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Conversion operators.  These are all single input single output
358f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operations.  For all of these, the result type must be strictly
359f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// wider or narrower (depending on the operation) than the source
360f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// type.
3614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
362f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SIGN_EXTEND - Used for integer types, replicating the sign bit
363f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// into new bits.
3644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SIGN_EXTEND,
3654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
366f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ZERO_EXTEND - Used for integer types, zeroing the new bits.
3674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ZERO_EXTEND,
3684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
369f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ANY_EXTEND - Used for integer types.  The high bits are undefined.
3704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ANY_EXTEND,
3714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
372f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TRUNCATE - Completely drop the high bits.
3734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TRUNCATE,
3744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
375f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// [SU]INT_TO_FP - These operators convert integers (whose interpreted sign
376f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// depends on the first letter) to floating point.
3774031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SINT_TO_FP,
3784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    UINT_TO_FP,
3794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
380f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SIGN_EXTEND_INREG - This operator atomically performs a SHL/SRA pair to
381f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// sign extend a small value in a large integer register (e.g. sign
382f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// extending the low 8 bits of a 32-bit register to fill the top 24 bits
383f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// with the 7th bit).  The size of the smaller type is indicated by the 1th
384f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operand, a ValueType node.
3854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SIGN_EXTEND_INREG,
3864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
3874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// FP_TO_[US]INT - Convert a floating point value to a signed or unsigned
3884031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// integer.
3894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_TO_SINT,
3904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_TO_UINT,
3914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
3924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// X = FP_ROUND(Y, TRUNC) - Rounding 'Y' from a larger floating point type
3934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// down to the precision of the destination VT.  TRUNC is a flag, which is
3944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// always an integer that is zero or one.  If TRUNC is 0, this is a
3954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// normal rounding, if it is 1, this FP_ROUND is known to not change the
3964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// value of Y.
3974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ///
3984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// The TRUNC = 1 case is used in cases where we know that the value will
3994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// not be modified by the node, because Y is not using any of the extra
4004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// precision of source type.  This allows certain transformations like
4014031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// FP_EXTEND(FP_ROUND(X,1)) -> X which are not safe for
4024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// FP_EXTEND(FP_ROUND(X,0)) because the extra bits aren't removed.
4034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_ROUND,
4044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
405f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FLT_ROUNDS_ - Returns current rounding mode:
406f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// -1 Undefined
407f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  0 Round to 0
408f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  1 Round to nearest
409f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  2 Round to +inf
410f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///  3 Round to -inf
4114031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FLT_ROUNDS_,
4124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
4134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// X = FP_ROUND_INREG(Y, VT) - This operator takes an FP register, and
4144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// rounds it to a floating point value.  It then promotes it and returns it
4154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// in a register of the same size.  This operation effectively just
4164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// discards excess precision.  The type to round down to is specified by
4174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// the VT operand, a VTSDNode.
4184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_ROUND_INREG,
4194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
4204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// X = FP_EXTEND(Y) - Extend a smaller FP type into a larger FP type.
4214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP_EXTEND,
4224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
423f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BITCAST - This operator converts between integer, vector and FP
424f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// values, as if the value was stored to memory with one type and loaded
425f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// from the same address with the other type (or equivalently for vector
426f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// format conversions, etc).  The source and result are required to have
427f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the same bit size (e.g.  f32 <-> i32).  This can also be used for
428f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// int-to-int or fp-to-fp conversions, but that is a noop, deleted by
429f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// getNode().
430bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck    BITCAST,
4314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
432f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CONVERT_RNDSAT - This operator is used to support various conversions
433f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// between various types (float, signed, unsigned and vectors of those
434f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// types) with rounding and saturation. NOTE: Avoid using this operator as
435f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// most target don't support it and the operator might be removed in the
436f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// future. It takes the following arguments:
437f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   0) value
438f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   1) dest type (type to convert to)
439f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   2) src type (type to convert from)
440f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   3) rounding imm
441f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   4) saturation imm
442f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   5) ISD::CvtCode indicating the type of conversion to do
4434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CONVERT_RNDSAT,
4444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
445f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FP16_TO_FP32, FP32_TO_FP16 - These operators are used to perform
446f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// promotions and truncation for half-precision (16 bit) floating
447f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// numbers. We need special nodes since FP16 is a storage-only type with
448f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// special semantics of operations.
4494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FP16_TO_FP32, FP32_TO_FP16,
4504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
451f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
452f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FLOG, FLOG2, FLOG10, FEXP, FEXP2,
453f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary
454f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// floating point operations. These are inspired by libm.
4554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW,
4564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FLOG, FLOG2, FLOG10, FEXP, FEXP2,
4574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR,
4584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
459f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// LOAD and STORE have token chains as their first operand, then the same
460f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operands as an LLVM load/store instruction, then an offset node that
461f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is added / subtracted from the base pointer to form the address (for
462f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// indexed memory ops).
4634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LOAD, STORE,
4644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
465f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DYNAMIC_STACKALLOC - Allocate some number of bytes on the stack aligned
466f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to a specified boundary.  This node always has two return values: a new
467f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// stack pointer value and a chain. The first operand is the token chain,
468f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the second is the number of bytes to allocate, and the third is the
469f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// alignment boundary.  The size is guaranteed to be a multiple of the
470f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// stack alignment, and the alignment is guaranteed to be bigger than the
471f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// stack alignment (if required) or 0 to get standard stack alignment.
4724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    DYNAMIC_STACKALLOC,
4734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
474f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Control flow instructions.  These all have token chains.
4754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
476f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BR - Unconditional branch.  The first operand is the chain
477f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operand, the second is the MBB to branch to.
4784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BR,
4794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
480f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BRIND - Indirect branch.  The first operand is the chain, the second
481f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is the value to branch to, which must be of the same type as the
482f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// target's pointer type.
4834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BRIND,
4844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
485f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BR_JT - Jumptable branch. The first operand is the chain, the second
486f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is the jumptable index, the last one is the jumptable entry index.
4874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BR_JT,
4884031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
489f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BRCOND - Conditional branch.  The first operand is the chain, the
490f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// second is the condition, the third is the block to branch to if the
491f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// condition is true.  If the type of the condition is not i1, then the
492f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// high bits must conform to getBooleanContents.
4934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BRCOND,
4944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
495f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// BR_CC - Conditional branch.  The behavior is like that of SELECT_CC, in
496f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// that the condition is represented as condition code, and two nodes to
497f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// compare, rather than as a combined SetCC node.  The operands in order
498f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// are chain, cc, lhs, rhs, block to branch to if condition is true.
4994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BR_CC,
5004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
501f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// INLINEASM - Represents an inline asm block.  This node always has two
502f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// return values: a chain and a flag result.  The inputs are as follows:
503f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #0  : Input chain.
504f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #1  : a ExternalSymbolSDNode with a pointer to the asm string.
505f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #2  : a MDNodeSDNode with the !srcloc metadata.
506f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #3  : HasSideEffect, IsAlignStack bits.
507f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   After this, it is followed by a list of operands with this format:
508f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///     ConstantSDNode: Flags that encode whether it is a mem or not, the
509f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///                     of operands that follow, etc.  See InlineAsm.h.
510f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///     ... however many operands ...
511f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///   Operand #last: Optional, an incoming flag.
512f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///
513f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// The variable width operands are required to represent target addressing
514f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// modes as a single "operand", even though they may have multiple
515f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SDOperands.
5164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    INLINEASM,
5174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
518f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// EH_LABEL - Represents a label in mid basic block used to track
519f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// locations needed for debug and exception handling tables.  These nodes
520f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// take a chain as input and return a chain.
5214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EH_LABEL,
5224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
523f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// STACKSAVE - STACKSAVE has one operand, an input chain.  It produces a
524f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value, the same type as the pointer type for the system, and an output
525f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// chain.
5264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    STACKSAVE,
5274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
528f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// STACKRESTORE has two operands, an input chain and a pointer to restore
529f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to it returns an output chain.
5304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    STACKRESTORE,
5314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
532f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CALLSEQ_START/CALLSEQ_END - These operators mark the beginning and end
533f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// of a call sequence, and carry arbitrary information that target might
534f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// want to know.  The first operand is a chain, the rest are specified by
535f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// the target and not touched by the DAG optimizers.
536f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// CALLSEQ_START..CALLSEQ_END pairs may not be nested.
5374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CALLSEQ_START,  // Beginning of a call sequence
5384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    CALLSEQ_END,    // End of a call sequence
5394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
540f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// VAARG - VAARG has four operands: an input chain, a pointer, a SRCVALUE,
541f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and the alignment. It returns a pair of values: the vaarg value and a
542f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// new chain.
5434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VAARG,
5444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
545f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// VACOPY - VACOPY has 5 operands: an input chain, a destination pointer,
546f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// a source pointer, a SRCVALUE for the destination, and a SRCVALUE for the
547f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// source.
5484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VACOPY,
5494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
550f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// VAEND, VASTART - VAEND and VASTART have three operands: an input chain,
551f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// pointer, and a SRCVALUE.
5524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    VAEND, VASTART,
5534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
554f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SRCVALUE - This is a node type that holds a Value* that is used to
555f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// make reference to a value in the LLVM IR.
5564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SRCVALUE,
557bf17cfa3f904e488e898ac2e3af706fd1a892f08Wesley Peck
558f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// MDNODE_SDNODE - This is a node that holdes an MDNode*, which is used to
559f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// reference metadata in the IR.
5604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MDNODE_SDNODE,
5614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
562f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// PCMARKER - This corresponds to the pcmarker intrinsic.
5634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PCMARKER,
5644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
565f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// READCYCLECOUNTER - This corresponds to the readcyclecounter intrinsic.
566f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// The only operand is a chain and a value and a chain are produced.  The
567f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// value is the contents of the architecture specific cycle counter like
568f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// register (or other high accuracy low latency clock source)
5694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    READCYCLECOUNTER,
5704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
571f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// HANDLENODE node - Used as a handle for various purposes.
5724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    HANDLENODE,
5734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
574f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// INIT_TRAMPOLINE - This corresponds to the init_trampoline intrinsic.  It
575f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// takes as input a token chain, the pointer to the trampoline, the pointer
576f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// to the nested function, the pointer to pass for the 'nest' parameter, a
577f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// SRCVALUE for the trampoline and another for the nested function
578f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// (allowing targets to access the original Function*).
579f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It produces a token chain as output.
5804a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands    INIT_TRAMPOLINE,
5814a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands
582f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// ADJUST_TRAMPOLINE - This corresponds to the adjust_trampoline intrinsic.
583f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// It takes a pointer to the trampoline and produces a (possibly) new
584f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// pointer to the same trampoline with platform-specific adjustments
585f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// applied.  The pointer it returns points to an executable block of code.
5864a544a79bd735967f1d33fe675ae4566dbd17813Duncan Sands    ADJUST_TRAMPOLINE,
5874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
588f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// TRAP - Trapping instruction
5894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    TRAP,
5904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
591f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// DEBUGTRAP - Trap intended to get the attention of a debugger.
592a6063c6e29746d9425bdf46d680e28a48dcf58f9Dan Gohman    DEBUGTRAP,
593d4347e1af9141ec9f8e3e527367bfd16c0cc4ffbDan Gohman
594f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// PREFETCH - This corresponds to a prefetch intrinsic. The first operand
595f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// is the chain.  The other operands are the address to prefetch,
596f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// read / write specifier, locality specifier and instruction / data cache
597f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// specifier.
5984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PREFETCH,
5994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
600f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = MEMBARRIER(INCHAIN, load-load, load-store, store-load,
601f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    ///                       store-store, device)
602f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the memory.barrier intrinsic.
603f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// it takes an input chain, 4 operands to specify the type of barrier, an
604f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// operand specifying if the barrier applies to device and uncached memory
605f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// and produces an output chain.
6064031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    MEMBARRIER,
6074031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
608f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = ATOMIC_FENCE(INCHAIN, ordering, scope)
609f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the fence instruction. It takes an input chain, and
610f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// two integer constants: an AtomicOrdering and a SynchronizationScope.
61114648468011c92a4210f8118721d58c25043daf8Eli Friedman    ATOMIC_FENCE,
61214648468011c92a4210f8118721d58c25043daf8Eli Friedman
613f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr)
614f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to "load atomic" instruction.
615327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman    ATOMIC_LOAD,
616327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman
617f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// OUTCHAIN = ATOMIC_LOAD(INCHAIN, ptr, val)
618f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to "store atomic" instruction.
619327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman    ATOMIC_STORE,
620327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman
621f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap)
622f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// This corresponds to the cmpxchg instruction.
6234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_CMP_SWAP,
6244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
625f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_SWAP(INCHAIN, ptr, amt)
626f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// Val, OUTCHAIN = ATOMIC_LOAD_[OpName](INCHAIN, ptr, amt)
627f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    /// These correspond to the atomicrmw instruction.
628327236cd6c211e54fc6288b0ac2b413901cc0611Eli Friedman    ATOMIC_SWAP,
6294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_ADD,
6304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_SUB,
6314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_AND,
6324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_OR,
6334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_XOR,
6344031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_NAND,
6354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_MIN,
6364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_MAX,
6374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_UMIN,
6384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ATOMIC_LOAD_UMAX,
6394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
640c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem    /// This corresponds to the llvm.lifetime.* intrinsics. The first operand
641c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem    /// is the chain and the second operand is the alloca pointer.
642c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem    LIFETIME_START, LIFETIME_END,
643c05d30601ced172b55be81bb529df6be91d6ae15Nadav Rotem
6444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// BUILTIN_OP_END - This must be the last enum value in this list.
6454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    /// The target-specific pre-isel opcode values start here.
6464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    BUILTIN_OP_END
6474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
6484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
6494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations
6504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// which do not reference a specific memory location should be less than
6514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// this value. Those that do must not be less than this value, and can
6524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// be used with SelectionDAG::getMemIntrinsicNode.
6533157ef1c13376f669a32bc152f2c3000480cedd3Bruno Cardoso Lopes  static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END+150;
6544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
6554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
6564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// MemIndexedMode enum - This enum defines the load / store indexed
6574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// addressing modes.
6584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
6594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// UNINDEXED    "Normal" load / store. The effective address is already
6604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computed and is available in the base pointer. The offset
6614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              operand is always undefined. In addition to producing a
6624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              chain, an unindexed load produces one value (result of the
6634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              load); an unindexed store does not produce a value.
6644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
6654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// PRE_INC      Similar to the unindexed mode where the effective address is
6664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// PRE_DEC      the value of the base pointer add / subtract the offset.
6674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              It considers the computation as being folded into the load /
6684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              store operation (i.e. the load / store does the address
6694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computation as well as performing the memory transaction).
6704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              The base operand is always undefined. In addition to
6714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              producing a chain, pre-indexed load produces two values
6724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              (result of the load and the result of the address
6734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computation); a pre-indexed store produces one value (result
6744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              of the address computation).
6754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
6764031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// POST_INC     The effective address is the value of the base pointer. The
6774031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// POST_DEC     value of the offset operand is then added to / subtracted
6784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              from the base after memory transaction. In addition to
6794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              producing a chain, post-indexed load produces two values
6804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              (the result of the load and the result of the base +/- offset
6814031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              computation); a post-indexed store produces one value (the
6824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///              the result of the base +/- offset computation).
6834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum MemIndexedMode {
6844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    UNINDEXED = 0,
6854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PRE_INC,
6864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    PRE_DEC,
6874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    POST_INC,
6884031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    POST_DEC,
6894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LAST_INDEXED_MODE
6904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
6914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
6924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
6934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// LoadExtType enum - This enum defines the three variants of LOADEXT
6944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// (load with extension).
6954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
6964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// SEXTLOAD loads the integer operand and sign extends it to a larger
6974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///          integer result type.
6984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// ZEXTLOAD loads the integer operand and zero extends it to a larger
6994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///          integer result type.
70079976e9ff18265c5b8c991db0c2ff6d2edad94feBob Wilson  /// EXTLOAD  is used for two things: floating point extending loads and
70179976e9ff18265c5b8c991db0c2ff6d2edad94feBob Wilson  ///          integer extending loads [the top bits are undefined].
7024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum LoadExtType {
7034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    NON_EXTLOAD = 0,
7044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    EXTLOAD,
7054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SEXTLOAD,
7064031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    ZEXTLOAD,
7074031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    LAST_LOADEXT_TYPE
7084031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
7094031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7104031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
7114031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// ISD::CondCode enum - These are ordered carefully to make the bitfields
7124031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// below work out, when considering SETFALSE (something that never exists
7134031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// dynamically) as 0.  "U" -> Unsigned (for integer operands) or Unordered
7144031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// (for floating point), "L" -> Less than, "G" -> Greater than, "E" -> Equal
7154031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// to.  If the "N" column is 1, the result of the comparison is undefined if
7164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// the input is a NAN.
7174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
7184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// All of these (except for the 'always folded ops') should be handled for
7194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// floating point.  For integer, only the SETEQ,SETNE,SETLT,SETLE,SETGT,
7204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// SETGE,SETULT,SETULE,SETUGT, and SETUGE opcodes are used.
7214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  ///
7224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// Note that these are laid out in a specific order to allow bit-twiddling
7234031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// to transform conditions.
7244031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum CondCode {
7254031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    // Opcode          N U L G E       Intuitive operation
7264031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETFALSE,      //    0 0 0 0       Always false (always folded)
7274031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOEQ,        //    0 0 0 1       True if ordered and equal
7284031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOGT,        //    0 0 1 0       True if ordered and greater than
7294031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOGE,        //    0 0 1 1       True if ordered and greater than or equal
7304031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOLT,        //    0 1 0 0       True if ordered and less than
7314031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETOLE,        //    0 1 0 1       True if ordered and less than or equal
7324031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETONE,        //    0 1 1 0       True if ordered and operands are unequal
7334031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETO,          //    0 1 1 1       True if ordered (no nans)
7344031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUO,         //    1 0 0 0       True if unordered: isnan(X) | isnan(Y)
7354031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUEQ,        //    1 0 0 1       True if unordered or equal
7364031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUGT,        //    1 0 1 0       True if unordered or greater than
7374031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUGE,        //    1 0 1 1       True if unordered, greater than, or equal
7384031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETULT,        //    1 1 0 0       True if unordered or less than
7394031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETULE,        //    1 1 0 1       True if unordered, less than, or equal
7404031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETUNE,        //    1 1 1 0       True if unordered or not equal
7414031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETTRUE,       //    1 1 1 1       Always true (always folded)
7424031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    // Don't care operations: undefined if the input is a nan.
7434031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETFALSE2,     //  1 X 0 0 0       Always false (always folded)
7444031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETEQ,         //  1 X 0 0 1       True if equal
7454031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETGT,         //  1 X 0 1 0       True if greater than
7464031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETGE,         //  1 X 0 1 1       True if greater than or equal
7474031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETLT,         //  1 X 1 0 0       True if less than
7484031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETLE,         //  1 X 1 0 1       True if less than or equal
7494031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETNE,         //  1 X 1 1 0       True if not equal
7504031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETTRUE2,      //  1 X 1 1 1       Always true (always folded)
7514031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7524031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    SETCC_INVALID       // Marker value.
7534031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
7544031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7554031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// isSignedIntSetCC - Return true if this is a setcc instruction that
7564031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// performs a signed comparison when used with integer operands.
7574031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline bool isSignedIntSetCC(CondCode Code) {
7584031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return Code == SETGT || Code == SETGE || Code == SETLT || Code == SETLE;
7594031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
7604031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7614031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// isUnsignedIntSetCC - Return true if this is a setcc instruction that
7624031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// performs an unsigned comparison when used with integer operands.
7634031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline bool isUnsignedIntSetCC(CondCode Code) {
7644031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return Code == SETUGT || Code == SETUGE || Code == SETULT || Code == SETULE;
7654031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
7664031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7674031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// isTrueWhenEqual - Return true if the specified condition returns true if
7684031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// the two operands to the condition are equal.  Note that if one of the two
7694031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// operands is a NaN, this value is meaningless.
7704031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline bool isTrueWhenEqual(CondCode Cond) {
7714031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return ((int)Cond & 1) != 0;
7724031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
7734031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7744031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// getUnorderedFlavor - This function returns 0 if the condition is always
7754031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// false if an operand is a NaN, 1 if the condition is always true if the
7764031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// operand is a NaN, and 2 if the condition is undefined if the operand is a
7774031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// NaN.
7784031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  inline unsigned getUnorderedFlavor(CondCode Cond) {
7794031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman    return ((int)Cond >> 3) & 3;
7804031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  }
7814031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7824031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// getSetCCInverse - Return the operation corresponding to !(X op Y), where
7834031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// 'op' is a valid SetCC operation.
7844031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCInverse(CondCode Operation, bool isInteger);
7854031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7864031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X)
7874031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// when given the operation for (X op Y).
7884031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCSwappedOperands(CondCode Operation);
7894031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7904031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// getSetCCOrOperation - Return the result of a logical OR between different
7914031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// comparisons of identical values: ((X op1 Y) | (X op2 Y)).  This
7924031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// function returns SETCC_INVALID if it is not possible to represent the
7934031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// resultant comparison.
7944031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCOrOperation(CondCode Op1, CondCode Op2, bool isInteger);
7954031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
7964031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// getSetCCAndOperation - Return the result of a logical AND between
7974031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// different comparisons of identical values: ((X op1 Y) & (X op2 Y)).  This
7984031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// function returns SETCC_INVALID if it is not possible to represent the
7994031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// resultant comparison.
8004031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  CondCode getSetCCAndOperation(CondCode Op1, CondCode Op2, bool isInteger);
8014031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
8024031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  //===--------------------------------------------------------------------===//
8034031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// CvtCode enum - This enum defines the various converts CONVERT_RNDSAT
8044031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  /// supports.
8054031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  enum CvtCode {
806f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_FF,     /// Float from Float
807f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_FS,     /// Float from Signed
808f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_FU,     /// Float from Unsigned
809f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_SF,     /// Signed from Float
810f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_UF,     /// Unsigned from Float
811f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_SS,     /// Signed from Signed
812f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_SU,     /// Signed from Unsigned
813f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_US,     /// Unsigned from Signed
814f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_UU,     /// Unsigned from Unsigned
815f4341e4155e272ec7e72ff61e100bafb50fc8bd8Nadav Rotem    CVT_INVALID /// Marker - Invalid opcode
8164031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman  };
8174031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
8184031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman} // end llvm::ISD namespace
8194031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
8204031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman} // end llvm namespace
8214031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman
8224031d59685cef09fad651dd39020ccca4c13ef89Dan Gohman#endif
823