X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FLangRef.html;h=95b89fcc4e5105f0a27cdbcbf0f5c9ab1d8668bf;hb=424641ef83fbb99640d3e2758148a9d3ea2b3830;hp=fa6a07846533dba5b2af6a81c10c97da31002f3b;hpb=66298c104e9562c414f106d2fb0415218ec5c5d6;p=oota-llvm.git diff --git a/docs/LangRef.html b/docs/LangRef.html index fa6a0784653..95b89fcc4e5 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -12,7 +12,7 @@ -
LLVM Language Reference Manual
+

LLVM Language Reference Manual

  1. Abstract
  2. Introduction
  3. @@ -239,6 +239,8 @@
  4. 'llvm.sin.*' Intrinsic
  5. 'llvm.cos.*' Intrinsic
  6. 'llvm.pow.*' Intrinsic
  7. +
  8. 'llvm.exp.*' Intrinsic
  9. +
  10. 'llvm.log.*' Intrinsic
  • Bit Manipulation Intrinsics @@ -321,10 +323,10 @@ -
    Abstract
    +

    Abstract

    -
    +

    This document is a reference manual for the LLVM assembly language. LLVM is a Static Single Assignment (SSA) based representation that provides type @@ -335,10 +337,10 @@

    - +

    Introduction

    -
    +

    The LLVM code representation is designed to be used in three different forms: as an in-memory compiler IR, as an on-disk bitcode representation (suitable @@ -359,12 +361,12 @@ variable is never accessed outside of the current function, allowing it to be promoted to a simple SSA value instead of a memory location.

    -
    - - +

    + Well-Formedness +

    -
    +

    It is important to note that this document describes 'well formed' LLVM assembly language. There is a difference between what the parser accepts and @@ -384,13 +386,15 @@

    +
    + - +

    Identifiers

    -
    +

    LLVM identifiers come in two basic types: global and local. Global identifiers (functions, global variables) begin with the '@' @@ -475,14 +479,15 @@

    - +

    High Level Structure

    - +
    - +

    + Module Structure +

    -
    +

    LLVM programs are composed of "Module"s, each of which is a translation unit of the input programs. Each module consists of functions, global variables, @@ -528,11 +533,11 @@ define i32 @main() { ; i32()*  

    - + -
    +

    All Global Variables and Functions have one of the following types of linkage:

    @@ -677,11 +682,11 @@ define i32 @main() { ; i32()*  
    - + -
    +

    LLVM functions, calls and invokes can all have an optional calling @@ -750,11 +755,11 @@ define i32 @main() { ; i32()*  

    - + -
    +

    All Global Variables and Functions have one of the following visibility styles:

    @@ -784,11 +789,11 @@ define i32 @main() { ; i32()*  
    - + -
    +

    LLVM IR allows you to specify name aliases for certain types. This can make it easier to read the IR and make the IR more condensed (particularly when @@ -815,11 +820,11 @@ define i32 @main() { ; i32()*  

    - + -
    +

    Global variables define regions of memory allocated at compilation time instead of run-time. Global variables may optionally be initialized, may @@ -883,11 +888,11 @@ define i32 @main() { ; i32()*   -

    + -
    +

    LLVM function definitions consist of the "define" keyword, an optional linkage type, an optional @@ -946,11 +951,11 @@ define [linkage] [visibility]

    -
    +

    Aliases -

    + -
    +

    Aliases act as "second name" for the aliasee value (which can be either function, global variable, another alias or bitcast of global value). Aliases @@ -965,11 +970,11 @@ define [linkage] [visibility]

    - + -
    +

    Named metadata is a collection of metadata. Metadata nodes (but not metadata strings) are the only valid operands for @@ -988,9 +993,11 @@ define [linkage] [visibility]

    - +

    + Parameter Attributes +

    -
    +

    The return type and each parameter of a function type may have a set of parameter attributes associated with them. Parameter attributes are @@ -1017,13 +1024,15 @@ declare signext i8 @returns_signed_char()

    zeroext
    This indicates to the code generator that the parameter or return value - should be zero-extended to a 32-bit value by the caller (for a parameter) - or the callee (for a return value).
    + should be zero-extended to the extent required by the target's ABI (which + is usually 32-bits, but is 8-bits for a i1 on x86-64) by the caller (for a + parameter) or the callee (for a return value).
    signext
    This indicates to the code generator that the parameter or return value - should be sign-extended to a 32-bit value by the caller (for a parameter) - or the callee (for a return value).
    + should be sign-extended to the extent required by the target's ABI (which + is usually 32-bits) by the caller (for a parameter) or the callee (for a + return value).
    inreg
    This indicates that this parameter or return value should be treated in a @@ -1095,11 +1104,11 @@ declare signext i8 @returns_signed_char()
    - + -
    +

    Each function may specify a garbage collector name, which is simply a string:

    @@ -1115,11 +1124,11 @@ define void @f() gc "name" { ... }
    - + -
    +

    Function attributes are set to communicate additional information about a function. Function attributes are considered to be part of the function, not @@ -1238,11 +1247,11 @@ define void @f() optsize { ... }

    - + -
    +

    Modules may contain "module-level inline asm" blocks, which corresponds to the GCC "file scope inline asm" blocks. These blocks are internally @@ -1264,11 +1273,11 @@ module asm "more can go here"

    - + -
    +

    A module may specify a target specific data layout string that specifies how data is to be laid out in memory. The syntax for the data layout is @@ -1376,11 +1385,11 @@ target datalayout = "layout specification"

    - + -
    +

    Any memory access must be done through a pointer value associated with an address range of the memory access, otherwise the behavior @@ -1440,11 +1449,11 @@ to implement type-based alias analysis.

    - + -
    +

    Certain memory accesses, such as loads, stores, and

    +
    + - +

    Type System

    -
    +

    The LLVM type system is one of the most important features of the intermediate representation. Being typed enables a number of optimizations @@ -1471,13 +1482,12 @@ synchronization behavior.

    and transformations that are not feasible to perform on normal three address code representations.

    -
    - - +

    + Type Classifications +

    -
    +

    The types fall into a few useful classifications:

    @@ -1534,19 +1544,21 @@ Classifications
    - +

    + Primitive Types +

    -
    +

    The primitive types are the fundamental building blocks of the LLVM system.

    -
    - - +

    + Integer Type +

    -
    +
    Overview:

    The integer type is a very simple type that simply specifies an arbitrary @@ -1580,9 +1592,11 @@ Classifications

    - +

    + Floating Point Types +

    -
    +
    @@ -1598,9 +1612,11 @@ Classifications - +

    + X86mmx Type +

    -
    +
    Overview:

    The x86mmx type represents a value held in an MMX register on an x86 machine. The operations allowed on it are quite limited: parameters and return values, load and store, and bitcast. User-specified MMX instructions are represented as intrinsic or asm calls with arguments and/or results of this type. There are no arrays, vectors or constants of this type.

    @@ -1613,9 +1629,11 @@ Classifications
    - +

    + Void Type +

    -
    +
    Overview:

    The void type does not represent any value and has no size.

    @@ -1628,9 +1646,11 @@ Classifications
    - +

    + Label Type +

    -
    +
    Overview:

    The label type represents code labels.

    @@ -1643,9 +1663,11 @@ Classifications
    - +

    + Metadata Type +

    -
    +
    Overview:

    The metadata type represents embedded metadata. No derived types may be @@ -1659,11 +1681,14 @@ Classifications

    + - +

    + Derived Types +

    -
    +

    The real power in LLVM comes from the derived types in the system. This is what allows a programmer to represent arrays, functions, pointers, and other @@ -1673,12 +1698,12 @@ Classifications

    of another array.

    -
    - - +

    + Aggregate Types +

    -
    +

    Aggregate Types are a subset of derived types that can contain multiple member types. Arrays, @@ -1688,9 +1713,11 @@ Classifications

    - +

    + Array Type +

    -
    +
    Overview:

    The array type is a very simple derived type that arranges elements @@ -1746,9 +1773,11 @@ Classifications

    - +

    + Function Type +

    -
    +
    Overview:

    The function type can be thought of as a function signature. It consists of @@ -1799,9 +1828,11 @@ Classifications

    - +

    + Structure Type +

    -
    +
    Overview:

    The structure type is used to represent a collection of data members together @@ -1837,10 +1868,11 @@ Classifications

    - +

    + Packed Structure Type +

    -
    +
    Overview:

    The packed structure type is used to represent a collection of data members @@ -1875,9 +1907,11 @@ Classifications

    - +

    + Pointer Type +

    -
    +
    Overview:

    The pointer type is used to specify memory locations. @@ -1919,9 +1953,11 @@ Classifications

    - +

    + Vector Type +

    -
    +
    Overview:

    A vector type is a simple derived type that represents a vector of elements. @@ -1958,8 +1994,11 @@ Classifications

    - -
    +

    + Opaque Type +

    + +
    Overview:

    Opaque types are used to represent unknown types in the system. This @@ -1982,12 +2021,14 @@ Classifications

    + + - + -
    +
    Overview:

    An "up reference" allows you to refer to a lexically enclosing type without @@ -2030,21 +2071,23 @@ Classifications

    + + - +

    Constants

    -
    +

    LLVM has several different basic types of constants. This section describes them all and their syntax.

    -
    - - +

    + Simple Constants +

    -
    +
    Boolean constants
    @@ -2097,12 +2140,12 @@ Classifications
    - + -
    +

    Complex constants are a (potentially recursive) combination of simple constants and smaller complex constants.

    @@ -2152,11 +2195,11 @@ Classifications
    - + -
    +

    The addresses of global variables and functions are always implicitly valid @@ -2174,8 +2217,11 @@ Classifications

    - -
    +

    + Undefined Values +

    + +

    The string 'undef' can be used anywhere a constant is expected, and indicates that the user of the value may receive an unspecified bit-pattern. @@ -2314,8 +2360,11 @@ b: unreachable

    - -
    +

    + Trap Values +

    + +

    Trap values are similar to undef values, however instead of representing an unspecified bit pattern, they represent the @@ -2367,7 +2416,12 @@ b: unreachable terminator instruction if the terminator instruction has multiple successors and the instruction is always executed when control transfers to one of the successors, and - may not be executed when control is transfered to another. + may not be executed when control is transferred to another. + +

  • Additionally, an instruction also control-depends on a terminator + instruction if the set of instructions it otherwise depends on would be + different if the terminator had transferred control to a different + successor.
  • Dependence is transitive.
  • @@ -2394,11 +2448,11 @@ entry: %narrowaddr = bitcast i32* @g to i16* %wideaddr = bitcast i32* @g to i64* - %trap3 = load 16* %narrowaddr ; Returns a trap value. - %trap4 = load i64* %widaddr ; Returns a trap value. + %trap3 = load i16* %narrowaddr ; Returns a trap value. + %trap4 = load i64* %wideaddr ; Returns a trap value. - %cmp = icmp i32 slt %trap, 0 ; Returns a trap value. - %br i1 %cmp, %true, %end ; Branch to either destination. + %cmp = icmp slt i32 %trap, 0 ; Returns a trap value. + br i1 %cmp, label %true, label %end ; Branch to either destination. true: volatile store i32 0, i32* @g ; This is control-dependent on %cmp, so @@ -2411,17 +2465,34 @@ end: ; control-dependent on %cmp, so this ; always results in a trap value. - volatile store i32 0, i32* @g ; %end is control-equivalent to %entry - ; so this is defined (ignoring earlier + volatile store i32 0, i32* @g ; This would depend on the store in %true + ; if %cmp is true, or the store in %entry + ; otherwise, so this is undefined behavior. + + br i1 %cmp, label %second_true, label %second_end + ; The same branch again, but this time the + ; true block doesn't have side effects. + +second_true: + ; No side effects! + ret void + +second_end: + volatile store i32 0, i32* @g ; This time, the instruction always depends + ; on the store in %end. Also, it is + ; control-equivalent to %end, so this is + ; well-defined (again, ignoring earlier ; undefined behavior in this example).
    - -
    +

    + Addresses of Basic Blocks +

    + +

    blockaddress(@function, %block)

    @@ -2446,10 +2517,11 @@ end: - +

    + Constant Expressions +

    -
    +

    Constant expressions are used to allow expressions involving other constants to be used as constants. Constant expressions may be of @@ -2575,16 +2647,18 @@ end:

    +
    + - +

    Other Values

    - +
    - + -
    +

    LLVM supports inline assembler expressions (as opposed to Module-Level Inline Assembly) through the use of @@ -2633,13 +2707,12 @@ call void asm alignstack "eieio", ""() documented here. Constraints on what can be done (e.g. duplication, moving, etc need to be documented). This is probably best done by reference to another document that covers inline asm from a holistic perspective.

    -
    - + -
    +

    The call instructions that wrap inline asm nodes may have a "!srcloc" MDNode attached to it that contains a list of constant integers. If present, the @@ -2660,12 +2733,14 @@ call void asm sideeffect "something bad", ""(), !srcloc !42

    - - -
    + +

    + Metadata Nodes and Metadata Strings +

    + +

    LLVM IR allows metadata to be attached to instructions in the program that can convey extra information about the code to the optimizers and code @@ -2690,25 +2765,31 @@ call void asm sideeffect "something bad", ""(), !srcloc !42

    Metadata can be used as function arguments. Here llvm.dbg.value function is using two metadata arguments.

    -
    -       call void @llvm.dbg.value(metadata !24, i64 0, metadata !25)
    -     
    +
    +
    +call void @llvm.dbg.value(metadata !24, i64 0, metadata !25)
    +
    +

    Metadata can be attached with an instruction. Here metadata !21 is attached with add instruction using !dbg identifier.

    -
    -      %indvar.next = add i64 %indvar, 1, !dbg !21
    -    
    +
    +
    +%indvar.next = add i64 %indvar, 1, !dbg !21
    +
    +
    + +
    - + - +

    LLVM has a number of "magic" global variables that contain data that affect code generation or other IR semantics. These are documented here. All globals of this sort should have a section specified as "llvm.metadata". This @@ -2716,11 +2797,11 @@ section and all globals that start with "llvm." are reserved for use by LLVM.

    - + -
    +

    The @llvm.used global is an array with i8* element type which has appending linkage. This array contains a list of @@ -2751,11 +2832,13 @@ object file to prevent the assembler and linker from molesting the symbol.

    - +

    + + The 'llvm.compiler.used' Global Variable + +

    -
    +

    The @llvm.compiler.used directive is the same as the @llvm.used directive, except that it only prevents the compiler from @@ -2769,11 +2852,11 @@ should not be exposed to source languages.

    - + -
    +
     %0 = type { i32, void ()* }
     @llvm.global_ctors = appending global [1 x %0] [%0 { i32 65535, void ()* @ctor }]
    @@ -2784,11 +2867,11 @@ should not be exposed to source languages.

    - + -
    +
     %0 = type { i32, void ()* }
     @llvm.global_dtors = appending global [1 x %0] [%0 { i32 65535, void ()* @dtor }]
    @@ -2799,12 +2882,13 @@ should not be exposed to source languages.

    +
    - +

    Instruction Reference

    -
    +

    The LLVM instruction set consists of several different classifications of instructions: terminator @@ -2813,13 +2897,12 @@ should not be exposed to source languages.

    memory instructions, and other instructions.

    -
    - - +

    + Terminator Instructions +

    -
    +

    As mentioned previously, every basic block in a program ends with a "Terminator" instruction, which indicates which @@ -2837,13 +2920,12 @@ Instructions

    'unwind' instruction, and the 'unreachable' instruction.

    -
    - - +

    + 'ret' Instruction +

    -
    +
    Syntax:
    @@ -2889,9 +2971,11 @@ Instruction 
    - +

    + 'br' Instruction +

    -
    +
    Syntax:
    @@ -2930,11 +3014,11 @@ IfUnequal:
     
    - + -
    +
    Syntax:
    @@ -2985,11 +3069,11 @@ IfUnequal:
     
     
     
    -
    +
     
    -
    +
    Syntax:
    @@ -3033,11 +3117,11 @@ IfUnequal:
     
     
     
    -
    +
     
    -
    +
    Syntax:
    @@ -3123,10 +3207,11 @@ that the invoke/unwind semantics are likely to change in future versions.

    - +

    + 'unwind' Instruction +

    -
    +
    Syntax:
    @@ -3154,10 +3239,11 @@ that the invoke/unwind semantics are likely to change in future versions.

    - +

    + 'unreachable' Instruction +

    -
    +
    Syntax:
    @@ -3175,10 +3261,14 @@ Instruction 
    +
    + - +

    + Binary Operations +

    -
    +

    Binary operators are used to do most of the computation in a program. They require two operands of the same type, execute an operation on them, and @@ -3188,14 +3278,12 @@ Instruction

    There are several different binary operators:

    -
    - - + -
    +
    Syntax:
    @@ -3236,11 +3324,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3266,11 +3354,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3318,11 +3406,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3354,11 +3442,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3404,11 +3492,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3434,10 +3522,11 @@ Instruction 
    - +

    + 'udiv' Instruction +

    -
    +
    Syntax:
    @@ -3474,10 +3563,11 @@ Instruction 
    - +

    + 'sdiv' Instruction +

    -
    +
    Syntax:
    @@ -3516,10 +3606,11 @@ Instruction 
    - +

    + 'fdiv' Instruction +

    -
    +
    Syntax:
    @@ -3545,10 +3636,11 @@ Instruction 
    - +

    + 'urem' Instruction +

    -
    +
    Syntax:
    @@ -3582,11 +3674,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -3606,9 +3698,10 @@ Instruction 
    Semantics:

    This instruction returns the remainder of a division (where the result - has the same sign as the dividend, op1), not the modulo - operator (where the result has the same sign as the divisor, op2) of - a value. For more information about the difference, + is either zero or has the same sign as the dividend, op1), not the + modulo operator (where the result is either zero or has the same sign + as the divisor, op2) of a value. + For more information about the difference, see The Math Forum. For a table of how this is implemented in various languages, please see @@ -3632,10 +3725,11 @@ Instruction

    - +

    + 'frem' Instruction +

    -
    +
    Syntax:
    @@ -3662,11 +3756,14 @@ Instruction 
    +
    + - +

    + Bitwise Binary Operations +

    -
    +

    Bitwise binary operators are used to do various forms of bit-twiddling in a program. They are generally very efficient instructions and can commonly be @@ -3674,13 +3771,12 @@ Operations

    same type, execute an operation on them, and produce a single value. The resulting value is the same type as its operands.

    -
    - - +

    + 'shl' Instruction +

    -
    +
    Syntax:
    @@ -3727,10 +3823,11 @@ Instruction 
    - +

    + 'lshr' Instruction +

    -
    +
    Syntax:
    @@ -3773,9 +3870,11 @@ Instruction 
    - -
    +

    + 'ashr' Instruction +

    + +
    Syntax:
    @@ -3818,10 +3917,11 @@ Instruction 
    - +

    + 'and' Instruction +

    -
    +
    Syntax:
    @@ -3878,9 +3978,11 @@ Instruction 
    - +

    + 'or' Instruction +

    -
    +
    Syntax:
    @@ -3939,10 +4041,11 @@ Instruction 
    - +

    + 'xor' Instruction +

    -
    +
    Syntax:
    @@ -4002,12 +4105,14 @@ Instruction 
    +
    + - + -
    +

    LLVM supports several instructions to represent vector operations in a target-independent manner. These instructions cover the element-access and @@ -4016,14 +4121,12 @@ Instruction

    will want to use target-specific intrinsics to take full advantage of a specific target.

    -
    - - + -
    +
    Syntax:
    @@ -4055,11 +4158,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -4091,11 +4194,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -4138,24 +4241,24 @@ Instruction 
    +
    + - + -
    +

    LLVM supports several instructions for working with aggregate values.

    -
    - - + -
    +
    Syntax:
    @@ -4193,15 +4296,15 @@ Instruction 
    - + -
    +
    Syntax:
    -  <result> = insertvalue <aggregate type> <val>, <ty> <elt>, <idx>    ; yields <aggregate type>
    +  <result> = insertvalue <aggregate type> <val>, <ty> <elt>, <idx>{, }*    ; yields <aggregate type>
     
    Overview:
    @@ -4225,33 +4328,33 @@ Instruction
    Example:
    -  %agg1 = insertvalue {i32, float} undef, i32 1, 0         ; yields {i32 1, float undef}
    -  %agg2 = insertvalue {i32, float} %agg1, float %val, 1    ; yields {i32 1, float %val}
    +  %agg1 = insertvalue {i32, float} undef, i32 1, 0              ; yields {i32 1, float undef}
    +  %agg2 = insertvalue {i32, float} %agg1, float %val, 1         ; yields {i32 1, float %val}
    +  %agg3 = insertvalue {i32, {float}} %agg1, float %val, 1, 0    ; yields {i32 1, float %val}
     
    +
    - + -
    +

    A key design point of an SSA-based representation is how it represents memory. In LLVM, no memory locations are in SSA form, which makes things very simple. This section describes how to read, write, and allocate memory in LLVM.

    -
    - - + -
    +
    Syntax:
    @@ -4298,10 +4401,11 @@ Instruction 
    - +

    + 'load' Instruction +

    -
    +
    Syntax:
    @@ -4356,10 +4460,11 @@ Instruction 
    - +

    + 'store' Instruction +

    -
    +
    Syntax:
    @@ -4417,11 +4522,11 @@ Instruction 
    - + -
    +
    Syntax:
    @@ -4547,23 +4652,25 @@ entry:
     
     
    - - -
    + +

    + Conversion Operations +

    + +

    The instructions in this category are the conversion instructions (casting) which all take a single operand and a type. They perform various bit conversions on the operand.

    -
    - - -
    + + +
    Syntax:
    @@ -4575,12 +4682,12 @@ entry:
        type ty2.

    Arguments:
    -

    The 'trunc' instruction takes a value to trunc, which must - be an integer type, and a type that specifies the - size and type of the result, which must be - an integer type. The bit size of value must - be larger than the bit size of ty2. Equal sized types are not - allowed.

    +

    The 'trunc' instruction takes a value to trunc, and a type to trunc it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be larger than + the bit size of the destination type, ty2. + Equal sized types are not allowed.

    Semantics:

    The 'trunc' instruction truncates the high order bits @@ -4590,18 +4697,20 @@ entry:

    Example:
    -  %X = trunc i32 257 to i8              ; yields i8:1
    -  %Y = trunc i32 123 to i1              ; yields i1:true
    -  %Z = trunc i32 122 to i1              ; yields i1:false
    +  %X = trunc i32 257 to i8                        ; yields i8:1
    +  %Y = trunc i32 123 to i1                        ; yields i1:true
    +  %Z = trunc i32 122 to i1                        ; yields i1:false
    +  %W = trunc <2 x i16> <i16 8, i16 7> to <2 x i8> ; yields <i8 8, i8 7>
     
    - -
    + + +
    Syntax:
    @@ -4614,10 +4723,11 @@ entry:
     
     
     
    Arguments:
    -

    The 'zext' instruction takes a value to cast, which must be of - integer type, and a type to cast it to, which must - also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, +

    The 'zext' instruction takes a value to cast, and a type to cast it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be smaller than + the bit size of the destination type, ty2.

    Semantics:
    @@ -4630,15 +4740,17 @@ entry:
       %X = zext i32 257 to i64              ; yields i64:257
       %Y = zext i1 true to i32              ; yields i32:1
    +  %Z = zext <2 x i16> <i16 8, i16 7> to <2 x i32> ; yields <i32 8, i32 7>
     
    - -
    + + +
    Syntax:
    @@ -4649,10 +4761,11 @@ entry:
     

    The 'sext' sign extends value to the type ty2.

    Arguments:
    -

    The 'sext' instruction takes a value to cast, which must be of - integer type, and a type to cast it to, which must - also be of integer type. The bit size of the - value must be smaller than the bit size of the destination type, +

    The 'sext' instruction takes a value to cast, and a type to cast it to. + Both types must be of integer types, or vectors + of the same number of integers. + The bit size of the value must be smaller than + the bit size of the destination type, ty2.

    Semantics:
    @@ -4666,16 +4779,17 @@ entry:
       %X = sext i8  -1 to i16              ; yields i16   :65535
       %Y = sext i1 true to i32             ; yields i32:-1
    +  %Z = sext <2 x i16> <i16 8, i16 7> to <2 x i32> ; yields <i32 8, i32 7>
     
    - + -
    +
    Syntax:
    @@ -4709,10 +4823,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4738,17 +4853,18 @@ entry:
     
     
    Example:
    -  %X = fpext float 3.1415 to double        ; yields double:3.1415
    -  %Y = fpext float 1.0 to float            ; yields float:1.0 (no-op)
    +  %X = fpext float 3.125 to double         ; yields double:3.125000e+00
    +  %Y = fpext double %X to fp128            ; yields fp128:0xL00000000000000004000900000000000
     
    - -
    + + +
    Syntax:
    @@ -4782,10 +4898,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4820,10 +4937,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4856,10 +4974,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4891,10 +5010,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4928,10 +5048,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -4965,10 +5086,11 @@ entry:
     
    - -
    + + +
    Syntax:
    @@ -5007,21 +5129,24 @@ entry:
     
     
    +
    + - +

    + Other Operations +

    -
    +

    The instructions in this category are the "miscellaneous" instructions, which defy better classification.

    -
    - - +

    + 'icmp' Instruction +

    -
    +
    Syntax:
    @@ -5120,10 +5245,11 @@ entry:
     
    - +

    + 'fcmp' Instruction +

    -
    +
    Syntax:
    @@ -5240,11 +5366,11 @@ entry:
     
    - + -
    +
    Syntax:
    @@ -5288,11 +5414,11 @@ Loop:       ; Infinite loop that counts from 0 on up...
     
    - + -
    +
    Syntax:
    @@ -5331,11 +5457,11 @@ Loop:       ; Infinite loop that counts from 0 on up...
     
    - + -
    +
    Syntax:
    @@ -5440,11 +5566,11 @@ freestanding environments and non-C-based languages.

    - + -
    +
    Syntax:
    @@ -5485,11 +5611,15 @@ freestanding environments and non-C-based languages.

    +
    + +
    + - +

    Intrinsic Functions

    -
    +

    LLVM supports the notion of an "intrinsic function". These functions have well known names and semantics and are required to follow certain @@ -5532,14 +5662,12 @@ freestanding environments and non-C-based languages.

    To learn how to add an intrinsic function, please see the Extending LLVM Guide.

    -
    - - + -
    +

    Variable argument support is defined in LLVM with the va_arg instruction and these three @@ -5581,15 +5709,13 @@ declare void @llvm.va_copy(i8*, i8*) declare void @llvm.va_end(i8*) -

    - - + -
    +
    Syntax:
    @@ -5615,11 +5741,11 @@ declare void @llvm.va_end(i8*)
     
    - + -
    +
    Syntax:
    @@ -5646,11 +5772,11 @@ declare void @llvm.va_end(i8*)
     
    - + -
    +
    Syntax:
    @@ -5676,12 +5802,14 @@ declare void @llvm.va_end(i8*)
     
     
    +
    + - + -
    +

    LLVM support for Accurate Garbage Collection (GC) requires the implementation and generation of these @@ -5696,14 +5824,12 @@ LLVM.

    The garbage collection intrinsics only operate on objects in the generic address space (address space zero).

    -
    - - + -
    +
    Syntax:
    @@ -5730,11 +5856,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5762,11 +5888,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5793,24 +5919,24 @@ LLVM.

    +
    + - + -
    +

    These intrinsics are provided by LLVM to expose special features that may only be implemented with code generator support.

    -
    - - + -
    +
    Syntax:
    @@ -5841,11 +5967,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5875,11 +6001,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5905,11 +6031,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5930,11 +6056,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5963,11 +6089,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -5994,11 +6120,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -6020,26 +6146,26 @@ LLVM.

    +
    + - + -
    +

    LLVM provides intrinsics for a few important standard C library functions. These intrinsics allow source-language front-ends to pass information about the alignment of the pointer arguments to the code generator, providing opportunity for more efficient code generation.

    -
    - - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.memcpy on any @@ -6089,11 +6215,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.memmove on any integer bit @@ -6145,11 +6271,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.memset on any integer bit @@ -6195,11 +6321,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sqrt on any @@ -6233,11 +6359,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.powi on any @@ -6269,11 +6395,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sin on any @@ -6303,11 +6429,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.cos on any @@ -6337,11 +6463,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.pow on any @@ -6371,24 +6497,90 @@ LLVM.

    +
    + + +

    + 'llvm.exp.*' Intrinsic +

    + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.exp on any + floating point or vector of floating point type. Not all targets support all + types however.

    + +
    +  declare float     @llvm.exp.f32(float  %Val)
    +  declare double    @llvm.exp.f64(double %Val)
    +  declare x86_fp80  @llvm.exp.f80(x86_fp80  %Val)
    +  declare fp128     @llvm.exp.f128(fp128 %Val)
    +  declare ppc_fp128 @llvm.exp.ppcf128(ppc_fp128  %Val)
    +
    + +
    Overview:
    +

    The 'llvm.exp.*' intrinsics perform the exp function.

    + +
    Arguments:
    +

    The argument and return value are floating point numbers of the same + type.

    + +
    Semantics:
    +

    This function returns the same values as the libm exp functions + would, and handles error conditions in the same way.

    + +
    + + +

    + 'llvm.log.*' Intrinsic +

    + +
    + +
    Syntax:
    +

    This is an overloaded intrinsic. You can use llvm.log on any + floating point or vector of floating point type. Not all targets support all + types however.

    + +
    +  declare float     @llvm.log.f32(float  %Val)
    +  declare double    @llvm.log.f64(double %Val)
    +  declare x86_fp80  @llvm.log.f80(x86_fp80  %Val)
    +  declare fp128     @llvm.log.f128(fp128 %Val)
    +  declare ppc_fp128 @llvm.log.ppcf128(ppc_fp128  %Val)
    +
    + +
    Overview:
    +

    The 'llvm.log.*' intrinsics perform the log function.

    + +
    Arguments:
    +

    The argument and return value are floating point numbers of the same + type.

    + +
    Semantics:
    +

    This function returns the same values as the libm log functions + would, and handles error conditions in the same way.

    + +
    + - + -
    +

    LLVM provides intrinsics for a few important bit manipulation operations. These allow efficient code generation for some algorithms.

    -
    - - + -
    +
    Syntax:

    This is an overloaded intrinsic function. You can use bswap on any integer @@ -6419,11 +6611,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ctpop on any integer bit @@ -6451,11 +6643,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ctlz on any @@ -6485,11 +6677,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.cttz on any @@ -6518,23 +6710,25 @@ LLVM.

    +
    + - + -
    +

    LLVM provides intrinsics for some arithmetic with overflow operations.

    -
    - - +

    + + 'llvm.sadd.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.sadd.with.overflow @@ -6576,11 +6770,13 @@ LLVM.

    - +

    + + 'llvm.uadd.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.uadd.with.overflow @@ -6621,11 +6817,13 @@ LLVM.

    - +

    + + 'llvm.ssub.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.ssub.with.overflow @@ -6667,11 +6865,13 @@ LLVM.

    - +

    + + 'llvm.usub.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.usub.with.overflow @@ -6713,11 +6913,13 @@ LLVM.

    - +

    + + 'llvm.smul.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.smul.with.overflow @@ -6760,11 +6962,13 @@ LLVM.

    - +

    + + 'llvm.umul.with.overflow.*' Intrinsics + +

    -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.umul.with.overflow @@ -6805,12 +7009,14 @@ LLVM.

    +
    + - + -
    +

    Half precision floating point is a storage-only format. This means that it is a dense encoding (in memory) but does not support computation in the @@ -6824,14 +7030,15 @@ LLVM.

    float if needed, then converted to i16 with llvm.convert.to.fp16, then storing as an i16 value.

    -
    - +

    + + 'llvm.convert.to.fp16' Intrinsic + +

    -
    +
    Syntax:
    @@ -6862,11 +7069,13 @@ LLVM.

    - +

    + + 'llvm.convert.from.fp16' Intrinsic + +

    -
    +
    Syntax:
    @@ -6896,12 +7105,14 @@ LLVM.

    +
    + - + -
    +

    The LLVM debugger intrinsics (which all start with llvm.dbg. prefix), are described in @@ -6911,11 +7122,11 @@ LLVM.

    - + -
    +

    The LLVM exception handling intrinsics (which all start with llvm.eh. prefix), are described in @@ -6925,11 +7136,11 @@ LLVM.

    - + -
    +

    This intrinsic makes it possible to excise one parameter, marked with the nest attribute, from a function. @@ -6955,14 +7166,14 @@ LLVM.

    The call %val = call i32 %fp(i32 %x, i32 %y) is then equivalent to %val = call i32 %f(i8* %nval, i32 %x, i32 %y).

    -
    - - +

    + + 'llvm.init.trampoline' Intrinsic + +

    -
    +
    Syntax:
    @@ -6999,12 +7210,14 @@ LLVM.

    +
    + - + -
    +

    These intrinsic functions expand the "universal IR" of LLVM to represent hardware constructs for atomic operations and memory synchronization. This @@ -7024,13 +7237,12 @@ LLVM.

    No one model or paradigm should be selected above others unless the hardware itself ubiquitously does so.

    -
    - - -
    + + +
    Syntax:
       declare void @llvm.memory.barrier(i1 <ll>, i1 <ls>, i1 <sl>, i1 <ss>, i1 <device>)
    @@ -7098,11 +7310,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.cmp.swap on @@ -7158,10 +7370,11 @@ LLVM.

    - -
    + + +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.swap on any @@ -7214,12 +7427,11 @@ LLVM.

    - - -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.load.add on @@ -7264,12 +7476,11 @@ LLVM.

    - - -
    +
    Syntax:

    This is an overloaded intrinsic. You can use llvm.atomic.load.sub on @@ -7316,14 +7527,25 @@ LLVM.

    - - -
    +

    + + 'llvm.atomic.load.and.*' Intrinsic + +
    + + 'llvm.atomic.load.nand.*' Intrinsic + +
    + + 'llvm.atomic.load.or.*' Intrinsic + +
    + + 'llvm.atomic.load.xor.*' Intrinsic + +

    + +
    Syntax:

    These are overloaded intrinsics. You can @@ -7396,14 +7618,25 @@ LLVM.

    - - -
    +

    + + 'llvm.atomic.load.max.*' Intrinsic + +
    + + 'llvm.atomic.load.min.*' Intrinsic + +
    + + 'llvm.atomic.load.umax.*' Intrinsic + +
    + + 'llvm.atomic.load.umin.*' Intrinsic + +

    + +
    Syntax:

    These are overloaded intrinsics. You can use llvm.atomic.load_max, @@ -7474,25 +7707,24 @@ LLVM.

    +
    - + -
    +

    This class of intrinsics exists to information about the lifetime of memory objects and ranges where variables are immutable.

    -
    - - + -
    +
    Syntax:
    @@ -7518,11 +7750,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7547,11 +7779,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7575,11 +7807,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7601,24 +7833,24 @@ LLVM.

    +
    + - + -
    +

    This class of intrinsics is designed to be generic and has no specific purpose.

    -
    - - + -
    +
    Syntax:
    @@ -7642,11 +7874,11 @@ LLVM.

    - + -
    +
    Syntax:

    This is an overloaded intrinsic. You can use 'llvm.annotation' on @@ -7678,11 +7910,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7703,11 +7935,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7737,11 +7969,11 @@ LLVM.

    - + -
    +
    Syntax:
    @@ -7771,6 +8003,10 @@ LLVM.

    +
    + +
    +
    @@ -7780,7 +8016,7 @@ LLVM.

    src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> Chris Lattner
    - The LLVM Compiler Infrastructure
    + The LLVM Compiler Infrastructure
    Last modified: $Date$