LLVM 3.
4 Reference Card
Terminator instructions
ret <ty> <value>
ret void
Return control flow from a function back to the
caller.
br i1 <cond>, label <iftrue>, label <iffalse>
br label <dest>
Transfer control to a basic block in the current
function.
switch <intty> <value>, label <defaultdest>
[ <intty> <val>, label <dest> ... ]
Transfer control depending on the value of an
input operand.
indirectbr <ty>* <address>, [ label <dest1>,
label <dest2>, ... ]
Indirect branch to a label within the current
function with the given address.
Arithmetic instructions
<result> = add [nuw] [nsw] <ty> <op1>, <op2>
<ty>
Integer addition.
<result> = fadd [<flags>] <ty> <op1>, <op2>
<ty>
Floating-point addition.
<result> = sub [nuw] [nsw] <ty> <op1>, <op2>
<ty>
Integer subtraction.
<result> = fsub [<flags>] <ty> <op1>, <op2>
<ty>
Floating-point subtraction.
<result> = mul [nuw] [nsw] <ty> <op1>, <op2>
<ty>
Integer multiplication.
<result> = fmul [<flags>] <ty> <op1>, <op2>
<ty>
Floating-point multiplication.
<result> = udiv [exact] <ty> <op1>, <op2>
<ty>
Unsigned integer division.
<result> = sdiv [exact] <ty> <op1>, <op2>
<ty>
Signed integer division.
<result> = fdiv [<flags>] <ty> <op1>, <op2>
<ty>
Floating-point division.
<result> = urem <ty> <op1>, <op2>
<ty>
Unsigned integer remainder.
<result> = srem <ty> <op1>, <op2>
<ty>
Signed integer remainder.
<result> = frem [<flags>]* <ty> <op1>, <op2>
<ty>
Floating-point remainder.
<result> = shl [nuw] [nsw] <ty> <op1>, <op2>
<ty>
Shift left.
<result> = lshr [exact] <ty> <op1>, <op2>
<ty>
Logical shift right (zero fill).
<result> = ashr [exact] <ty> <op1>, <op2>
<ty>
Arithmetic shift right (sign extend).
<result> = and <ty> <op1>, <op2>
<ty>
Bitwise AND operation.
<result> = or <ty> <op1>, <op2>
<ty>
Bitwise OR operation.
<result> = xor <ty> <op1>, <op2>
<ty>
Bitwise XOR operation.
Bitwise arithmetic
Vector operations
<result> = extractelement <n x <ty>> <val>,
i32 <idx>
<ty>
Extract a scalar element from a vector at
the given index.
<result> = insertelement <n x <ty>> <val>,
<ty> <elt>, i32 <idx>
n x <ty>
Insert a scalar element into a vector at the
given index.
<result> = shufflevector <n x <ty>> <v1>,
<n x <ty>> <v2>, <m x i32> <mask>
m x <ty>
Construct a permutation of elements from
two input vectors.
Aggregate operations
<result> = extractvalue <aggregate type> <val>,
<idx>[, <idx> ...]
<any> Extract the value of a member field from an
<result> = insertvalue <aggregate type> <val>,
<ty> <elt>, <idx>[, <idx> ...]
<aggr Insert a value into a member field in an
ty> aggregate value.
aggregate value.
Memory access and addressing
<result> = alloca <ty>[, <intty> <NumElements>]
[, align <alignment>]
<ty>*
Allocate memory on the stack frame of the
current function.
<result> = load [volatile] <ty>* <pointer>
[, align <alignment>]
<ty>
Read from memory.
store [volatile] <ty> <value>, <ty>* <pointer>
[, align <alignment>]
Write to memory.
fence [singlethread] <ordering>
Introduce synchronization edge.
cmpxchg [volatile] <ty>* <pointer>, <ty> <cmp>,
<ty> <new> [singlethread] <ordering>
<ty>
Atomic compare-and-exchange.
atomicrmw [volatile] <operation> <ty>* <pointer>,
<ty> <value> [singlethread] <ordering>
<ty>
Atomic read-modify-write.
<result> = getelementptr <pty>* <ptrval>
[, <intty> <idx>][, <intty> <idx> ]
<any>* Calculate a memory address of a sub-
element of an aggregate data structure.
Conversion operations
<result> = trunc <ty> <value> to <ty2>
<ty2>
Truncate integer value.
<result> = zext <ty> <value> to <ty2>
<ty2>
Zero-extend integer value.
<result> = sext <ty> <value> to <ty2>
<ty2>
Sign-extend integer value.
<result> = fptrunc <ty> <value> to <ty2>
<ty2>
Truncate floating-point value.
<result> = fpext <ty> <value> to <ty2>
<ty2>
Extend floating-point value.
<result> = fptoui <ty> <value> to <ty2>
<ty2>
Convert floating-point to unsigned integer.
<result> = fptosi <ty> <value> to <ty2>
<ty2>
Convert floating-point to signed integer.
<result> = uitofp <ty> <value> to <ty2>
<ty2>
Convert unsigned integer to floating-point.
<result> = sitofp <ty> <value> to <ty2>
<ty2>
Convert signed integer to floating-point.
<result> = ptrtoint <ty> <value> to <ty2>
<ty2>
Convert pointer to integer.
<result> = inttoptr <ty> <value> to <ty2>
<ty2>
Convert integer to pointer.
<result> = bitcast <ty> <value> to <ty2>
<ty2>
Convert without changing bits.
<result> = addrspacecast <pty> <ptrval> to <pty2>
<pty2> Convert to pointer in another address space.
Miscellaneous
<result> = icmp {eq|ne|ugt|uge|ult|ule|sgt|sge|slt|sle}
<ty> <op1>, <op2>
i1
Compare integer values.
<result> = fcmp {false|oeq|ogt|oge|olt|ole|one|ord|ueq|
ugt|uge|ult|ule|une|uno|true} <ty> <op1>, <op2>
i1
Compare floating-point values.
<result> = phi <ty> [ <val0>, <label0> ...]
<ty> Phi node in an SSA graph.
<result> = select i1 <cond>, <ty> <val1>
[, <ty> <val2> ...]
<ty> Choose one value based on a
<result> = [tail] call [cconv] [ret attrs]
<ty> [<fnty>*] <name>(<args>) [fn attrs]
<ty> Function call.
condition without branching.