Lines Matching +full:depth +full:- +full:wise
7 :depth: 3
14 type safety, low-level operations, flexibility, and the capability of
15 representing 'all' high-level languages cleanly. It is the common code
23 forms: as an in-memory compiler IR, as an on-disk bitcode representation
24 (suitable for fast loading by a Just-In-Time compiler), and as a human
32 The LLVM representation aims to be light-weight and low-level while
35 high-level ideas may be cleanly mapped to it (similar to how
45 Well-Formedness
46 ---------------
53 .. code-block:: llvm
70 -----------
81 '``[%@][-a-zA-Z$._][-a-zA-Z$._0-9]*``'. Identifiers that require other
110 .. code-block:: llvm
116 .. code-block:: llvm
122 .. code-block:: llvm
136 per-function incrementing counter, starting with 0). However, when explicitly
150 ----------------
161 * ``\`` followed by two hexadecimal characters (0-9, a-f, or A-F)
179 ----------------
188 .. code-block:: llvm
221 -------------
299 called, one of the definitions is non-deterministically chosen to run. For
304 These linkage types are otherwise the same as their non-``odr`` versions.
316 -------------------
325 "``ccc``" - The C calling convention
331 "``fastcc``" - The fast calling convention
338 used. <CodeGenerator.html#tail-call-optimization>`_ This calling
341 "``coldcc``" - The cold calling convention
350 "``ghccc``" - GHC convention
361 - On *X86-32* only up to 4 bit type parameters are supported. No
362 floating-point types are supported.
363 - On *X86-64* only up to 10 bit type parameters and 6
364 floating-point parameters are supported.
365 - On *AArch64* only up to 4 32-bit floating-point parameters,
366 4 64-bit floating-point parameters, and 10 bit type parameters
368 - *RISCV64* only supports up to 11 bit type parameters, 4
369 32-bit floating-point parameters, and 4 64-bit floating-point
373 optimization <CodeGenerator.html#tail-call-optimization>`_ but requires
375 "``cc 11``" - The HiPE calling convention
377 the `High-Performance Erlang
382 convention and defines no callee-saved registers. The calling
384 optimization <CodeGenerator.html#tail-call-optimization>`_ but requires
390 "``anyregcc``" - Dynamic calling convention for code patching
397 "``preserve_mostcc``" - The `PreserveMost` calling convention
401 uses a different set of caller/callee-saved registers. This alleviates the
403 call in the caller. If the arguments are passed in callee-saved registers,
405 apply for values returned in callee-saved registers.
407 - On X86-64 the callee preserves all general purpose registers, except for
409 The treatment of floating-point registers (XMMs/YMMs) matches the OS's C
411 be saved by the caller, but on Windows, xmm6-xmm15 are preserved.
413 - On AArch64 the callee preserve all general purpose registers, except X0-X8
414 and X16-X18.
419 another function and therefore only needs to preserve the caller-saved
422 convention in terms of caller/callee-saved registers, but they are used for
433 supports X86-64, but the intention is to support more architectures in the
435 "``preserve_allcc``" - The `PreserveAll` calling convention
440 caller/callee-saved registers. This removes the burden of saving and
442 the arguments are passed in callee-saved registers, then they will be
444 returned in callee-saved registers.
446 - On X86-64 the callee preserves all general purpose registers, except for
448 all floating-point registers (XMMs/YMMs).
450 - On AArch64 the callee preserve all general purpose registers, except X0-X8
451 and X16-X18. Furthermore it also preserves lower 128 bits of V8-V31 SIMD -
460 "``preserve_nonecc``" - The `PreserveNone` calling convention
463 registers to pass arguments. This attribute doesn't impact non-general
465 Non-general purpose registers still follow the standard c calling
467 "``cxx_fast_tlscc``" - The `CXX_FAST_TLS` calling convention for access functions
468 Clang generates an access function to access C++-style TLS. The access
471 a few TLS IR variables, each access will be lowered to a platform-specific
480 caller/callee-saved registers.
485 - On X86-64 the callee preserves all general purpose registers, except for
487 "``tailcc``" - Tail callable calling convention
492 the GHC or the HiPE convention is used. <CodeGenerator.html#tail-call-optimization>`_
495 "``swiftcc``" - This calling convention is used for Swift language.
496 - On X86-64 RCX and R8 are available for additional integer returns, and
498 - On iOS platforms, we use AAPCS-VFP calling convention.
503 "``cfguard_checkcc``" - Windows Control Flow Guard (Check mechanism)
507 but it will trigger an OS-level error if the address is not a valid target.
509 containing the target address are architecture-specific.
511 - On X86 the target address is passed in ECX.
512 - On ARM the target address is passed in R0.
513 - On AArch64 the target address is passed in X15.
514 "``cc <n>``" - Numbered convention
516 target-specific calling conventions to be used. Target specific
519 More calling conventions can be added/defined on an as-needed basis, to
520 support Pascal conventions or any other well-known target-independent
526 -----------------
531 "``default``" - Default style
541 "``hidden``" - Hidden style
547 "``protected``" - Protected style
559 -------------------
586 ---------------------------
590 variable). Not all targets support thread-local variables. Optionally, a
603 Thread-Local Storage <http://people.redhat.com/drepper/tls.pdf>`_ for
611 For platforms without linker support of ELF TLS model, the -femulated-tls
617 -----------------------------
635 ---------------
644 .. code-block:: llvm
653 Non-Integral Pointer Type
654 -------------------------
656 Note: non-integral pointer types are a work in progress, and they should be
660 spaces as "non-integral" via the :ref:`datalayout string<langref_datalayout>`.
661 Non-integral pointer types represent pointers that have an *unspecified* bitwise
668 aware of. Because the bit-representation of a non-integral pointer may
671 non-integral type depends on environmental state in an implementation
680 non-integral types are analogous to ones on integral types with one
687 ``ptrtoint(v)-ptrtoint(v) == 0``, don't hold for non-integral types.
691 The alignment information provided by the frontend for a non-integral pointer
698 ----------------
701 instead of run-time.
717 optimization, allowing the global data to be placed in the read-only
745 A global variable may be declared to reside in a target-specific
782 to over-align the global if the global has an assigned section. In this
816 Globals with ``toc-data`` attribute set are stored in TOC of XCOFF. Their
837 .. code-block:: llvm
843 .. code-block:: llvm
850 .. code-block:: llvm
854 The following example defines a thread-local global with the
857 .. code-block:: llvm
864 ---------
959 -------
1012 -------
1018 Mach-O platforms, they are lowered in terms of ``.symbol_resolver`` functions,
1033 -------
1067 - XCOFF and Mach-O don't support COMDATs.
1068 - COFF supports all selection kinds. Non-``nodeduplicate`` selection kinds need
1069 a non-local linkage COMDAT symbol.
1070 - ELF supports ``any`` and ``nodeduplicate``.
1071 - WebAssembly only supports ``any``.
1076 .. code-block:: text
1094 .. code-block:: llvm
1103 The contents and size of this object may be used during link-time to determine
1112 .. code-block:: llvm
1127 in individual sections (e.g. when `-data-sections` or `-function-sections`
1133 --------------
1156 --------------------
1164 be placed both on function declarations/definitions, and at call-sites.
1170 .. code-block:: llvm
1176 define void @baz(i32 "amdgpu-flat-work-group-size"="1,256" %x)
1178 ; On call-sites:
1192 and call-site, otherwise the behavior may be undefined. ABI attributes cannot
1194 call-site and function: The intersection of their implied semantics applies.
1198 kind of extension used is target-specific. Some targets depend for
1205 value should be zero-extended to the extent required by the target's
1209 value should be sign-extended to the extent required by the target's
1210 ABI (which is usually 32-bits) by the caller (for a parameter) or
1220 in a special target-dependent fashion while emitting code for
1224 target-specific.
1237 The byval type argument indicates the in-memory value type, and
1244 makes a target-specific assumption.
1265 makes a target-specific assumption.
1293 makes a target-specific assumption.
1354 calls. It cannot be applied to non-intrinsic calls, and cannot be applied
1355 to parameters on function declarations. For non-opaque pointers, the type
1367 behavior is undefined. Note that ``align 1`` has no effect on non-byval,
1368 non-preallocated arguments.
1407 - ``address``: The integral address of the pointer.
1408 - ``address_is_null`` (subset of ``address``): Whether the address is null.
1409 - ``provenance``: The ability to access the pointer for both read and write
1411 - ``read_provenance`` (subset of ``provenance``): The ability to access the
1423 - ``captures(none)``: Pointer not captured.
1424 - ``captures(address, provenance)``: Equivalent to omitting the attribute.
1425 - ``captures(address)``: Address may be captured, but not provenance.
1426 - ``captures(address_is_null)``: Only captures whether the address is null.
1427 - ``captures(address, read_provenance)``: Both address and provenance
1428 captured, but only for read-only access.
1429 - ``captures(ret: address, provenance)``: Pointer captured through return
1431 - ``captures(address_is_null, ret: address, provenance)``: The whole pointer
1481 non-null and non-dereferenceable (up to ``<n>`` bytes) at the same
1482 time. All non-null pointers tagged with
1501 triggers the creation of a target-specific extended frame record to store
1508 pointer-sized alloca. At the call site, the actual argument that corresponds
1519 on a parameter is not ABI-compatible with one which does not.
1527 value. This must be a trivial immediate integer or floating-point
1539 must match between the call-site and the function definition.
1545 floating-point and vector of floating-point types, as well as
1547 (matching the supported types for :ref:`fast-math flags <fastmath>`).
1550 of floating-point values are not permitted for the value. For example
1553 If the value is a floating-point class indicated by the
1557 .. code-block:: text
1569 This does not depend on the floating-point environment. For
1572 marked with :ref:`\"denormal-fp-math\" <denormal_fp_math>`
1578 +-------+----------------------+---------------+
1579 | Name | floating-point class | Bitmask value |
1582 +-------+----------------------+---------------+
1583 | inf | +/- infinity | 516 |
1584 +-------+----------------------+---------------+
1585 | norm | +/- normal | 264 |
1586 +-------+----------------------+---------------+
1587 | sub | +/- subnormal | 144 |
1588 +-------+----------------------+---------------+
1589 | zero | +/- 0 | 96 |
1590 +-------+----------------------+---------------+
1592 +-------+----------------------+---------------+
1594 +-------+----------------------+---------------+
1596 +-------+----------------------+---------------+
1598 +-------+----------------------+---------------+
1600 +-------+----------------------+---------------+
1602 +-------+----------------------+---------------+
1604 +-------+----------------------+---------------+
1606 +-------+----------------------+---------------+
1608 +-------+----------------------+---------------+
1610 +-------+----------------------+---------------+
1612 +-------+----------------------+---------------+
1618 lowering. The enforcement of the specified alignment is target-dependent,
1619 as target-specific calling convention rules may override this value. This
1622 over-alignment specification through language attributes).
1628 than the requested alignment, but not less aligned. Invalid (e.g. non-power-of-2)
1634 that will be manipulated by the allocator. For a realloc-like
1636 same address may be returned), for a free-like function the
1671 (non-atomically) loaded and stored back on entry to the function.
1680 ``dereferenceable_or_null`` (if the pointer is non-null) and the
1692 means the first memory access is a non-volatile, non-atomic write. The
1706 overlapping or consecutive list elements. ``LoN/HiN`` are 64-bit integers,
1716 More precisely, the behavior is as-if any memory written through the
1729 - The type must match the scalar type of the parameter or return value.
1730 - The pair ``a,b`` represents the range ``[a,b)``.
1731 - Both ``a`` and ``b`` are constants.
1732 - The range is allowed to wrap.
1733 - The empty range is represented using ``0,0``.
1734 - Otherwise, ``a`` and ``b`` are not allowed to be equal.
1739 For vector-typed parameters, the range is applied element-wise.
1744 --------------------------------
1749 .. code-block:: llvm
1754 <builtin-gc-strategies>` and any provided by loaded plugins. Specifying a GC
1763 -----------
1768 language-specific runtime metadata with specific functions and make it
1774 index -1. This implies that the IR symbol points just past the end of
1778 .. code-block:: llvm
1784 .. code-block:: llvm
1786 %a = getelementptr inbounds i32, ptr @f, i32 -1
1804 -------------
1808 function hot-patching and instrumentation.
1822 .. code-block:: text
1830 .. code-block:: text
1843 --------------------
1851 ----------------
1859 An attribute group is a module-level object. To use an attribute group, an
1867 .. code-block:: llvm
1869 ; Target-independent attributes:
1872 ; Target-dependent attributes:
1873 attributes #1 = { "no-sse" }
1875 ; Function @f has attributes: alwaysinline, alignstack=4, and "no-sse".
1881 -------------------
1892 .. code-block:: llvm
1898 define void @f() "no-sse" { ... }
1905 ``"alloc-family"="FAMILY"``
1919 result is non-null the memory contents from the start of the block up to
1925 * "uninitialized": Any newly-allocated memory (either a new block from
1928 * "zeroed": Any newly-allocated memory (either a new block from a "alloc"
1936 are invalid for "free"-type functions.
1939 least a given number of bytes (or null). Its arguments are zero-indexed
1952 recognized as a built-in function, even though the function's declaration
1958 computing edge weights, basic blocks post-dominated by a cold
1970 is non-convergent.
1989 ``"dontcall-error"``
1995 ``"dontcall-warn"``
2003 be replaced with jumps to externally-defined architecture-specific symbols.
2005 ``"frame-pointer"``
2011 * ``"none"`` (default) - the frame pointer can be eliminated, and it's
2013 * ``"reserved"`` - the frame pointer register must either be updated to
2016 * ``"non-leaf"`` - the frame pointer should be kept if the function calls
2018 * ``"all"`` - the frame pointer should be kept.
2035 jump-instruction table at code-generation time, and that all address-taken
2037 appropriate jump-instruction-table function pointer. Note that this creates
2039 on function-pointer identity can break. So, any function annotated with
2042 This attribute specifies the possible memory effects of the call-site or
2048 - ``memory(none)``: Does not access any memory.
2049 - ``memory(read)``: May read (but not write) any memory.
2050 - ``memory(write)``: May write (but not read) any memory.
2051 - ``memory(readwrite)``: May read or write any memory.
2052 - ``memory(argmem: read)``: May only read argument memory.
2053 - ``memory(argmem: read, inaccessiblemem: write)``: May only read argument
2055 - ``memory(read, argmem: readwrite)``: May read any memory (default mode)
2057 - ``memory(readwrite, argmem: none)``: May access any memory apart from
2062 - ``readwrite``: Any kind of access to the location is allowed.
2063 - ``read``: The location is only read. Writing to the location is immediate
2066 - ``write``: Only writes to the location are observable outside the function
2070 - ``none``: No reads or writes to the location are observed outside the
2077 - ``argmem``: This refers to accesses that are based on pointer arguments
2079 - ``inaccessiblemem``: This refers to accesses to memory which is not
2080 accessible by the current module (before return from the function -- an
2084 - The default access kind (specified without a location prefix) applies to
2094 call-site annotation takes precedence over the potential effects described
2105 function. This can have very system-specific consequences. The arguments of
2107 ``"no-inline-line-tables"``
2114 ``no-jump-tables``
2119 a built-in function. LLVM will retain the original call and not replace it
2120 with equivalent code based on the semantics of the built-in function, unless
2149 transitively, call a memory-deallocation function (``free``, for example)
2165 Disallows implicit floating-point code. This inhibits optimizations that
2166 use floating-point code and floating-point registers for operations that are
2167 not nominally floating-point. LLVM instructions that perform floating-point
2168 operations or require access to floating-point registers may still cause
2169 floating-point code to be generated.
2203 red zone, even if the target-specific ABI normally permits it.
2204 ``indirect-tls-seg-refs``
2207 target-specific ABI normally permits it.
2229 (synchronize) with another thread through memory or other well-defined means.
2256 in address-space 0 is considered to be a valid address for memory loads and
2290 ``"patchable-function"``
2297 * ``"prologue-short-redirect"`` - This style of patchable
2303 fully changed via an atomic compare-and-swap instruction.
2305 enough NOP, LLVM can and will try to re-purpose an existing
2309 ``"prologue-short-redirect"`` is currently only supported on
2310 x86-64.
2313 inter-procedural optimizations. All of the semantic effects the
2315 ``"probe-stack"``
2322 If a function that has a ``"probe-stack"`` attribute is inlined into
2323 a function with another ``"probe-stack"`` attribute, the resulting
2324 function has the ``"probe-stack"`` attribute of the caller. If a
2325 function that has a ``"probe-stack"`` attribute is inlined into a
2326 function that has no ``"probe-stack"`` attribute at all, the resulting
2327 function has the ``"probe-stack"`` attribute of the callee.
2328 ``"stack-probe-size"``
2330 the ``"probe-stack"`` attribute, or ABI-required stack probes, if any.
2336 If a function that has a ``"stack-probe-size"`` attribute is inlined into
2337 a function with another ``"stack-probe-size"`` attribute, the resulting
2338 function has the ``"stack-probe-size"`` attribute that has the lower
2339 numeric value. If a function that has a ``"stack-probe-size"`` attribute is
2340 inlined into a function that has no ``"stack-probe-size"`` attribute
2341 at all, the resulting function has the ``"stack-probe-size"`` attribute
2343 ``"no-stack-arg-probe"``
2344 This attribute disables ABI-required stack probes, if any.
2378 (realtime safety analysis - no allocations, syscalls or exceptions) are enabled
2390 Speculative Load Hardening is a best-effort mitigation against
2392 miss-speculation - specifically miss-speculation of whether a branch
2395 mitigate against miss-speculation of branch target, classified as
2416 smashing protector. It is in the form of a "canary" --- a random value
2422 - Character arrays larger than ``ssp-buffer-size`` (default 8).
2423 - Aggregates containing character arrays larger than ``ssp-buffer-size``.
2424 - Calls to alloca() with variable sizes or constant sizes greater than
2425 ``ssp-buffer-size``.
2439 - Arrays of any size and type
2440 - Aggregates containing an array of any size and type.
2441 - Calls to alloca().
2442 - Local variables that have had their address taken.
2449 (``>= ssp-buffer-size``) are closest to the stack protector.
2451 (``< ssp-buffer-size``) are 2nd closest to the protector.
2471 (``>= ssp-buffer-size``) are closest to the stack protector.
2473 (``< ssp-buffer-size``) are 2nd closest to the protector.
2485 requires strict floating-point semantics. LLVM will not attempt any
2486 optimizations that require assumptions about the floating-point rounding
2487 mode or that might alter the state of floating-point status flags that
2489 not introduce any new floating-point instructions that may trap.
2493 ``"denormal-fp-math"``
2495 assumed for the default floating-point environment. This is a
2497 ``"preserve-sign"``, ``"positive-zero"``, or ``"dynamic"``. The
2506 If the output mode is ``"preserve-sign"``, or ``"positive-zero"``,
2507 denormal outputs may be flushed to zero by standard floating-point
2513 dynamic state of the floating-point environment. Transformations
2522 If the input mode is ``"preserve-sign"``, or ``"positive-zero"``,
2523 a floating-point operation must treat any input denormal value as
2528 ``"denormal-fp-math-f32"``
2529 Same as ``"denormal-fp-math"``, but only controls the behavior of
2530 the 32-bit float type (or vectors of 32-bit floats). If both are
2531 are present, this overrides ``"denormal-fp-math"``. Not all targets
2545 the ELF x86-64 abi, but it can be disabled for some compilation
2551 This attribute indicates that no control-flow check will be performed on
2552 the attributed entity. It disables -fcf-protection=<> for a specific
2560 currently x86_64-specific.
2572 terminating loops without side-effects can be removed. If a ``mustprogress``
2575 and that function never returns, the program is well-defined even if there
2578 ``"warn-stack-size"="<threshold>"``
2581 required integer value, which should be a non-negative integer, and less
2585 This function attribute indicates `vscale` is a power-of-two within a
2586 specified range. `min` must be a power-of-two that is greater than 0. When
2587 specified, `max` must be a power-of-two greater-than-or-equal to `min` or 0
2596 ----------------------
2601 ``vector-function-abi-variant``
2628 found at https://github.com/ARM-software/abi-aa and
2629 https://software.intel.com/content/www/us/en/develop/download/vector-simd-function-abi.html,
2634 ``<isa>`` token that can be used to create scalar-to-vector
2639 <isa>:= b | c | d | e -> X86 SSE, AVX, AVX2, AVX512
2640 | n | s -> Armv8 Advanced SIMD, SVE
2641 | __LLVM__ -> Internal LLVM Vector ISA
2646 <mask>:= M | N -> mask | no mask
2648 <vlen>:= number -> number of lanes
2649 | x -> VLA (Vector Length Agnostic)
2651 <parameters>:= v -> vector
2652 | l | l <number> -> linear
2653 | R | R <number> -> linear with ref modifier
2654 | L | L <number> -> linear with val modifier
2655 | U | U <number> -> linear with uval modifier
2656 | ls <pos> -> runtime linear
2657 | Rs <pos> -> runtime linear with ref modifier
2658 | Ls <pos> -> runtime linear with val modifier
2659 | Us <pos> -> runtime linear with uval modifier
2660 | u -> uniform
2675 -----------------
2686 `-fsanitize-ignorelist` file.
2692 `-fsanitize-ignorelist` file.
2700 `-fsanitize=memtag-globals` is provided, as long as the global is not marked
2703 `-fsanitize-ignorelist` file. The AArch64 Globals Tagging pass may remove
2715 ---------------
2736 runtime-introspection-like functionality for managed languages. While
2745 - The bundle operands for an unknown operand bundle escape in unknown
2747 - Calls and invokes with operand bundles have unknown read / write
2751 - An operand bundle at a call site cannot change the implementation
2752 of the called function. Inter-procedural optimizations work as
2788 .. code-block:: llvm
2804 .. code-block:: llvm
2831 `description in the EH doc\ <ExceptionHandling.html#wineh-constraints>`_),
2836 * has a ``"funclet"`` bundle whose operand is not the most-recently-entered
2837 not-yet-exited funclet EH pad.
2839 Similarly, if no funclet EH pads have been entered-but-not-yet-exited,
2846 ``"gc-transition"`` operand bundle tag. These operand bundles mark a
2894 .. code-block:: llvm
2901 .. code-block:: llvm
2914 .. code-block:: llvm
2921 * ``"align"`` operand bundles may specify a non-power-of-two alignment
2929 .. code-block:: llvm
2947 simplifies and improves heuristics, e.g., for use "use-sensitive"
2958 non-trivially copyable objects by value in a way that is compatible with MSVC
2965 .. code-block:: llvm
2981 A "gc-live" operand bundle is only valid on a :ref:`gc.statepoint <gc_statepoint>`
2986 :ref:`stackmap entry <statepoint-stackmap-format>`. See the intrinsic description
3001 .. code-block:: llvm
3018 `Pointer Authentication <PointerAuth.html#operand-bundle>`__ document.
3030 .. code-block:: llvm
3035 ``-fsanitize=kcfi``.
3048 Module-Level Inline Assembly
3049 ----------------------------
3051 Modules may contain "module-level inline asm" blocks, which corresponds
3056 .. code-block:: llvm
3061 The strings can contain any character by escaping non-printable
3071 -----------
3077 .. code-block:: llvm
3082 separated by the minus sign character ('-'). Each specification starts
3088 Specifies that the target lays out data in big-endian form. That is,
3092 Specifies that the target lays out data in little-endian form. That
3099 must be a multiple of 8-bits. If omitted, the natural stack
3144 This specifies the alignment for a floating-point type of a given bit
3170 * ``o``: Mach-O mangling: Private symbols get ``L`` prefix. Other
3182 bits. For example, it might contain ``n32`` for 32-bit PowerPC,
3183 ``n32:64`` for PowerPC 64, or ``n8:16:32:64`` for X86-64. Elements of
3188 as :ref:`Non-Integral Pointer Type <nointptrtype>` s. The ``0``
3189 address space cannot be specified as non-integral.
3200 - ``e`` - little endian
3201 - ``p:64:64:64`` - 64-bit pointers with 64-bit alignment.
3202 - ``p[n]:64:64:64`` - Other address spaces are assumed to be the
3204 - ``S0`` - natural stack alignment is unspecified
3205 - ``i1:8:8`` - i1 is 8-bit (byte) aligned
3206 - ``i8:8:8`` - i8 is 8-bit (byte) aligned as mandated
3207 - ``i16:16:16`` - i16 is 16-bit aligned
3208 - ``i32:32:32`` - i32 is 32-bit aligned
3209 - ``i64:32:64`` - i64 has ABI alignment of 32-bits but preferred
3210 alignment of 64-bits
3211 - ``f16:16:16`` - half is 16-bit aligned
3212 - ``f32:32:32`` - float is 32-bit aligned
3213 - ``f64:64:64`` - double is 64-bit aligned
3214 - ``f128:128:128`` - quad is 128-bit aligned
3215 - ``v64:64:64`` - 64-bit vector is 64-bit aligned
3216 - ``v128:128:128`` - 128-bit vector is 128-bit aligned
3217 - ``a:0:64`` - aggregates are 64-bit aligned
3238 mid-level optimizers to improve code, and this only works if it matches
3240 that does not embed this target-specific detail into the IR. If you
3249 -------------
3254 .. code-block:: llvm
3256 target triple = "x86_64-apple-macosx10.7.0"
3259 by the minus sign character ('-'). The canonical forms are:
3263 ARCHITECTURE-VENDOR-OPERATING_SYSTEM
3264 ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT
3268 command line with the ``-mtriple`` command line option.
3273 ----------------------
3300 ----------------------
3307 - A pointer value is associated with the addresses associated with any
3309 - An address of a global variable is associated with the address range
3311 - The result value of an allocation instruction is associated with the
3313 - A null pointer in the default address-space is associated with no
3315 - An :ref:`undef value <undefvalues>` in *any* address-space is
3317 - An integer constant other than zero or a pointer value returned from
3326 - A pointer value formed from a scalar ``getelementptr`` operation is *based* on
3327 the pointer-typed operand of the ``getelementptr``.
3328 - The pointer in lane *l* of the result of a vector ``getelementptr`` operation
3329 is *based* on the pointer in lane *l* of the vector-of-pointers-typed operand
3331 - The result value of a ``bitcast`` is *based* on the operand of the
3333 - A pointer value formed by an ``inttoptr`` is *based* on all pointer
3336 - The "*based* on" relationship is transitive.
3347 Consequently, type-based alias analysis, aka TBAA, aka
3348 ``-fstrict-aliasing``, is not applicable to general unadorned LLVM IR.
3350 which specialized optimization passes may use to implement type-based
3356 ---------------
3374 .. code-block:: llvm
3388 .. code-block:: llvm
3400 .. code-block:: llvm
3416 .. code-block:: llvm
3424 (e.g. using ``ptrtoint``) to be location-independent. The following example
3425 is *not* considered a return-only capture, even though the ``ptrtoint``
3428 .. code-block:: llvm
3450 .. code-block:: llvm
3478 .. code-block:: llvm
3492 .. code-block:: llvm
3511 ------------------------
3518 operations relative to non-volatile operations. This is not Java's
3519 "volatile" and has no cross-thread synchronization behavior.
3521 A volatile load or store may have additional target-specific semantics.
3526 not use a volatile operation to prove a non-volatile access to that
3529 The allowed side-effects for volatile accesses are limited. If a
3530 non-volatile store to a given address would be legal, a volatile
3550 IR-level volatile loads and stores cannot safely be optimized into llvm.memcpy
3552 Likewise, the backend should never split or merge target-legal volatile
3553 load/store instructions. Similarly, IR-level volatile loads and stores cannot
3554 change from integer to floating-point or vice versa.
3560 this holds for an l-value of volatile primitive type with native
3569 --------------------------------------
3573 platform-specific ways to create them, and we define LLVM IR's behavior
3578 We define a *happens-before* partial order as the least partial order
3581 - Is a superset of single-thread program order, and
3582 - When ``a`` *synchronizes-with* ``b``, includes an edge from ``a`` to
3583 ``b``. *Synchronizes-with* pairs are introduced by platform-specific
3588 Note that program order does not introduce *happens-before* edges
3592 loads/read-modify-writes, etc.) R reads a series of bytes written by
3594 stores/read-modify-writes, memcpy, etc.). For the purposes of this
3600 - If write\ :sub:`1` happens before write\ :sub:`2`, and
3603 - If R\ :sub:`byte` happens before write\ :sub:`3`, then
3608 - If R is volatile, the result is target-dependent. (Volatile is
3611 like normal memory. It does not generally provide cross-thread
3613 - Otherwise, if there is no write to the same byte that happens before
3615 - Otherwise, if R\ :sub:`byte` may see exactly one write,
3617 - Otherwise, if R is atomic, and all the writes R\ :sub:`byte` may
3621 - Otherwise R\ :sub:`byte` returns ``undef``.
3631 is required for single-threaded execution: introducing a store to a byte
3640 ----------------------------------
3657 The set of values that can be read is governed by the happens-before
3660 Java's non-volatile shared variables. This ordering cannot be
3661 specified for read-modify-write operations; it is not strong enough
3667 happens-before order. There is no guarantee that the modification
3670 read-modify-write operation (:ref:`cmpxchg <i_cmpxchg>` and
3677 ``monotonic``-ally by one thread, and other threads ``monotonic``-ally
3682 *synchronizes-with* edge may be formed with a ``release`` operation.
3687 operation, it *synchronizes-with* that operation. Furthermore,
3689 has been modified by a read-modify-write operation before being
3700 sequentially-consistent operations on all addresses. Each
3701 sequentially-consistent read sees the last preceding write to the
3706 consistent with the *happens-before* partial order if
3707 non-``seq_cst`` accesses are involved. See the C++ standard
3717 If an atomic operation is marked ``syncscope("<target-scope>")``, where
3718 ``<target-scope>`` is a target specific synchronization scope, then it is target
3723 or ``syncscope("<target-scope>")`` *synchronizes with* and participates in the
3725 ``syncscope("singlethread")`` or ``syncscope("<target-scope>")``.
3729 Floating-Point Environment
3730 --------------------------
3732 The default LLVM floating-point environment assumes that traps are disabled and
3733 status flags are not observable. Therefore, floating-point math operations do
3735 round-to-nearest rounding mode, and subnormals are assumed to be preserved.
3738 typically leads to undefined behavior. The ``strictfp`` and ``denormal-fp-math``
3739 attributes as well as :ref:`Constrained Floating-Point Intrinsics
3741 behavior in non-default floating-point environments; see their respective
3746 Behavior of Floating-Point NaN values
3747 -------------------------------------
3749 A floating-point NaN value consists of a sign bit, a quiet/signaling bit, and a
3755 The representation bits of a floating-point value do not mutate arbitrarily; in
3756 particular, if there is no floating-point operation being performed, NaN signs,
3760 are not "floating-point math operations": ``fneg``, ``llvm.fabs``, and
3764 Floating-point math operations that return a NaN are an exception from the
3765 general principle that LLVM implements IEEE-754 semantics. Unless specified
3766 otherwise, the following rules apply whenever the IEEE-754 semantics say that a
3767 NaN value is returned: the result has a non-deterministic sign; the quiet bit
3768 and payload are non-deterministically chosen from the following set of options:
3770 - The quiet bit is set and the payload is all-zero. ("Preferred NaN" case)
3771 - The quiet bit is set and the payload is copied from any input operand that is
3773 - The quiet bit and payload are copied from any input operand that is a NaN.
3775 - The quiet bit is set and the payload is picked from a target-specific set of
3777 This set is empty on x86 and ARM, but can be non-empty on other architectures.
3778 (For instance, on wasm, if any input NaN does not have the preferred all-zero
3780 payloads; otherwise, it is empty. On SPARC, this set consists of the all-one
3790 Floating-point math operations are allowed to treat all NaNs as if they were
3794 :ref:`Constrained Floating-Point Intrinsics <constrainedfp>`.
3798 Unfortunately, due to hard-or-impossible-to-fix issues, LLVM violates its own
3801 - x86-32 without SSE2 enabled may convert floating-point values to x86_fp80 and
3802 back when performing floating-point math operations; this can lead to results
3806 <https://github.com/llvm/llvm-project/issues/44218>`_.
3807 - x86-32 (even with SSE2 enabled) may implicitly perform such a conversion on
3809 #66803 <https://github.com/llvm/llvm-project/issues/66803>`_.
3810 - Older MIPS versions use the opposite polarity for the quiet/signaling bit, and
3812 <https://github.com/llvm/llvm-project/issues/60796>`_.
3816 Floating-Point Semantics
3817 ------------------------
3819 This section defines the semantics for core floating-point operations on types
3820 that use a format specified by IEEE-745. These types are: ``half``, ``float``,
3823 section 5 of IEEE-745, which all have corresponding LLVM operations.
3826 IEEE-754 operation executed in the :ref:`default LLVM floating-point environment
3828 specified here <floatnan>`. In particular, such a floating-point instruction
3829 returning a non-NaN value is guaranteed to always return the same bit-identical
3838 :ref:`floating-point environment section <floatenv>` regarding flags and
3842 operations and thus make them not bit-identical across machines and optimization
3843 levels any more: most notably, the :ref:`fast-math flags <fastmath>` as well as
3844 the :ref:`strictfp <strictfp>` and :ref:`denormal-fp-math <denormal_fp_math>`
3845 attributes and :ref:`!fpmath metadata <fpmath-metadata>`. See their
3850 Fast-Math Flags
3851 ---------------
3853 LLVM IR floating-point operations (:ref:`fneg <i_fneg>`, :ref:`fadd <i_fadd>`,
3857 :ref:`call <i_call>` instructions that return floating-point types may use the
3858 following flags to enable otherwise unsafe floating-point transformations.
3861 This flag is a shorthand for specifying all fast-math flags at once, and
3865 No NaNs - Allow optimizations to assume the arguments and result are not
3870 No Infs - Allow optimizations to assume the arguments and result are not
3871 +/-Inf. If an argument is +/-Inf, or the result would be +/-Inf, it
3875 No Signed Zeros - Allow optimizations to treat the sign of a zero
3876 argument or zero result as insignificant. This does not imply that -0.0
3880 instructions, the following return types are considered to be floating-point
3885 - Floating-point scalar or vector types
3886 - Array types (nested to any depth) of floating-point scalar or vector types
3887 - Homogeneous literal struct types of floating-point scalar or vector types
3889 Rewrite-based flags
3892 The following flags have rewrite-based semantics. These flags allow expressions,
3893 potentially containing multiple non-consecutive instructions, to be rewritten
3896 rewrite-based flag present on them, and the rewritten instructions will
3899 In the following example, the floating-point expression in the body of ``@orig``
3908 .. code-block:: llvm
3922 These rules do not apply to the other fast-math flags. Whether or not a flag
3936 Allow floating-point contraction (e.g. fusing a multiply followed by an
3937 addition into a fused multiply-and-add). This does not enable reassociation
3944 Approximate functions - Allow substitution of approximate calculations for
3945 functions (sin, log, sqrt, etc). See floating-point intrinsic definitions
3949 Allow reassociation transformations for floating-point instructions.
3950 This may dramatically change results in floating-point.
3954 Use-list Order Directives
3955 -------------------------
3957 Use-list directives encode the in-memory order of each use-list, allowing the
3958 order to be recreated. ``<order-indexes>`` is a comma-separated list of
3960 value's use-list is immediately sorted by these indexes.
3962 Use-list directives may appear at function scope or global scope. They are not
3967 ``uselistorder_bb`` can be used to reorder their use-lists from outside their
3974 uselistorder <ty> <value>, { <order-indexes> }
3975 uselistorder_bb @function, %block { <order-indexes> }
4001 ---------------
4014 .. code-block:: text
4034 ---------
4052 -------------
4059 type is a void type or first class type --- except for :ref:`label <t_label>`
4068 ...where '``<parameter list>``' is a comma-separated list of type
4077 +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4079 +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4081 +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4083 +---------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4088 -----------------
4124 +----------------+------------------------------------------------+
4125 | ``i1`` | a single-bit integer. |
4126 +----------------+------------------------------------------------+
4127 | ``i32`` | a 32-bit integer. |
4128 +----------------+------------------------------------------------+
4130 +----------------+------------------------------------------------+
4134 Floating-Point Types
4137 .. list-table::
4138 :header-rows: 1
4140 * - Type
4141 - Description
4143 * - ``half``
4144 - 16-bit floating-point value (IEEE-754 binary16)
4146 * - ``bfloat``
4147 - 16-bit "brain" floating-point value (7-bit significand). Provides the
4149 range, but with greatly reduced precision. Used in Intel's AVX-512 BF16
4150 extensions and Arm's ARMv8.6-A extensions, among others.
4152 * - ``float``
4153 - 32-bit floating-point value (IEEE-754 binary32)
4155 * - ``double``
4156 - 64-bit floating-point value (IEEE-754 binary64)
4158 * - ``fp128``
4159 - 128-bit floating-point value (IEEE-754 binary128)
4161 * - ``x86_fp80``
4162 - 80-bit floating-point value (X87)
4164 * - ``ppc_fp128``
4165 - 128-bit floating-point value (two 64-bits)
4197 the numbered address space where the pointed-to object resides. For
4207 The semantics of non-zero address spaces are target-specific. Memory
4208 access through a non-dereferenceable pointer is undefined behavior in
4209 any address space. Pointers with the bit-value 0 are only assumed to
4210 be non-dereferenceable in address space 0, unless the function is
4219 pointers" are still supported under non-default options. See the
4239 arise from target-specific intrinsics and functions.
4260 .. code-block:: llvm
4304 .. code-block:: llvm
4314 ; In memory the content will be (8-bit addressing):
4321 .. code-block:: llvm
4331 ; In memory the content will be (8-bit addressing):
4345 < <# elements> x <elementtype> > ; Fixed-length vector
4349 elementtype may be any integer, floating-point or pointer type. Vectors
4353 and the same hardware-dependent constant for all scalable vectors at run
4359 +------------------------+----------------------------------------------------+
4360 | ``<4 x i32>`` | Vector of 4 32-bit integer values. |
4361 +------------------------+----------------------------------------------------+
4362 | ``<8 x float>`` | Vector of 8 32-bit floating-point values. |
4363 +------------------------+----------------------------------------------------+
4364 | ``<2 x i64>`` | Vector of 2 64-bit integer values. |
4365 +------------------------+----------------------------------------------------+
4367 +------------------------+----------------------------------------------------+
4368 | ``<vscale x 4 x i32>`` | Vector with a multiple of 4 32-bit integer values. |
4369 +------------------------+----------------------------------------------------+
4454 +------------------+--------------------------------------+
4455 | ``[40 x i32]`` | Array of 40 32-bit integer values. |
4456 +------------------+--------------------------------------+
4457 | ``[41 x i32]`` | Array of 41 32-bit integer values. |
4458 +------------------+--------------------------------------+
4459 | ``[4 x i8]`` | Array of 4 8-bit integer values. |
4460 +------------------+--------------------------------------+
4464 +-----------------------------+----------------------------------------------------------+
4465 | ``[3 x [4 x i32]]`` | 3x4 array of 32-bit integer values. |
4466 +-----------------------------+----------------------------------------------------------+
4467 | ``[12 x [10 x float]]`` | 12x10 array of single precision floating-point values. |
4468 +-----------------------------+----------------------------------------------------------+
4469 | ``[2 x [3 x [4 x i16]]]`` | 2x3x4 array of 16-bit integer values. |
4470 +-----------------------------+----------------------------------------------------------+
4475 single-dimension 'variable sized array' addressing can be implemented in
4498 between the elements. In non-packed structs, padding between field types
4518 +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4520 +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4522 +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4524 +------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4547 +--------------+-------------------+
4549 +--------------+-------------------+
4560 ----------------
4568 hexadecimal. Decimal integers can be prefixed with - to represent
4569 negative integers, e.g. '``-1234``'. Hexadecimal integers must be
4572 '``s0x8000``' gives -32768.
4576 zeros. So '``s0x0001``' of type '``i16``' will be -1, not 1.
4577 **Floating-point constants**
4578 Floating-point constants use standard decimal notation (e.g.
4581 decimal value of a floating-point constant. For example, the
4583 decimal in binary. Floating-point constants must have a
4584 :ref:`floating-point <t_floating>` type.
4592 The one non-intuitive notation for constants is the hexadecimal form of
4593 floating-point constants. For example, the form
4595 than) '``double 4.5e+15``'. The only time hexadecimal floating-point
4597 disassembler) is when a floating-point constant must be emitted but it
4598 cannot be represented as a decimal floating-point number in a reasonable
4604 double are represented using the 16-digit form shown above (which matches the
4608 there are three forms of long double. The 80-bit format used by x86 is
4609 represented as ``0xK`` followed by 20 hexadecimal digits. The 128-bit format
4611 hexadecimal digits. The IEEE 128-bit format is represented by ``0xL`` followed
4613 double format on your target. The IEEE 16-bit format (half precision) is
4614 represented by ``0xH`` followed by 4 hexadecimal digits. The bfloat 16-bit
4616 hexadecimal formats are big-endian (sign bit at the left).
4623 -----------------
4643 constants may also be represented as a double-quoted string using the ``c``
4648 less-than/greater-than's (``<>``)). For example:
4672 --------------------------------------
4676 (link-time) constants. These constants are explicitly referenced when
4681 .. code-block:: llvm
4690 ----------------
4694 bit-pattern. Undefined values may be of any type (other than '``label``'
4709 .. code-block:: llvm
4722 .. code-block:: llvm
4727 %A = -1
4731 %B = %X ;; By choosing undef as -1
4744 allowing the '``or``' to be folded to -1.
4746 .. code-block:: llvm
4769 .. code-block:: llvm
4803 .. code-block:: llvm
4813 allowed to have an arbitrary bit-pattern. This means that the ``%A``
4824 .. code-block:: text
4826 a: store undef -> %X
4827 b: store %X -> undef
4845 .. code-block:: llvm
4859 switch i8 %X, label %ret [ .. ] ; Well-defined
4862 br %X, BB1, BB2 ; Well-defined (non-deterministic jump)
4869 -------------
4891 - The pointer operand of a :ref:`load <i_load>`, :ref:`store <i_store>` or
4894 - The divisor operand of a ``udiv``, ``sdiv``, ``urem`` or ``srem``
4896 - The condition operand of a :ref:`br <i_br>` instruction.
4897 - The callee operand of a :ref:`call <i_call>` or :ref:`invoke <i_invoke>`
4899 - The parameter operand of a :ref:`call <i_call>` or :ref:`invoke <i_invoke>`
4902 - The operand of a :ref:`ret <i_ret>` instruction if the function or invoking
4907 .. code-block:: llvm
4930 Well-Defined Values
4931 -------------------
4939 A constant of a :ref:`single value <t_single_value>`, non-vector type is well
4947 -------------------------
4961 equality tests between labels addresses results in undefined behavior ---
4974 --------------------
4989 - If the function has local linkage, hidden visibility, or is
4992 - ``dso_local_equivalent`` can be implemented with a stub that tail-calls the
5011 ------
5015 With `Control-Flow Integrity (CFI)
5019 may be useful in low-level programs, such as operating system kernels, which
5025 --------------------------------
5043 .. code-block:: llvm
5050 .. code-block:: llvm
5059 --------------------
5087 may be implicitly sign-extended or truncated to match the index size
5115 ----------------------------
5117 LLVM supports inline assembler expressions (as opposed to :ref:`Module-Level
5128 be used, where ``MODIFIER`` is a target-specific annotation for how to print the
5129 operand (See :ref:`inline-asm-modifiers`).
5135 disabled -- even when emitting a ``.s`` file -- and thus must contain assembly
5140 - ``${:uid}``: Expands to a decimal integer unique to this inline assembly blob.
5143 Adding a blob-unique identifier ensures that the two labels will not conflict
5145 string <https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html>`_.
5146 - ``${:comment}``: Expands to the comment character of the current target's
5149 - ``${:private}``: Expands to the assembler private label prefix. Labels with
5155 GCC-compatible inline-asm support. Thus, the feature-set and the constraint and
5159 while most constraint letters are passed through as-is by Clang, some get
5165 .. code-block:: llvm
5173 .. code-block:: llvm
5181 .. code-block:: llvm
5192 .. code-block:: llvm
5196 Inline asms also support using non-standard assembly dialects. The
5201 .. code-block:: llvm
5209 .. code-block:: llvm
5223 The constraint list is a comma-separated string, each element containing one or
5238 - Register constraint. This is either a register class, or a fixed physical
5241 - Memory constraint. This kind of constraint is for use with an instruction
5244 - Immediate value constraint. This kind of constraint is for an integer or other
5246 various target-specific constraints allow the selection of a value in the
5264 "early-clobber" output. Marking an output as "early-clobber" ensures that LLVM
5271 Input constraints do not have a prefix -- just the constraint codes. Each input
5281 take up a position in the asm template numbering as is usual -- they will simply
5287 It is permitted to tie an input to an "early-clobber" output. In that case, no
5288 *other* input may share the same register as the input tied to the early-clobber
5303 instructions, this is not an appropriate way to support them. (e.g. the 32-bit
5304 SparcV8 has a 64-bit load, which instruction takes a single 32-bit register. The
5309 to the second register of a two-register operand (e.g. MIPS ``L``, ``M``, and
5349 general constraint code letters -- they may use only explicit register
5352 memory locations -- not only the memory pointed to by a declared indirect
5375 followed by two letters (e.g. "``^wc``"), or "``{``" register-name "``}``"
5419 GCC. LLVM's support is often implemented on an 'as-needed' basis, to support C
5425 - ``r``: A register in the target's general purpose register class.
5426 - ``m``: A memory address operand. It is target-specific what addressing modes
5428 or register + immediate offset (of some target-specific size).
5429 - ``p``: An address operand. Similar to ``m``, but used by "load address"
5431 - ``i``: An integer constant (of target-specific width). Allows either a simple
5433 - ``n``: An integer constant -- *not* including relocatable values.
5434 - ``s``: A symbol or label reference with a constant offset.
5435 - ``X``: Allows an operand of any kind, no constraint whatsoever. Typically
5441 - ``{register-name}``: Requires exactly the named physical register.
5443 Other constraints are target-specific:
5447 - ``z``: An immediate integer 0. Outputs ``WZR`` or ``XZR``, as appropriate.
5448 - ``I``: An immediate integer valid for an ``ADD`` or ``SUB`` instruction,
5450 - ``J``: An immediate integer that, when negated, is valid for an ``ADD`` or
5451 ``SUB`` instruction, i.e. -1 to -4095 with optional left shift by 12.
5452 - ``K``: An immediate integer that is valid for the 'bitmask immediate 32' of a
5453 logical instruction like ``AND``, ``EOR``, or ``ORR`` with a 32-bit register.
5454 - ``L``: An immediate integer that is valid for the 'bitmask immediate 64' of a
5455 logical instruction like ``AND``, ``EOR``, or ``ORR`` with a 64-bit register.
5456 - ``M``: An immediate integer for use with the ``MOV`` assembly alias on a
5457 32-bit register. This is a superset of ``K``: in addition to the bitmask
5460 - ``N``: An immediate integer for use with the ``MOV`` assembly alias on a
5461 64-bit register. This is a superset of ``L``.
5462 - ``Q``: Memory address operand must be in a single register (no
5465 - ``r``: A 32 or 64-bit integer register (W* or X*).
5466 - ``S``: A symbol or label reference with a constant offset. The generic ``s``
5468 - ``Uci``: Like r, but restricted to registers 8 to 11 inclusive.
5469 - ``Ucj``: Like r, but restricted to registers 12 to 15 inclusive.
5470 - ``w``: A 32, 64, or 128-bit floating-point, SIMD or SVE vector register.
5471 - ``x``: Like w, but restricted to registers 0 to 15 inclusive.
5472 - ``y``: Like w, but restricted to SVE vector registers Z0 to Z7 inclusive.
5473 - ``Uph``: One of the upper eight SVE predicate registers (P8 to P15)
5474 - ``Upl``: One of the lower eight SVE predicate registers (P0 to P7)
5475 - ``Upa``: Any of the SVE predicate registers (P0 to P15)
5479 - ``r``: A 32 or 64-bit integer register.
5480 - ``[0-9]v``: The 32-bit VGPR register, number 0-9.
5481 - ``[0-9]s``: The 32-bit SGPR register, number 0-9.
5482 - ``[0-9]a``: The 32-bit AGPR register, number 0-9.
5483 - ``I``: An integer inline constant in the range from -16 to 64.
5484 - ``J``: A 16-bit signed integer constant.
5485 - ``A``: An integer or a floating-point inline constant.
5486 - ``B``: A 32-bit signed integer constant.
5487 - ``C``: A 32-bit unsigned integer constant or an integer inline constant in the range from -16 to 64.
5488 - ``DA``: A 64-bit constant that can be split into two "A" constants.
5489 - ``DB``: A 64-bit constant that can be split into two "B" constants.
5493 - ``Q``, ``Um``, ``Un``, ``Uq``, ``Us``, ``Ut``, ``Uv``, ``Uy``: Memory address
5495 - ``Te``: An even general-purpose 32-bit integer register: ``r0,r2,...,r12,r14``
5496 - ``To``: An odd general-purpose 32-bit integer register: ``r1,r3,...,r11``
5500 - ``j``: An immediate integer between 0 and 65535 (valid for ``MOVW``)
5501 - ``I``: An immediate integer valid for a data-processing instruction.
5502 - ``J``: An immediate integer between -4095 and 4095.
5503 - ``K``: An immediate integer whose bitwise inverse is valid for a
5504 data-processing instruction. (Can be used with template modifier "``B``" to
5506 - ``L``: An immediate integer whose negation is valid for a data-processing
5509 - ``M``: A power of two or an integer between 0 and 32.
5510 - ``N``: Invalid immediate constraint.
5511 - ``O``: Invalid immediate constraint.
5512 - ``r``: A general-purpose 32-bit integer register (``r0-r15``).
5513 - ``l``: In Thumb2 mode, low 32-bit GPR registers (``r0-r7``). In ARM mode, same
5515 - ``h``: In Thumb2 mode, a high 32-bit GPR register (``r8-r15``). In ARM mode,
5517 - ``w``: A 32, 64, or 128-bit floating-point/SIMD register in the ranges
5518 ``s0-s31``, ``d0-d31``, or ``q0-q15``, respectively.
5519 - ``t``: A 32, 64, or 128-bit floating-point/SIMD register in the ranges
5520 ``s0-s31``, ``d0-d15``, or ``q0-q7``, respectively.
5521 - ``x``: A 32, 64, or 128-bit floating-point/SIMD register in the ranges
5522 ``s0-s15``, ``d0-d7``, or ``q0-q3``, respectively.
5526 - ``I``: An immediate integer between 0 and 255.
5527 - ``J``: An immediate integer between -255 and -1.
5528 - ``K``: An immediate integer between 0 and 255, with optional left-shift by
5530 - ``L``: An immediate integer between -7 and 7.
5531 - ``M``: An immediate integer which is a multiple of 4 between 0 and 1020.
5532 - ``N``: An immediate integer between 0 and 31.
5533 - ``O``: An immediate integer which is a multiple of 4 between -508 and 508.
5534 - ``r``: A low 32-bit GPR register (``r0-r7``).
5535 - ``l``: A low 32-bit GPR register (``r0-r7``).
5536 - ``h``: A high GPR register (``r0-r7``).
5537 - ``w``: A 32, 64, or 128-bit floating-point/SIMD register in the ranges
5538 ``s0-s31``, ``d0-d31``, or ``q0-q15``, respectively.
5539 - ``t``: A 32, 64, or 128-bit floating-point/SIMD register in the ranges
5540 ``s0-s31``, ``d0-d15``, or ``q0-q7``, respectively.
5541 - ``x``: A 32, 64, or 128-bit floating-point/SIMD register in the ranges
5542 ``s0-s15``, ``d0-d7``, or ``q0-q3``, respectively.
5546 - ``o``, ``v``: A memory address operand, treated the same as constraint ``m``,
5548 - ``r``: A 32 or 64-bit register.
5552 - ``f``: A floating-point register (if available).
5553 - ``k``: A memory operand whose address is formed by a base register and
5555 - ``l``: A signed 16-bit constant.
5556 - ``m``: A memory operand whose address is formed by a base register and
5559 - ``I``: A signed 12-bit constant (for arithmetic instructions).
5560 - ``J``: An immediate integer zero.
5561 - ``K``: An unsigned 12-bit constant (for logic instructions).
5562 - ``ZB``: An address that is held in a general-purpose register. The offset
5564 - ``ZC``: A memory operand whose address is formed by a base register and
5570 - ``r``: An 8 or 16-bit register.
5574 - ``I``: An immediate signed 16-bit integer.
5575 - ``J``: An immediate integer zero.
5576 - ``K``: An immediate unsigned 16-bit integer.
5577 - ``L``: An immediate 32-bit integer, where the lower 16 bits are 0.
5578 - ``N``: An immediate integer between -65535 and -1.
5579 - ``O``: An immediate signed 15-bit integer.
5580 - ``P``: An immediate integer between 1 and 65535.
5581 - ``m``: A memory address operand. In MIPS-SE mode, allows a base address
5582 register plus 16-bit immediate offset. In MIPS mode, just a base register.
5583 - ``R``: A memory address operand. In MIPS-SE mode, allows a base address
5584 register plus a 9-bit signed offset. In MIPS mode, the same as constraint
5586 - ``ZC``: A memory address operand, suitable for use in a ``pref``, ``ll``, or
5588 - ``r``, ``d``, ``y``: A 32 or 64-bit GPR register.
5589 - ``f``: A 32 or 64-bit FPU register (``F0-F31``), or a 128-bit MSA register
5590 (``W0-W31``). In the case of MSA registers, it is recommended to use the ``w``
5592 - ``c``: A 32-bit or 64-bit GPR register suitable for indirect jump (always
5594 - ``l``: The ``lo`` register, 32 or 64-bit.
5595 - ``x``: Invalid.
5599 - ``b``: A 1-bit integer register.
5600 - ``c`` or ``h``: A 16-bit integer register.
5601 - ``r``: A 32-bit integer register.
5602 - ``l`` or ``N``: A 64-bit integer register.
5603 - ``q``: A 128-bit integer register.
5604 - ``f``: A 32-bit float register.
5605 - ``d``: A 64-bit float register.
5610 - ``I``: An immediate signed 16-bit integer.
5611 - ``J``: An immediate unsigned 16-bit integer, shifted left 16 bits.
5612 - ``K``: An immediate unsigned 16-bit integer.
5613 - ``L``: An immediate signed 16-bit integer, shifted left 16 bits.
5614 - ``M``: An immediate integer greater than 31.
5615 - ``N``: An immediate integer that is an exact power of 2.
5616 - ``O``: The immediate integer constant 0.
5617 - ``P``: An immediate integer constant whose negation is a signed 16-bit
5619 - ``es``, ``o``, ``Q``, ``Z``, ``Zy``: A memory address operand, currently
5621 - ``r``: A 32 or 64-bit integer register.
5622 - ``b``: A 32 or 64-bit integer register, excluding ``R0`` (that is:
5623 ``R1-R31``).
5624 - ``f``: A 32 or 64-bit float register (``F0-F31``),
5625 - ``v``: For ``4 x f32`` or ``4 x f64`` types, a 128-bit altivec vector
5626 register (``V0-V31``).
5628 - ``y``: Condition register (``CR0-CR7``).
5629 - ``wc``: An individual CR bit in a CR register.
5630 - ``wa``, ``wd``, ``wf``: Any 128-bit VSX vector register, from the full VSX
5631 register set (overlapping both the floating-point and vector register files).
5632 - ``ws``: A 32 or 64-bit floating-point register, from the full VSX register
5635 RISC-V:
5637 - ``A``: An address operand (using a general-purpose register, without an
5639 - ``I``: A 12-bit signed integer immediate operand.
5640 - ``J``: A zero integer immediate operand.
5641 - ``K``: A 5-bit unsigned integer immediate operand.
5642 - ``f``: A 32- or 64-bit floating-point register (requires F or D extension).
5643 - ``r``: A 32- or 64-bit general-purpose register (depending on the platform
5645 - ``S``: Alias for ``s``.
5646 - ``vd``: A vector register, excluding ``v0`` (requires V extension).
5647 - ``vm``: The vector register ``v0`` (requires V extension).
5648 - ``vr``: A vector register (requires V extension).
5652 - ``I``: An immediate 13-bit signed integer.
5653 - ``r``: A 32-bit integer register.
5654 - ``f``: Any floating-point register on SparcV8, or a floating-point
5656 - ``e``: Any floating-point register. (Same as ``f`` on SparcV8.)
5660 - ``I``: An immediate unsigned 8-bit integer.
5661 - ``J``: An immediate unsigned 12-bit integer.
5662 - ``K``: An immediate signed 16-bit integer.
5663 - ``L``: An immediate signed 20-bit integer.
5664 - ``M``: An immediate integer 0x7fffffff.
5665 - ``Q``: A memory address operand with a base address and a 12-bit immediate
5667 - ``R``: A memory address operand with a base address, a 12-bit immediate
5669 - ``S``: A memory address operand with a base address and a 20-bit immediate
5671 - ``T``: A memory address operand with a base address, a 20-bit immediate
5673 - ``r`` or ``d``: A 32, 64, or 128-bit integer register.
5674 - ``a``: A 32, 64, or 128-bit integer address register (excludes R0, which in an
5676 - ``h``: A 32-bit value in the high part of a 64bit data register
5677 (LLVM-specific)
5678 - ``f``: A 32, 64, or 128-bit floating-point register.
5682 - ``I``: An immediate integer between 0 and 31.
5683 - ``J``: An immediate integer between 0 and 64.
5684 - ``K``: An immediate signed 8-bit integer.
5685 - ``L``: An immediate integer, 0xff or 0xffff or (in 64-bit mode only)
5687 - ``M``: An immediate integer between 0 and 3.
5688 - ``N``: An immediate unsigned 8-bit integer.
5689 - ``O``: An immediate integer between 0 and 127.
5690 - ``e``: An immediate 32-bit signed integer.
5691 - ``Z``: An immediate 32-bit unsigned integer.
5692 - ``q``: An 8, 16, 32, or 64-bit register which can be accessed as an 8-bit
5693 ``l`` integer register. On X86-32, this is the ``a``, ``b``, ``c``, and ``d``
5694 registers, and on X86-64, it is all of the integer registers. When feature
5695 `egpr` and `inline-asm-use-gpr32` are both on, it will be extended to gpr32.
5696 - ``Q``: An 8, 16, 32, or 64-bit register which can be accessed as an 8-bit
5698 - ``r`` or ``l``: An 8, 16, 32, or 64-bit integer register. When feature
5699 `egpr` and `inline-asm-use-gpr32` are both on, it will be extended to gpr32.
5700 - ``R``: An 8, 16, 32, or 64-bit "legacy" integer register -- one which has
5702 - ``f``: A 32, 64, or 80-bit '387 FPU stack pseudo-register.
5703 - ``y``: A 64-bit MMX register, if MMX is enabled.
5704 - ``v``: If SSE is enabled: a 32 or 64-bit scalar operand, or 128-bit vector
5705 operand in a SSE register. If AVX is also enabled, can also be a 256-bit
5706 vector operand in an AVX register. If AVX-512 is also enabled, can also be a
5707 512-bit vector operand in an AVX512 register. Otherwise, an error.
5708 - ``Ws``: A symbolic reference with an optional constant addend or a label
5710 - ``x``: The same as ``v``, except that when AVX-512 is enabled, the ``x`` code
5711 only allocates into the first 16 AVX-512 registers, while the ``v`` code
5712 allocates into any of the 32 AVX-512 registers.
5713 - ``Y``: The same as ``x``, if *SSE2* is enabled, otherwise an error.
5714 - ``A``: Special case: allocates EAX first, then EDX, for a single operand (in
5715 32-bit mode, a 64-bit integer operand will get split into two registers). It
5716 is not recommended to use this constraint, as in 64-bit mode, the 64-bit
5717 operand will get allocated only to RAX -- if two 32-bit operands are needed,
5720 - ``jr``: An 8, 16, 32, or 64-bit integer gpr16. It won't be extended to gpr32
5721 when feature `egpr` or `inline-asm-use-gpr32` is on.
5722 - ``jR``: An 8, 16, 32, or 64-bit integer gpr32 when feature `egpr`` is on.
5727 - ``r``: A 32-bit integer register.
5730 .. _inline-asm-modifiers:
5739 GCC. LLVM's support is often implemented on an 'as-needed' basis, to support C
5743 Target-independent:
5745 - ``c``: Print an immediate integer constant unadorned, without
5746 the target-specific immediate punctuation (e.g. no ``$`` prefix).
5747 - ``n``: Negate and print immediate integer constant unadorned, without the
5748 target-specific immediate punctuation (e.g. no ``$`` prefix).
5749 - ``l``: Print as an unadorned label, without the target-specific label
5754 - ``w``: Print a GPR register with a ``w*`` name instead of ``x*`` name. E.g.,
5756 - ``x``: Print a GPR register with a ``x*`` name. (this is the default, anyhow).
5757 - ``b``, ``h``, ``s``, ``d``, ``q``: Print a floating-point/SIMD register with a
5763 - ``r``: No effect.
5767 - ``a``: Print an operand as an address (with ``[`` and ``]`` surrounding a
5769 - ``P``: No effect.
5770 - ``q``: No effect.
5771 - ``y``: Print a VFP single-precision register as an indexed double (e.g. print
5773 - ``B``: Bitwise invert and print an immediate integer constant without ``#``
5775 - ``L``: Print the low 16-bits of an immediate integer constant.
5776 - ``M``: Print as a register set suitable for ldm/stm. Also prints *all*
5778 - ``Q``: Print the low-order register of a register-pair, or the low-order
5779 register of a two-register operand.
5780 - ``R``: Print the high-order register of a register-pair, or the high-order
5781 register of a two-register operand.
5782 - ``H``: Print the second register of a register-pair. (On a big-endian system,
5783 ``H`` is equivalent to ``Q``, and on little-endian system, ``H`` is equivalent
5787 of a two-register operand.
5789 - ``e``: Print the low doubleword register of a NEON quad register.
5790 - ``f``: Print the high doubleword register of a NEON quad register.
5791 - ``m``: Print the base register of a memory operand without the ``[`` and ``]``
5796 - ``L``: Print the second register of a two-register operand. Requires that it
5802 - ``I``: Print the letter 'i' if the operand is an integer constant, otherwise
5807 - ``z``: Print $zero register if operand is zero, otherwise print it normally.
5815 - ``X``: Print an immediate integer as hexadecimal
5816 - ``x``: Print the low 16 bits of an immediate integer as hexadecimal.
5817 - ``d``: Print an immediate integer as decimal.
5818 - ``m``: Subtract one and print an immediate integer as decimal.
5819 - ``z``: Print $0 if an immediate zero, otherwise print normally.
5820 - ``L``: Print the low-order register of a two-register operand, or prints the
5821 address of the low-order word of a double-word memory operand.
5825 - ``M``: Print the high-order register of a two-register operand, or prints the
5826 address of the high-order word of a double-word memory operand.
5830 - ``D``: Print the second register of a two-register operand, or prints the
5831 second word of a double-word memory operand. (On a big-endian system, ``D`` is
5832 equivalent to ``L``, and on little-endian system, ``D`` is equivalent to
5834 - ``w``: No effect. Provided for compatibility with GCC which requires this
5835 modifier in order to print MSA registers (``W0-W31``) with the ``f``
5840 - ``r``: No effect.
5844 - ``L``: Print the second register of a two-register operand. Requires that it
5850 - ``I``: Print the letter 'i' if the operand is an integer constant, otherwise
5852 - ``y``: For a memory operand, prints formatter for a two-register X-form
5854 - ``U``: Prints 'u' if the memory operand is an update form, and nothing
5857 - ``X``: Prints 'x' if the memory operand is an indexed form. (NOTE: LLVM does
5860 RISC-V:
5862 - ``i``: Print the letter 'i' if the operand is not a register, otherwise print
5864 - ``z``: Print the register ``zero`` if an immediate zero, otherwise print
5869 - ``L``: Print the low-order register of a two-register operand.
5870 - ``H``: Print the high-order register of a two-register operand.
5871 - ``r``: No effect.
5876 target-independent modifiers.
5880 - ``c``: Print an unadorned integer or symbol name. (The latter is
5881 target-specific behavior for this typically target-independent modifier).
5882 - ``A``: Print a register name with a '``*``' before it.
5883 - ``b``: Print an 8-bit register name (e.g. ``al``); do nothing on a memory
5885 - ``h``: Print the upper 8-bit register name (e.g. ``ah``); do nothing on a
5887 - ``w``: Print the 16-bit register name (e.g. ``ax``); do nothing on a memory
5889 - ``k``: Print the 32-bit register name (e.g. ``eax``); do nothing on a memory
5891 - ``q``: Print the 64-bit register name (e.g. ``rax``), if 64-bit registers are
5892 available, otherwise the 32-bit register name; do nothing on a memory operand.
5893 - ``n``: Negate and print an unadorned integer, or, for operands other than an
5894 immediate integer (e.g. a relocatable symbol expression), print a '-' before
5896 target-specific behavior for this typically target-independent modifier)
5897 - ``H``: Print a memory reference with additional offset +8.
5898 - ``p``: Print a raw symbol name (without syntax-specific prefixes).
5899 - ``P``: Print a memory reference used as the argument of a call instruction or
5902 though it's PC-relative.)
5916 error reporting mechanisms. This allows a front-end to correlate backend
5920 .. code-block:: llvm
5926 It is up to the front-end to make sense of the magic numbers it places
5946 One example application of metadata is source-level debug information,
5951 A value of non-\ ``metadata`` type can be used in a metadata context using the
5960 - Arguments to certain intrinsic functions, as described in their specification.
5961 - Arguments to the ``catchpad``/``cleanuppad`` instructions.
5966 in a value context: ``MetadataAsValue`` is-a ``Value``.
5969 referenced in a metadata context: ``ValueAsMetadata`` is-a ``Metadata``.
5981 .. code-block:: llvm
5987 .. code-block:: llvm
5993 .. code-block:: llvm
5999 .. code-block:: llvm
6003 .. _metadata-string:
6006 -------------------------------
6012 contain any character by escaping non-printable characters with
6020 .. _metadata-node:
6023 ---------------------------
6033 .. code-block:: llvm
6039 .. code-block:: text
6051 .. code-block:: llvm
6058 .. code-block:: llvm
6071 .. code-block:: llvm
6082 .. code-block:: llvm
6107 .. _specialized-metadata:
6129 indicating whether or not line-table discriminators are updated to provide
6130 more-accurate debug info for profiling results.
6132 .. code-block:: text
6135 isOptimized: true, flags: "-O2", runtimeVersion: 2,
6153 .. code-block:: none
6174 .. code-block:: text
6183 .. code-block:: text
6203 .. code-block:: text
6217 .. code-block:: text
6226 .. code-block:: text
6272 derived types <DIDerivedTypeMember>` that reference the ODR-type in their
6280 .. code-block:: text
6284 !2 = !DIEnumerator(name: "NegEightKind", value: -8)
6291 .. code-block:: text
6335 - ``count: -1`` indicates an empty array.
6336 - ``count: !10`` describes the count with a :ref:`DILocalVariable`.
6337 - ``count: !12`` describes the count with a :ref:`DIGlobalVariable`.
6339 .. code-block:: text
6343 !2 = !DISubrange(count: -1) ; empty array.
6367 .. code-block:: text
6371 !2 = !DIEnumerator(name: "NegEightKind", value: -8)
6380 .. code-block:: text
6393 .. code-block:: text
6402 .. code-block:: text
6413 .. code-block:: text
6428 .. code-block:: text
6468 .. code-block:: text
6491 two lexical blocks at same depth. They are valid targets for ``scope:``
6494 .. code-block:: text
6511 .. code-block:: text
6526 .. code-block:: text
6536 the ``arg:`` field is set to non-zero, then this variable is a subprogram
6540 .. code-block:: text
6557 expressions are interpreted left-to-right: start by pushing the value/address
6563 - ``DW_OP_deref`` dereferences the top of the expression stack.
6564 - ``DW_OP_plus`` pops the last two entries from the expression stack, adds
6566 - ``DW_OP_minus`` pops the last two entries from the expression stack, subtracts
6569 - ``DW_OP_plus_uconst, 93`` adds ``93`` to the working expression.
6570 - ``DW_OP_LLVM_fragment, 16, 8`` specifies the offset and size (``16`` and ``8``
6574 - ``DW_OP_LLVM_convert, 16, DW_ATE_signed`` specifies a bit size and encoding
6578 - ``DW_OP_LLVM_extract_bits_sext, 16, 8,`` specifies the offset and size
6580 sign-extended from the value at the top of the expression stack. If the top of
6584 - ``DW_OP_LLVM_extract_bits_zext`` behaves similarly to
6585 ``DW_OP_LLVM_extract_bits_sext``, but zero-extends instead of sign-extending.
6587 - ``DW_OP_LLVM_tag_offset, tag_offset`` specifies that a memory tag should be
6589 given tag offset in an implementation-defined manner.
6590 - ``DW_OP_swap`` swaps top two stack entries.
6591 - ``DW_OP_xderef`` provides extended dereference mechanism. The entry at the top
6594 - ``DW_OP_stack_value`` marks a constant value.
6595 - ``DW_OP_LLVM_entry_value, N`` refers to the value a register had upon
6601 The next ``(N - 1)`` operations will be part of the ``DW_OP_entry_value``
6613 - ``LiveDebugValues`` pass, which applies it to function parameters that
6616 parameters passed-by-value to a callee via a pointer to a temporary copy
6618 - ``AsmPrinter`` pass when a call site parameter value
6621 - ``CoroSplit`` pass, which may move variables from allocas into a
6626 - ``DW_OP_LLVM_arg, N`` is used in debug intrinsics that refer to more than one
6632 ``%reg1 - reg2``. This list of values should be provided by the containing
6634 - ``DW_OP_breg`` (or ``DW_OP_bregx``) represents a content on the provided
6638 - ``DW_OP_push_object_address`` pushes the address of the object which can then
6641 - ``DW_OP_over`` duplicates the entry currently second in the stack at the top
6645 - ``DW_OP_LLVM_implicit_pointer`` It specifies the dereferenced value. It can
6651 .. code-block:: text
6654 --------------
6663 --------------
6703 .. code-block:: text
6721 .. code-block:: llvm
6744 .. code-block:: text
6764 ``DIObjCProperty`` nodes represent Objective-C property nodes.
6766 .. code-block:: text
6778 .. code-block:: text
6791 defining a function-like macro, and the ``value`` field is the token-string
6794 .. code-block:: text
6807 .. code-block:: text
6824 .. code-block:: text
6859 - ``stringLength:``, which points to a ``DIVariable`` whose value is the string
6861 - ``stringLengthExpression:``, which points to a ``DIExpression`` which
6863 - ``size``, which contains the literal length in bits.
6931 undefined if ``Offset`` is non-zero.
6947 .. code-block:: c
6961 outer->f = 0; // tag0: (OuterStructTy, FloatScalarTy, 0)
6962 outer->inner_a.i = 0; // tag1: (OuterStructTy, IntScalarTy, 12)
6963 outer->inner_a.f = 0.0; // tag2: (OuterStructTy, FloatScalarTy, 16)
6970 .. code-block:: text
7008 ``ConstantInt`` operands. With N starting from 1, the 2N - 1 th operand,
7011 must be in non-decreasing order.
7044 .. code-block:: llvm
7060 noalias memory-access sets. This means that some collection of memory access
7061 instructions (loads, stores, memory-accessing calls, etc.) that carry
7082 self-reference can be used to create globally unique domain names. A
7088 self-reference can be used to create globally unique scope names. A metadata
7094 .. code-block:: llvm
7125 .. _fpmath-metadata:
7130 ``fpmath`` metadata may be attached to any instruction of floating-point
7137 floating-point numbers ``a`` and ``b``, without being equal to one
7138 of them, then ``ulp(x) = |b - a|``, otherwise ``ulp(x)`` is the
7139 distance between the two non-equal finite floating-point numbers
7145 .. code-block:: llvm
7149 .. _range-metadata:
7162 - The type must match the scalar type of the instruction.
7163 - The pair ``a,b`` represents the range ``[a,b)``.
7164 - Both ``a`` and ``b`` are constants.
7165 - The range is allowed to wrap.
7166 - The range should not represent the full or empty set. That is,
7170 they must be non-contiguous.
7172 For vector-typed instructions, the range is applied element-wise.
7176 .. code-block:: llvm
7179 %b = load i8, ptr %y, align 1, !range !1 ; Can only be 255 (-1), 0 or 1
7182 unwind label %lpad, !range !3 ; Can only be -2, -1, 3, 4 or 5
7188 !3 = !{ i8 -2, i8 0, i8 3, i8 6 }
7198 ``range`` metadata, with the extension that the pair ``all-ones,all-ones``
7201 Example (assuming 64-bit pointers):
7203 .. code-block:: llvm
7210 !1 = !{ i64 -1, i64 -1 }
7218 this metadata is to facilitate optimizations such as indirect-call promotion.
7222 .. code-block:: llvm
7241 pass-through to the callback function.
7258 or ``i64 -1`` to indicate an unknown or inspected argument. The order in which
7272 .. FIXME why does the llvm-sphinx-docs builder give a highlighting
7276 .. code-block:: text
7286 values (each identified by a ``i64 -1``) and afterwards all
7290 .. FIXME why does the llvm-sphinx-docs builder give a highlighting
7294 .. code-block:: text
7299 !1 = !{i64 2, i64 -1, i64 -1, i1 true}
7314 .. code-block:: text
7368 .. code-block:: llvm
7379 the loop-metadata node can be attached to multiple nodes, the 'distinct'
7384 source-code location where the loop begins. The second, if present,
7385 identifies the source-code location where the loop ends.
7406 followup-attributes). Otherwise, which transformation will be applied
7409 See :ref:`transformation-metadata` for details.
7415 used to control per-loop vectorization and interleaving parameters such as
7421 which contains information about loop-carried memory dependencies can be helpful
7432 .. code-block:: llvm
7448 .. code-block:: llvm
7463 .. code-block:: llvm
7478 .. code-block:: llvm
7490 .. code-block:: llvm
7503 have. See :ref:`transformation-metadata` for details.
7513 :ref:`Transformation Metadata <transformation-metadata>` for details.
7520 See :ref:`Transformation Metadata <transformation-metadata>` for details.
7540 .. code-block:: llvm
7553 .. code-block:: llvm
7563 .. code-block:: llvm
7575 .. code-block:: llvm
7586 .. code-block:: llvm
7594 See :ref:`Transformation Metadata <transformation-metadata>` for details.
7601 :ref:`Transformation Metadata <transformation-metadata>` for details.
7627 .. code-block:: llvm
7640 .. code-block:: llvm
7652 .. code-block:: llvm
7660 have. See :ref:`Transformation Metadata <transformation-metadata>` for
7667 have. See :ref:`Transformation Metadata <transformation-metadata>` for
7676 :ref:`Transformation Metadata <transformation-metadata>` for details.
7684 :ref:`Transformation Metadata <transformation-metadata>` for details.
7691 :ref:`Transformation Metadata <transformation-metadata>` for details.
7697 of enabling loop-invariant code motion (LICM). The metadata has a single operand
7700 .. code-block:: llvm
7717 .. code-block:: llvm
7730 :ref:`Transformation Metadata <transformation-metadata>` for details.
7737 :ref:`Transformation Metadata <transformation-metadata>` for details.
7743 the non-distributed fallback version will have. See
7744 :ref:`Transformation Metadata <transformation-metadata>` for details.
7751 :ref:`Transformation Metadata <transformation-metadata>` for details.
7756 This metadata indicates that loop-invariant code motion (LICM) should not be
7760 .. code-block:: llvm
7777 .. code-block:: llvm
7806 no loop-carried memory dependence exist between it and other instructions
7818 If all memory-accessing instructions in a loop have
7822 parallel loop. If there is a loop-carried dependency, the behavior is
7837 .. code-block:: llvm
7854 .. code-block:: llvm
7906 .. code-block:: llvm
7933 .. code-block:: llvm
7965 .. code-block:: llvm
7990 - Be in ``@llvm.compiler.used``.
7991 - If the referenced global variable is in a comdat, be in the same comdat.
7993 ``!associated`` can not express many-to-one relationship. A global variable with
7997 alive, but this many-to-one relationship is not representable. Moreover, if the
8003 linker-defined encapsulation symbols ``__start_<section_name>`` and
8006 It does not have any effect on non-ELF targets.
8010 .. code-block:: text
8071 .. code-block:: llvm
8074 !1 = !{!"VP", i32 0, i64 1600, i64 7651369219802541373, i64 1030, i64 -4377547752858689819, i64 410}
8096 .. code-block:: text
8099 !0 = !{!"auto-init"}
8103 .. code-block:: text
8121 .. code-block:: text
8142 .. code-block:: text
8149 Clang emits ``kcfi_type`` metadata nodes for address-taken functions with
8150 ``-fsanitize=kcfi``.
8158 allocation calls. Multiple context-sensitive profiles can be represented
8163 .. code-block:: text
8170 !4 = !{i64 4854880825882961848, i64 -6528110295079665978}
8186 different module. The contexts are listed in order from leaf-most call (the
8205 .. code-block:: text
8208 !0 = !{i64 -6528110295079665978, i64 5462047985461644151}
8215 full inline sequence, in order from the leaf-most call's id to the outermost
8228 This follows the same form as :ref:`range metadata <range-metadata>`,
8234 .. code-block:: llvm
8261 this. These flags are in the form of key / value pairs --- much like a
8262 dictionary --- making it easy for any subsystem who cares about a flag to
8268 - The first element is a *behavior* flag, which specifies the behavior
8272 - The second element is a metadata string that is a unique ID for the
8275 - The third element is the value of the flag.
8286 .. list-table::
8287 :header-rows: 1
8290 * - Value
8291 - Behavior
8293 * - 1
8294 - **Error**
8298 * - 2
8299 - **Warning**
8306 * - 3
8307 - **Require**
8316 * - 4
8317 - **Override**
8322 * - 5
8323 - **Append**
8326 * - 6
8327 - **AppendUnique**
8332 * - 7
8333 - **Max**
8336 * - 8
8337 - **Min**
8338 Takes the min of the two values, which are required to be non-negative integers.
8347 .. code-block:: llvm
8359 - Metadata ``!0`` has the ID ``!"foo"`` and the value '1'. The behavior
8363 - Metadata ``!1`` has the ID ``!"bar"`` and the value '37'. The
8367 - Metadata ``!2`` has the ID ``!"qux"`` and the value '42'. The
8371 - Metadata ``!3`` has the ID ``!"qux"`` and the value:
8382 -------------------------------------------
8393 - "frame-pointer": **Max**. The value can be 0, 1, or 2. A synthesized function
8394 will get the "frame-pointer" function attribute, with value being "none",
8395 "non-leaf", or "all", respectively.
8396 - "function_return_thunk_extern": The synthesized function will get the
8398 - "uwtable": **Max**. The value can be 0, 1, or 2. If the value is 1, a synthesized
8402 Objective-C Garbage Collection Module Flags Metadata
8403 ----------------------------------------------------
8405 On the Mach-O platform, Objective-C stores metadata about garbage
8412 The Objective-C garbage collection module flags metadata consists of the
8413 following key-value pairs:
8415 .. list-table::
8416 :header-rows: 1
8419 * - Key
8420 - Value
8422 * - ``Objective-C Version``
8423 - **[Required]** --- The Objective-C ABI version. Valid values are 1 and 2.
8425 * - ``Objective-C Image Info Version``
8426 - **[Required]** --- The version of the image info section. Currently
8429 * - ``Objective-C Image Info Section``
8430 - **[Required]** --- The section to place the metadata. Valid values are
8431 ``"__OBJC, __image_info, regular"`` for Objective-C ABI version 1, and
8433 Objective-C ABI version 2.
8435 * - ``Objective-C Garbage Collection``
8436 - **[Required]** --- Specifies whether garbage collection is supported or
8440 * - ``Objective-C GC Only``
8441 - **[Optional]** --- Specifies that only garbage collection is supported.
8443 ``Objective-C Garbage Collection`` flag have the value 2.
8447 - If a module with ``Objective-C Garbage Collection`` set to 0 is
8448 merged with a module with ``Objective-C Garbage Collection`` set to
8450 ``Objective-C Garbage Collection`` flag set to 0.
8451 - A module with ``Objective-C Garbage Collection`` set to 0 cannot be
8452 merged with a module with ``Objective-C GC Only`` set to 6.
8455 ----------------------------------
8458 options that it was compiled with (in a compiler-independent way) to prevent
8464 flags metadata, using the following key-value pairs:
8466 .. list-table::
8467 :header-rows: 1
8470 * - Key
8471 - Value
8473 * - short_wchar
8474 - * 0 --- sizeof(wchar_t) == 4
8475 * 1 --- sizeof(wchar_t) == 2
8477 * - short_enum
8478 - * 0 --- Enums are at least as large as an ``int``.
8479 * 1 --- Enums are stored in the smallest integer type which can
8491 ------------------------
8500 !0 = !{i32 1, !"override-stack-alignment", i32 8}
8534 !0 = !{ !"-lz" }
8535 !1 = !{ !"-framework", !"Cocoa" }
8558 ``!llvm.dependent-libraries``. Each operand is expected to be a metadata node
8565 !llvm.dependent-libraries = !{ !0, !1 }
8581 IR, via the "``llvm-as``" tool. Tools that parse the Module IR for the purposes
8582 of optimization (e.g. "``clang -x ir``" and "``opt``"), will ignore the
8589 (i.e. llvm-lto and llvm-lto2), or when parsing a combined index
8590 for a distributed ThinLTO backend via clang's "``-fthinlto-index=<>``" flag
8591 (this part is not yet implemented, use llvm-as to create a bitcode object
8602 -------------------------
8611 .. code-block:: text
8616 field is the 160-bit SHA-1 hash of the IR bitcode contents, used for
8622 --------------------------
8629 .. code-block:: text
8649 .. code-block:: text
8670 .. code-block:: text
8684 .. code-block:: text
8699 .. code-block:: text
8713 .. code-block:: text
8719 .. code-block:: text
8736 .. code-block:: text
8743 .. code-block:: text
8755 .. code-block:: text
8757 callee: ^3, param: 5, offset: [-3, 3]
8772 .. code-block:: text
8786 .. code-block:: text
8788 params: ((param: 0, offset: [0, 7]),(param: 2, offset: [5, 5], calls: ((callee: ^3, param: 1, offset: [-128, 127]))))
8807 .. code-block:: text
8823 .. code-block:: text
8832 .. code-block:: text
8842 .. code-block:: text
8848 .. code-block:: text
8858 .. code-block:: text
8867 .. code-block:: text
8873 .. code-block:: text
8883 .. code-block:: text
8893 ---------------------
8902 .. code-block:: text
8908 the ``size-1`` bit width. It is followed by optional flags, which default to 0,
8912 .. code-block:: text
8916 where each entry is a mapping from the given byte offset to the whole-program
8919 .. code-block:: text
8928 .. code-block:: text
8934 .. code-block:: text
8959 -----------------------------------
8967 .. code-block:: llvm
8992 --------------------------------------------
9006 -------------------------------------------
9008 .. code-block:: llvm
9019 If the third field is non-null, and points to a global variable
9027 -------------------------------------------
9029 .. code-block:: llvm
9040 If the third field is non-null, and points to a global variable
9060 -----------------------
9088 ret <type> <value> ; Return a value from a non-void function
9108 A function is not :ref:`well formed <wellformed>` if it has a non-void
9129 .. code-block:: llvm
9176 .. code-block:: llvm
9236 .. code-block:: llvm
9299 .. code-block:: llvm
9333 as its first non-PHI instruction. The restrictions on the
9386 '``catch``' clauses in high-level languages that support them.
9396 .. code-block:: llvm
9489 .. code-block:: llvm
9528 (in-flight) exception whose unwinding was interrupted with a
9534 .. code-block:: llvm
9568 the `exception handling documentation\ <ExceptionHandling.html#wineh-constraints>`_.
9581 it must be both the first non-phi instruction and last instruction in the basic
9582 block. Therefore, it must be the only non-phi instruction in the block.
9587 .. code-block:: text
9624 The '``catchret``' instruction ends an existing (in-flight) exception whose
9631 If the specified ``catchpad`` is not the most-recently-entered not-yet-exited
9632 funclet pad (as described in the `EH documentation\ <ExceptionHandling.html#wineh-constraints>`_),
9638 .. code-block:: text
9667 If the specified ``cleanuppad`` is not the most-recently-entered not-yet-exited
9668 funclet pad (as described in the `EH documentation\ <ExceptionHandling.html#wineh-constraints>`_),
9675 `exception handling documentation\ <ExceptionHandling.html#wineh-constraints>`_.
9688 .. code-block:: text
9711 after a no-return function cannot be reached, and other facts.
9721 -----------------
9738 <result> = fneg [fast-math flags]* <ty> <op1> ; yields ty:result
9749 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>` of
9750 floating-point values.
9759 This instruction can also take any number of :ref:`fast-math
9761 unsafe floating-point optimizations:
9766 .. code-block:: text
9768 <result> = fneg float %val ; yields float:result = -%var
9773 -----------------
9830 .. code-block:: text
9844 <result> = fadd [fast-math flags]* <ty> <op1>, <op2> ; yields ty:result
9855 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>` of
9856 floating-point values. Both arguments must have identical types.
9861 The value produced is the floating-point sum of the two operands.
9862 This instruction is assumed to execute in the default :ref:`floating-point
9864 This instruction can also take any number of :ref:`fast-math
9866 unsafe floating-point optimizations:
9871 .. code-block:: text
9925 .. code-block:: text
9927 <result> = sub i32 4, %var ; yields i32:result = 4 - %var
9928 <result> = sub i32 0, %val ; yields i32:result = -%var
9940 <result> = fsub [fast-math flags]* <ty> <op1>, <op2> ; yields ty:result
9951 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>` of
9952 floating-point values. Both arguments must have identical types.
9957 The value produced is the floating-point difference of the two operands.
9958 This instruction is assumed to execute in the default :ref:`floating-point
9960 This instruction can also take any number of :ref:`fast-math
9962 unsafe floating-point optimizations:
9967 .. code-block:: text
9969 <result> = fsub float 4.0, %var ; yields float:result = 4.0 - %var
9970 <result> = fsub float -0.0, %val ; yields float:result = -%var
10011 (e.g. ``i32`` * ``i32`` -> ``i64``) is needed, the operands should be
10012 sign-extended or zero-extended as appropriate to the width of the full
10023 .. code-block:: text
10037 <result> = fmul [fast-math flags]* <ty> <op1>, <op2> ; yields ty:result
10048 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>` of
10049 floating-point values. Both arguments must have identical types.
10054 The value produced is the floating-point product of the two operands.
10055 This instruction is assumed to execute in the default :ref:`floating-point
10057 This instruction can also take any number of :ref:`fast-math
10059 unsafe floating-point optimizations:
10064 .. code-block:: text
10112 .. code-block:: text
10153 occur, for example, by doing a 32-bit division of -2147483648 by -1.
10161 .. code-block:: text
10175 <result> = fdiv [fast-math flags]* <ty> <op1>, <op2> ; yields ty:result
10186 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>` of
10187 floating-point values. Both arguments must have identical types.
10192 The value produced is the floating-point quotient of the two operands.
10193 This instruction is assumed to execute in the default :ref:`floating-point
10195 This instruction can also take any number of :ref:`fast-math
10197 unsafe floating-point optimizations:
10202 .. code-block:: text
10248 .. code-block:: text
10299 occur, for example, by taking the remainder of a 32-bit division of
10300 -2147483648 by -1. (The remainder doesn't actually overflow, but this
10307 .. code-block:: text
10321 <result> = frem [fast-math flags]* <ty> <op1>, <op2> ; yields ty:result
10339 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>` of
10340 floating-point values. Both arguments must have identical types.
10345 The value produced is the floating-point remainder of the two operands.
10349 This instruction is assumed to execute in the default :ref:`floating-point
10351 This instruction can also take any number of :ref:`fast-math
10353 unsafe floating-point optimizations:
10358 .. code-block:: text
10365 -------------------------
10367 Bitwise binary operators are used to do various forms of bit-twiddling
10412 value if it shifts out any non-zero bits.
10419 .. code-block:: text
10465 a poison value if any of the bits shifted out are non-zero.
10470 .. code-block:: text
10475 <result> = lshr i8 -2, 1 ; yields i8:result = 0x7F
10477 <result> = lshr <2 x i32> < i32 -2, i32 4>, < i32 1, i32 2> ; yields: result=<2 x i32> < i32 0x7FFFFFFF, i32 1>
10517 a poison value if any of the bits shifted out are non-zero.
10522 .. code-block:: text
10527 <result> = ashr i8 -2, 1 ; yields i8:result = -1
10529 <result> = ashr <2 x i32> < i32 -2, i32 4>, < i32 1, i32 3> ; yields: result=<2 x i32> < i32 -1, i32 0>
10561 +-----+-----+-----+
10563 +-----+-----+-----+
10565 +-----+-----+-----+
10567 +-----+-----+-----+
10569 +-----+-----+-----+
10571 +-----+-----+-----+
10576 .. code-block:: text
10613 +-----+-----+-----+
10615 +-----+-----+-----+
10617 +-----+-----+-----+
10619 +-----+-----+-----+
10621 +-----+-----+-----+
10623 +-----+-----+-----+
10671 +-----+-----+-----+
10673 +-----+-----+-----+
10675 +-----+-----+-----+
10677 +-----+-----+-----+
10679 +-----+-----+-----+
10681 +-----+-----+-----+
10686 .. code-block:: text
10691 <result> = xor i32 %V, -1 ; yields i32:result = ~%V
10694 -----------------
10697 target-independent manner. These instructions cover the element-access
10698 and vector-specific operations needed to process vectors effectively.
10700 sophisticated algorithms will want to use target-specific intrinsics to
10735 exceeds the length of ``val`` for a fixed-length vector, the result is a
10743 .. code-block:: text
10781 ``elt``. If ``idx`` exceeds the length of ``val`` for a fixed-length vector,
10789 .. code-block:: text
10829 to the result. Non-negative elements in the mask represent an index
10834 For backwards-compatibility reasons, LLVM temporarily also accepts ``undef``
10846 .. code-block:: text
10851 <4 x i32> <i32 0, i32 1, i32 2, i32 3> ; yields <4 x i32> - Identity shuffle.
10858 --------------------
10891 - Since the value being indexed is not a pointer, the first index is
10893 - At least one index must be specified.
10894 - Not only struct indices but also array indices must be in bounds.
10905 .. code-block:: text
10932 a first-class value to insert. The following operands are constant
10948 .. code-block:: llvm
10957 ---------------------------------------
10959 A key design point of an SSA-based representation is how it represents
10998 The alignment is only optional when parsing textual IR; for in-memory IR,
11031 lifetime-manipulating intrinsics.
11036 .. code-block:: llvm
11054 <result> = load atomic [volatile] <ty>, ptr <pointer> [syncscope("<target-scope>")] <ordering>, align <alignment> [, !invariant.group !<empty_node>]
11076 <ordering>` and optional ``syncscope("<target-scope>")`` argument. The
11080 floating-point type whose bit width is a power of two greater than or equal to
11081 eight and less than or equal to a target-specific size limit. ``align`` must be
11099 The alignment is only optional when parsing textual IR; for in-memory IR, it is
11157 metadata is combined with poison-generating metadata like ``!nonnull``,
11173 If ``<pointer>`` is not a well-defined value, the behavior is undefined.
11178 .. code-block:: llvm
11195 store atomic [volatile] <ty> <value>, ptr <pointer> [syncscope("<target-scope>")] <ordering>, align <alignment> [, !invariant.group !<empty_node>] ; yields void
11217 <ordering>` and optional ``syncscope("<target-scope>")`` argument. The
11221 floating-point type whose bit width is a power of two greater than or equal to
11222 eight and less than or equal to a target-specific size limit. ``align`` must be
11240 The alignment is only optional when parsing textual IR; for in-memory IR, it is
11268 If ``<pointer>`` is not a well-defined value, the behavior is undefined.
11273 .. code-block:: llvm
11289 fence [syncscope("<target-scope>")] <ordering> ; yields void
11294 The '``fence``' instruction is used to introduce happens-before edges
11301 defines what *synchronizes-with* edges they add. They can only be given
11313 *happens-before* dependency between A and B. Rather than an explicit
11316 still *synchronize-with* the explicit ``fence`` and establish the
11317 *happens-before* edge.
11335 .. code-block:: text
11351 cmpxchg [weak] [volatile] ptr <pointer>, <ty> <cmp>, <ty> <new> [syncscope("<target-scope>")] <success ordering> <failure ordering>[, align <alignment>] ; yields { ty, i1 }
11368 than or equal to a target-specific size limit. '<cmp>' and '<new>' must
11386 The alignment is only optional when parsing textual IR; for in-memory IR, it is
11410 A successful ``cmpxchg`` is a read-modify-write instruction for the purpose of
11417 .. code-block:: llvm
11444 atomicrmw [volatile] <operation> ptr <pointer>, <ty> <value> [syncscope("<target-scope>")] <ordering>[, align <alignment>] ; yields ty
11458 - xchg
11459 - add
11460 - sub
11461 - and
11462 - nand
11463 - or
11464 - xor
11465 - max
11466 - min
11467 - umax
11468 - umin
11469 - fadd
11470 - fsub
11471 - fmax
11472 - fmin
11473 - uinc_wrap
11474 - udec_wrap
11475 - usub_cond
11476 - usub_sat
11480 and less than or equal to a target-specific size limit. For xchg, this
11482 as integers. For fadd/fsub/fmax/fmin, this must be a floating-point
11483 or fixed vector of floating-point type. The type of the '``<pointer>``'
11493 The alignment is only optional when parsing textual IR; for in-memory IR, it is
11510 - xchg: ``*ptr = val``
11511 - add: ``*ptr = *ptr + val``
11512 - sub: ``*ptr = *ptr - val``
11513 - and: ``*ptr = *ptr & val``
11514 - nand: ``*ptr = ~(*ptr & val)``
11515 - or: ``*ptr = *ptr | val``
11516 - xor: ``*ptr = *ptr ^ val``
11517 - max: ``*ptr = *ptr > val ? *ptr : val`` (using a signed comparison)
11518 - min: ``*ptr = *ptr < val ? *ptr : val`` (using a signed comparison)
11519 - umax: ``*ptr = *ptr > val ? *ptr : val`` (using an unsigned comparison)
11520 - umin: ``*ptr = *ptr < val ? *ptr : val`` (using an unsigned comparison)
11521 - fadd: ``*ptr = *ptr + val`` (using floating point arithmetic)
11522 - fsub: ``*ptr = *ptr - val`` (using floating point arithmetic)
11523 - fmax: ``*ptr = maxnum(*ptr, val)`` (match the `llvm.maxnum.*`` intrinsic)
11524 - fmin: ``*ptr = minnum(*ptr, val)`` (match the `llvm.minnum.*`` intrinsic)
11525 - uinc_wrap: ``*ptr = (*ptr u>= val) ? 0 : (*ptr + 1)`` (increment value with wraparound to zero when incremented above input value)
11526 - udec_wrap: ``*ptr = ((*ptr == 0) || (*ptr u> val)) ? val : (*ptr - 1)`` (decrement with wraparound to input value when decremented below zero).
11527 - usub_cond: ``*ptr = (*ptr u>= val) ? *ptr - val : *ptr`` (subtract only if no unsigned overflow).
11528 - usub_sat: ``*ptr = (*ptr u>= val) ? *ptr - val : 0`` (subtract with unsigned clamping to zero).
11534 .. code-block:: llvm
11574 can be non-zero), etc. The first type indexed into must be a pointer
11590 .. code-block:: c
11609 .. code-block:: llvm
11638 .. code-block:: llvm
11651 index is sign-extended or truncated to the pointer index type. Otherwise, the
11652 index itself is sign-extended or truncated, and then multiplied by the type
11657 type width, with silently-wrapping two's complement arithmetic. If the pointer
11670 pointers, the attributes apply to each computation element-wise.
11700 if the ``getelementptr`` has any non-zero indices, the following rules apply:
11705 live anymore; being in-bounds of a deallocated object is sufficient.
11709 Note that ``getelementptr`` with all-zero indices is always considered to be
11724 behavior if the load or store would access memory outside the half-open range
11726 a pointer comparison or ``ptrtoint`` (including ``ptrtoint``-like operations
11739 .. code-block:: llvm
11754 .. code-block:: llvm
11772 .. code-block:: llvm
11786 .. code-block:: c
11794 .. code-block:: llvm
11803 ---------------------
11843 be larger than the destination size, ``trunc`` cannot be a *no-op cast*.
11846 If the ``nuw`` keyword is present, and any of the truncated bits are non-zero,
11854 .. code-block:: llvm
11878 The ``nneg`` (non-negative) flag, if present, specifies that the operand is
11879 non-negative. This property may be used by optimization passes to later
11904 .. code-block:: llvm
11911 %b = zext nneg i8 -1 to i16 ; yields i16 poison
11945 When sign extending from i1, the extension always results in -1 or 0.
11950 .. code-block:: llvm
11952 %X = sext i8 -1 to i16 ; yields i16 :65535
11953 %Y = sext i1 true to i32 ; yields i32:-1
11966 <result> = fptrunc [fast-math flags]* <ty> <value> to <ty2> ; yields ty2
11976 The '``fptrunc``' instruction takes a :ref:`floating-point <t_floating>`
11977 value to cast and a :ref:`floating-point <t_floating>` type to cast it to.
11979 implies that ``fptrunc`` cannot be used to make a *no-op cast*.
11985 :ref:`floating-point <t_floating>` type to a smaller :ref:`floating-point
11987 This instruction is assumed to execute in the default :ref:`floating-point
11994 the low order bits leads to an all-0 payload, this cannot be represented as a
11998 This instruction can also take any number of :ref:`fast-math
12000 unsafe floating-point optimizations.
12005 .. code-block:: llvm
12020 <result> = fpext [fast-math flags]* <ty> <value> to <ty2> ; yields ty2
12025 The '``fpext``' extends a floating-point ``value`` to a larger floating-point
12031 The '``fpext``' instruction takes a :ref:`floating-point <t_floating>`
12032 ``value`` to cast, and a :ref:`floating-point <t_floating>` type to cast it
12039 :ref:`floating-point <t_floating>` type to a larger :ref:`floating-point
12041 *no-op cast* because it always changes bits. Use ``bitcast`` to make a
12042 *no-op cast* for a floating-point cast.
12049 This instruction can also take any number of :ref:`fast-math
12051 unsafe floating-point optimizations.
12056 .. code-block:: llvm
12074 The '``fptoui``' converts a floating-point ``value`` to its unsigned
12081 scalar or vector :ref:`floating-point <t_floating>` value, and a type to
12083 ``ty`` is a vector floating-point type, ``ty2`` must be a vector integer
12089 The '``fptoui``' instruction converts its :ref:`floating-point
12097 .. code-block:: llvm
12116 The '``fptosi``' instruction converts :ref:`floating-point <t_floating>`
12123 scalar or vector :ref:`floating-point <t_floating>` value, and a type to
12125 ``ty`` is a vector floating-point type, ``ty2`` must be a vector integer
12131 The '``fptosi``' instruction converts its :ref:`floating-point
12139 .. code-block:: llvm
12141 %X = fptosi double -123.0 to i32 ; yields i32:-123
12142 %Y = fptosi float 1.0E-247 to i1 ; yields undefined:1
12161 The ``nneg`` (non-negative) flag, if present, specifies that the
12162 operand is non-negative. This property may be used by optimization
12170 ``ty2``, which must be an :ref:`floating-point <t_floating>` type. If
12171 ``ty`` is a vector integer type, ``ty2`` must be a vector floating-point
12178 integer quantity and converts it to the corresponding floating-point
12189 .. code-block:: llvm
12192 %Y = uitofp i8 -1 to double ; yields double:255.0
12195 %b = uitofp nneg i32 -256 to i32 ; yields i32 poison
12218 ``ty2``, which must be an :ref:`floating-point <t_floating>` type. If
12219 ``ty`` is a vector integer type, ``ty2`` must be a vector floating-point
12226 quantity and converts it to the corresponding floating-point value. If the
12233 .. code-block:: llvm
12236 %Y = sitofp i8 -1 to double ; yields double:-1.0
12272 the same size, then nothing is done (*no-op cast*) other than a type
12278 .. code-block:: llvm
12280 %X = ptrtoint ptr %P to i8 ; yields truncation on 32-bit architecture
12281 %Y = ptrtoint ptr %P to i64 ; yields zero extension on 32-bit architecture
12282 %Z = ptrtoint <4 x ptr> %P to <4 x i64>; yields vector zero extension for a vector of addresses on 32-bit architecture
12327 nothing is done (*no-op cast*).
12332 .. code-block:: llvm
12334 %X = inttoptr i32 255 to ptr ; yields zero extension on 64-bit architecture
12335 %Y = inttoptr i32 255 to ptr ; yields no-op on 32-bit architecture
12336 %Z = inttoptr i64 0 to ptr ; yields truncation on 32-bit architecture
12361 non-aggregate first class value, and a type to cast it to, which must
12362 also be a non-aggregate :ref:`first class <t_firstclass>` type. The
12373 is always a *no-op cast* because no bits change with this
12383 of the vector in the least significant bits of the i16 for little-endian while
12384 element zero ends up in the most significant bits for big-endian.
12389 .. code-block:: text
12391 %X = bitcast i8 255 to i8 ; yields i8 :-1
12425 ``ptrval`` to type ``pty2``. It can be a *no-op cast* or a complex
12445 .. code-block:: llvm
12454 ----------------
12546 .. code-block:: text
12552 <result> = icmp ule i16 -4, 5 ; yields: result=false
12565 <result> = fcmp [fast-math flags]* <cond> <ty> <op1>, <op2> ; yields i1 or <N x i1>:result
12573 If the operands are floating-point scalars, then the result type is a
12576 If the operands are floating-point vectors, then the result type is a
12607 Each of ``val1`` and ``val2`` arguments must be either a :ref:`floating-point
12608 <t_floating>` type or a :ref:`vector <t_vector>` of floating-point type.
12649 :ref:`fast-math flags <fastmath>`, which are optimization hints to enable
12650 otherwise unsafe floating-point optimizations.
12652 Any set of fast-math flags are legal on an ``fcmp`` instruction, but the
12660 .. code-block:: text
12677 <result> = phi [fast-math-flags] <ty> [ <val0>, <label0>], ...
12695 There must be no non-phi instructions between the start of a basic block
12704 The optional ``fast-math-flags`` marker indicates that the phi has one
12705 or more :ref:`fast-math-flags <fastmath>`. These are optimization hints
12706 to enable otherwise unsafe floating-point optimizations. Fast-math-flags
12707 are only valid for phis that return :ref:`supported floating-point types
12720 .. code-block:: llvm
12737 <result> = select [fast-math flags] selty <cond>, <ty> <val1>, <ty> <val2> ; yields ty
12745 condition, without IR-level branching.
12754 #. The optional ``fast-math flags`` marker indicates that the select has one or more
12755 :ref:`fast-math flags <fastmath>`. These are optimization hints to enable
12756 otherwise unsafe floating-point optimizations. Fast-math flags are only valid
12757 for selects that return :ref:`supported floating-point types
12776 .. code-block:: llvm
12809 Otherwise, this instruction is a no-op and returns the input argument.
12815 non-dereferenceable pointer. See the
12817 If an aggregate value or vector is frozen, the operand is frozen element-wise.
12825 .. code-block:: text
12841 %v.fr = freeze <2 x i32> %v ; element-wise freeze
12848 br i1 %c, label %foo, label %bar ; non-deterministic branch to %foo or %bar
12861 <result> = [tail | musttail | notail ] call [fast-math flags] [cconv] [ret attrs] [addrspace(<num>)]
12876 `can be ignored <CodeGenerator.html#tail-call-optimization>`_. The
12879 attributes like "disable-tail-calls". The ``musttail`` marker provides these
12882 - The call will not cause unbounded stack growth if it is part of a
12884 - Arguments with the :ref:`inalloca <attr_inalloca>` or
12886 - If the musttail call appears in a function with the ``"thunk"`` attribute
12897 .. code-block:: llvm
12903 ; may be de-allocated before the call to @take_ptr.
12944 ; passed to tail callee as non-byval ptr.
12953 - The call must immediately precede a :ref:`ret <i_ret>` instruction,
12955 - The ret instruction must return the (possibly bitcasted) value
12957 - The calling conventions of the caller and callee must match.
12958 - The callee must be varargs iff the caller is varargs. Bitcasting a
12959 non-varargs function to the appropriate varargs type is legal so
12960 long as the non-varargs prefixes obey the other rules.
12961 - The return type must not undergo automatic conversion to an `sret` pointer.
12965 - All ABI-impacting function attributes, such as sret, byval, inreg,
12967 - The caller and callee prototypes must match. Pointer types of parameters
12972 - Only these ABI-impacting attributes attributes are allowed: sret, byval,
12974 - Prototypes are not required to match.
12979 - Caller and callee both have the calling convention ``fastcc`` or ``tailcc``.
12980 - The call is in tail position (ret immediately follows call and ret
12982 - Option ``-tailcallopt`` is enabled, ``llvm::GuaranteedTailCallOpt`` is
12984 - `Platform-specific constraints are met.
12985 <CodeGenerator.html#tail-call-optimization>`_
12991 #. The optional ``fast-math flags`` marker indicates that the call has one or more
12992 :ref:`fast-math flags <fastmath>`, which are optimization hints to enable
12993 otherwise unsafe floating-point optimizations. Fast-math flags are only valid
12994 for calls that return :ref:`supported floating-point types <fastmath_return_types>`.
13037 .. code-block:: llvm
13056 support for freestanding environments and non-C-based languages.
13130 is a landing pad --- one where the exception lands, and corresponds to the
13133 re-entry to the function. The ``resultval`` has the type ``resultty``.
13141 A ``clause`` begins with the clause type --- ``catch`` or ``filter`` --- and
13153 :ref:`personality function <personalityfn>` upon re-entry to the function, and
13168 - A landing pad block is a basic block which is the unwind destination
13170 - A landing pad block must have a '``landingpad``' instruction as its
13171 first non-PHI instruction.
13172 - There can be only one '``landingpad``' instruction within the landing
13174 - A basic block that is not a landing pad block may not include a
13180 .. code-block:: llvm
13210 begins a catch handler --- one where a personality routine attempts to transfer
13236 entirely target and personality function-specific.
13239 instruction must be the first non-phi of its parent basic block.
13246 described in the `EH documentation\ <ExceptionHandling.html#wineh-constraints>`_),
13253 .. code-block:: text
13278 is a cleanup block --- one where a personality routine attempts to
13300 ``cleanuppad`` with the aid of the personality-specific arguments.
13306 - A cleanup block is a basic block which is the unwind destination of
13308 - A cleanup block must have a '``cleanuppad``' instruction as its
13309 first non-PHI instruction.
13310 - There can be only one '``cleanuppad``' instruction within the
13312 - A basic block that is not a cleanup block may not include a
13316 described in the `EH documentation\ <ExceptionHandling.html#wineh-constraints>`_),
13323 .. code-block:: text
13330 -----------------------
13337 .. code-block:: llvm
13344 Debug records will be disabled if ``--write-experimental-debuginfo=false`` is
13347 Source Level Debugging <SourceLevelDebugging.html#format-common-intrinsics>`_
13404 For target developers who are defining intrinsics for back-end code
13420 -------------------------------------
13427 All of these functions take as arguments pointers to a target-specific
13436 .. code-block:: llvm
13495 available in C. In a target-dependent way, it initializes the
13528 available in C. In a target-dependent way, it destroys the ``va_list``
13564 available in C. In a target-dependent way, it copies the source
13570 --------------------------------------
13580 Frontends for type-safe garbage collected languages should generate
13615 a global value address) contains the meta-data to be associated with the
13622 "ptrloc" location. At compile-time, the code generator generates
13720 The statepoint intrinsic represents a call which is parse-able by the
13733 If 'num patch bytes' is non-zero then the call instruction
13761 as GC transitions. This operand is a 64-bit integer with the following
13764 +-------+---------------------------------------------------+
13769 +-------+---------------------------------------------------+
13770 | 1-63 | Reserved for future use; must be cleared. |
13771 +-------+---------------------------------------------------+
13866 corresponding statepoint's :ref:`gc-live <ob_gc_live>` operand bundle.
13878 argument if-and-only-if a base pointer is being relocated.
13887 language object with the same offset, and b) the 'based-on'
13979 -------------------------
13998 target-specific value indicating the return address of the current
14020 of the obvious source-language caller.
14035 The '``llvm.addressofreturnaddress``' intrinsic returns a target-specific
14044 of the obvious source-language caller.
14083 target-specific frame pointer value for the specified stack frame.
14104 of the obvious source-language caller.
14163 pointer in platform-specific ways.
14166 '``llvm.localescape``' to recover. It is zero-indexed.
14199 When a C-function is compiled with Windows SEH Asynchronous Exception option,
14200 -feh_asynch (aka MSVC -EHa), these two intrinsics are injected to mark _try
14221 Handling (MSVC option -EHa).
14226 LLVM's ordinary exception-handling representation associates EH cleanups and
14230 into an ``invoke`` of a new, potentially-throwing intrinsic would require adding a
14234 C++ object with a non-trivial destructor. ``llvm.seh.scope.begin`` is used to mark
14236 being the desired unwind destination for any potentially-throwing instructions
14277 A call to '``llvm.read_volatile_register``' is assumed to have side-effects
14282 bare-metal programs including OS kernels.
14383 These intrinsics return a non-negative integer value that can be used to
14393 compile-time-known constant value.
14421 ``locality`` is a temporal locality specifier ranging from (0) - no
14422 locality, to (3) - extremely local keep in cache. The ``cache type``
14496 Note that runtime support may be conditional on the privilege-level code is
14514 targets with non-unified instruction and data cache, the implementation
14521 intrinsic is a nop. On platforms with non-coherent instruction and data
14541 i32 <num-counters>, i32 <index>)
14548 lowered by the ``-instrprof`` pass to generate execution counts of a
14561 error if ``hash`` or ``num-counters`` differ between two instances of
14565 be incremented. It should be a value between 0 and ``num-counters``.
14571 cause the ``-instrprof`` pass to generate the appropriate data
14574 the ``llvm-profdata`` tool.
14580 ``-ctx-instr-lower`` pass. Here:
14582 * the entry basic block increment counter is lowered as a call to compiler-rt,
14586 pointer value returned by compiler-rt may have its LSB set - counter increments
14604 i32 <num-counters>,
14634 i32 <num-counters>,
14642 contextual profiling and has side-effects. Its lowering happens in IR, and
14643 target-specific backends should never encounter it.
14658 from compiler-rt, a pointer to a context object. The context object consists of
14661 buffer, ``<num-counters>`` x ``sizeof(ptr)`` - sized, is expected to contain
14673 ``__llvm_ctx_profile_{expected_callee|callsite}`` are initialized by compiler-rt
14676 compiler-rt. The pointer's LSB gives the index.
14688 i32 <num-counters>, i32 <index>)
14715 i32 <num-counters>, i32 <index>)
14751 lowered by the ``-instrprof`` pass to find out the target values,
14767 expression's value should be representable as an unsigned 64-bit value. The
14778 should be inserted for value profiling of target expressions. ``-instrprof``
14792 i32 <bitmap-bits>)
14817 instrumentation sequences in a function. It will cause the ``-instrprof`` pass
14820 consumed via the ``llvm-profdata`` tool.
14831 i32 <bitmap-index>,
14832 ptr <mcdc-temp-addr>)
14865 sequence and will cause the ``-instrprof`` pass to generate the code to
14868 by the ``llvm-profdata`` and ``llvm-cov`` tools.
14926 :: code-block:: llvm
14935 :: code-block:: llvm
15024 .. code-block:: llvm
15040 ---------------------------------
15043 functions. These intrinsics allow source-language front-ends to pass
15110 Vector intrinsics operate on a per-element basis. The larger element of ``%a``
15141 Vector intrinsics operate on a per-element basis. The smaller element of ``%a``
15172 integers. Vector intrinsics operate on a per-element basis. The larger element
15203 integers. Vector intrinsics operate on a per-element basis. The smaller element
15232 Return ``-1`` if ``%a`` is signed less than ``%b``, ``0`` if they are equal, and
15233 ``1`` if ``%a`` is signed greater than ``%b``. Vector intrinsics operate on a per-element basis.
15261 Return ``-1`` if ``%a`` is unsigned less than ``%b``, ``0`` if they are equal, and
15262 ``1`` if ``%a`` is unsigned greater than ``%b``. Vector intrinsics operate on a per-element basis.
15320 non-overlapping. It copies "len" bytes of memory over. If the argument is known
15324 If ``<len>`` is 0, it is no-op modulo the behavior of attributes attached to
15326 If ``<len>`` is not a well-defined value, the behavior is undefined.
15327 If ``<len>`` is not zero, both ``<dest>`` and ``<src>`` should be well-defined,
15442 If ``<len>`` is 0, it is no-op modulo the behavior of attributes attached to
15444 If ``<len>`` is not a well-defined value, the behavior is undefined.
15445 If ``<len>`` is not zero, both ``<dest>`` and ``<src>`` should be well-defined,
15500 If ``<len>`` is 0, it is no-op modulo the behavior of attributes attached to
15502 If ``<len>`` is not a well-defined value, the behavior is undefined.
15503 If ``<len>`` is not zero, ``<dest>`` should be well-defined, otherwise the
15558 If ``<len>`` is 0, it is no-op modulo the behavior of attributes attached to
15560 If ``<len>`` is not a well-defined value, the behavior is undefined.
15561 If ``<len>`` is not zero, ``<dest>`` should be well-defined, otherwise the
15619 If ``<count>`` is 0, it is no-op modulo the behavior of attributes attached to
15621 If ``<count>`` is not a well-defined value, the behavior is undefined.
15622 If ``<count>`` is not zero, ``<dest>`` should be well-defined, otherwise the
15634 floating-point or vector of floating-point type. Not all targets support
15653 The argument and return value are floating-point numbers of the same type.
15659 trapping or setting ``errno``. For types specified by IEEE-754, the result
15662 When specified with the fast-math-flag 'afn', the result may be approximated
15672 floating-point or vector of floating-point type. Not all targets support
15691 multiplications is not defined. When a vector of floating-point type is
15715 floating-point or vector of floating-point type. Not all targets support
15734 The argument and return value are floating-point numbers of the same type.
15742 When specified with the fast-math-flag 'afn', the result may be approximated
15754 floating-point or vector of floating-point type. Not all targets support
15773 The argument and return value are floating-point numbers of the same type.
15781 When specified with the fast-math-flag 'afn', the result may be approximated
15791 floating-point or vector of floating-point type. Not all targets support
15810 The argument and return value are floating-point numbers of the same type.
15818 When specified with the fast-math-flag 'afn', the result may be approximated
15828 floating-point or vector of floating-point type. Not all targets support
15847 The argument and return value are floating-point numbers of the same type.
15855 When specified with the fast-math-flag 'afn', the result may be approximated
15865 floating-point or vector of floating-point type. Not all targets support
15884 The argument and return value are floating-point numbers of the same type.
15892 When specified with the fast-math-flag 'afn', the result may be approximated
15902 floating-point or vector of floating-point type. Not all targets support
15921 The argument and return value are floating-point numbers of the same type.
15929 When specified with the fast-math-flag 'afn', the result may be approximated
15939 floating-point or vector of floating-point type. Not all targets support
15959 The arguments and return value are floating-point numbers of the same type.
15967 When specified with the fast-math-flag 'afn', the result may be approximated
15977 floating-point or vector of floating-point type. Not all targets support
15996 The argument and return value are floating-point numbers of the same type.
16004 When specified with the fast-math-flag 'afn', the result may be approximated
16014 floating-point or vector of floating-point type. Not all targets support
16033 The argument and return value are floating-point numbers of the same type.
16041 When specified with the fast-math-flag 'afn', the result may be approximated
16051 floating-point or vector of floating-point type. Not all targets support
16070 The argument and return value are floating-point numbers of the same type.
16078 When specified with the fast-math-flag 'afn', the result may be approximated
16089 floating-point or vector of floating-point type. Not all targets support
16109 The argument is a :ref:`floating-point <t_floating>` value or
16110 :ref:`vector <t_vector>` of floating-point values. Returns two values matching
16122 When specified with the fast-math-flag 'afn', the result may be approximated
16132 floating-point or vector of floating-point type. Not all targets support
16152 The arguments and return value are floating-point numbers of the same type.
16160 When specified with the fast-math-flag 'afn', the result may be approximated
16172 floating-point or vector of floating-point type. Not all targets support
16186 The '``llvm.exp.*``' intrinsics compute the base-e exponential of the specified
16192 The argument and return value are floating-point numbers of the same type.
16200 When specified with the fast-math-flag 'afn', the result may be approximated
16212 floating-point or vector of floating-point type. Not all targets support
16226 The '``llvm.exp2.*``' intrinsics compute the base-2 exponential of the
16232 The argument and return value are floating-point numbers of the same type.
16240 When specified with the fast-math-flag 'afn', the result may be approximated
16252 floating-point or vector of floating-point type. Not all targets support
16266 The '``llvm.exp10.*``' intrinsics compute the base-10 exponential of the
16272 The argument and return value are floating-point numbers of the same type.
16280 When specified with the fast-math-flag 'afn', the result may be approximated
16311 The first argument and the return value are :ref:`floating-point
16312 <t_floating>` or :ref:`vector <t_vector>` of floating-point values of
16354 The argument is a :ref:`floating-point <t_floating>` or
16355 :ref:`vector <t_vector>` of floating-point values. Returns two values
16366 For a non-zero argument, returns the argument multiplied by some power
16390 floating-point or vector of floating-point type. Not all targets support
16404 The '``llvm.log.*``' intrinsics compute the base-e logarithm of the specified
16410 The argument and return value are floating-point numbers of the same type.
16418 When specified with the fast-math-flag 'afn', the result may be approximated
16430 floating-point or vector of floating-point type. Not all targets support
16444 The '``llvm.log10.*``' intrinsics compute the base-10 logarithm of the
16450 The argument and return value are floating-point numbers of the same type.
16458 When specified with the fast-math-flag 'afn', the result may be approximated
16471 floating-point or vector of floating-point type. Not all targets support
16485 The '``llvm.log2.*``' intrinsics compute the base-2 logarithm of the specified
16491 The argument and return value are floating-point numbers of the same type.
16499 When specified with the fast-math-flag 'afn', the result may be approximated
16511 floating-point or vector of floating-point type. Not all targets support
16525 The '``llvm.fma.*``' intrinsics perform the fused multiply-add operation.
16530 The arguments and return value are floating-point numbers of the same type.
16535 Return the same value as the IEEE-754 fusedMultiplyAdd operation. This
16538 When specified with the fast-math-flag 'afn', the result may be approximated
16550 floating-point or vector of floating-point type. Not all targets support
16570 The argument and return value are floating-point numbers of the same
16591 on working with qNaN/sNaN and +0.0/-0.0. Here is the list:
16593 .. list-table::
16594 :header-rows: 2
16596 * - ``ISO C``
16597 - fmin/fmax
16598 - fmininum/fmaximum
16599 - fminimum_num/fmaximum_num
16601 * - ``IEEE754``
16602 - minNum/maxNum (2008)
16603 - minimum/maximum (2019)
16604 - minimumNumber/maximumNumber (2019)
16606 * - ``+0.0 vs -0.0``
16607 - either one
16608 - +0.0 > -0.0
16609 - +0.0 > -0.0
16611 * - ``NUM vs sNaN``
16612 - qNaN, invalid exception
16613 - qNaN, invalid exception
16614 - NUM, invalid exception
16616 * - ``qNaN vs sNaN``
16617 - qNaN, invalid exception
16618 - qNaN, invalid exception
16619 - qNaN, invalid exception
16621 * - ``NUM vs qNaN``
16622 - NUM, no exception
16623 - qNaN, no exception
16624 - NUM, no exception
16630 default floating-point environment exceptions are ignored. The constrained
16633 .. list-table::
16634 :header-rows: 1
16637 * - Operation
16638 - minnum/maxnum
16639 - minimum/maximum
16640 - minimumnum/maximumnum
16642 * - ``NUM vs qNaN``
16643 - NUM, no exception
16644 - qNaN, no exception
16645 - NUM, no exception
16647 * - ``NUM vs sNaN``
16648 - qNaN, invalid exception
16649 - qNaN, invalid exception
16650 - NUM, invalid exception
16652 * - ``qNaN vs sNaN``
16653 - qNaN, invalid exception
16654 - qNaN, invalid exception
16655 - qNaN, invalid exception
16657 * - ``sNaN vs sNaN``
16658 - qNaN, invalid exception
16659 - qNaN, invalid exception
16660 - qNaN, invalid exception
16662 * - ``+0.0 vs -0.0``
16663 - either one
16664 - +0.0(max)/-0.0(min)
16665 - +0.0(max)/-0.0(min)
16667 * - ``NUM vs NUM``
16668 - larger(max)/smaller(min)
16669 - larger(max)/smaller(min)
16670 - larger(max)/smaller(min)
16681 floating-point or vector of floating-point type. Not all targets support
16702 The arguments and return value are floating-point numbers of the same
16708 Follows the IEEE-754 semantics for minNum, except for handling of
16711 If either operand is a NaN, returns the other non-NaN operand. Returns
16714 fmin(+0.0, -0.0) returns either operand.
16716 Unlike the IEEE-754 2008 behavior, this does not distinguish between
16720 correctly return the non-NaN input (e.g. by using the equivalent of
16732 floating-point or vector of floating-point type. Not all targets support
16753 The arguments and return value are floating-point numbers of the same
16758 Follows the IEEE-754 semantics for maxNum except for the handling of
16761 If either operand is a NaN, returns the other non-NaN operand. Returns
16764 fmax(+0.0, -0.0) returns either -0.0 or 0.0.
16766 Unlike the IEEE-754 2008 behavior, this does not distinguish between
16770 correctly return the non-NaN input (e.g. by using the equivalent of
16782 floating-point or vector of floating-point type. Not all targets support
16797 arguments, propagating NaNs and treating -0.0 as less than +0.0.
16803 The arguments and return value are floating-point numbers of the same
16809 of the two arguments. -0.0 is considered to be less than +0.0 for this
16811 IEEE 754-2019.
16822 floating-point or vector of floating-point type. Not all targets support
16837 arguments, propagating NaNs and treating -0.0 as less than +0.0.
16843 The arguments and return value are floating-point numbers of the same
16849 of the two arguments. -0.0 is considered to be less than +0.0 for this
16851 IEEE 754-2019.
16862 floating-point or vector of floating-point type. Not all targets support
16877 arguments, not propagating NaNs and treating -0.0 as less than +0.0.
16883 The arguments and return value are floating-point numbers of the same
16890 Otherwise returns the lesser of the two arguments. -0.0 is considered to
16893 Note that these are the semantics of minimumNumber specified in IEEE 754-2019.
16897 2)'``llvm.minnum*``' may return either one if we compare +0.0 vs -0.0.
16908 floating-point or vector of floating-point type. Not all targets support
16923 arguments, not propagating NaNs and treating -0.0 as less than +0.0.
16929 The arguments and return value are floating-point numbers of the same
16936 Otherwise returns the greater of the two arguments. -0.0 is considered to
16939 Note that these are the semantics of maximumNumber specified in IEEE 754-2019.
16943 2)'``llvm.maxnum*``' may return either one if we compare +0.0 vs -0.0.
16954 floating-point or vector of floating-point type. Not all targets support
16974 The arguments and return value are floating-point numbers of the same
16995 floating-point or vector of floating-point type. Not all targets support
17014 The argument and return value are floating-point numbers of the same
17032 floating-point or vector of floating-point type. Not all targets support
17051 The argument and return value are floating-point numbers of the same
17070 floating-point or vector of floating-point type. Not all targets support
17090 The argument and return value are floating-point numbers of the same
17108 floating-point or vector of floating-point type. Not all targets support
17123 nearest integer. It may raise an inexact floating-point exception if the
17129 The argument and return value are floating-point numbers of the same
17137 :ref:`default floating-point environment <floatenv>`, the rounding mode is
17139 integer. Use :ref:`Constrained Floating-Point Intrinsics <constrainedfp>`
17151 floating-point or vector of floating-point type. Not all targets support
17171 The argument and return value are floating-point numbers of the same
17179 assumes the :ref:`default floating-point environment <floatenv>`, the rounding
17181 integer. Use :ref:`Constrained Floating-Point Intrinsics <constrainedfp>` to
17193 floating-point or vector of floating-point type. Not all targets support
17213 The argument and return value are floating-point numbers of the same
17231 floating-point or vector of floating-point type. Not all targets support
17246 integer in floating-point format rounding halfway cases to even (that is, to the
17252 The argument and return value are floating-point numbers of the same type.
17257 This function implements IEEE-754 operation ``roundToIntegralTiesToEven``. It
17269 floating-point type or vector of floating-point type. Not all targets
17296 The argument is a floating-point number and the return value is an integer
17304 be stored in the result type, the return value is a non-deterministic
17314 floating-point type. Not all targets support all types however.
17333 The argument is a floating-point number and the return value is an integer
17342 non-deterministic value (equivalent to `freeze poison`).
17353 floating-point type or vector of floating-point type. Not all targets
17380 The argument is a floating-point number and the return value is an integer
17388 be stored in the result type, the return value is a non-deterministic
17400 floating-point type or vector of floating-point type. Not all targets
17420 The argument is a floating-point number and the return value is an integer
17428 be stored in the result type, the return value is a non-deterministic
17432 ---------------------------
17466 ``M`` in the input moved to bit ``N-M-1`` in the output. The vector
17467 intrinsics, such as ``llvm.bitreverse.v4i32``, operate on a per-element
17504 concept to additional even-byte lengths (6 bytes, 8 bytes and more,
17506 operate on a per-element basis and the element order is not affected.
17583 zero-value inputs.
17629 zero-value inputs.
17683 .. code-block:: text
17731 .. code-block:: text
17739 -----------------------------------
17743 Each of these intrinsics returns a two-element struct. The first
17748 result of a 32-bit ``add`` instruction with the same operands, where
17759 The behavior of these intrinsics is well-defined for all argument
17798 a signed addition of the two variables. They return a structure --- the
17806 .. code-block:: llvm
17849 an unsigned addition of the two arguments. They return a structure --- the
17856 .. code-block:: llvm
17899 a signed subtraction of the two arguments. They return a structure --- the
17907 .. code-block:: llvm
17950 an unsigned subtraction of the two arguments. They return a structure ---
17958 .. code-block:: llvm
18001 a signed multiplication of the two arguments. They return a structure ---
18009 .. code-block:: llvm
18052 an unsigned multiplication of the two arguments. They return a structure ---
18060 .. code-block:: llvm
18068 ---------------------------------
18118 .. code-block:: llvm
18122 %res = call i4 @llvm.sadd.sat.i4(i4 -4, i4 2) ; %res = -2
18123 %res = call i4 @llvm.sadd.sat.i4(i4 -4, i4 -5) ; %res = -8
18168 .. code-block:: llvm
18217 .. code-block:: llvm
18220 %res = call i4 @llvm.ssub.sat.i4(i4 2, i4 6) ; %res = -4
18221 %res = call i4 @llvm.ssub.sat.i4(i4 -4, i4 5) ; %res = -8
18222 %res = call i4 @llvm.ssub.sat.i4(i4 4, i4 -5) ; %res = 7
18268 .. code-block:: llvm
18319 .. code-block:: llvm
18323 %res = call i4 @llvm.sshl.sat.i4(i4 -5, i4 1) ; %res = -8
18324 %res = call i4 @llvm.sshl.sat.i4(i4 -1, i4 1) ; %res = -2
18370 .. code-block:: llvm
18377 ---------------------------------
18390 .. code-block:: llvm
18406 .. code-block:: llvm
18480 .. code-block:: llvm
18484 %res = call i4 @llvm.smul.fix.i4(i4 3, i4 -2, i32 1) ; %res = -3 (1.5 x -1 = -1.5)
18486 ; The result in the following could be rounded up to -2 or down to -2.5
18487 %res = call i4 @llvm.smul.fix.i4(i4 3, i4 -3, i32 1) ; %res = -5 (or -4) (1.5 x -1.5 = -2.25)
18540 .. code-block:: llvm
18599 .. code-block:: llvm
18603 %res = call i4 @llvm.smul.fix.sat.i4(i4 3, i4 -2, i32 1) ; %res = -3 (1.5 x -1 = -1.5)
18605 ; The result in the following could be rounded up to -2 or down to -2.5
18606 %res = call i4 @llvm.smul.fix.sat.i4(i4 3, i4 -3, i32 1) ; %res = -5 (or -4) (1.5 x -1.5 = -2.25)
18611 %res = call i4 @llvm.smul.fix.sat.i4(i4 -8, i4 5, i32 2) ; %res = -8
18612 %res = call i4 @llvm.smul.fix.sat.i4(i4 -8, i4 -2, i32 1) ; %res = 7
18615 %res = call i4 @llvm.smul.fix.sat.i4(i4 2, i4 4, i32 0) ; %res = 7 (2 x 4 -> clamped to 7)
18669 .. code-block:: llvm
18678 %res = call i4 @llvm.umul.fix.sat.i4(i4 8, i4 2, i32 0) ; %res = 15 (8 x 2 -> clamped to 15)
18679 %res = call i4 @llvm.umul.fix.sat.i4(i4 8, i4 8, i32 2) ; %res = 15 (2 x 2 -> clamped to 3.75)
18682 %res = call i4 @llvm.umul.fix.sat.i4(i4 2, i4 4, i32 0) ; %res = 7 (2 x 4 -> clamped to 7)
18736 .. code-block:: llvm
18740 %res = call i4 @llvm.sdiv.fix.i4(i4 3, i4 -2, i32 1) ; %res = -3 (1.5 / -1 = -1.5)
18796 .. code-block:: llvm
18800 %res = call i4 @llvm.udiv.fix.i4(i4 1, i4 -8, i32 4) ; %res = 2 (0.0625 / 0.5 = 0.125)
18858 .. code-block:: llvm
18862 %res = call i4 @llvm.sdiv.fix.sat.i4(i4 3, i4 -2, i32 1) ; %res = -3 (1.5 / -1 = -1.5)
18868 %res = call i4 @llvm.sdiv.fix.sat.i4(i4 -8, i4 -1, i32 0) ; %res = 7 (-8 / -1 = 8 => 7)
18870 %res = call i4 @llvm.sdiv.fix.sat.i4(i4 -4, i4 1, i32 2) ; %res = -8 (-1 / 0.25 = -4 => -2)
18924 .. code-block:: llvm
18937 ---------------------------------
18956 encoding of a floating-point number. This canonicalization is useful for
18958 defined by IEEE-754-2008 to be:
18962 2.1.8 canonical encoding: The preferred encoding of a floating-point
18966 This operation can also be considered equivalent to the IEEE-754-2008
18967 conversion of a floating-point value to the same format. NaNs are handled
18970 Examples of non-canonical encodings:
18972 - x87 pseudo denormals, pseudo NaNs, pseudo Infinity, Unnormals. These are
18973 converted to a canonical representation per hardware-specific protocol.
18974 - Many normal decimal floating-point numbers have non-canonical alternative
18976 - Some machines, like GPUs or ARMv7 NEON, do not support subnormal values.
18977 These are treated as non-canonical encodings of zero and will be flushed to
18980 Note that per IEEE-754-2008 6.2, systems that support signaling NaNs with
18987 -0.0 is also sufficient provided that the rounding mode is not -Infinity.
18991 - ``(@llvm.canonicalize(x) == x)`` is equivalent to ``(x == x)``
18992 - ``(@llvm.canonicalize(x) == @llvm.canonicalize(y))`` is equivalent
18996 ``@llvm.canonicalize(-0.0) = -0.0`` and ``@llvm.canonicalize(+0.0) = +0.0``
19005 - The input is known to be canonical. For example, it was produced by a
19006 floating-point operation that is required by the standard to be canonical.
19007 - The result is consumed only by (or fused with) other floating-point
19008 operations. That is, the bits of the floating-point value are not examined.
19026 The '``llvm.fmuladd.*``' intrinsic functions represent multiply-add
19050 If a fused multiply-add is required, the corresponding
19057 .. code-block:: llvm
19062 Hardware-Loop Intrinsics
19063 ------------------------
19065 LLVM support several intrinsics to mark a loop as a hardware-loop. They are
19067 specific instructions, or revert the hardware-loop to a normal loop if target
19068 specific restriction are not met and a hardware-loop can't be generated.
19071 outside the backend. Thus, front-end and mid-level optimizations should not be
19092 hardware-loop trip count. They are placed in the loop preheader basic block and
19099 The integer operand is the loop trip count of the hardware-loop, and thus
19100 not e.g. the loop back-edge taken count.
19107 hardware-loop count with a target specific instruction, usually a move of this
19108 value to a special register or a hardware-loop instruction.
19129 hardware-loop trip count but also produce a value identical to the input
19138 The integer operand is the loop trip count of the hardware-loop, and thus
19139 not e.g. the loop back-edge taken count.
19146 hardware-loop count with a target specific instruction, usually a move of this
19147 value to a special register or a hardware-loop instruction.
19167 it to control entry to a while-loop. They are placed in the loop preheader's
19174 The integer operand is the loop trip count of the hardware-loop, and thus
19175 not e.g. the loop back-edge taken count.
19182 set up the hardware-loop count with a target specific instruction, usually a
19183 move of this value to a special register or a hardware-loop instruction.
19205 intrinsics, used to specify the hardware-loop trip count, but also produce a
19207 second i1 output controls entry to a while-loop.
19212 The integer operand is the loop trip count of the hardware-loop, and thus
19213 not e.g. the loop back-edge taken count.
19220 set up the hardware-loop count with a target specific instruction, usually a
19221 move of this value to a special register or a hardware-loop instruction.
19306 ---------------------------
19331 the element-type of the vector input.
19353 The '``llvm.vector.reduce.fadd.*``' intrinsics do a floating-point
19355 matches the element-type of the vector input.
19376 The type of the start value matches the element-type of the vector input.
19377 The second argument must be a vector of floating-point values.
19379 To ignore the start value, negative zero (``-0.0``) can be used, as it is
19387 %unord = call reassoc float @llvm.vector.reduce.fadd.v4f32(float -0.0, <4 x float> %input) ; relaxed reduction
19409 the element-type of the vector input.
19431 The '``llvm.vector.reduce.fmul.*``' intrinsics do a floating-point
19433 matches the element-type of the vector input.
19454 The type of the start value matches the element-type of the vector input.
19455 The second argument must be a vector of floating-point values.
19485 the element-type of the vector input.
19508 element-type of the vector input.
19531 the element-type of the vector input.
19554 matches the element-type of the vector input.
19577 matches the element-type of the vector input.
19600 return type matches the element-type of the vector input.
19623 return type matches the element-type of the vector input.
19645 The '``llvm.vector.reduce.fmax.*``' intrinsics do a floating-point
19647 matches the element-type of the vector input.
19652 containing both +0.0 and -0.0 elements, the sign of the result is unspecified.
19654 If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
19659 The argument to this intrinsic must be a vector of floating-point values.
19678 The '``llvm.vector.reduce.fmin.*``' intrinsics do a floating-point
19680 matches the element-type of the vector input.
19685 containing both +0.0 and -0.0 elements, the sign of the result is unspecified.
19687 If the intrinsic call has the ``nnan`` fast-math flag, then the operation can
19692 The argument to this intrinsic must be a vector of floating-point values.
19711 The '``llvm.vector.reduce.fmaximum.*``' intrinsics do a floating-point
19713 matches the element-type of the vector input.
19717 greater than -0.0. If any element of the vector is a NaN, the result is NaN.
19721 The argument to this intrinsic must be a vector of floating-point values.
19740 The '``llvm.vector.reduce.fminimum.*``' intrinsics do a floating-point
19742 matches the element-type of the vector input.
19745 intrinsic. That is, this intrinsic propagates NaNs and -0.0 is considered less
19750 The argument to this intrinsic must be a vector of floating-point values.
19777 non-scalable vectors, however this intrinsic can also be used on purely fixed
19793 num_elements(``subvec``) - 1) must be valid ``vec`` indices. If this condition
19823 non-scalable parts, however this intrinsic can also be used on purely fixed
19834 subvector is extracted. ``idx`` must be a constant multiple of the known-minimum
19837 ``idx`` through (``idx`` + num_elements(result_type) - 1) must be valid vector
19862 the recommended way to express this operation for fixed-width vectors is
19891 fixed-width vectors is still to use a shufflevector, as that may allow for more
19896 .. code-block:: text
19926 fixed-width vectors is still to use a shufflevector, as that may allow for more
19931 .. code-block:: text
20001 immediate, it extracts ``-imm`` trailing elements from the first vector, and
20006 fixed-width vectors is still to use a shufflevector, as that may allow for more
20011 .. code-block:: text
20014 llvm.vector.splice(<A,B,C,D>, <E,F,G,H>, -3); ==> <B, C, D, E> trailing elements
20021 modulo the runtime number of elements in the source vector. For a fixed-width
20023 -N <= imm < N. For a scalable vector <vscale x N x eltty>, imm is a signed
20024 integer constant in the range -X <= imm < X where X=vscale_range_min * N.
20047 fixed-width vectors is still to generate a constant vector instead.
20086 Returns a non-negative i32 value (explicit vector length) that is unknown at compile
20099 - If ``%cnt`` equals to 0, returns 0.
20100 - The returned value is always less than or equal to ``%max_lanes``.
20101 - The returned value is always greater than or equal to ``ceil(%cnt / ceil(%cnt / %max_lanes))``,
20102 if ``%cnt`` is non-zero.
20103 - The returned values are monotonically non-increasing in each loop iteration. That is,
20109 - For a loop that uses this intrinsic, the number of iterations is equal to
20111 - If ``%cnt`` is non-zero, the return value is non-zero as well.
20112 - If ``%cnt`` is less than or equal to ``%max_lanes``, the return value is equal to ``%cnt``.
20150 These intrinsics represent histogram-like operations; that is, updating values
20157 .. code-block:: c
20191 1. Perform a cross-vector histogram operation on the ``ptrs`` operand.
20242 .. code-block:: llvm
20282 It collects elements from possibly non-adjacent lanes of a vector and places
20292 of ``true`` entries in the mask, i.e., all lanes >= number-of-selected-values
20295 .. code-block:: cpp
20352 -----------------
20359 corresponding vector, with indices starting at 0. Currently column-major layout
20500 Half Precision Floating-Point Intrinsics
20501 ----------------------------------------
20503 For most target platforms, half precision floating-point is a
20504 storage-only format. This means that it is a dense encoding (in memory)
20507 This means that code must first load the half-precision floating-point
20533 conventional floating-point type to half precision floating-point format.
20538 The intrinsic function contains single argument - the value to be
20545 conventional floating-point format to half precision floating-point format. The
20551 .. code-block:: llvm
20573 conversion from half precision floating-point format to single precision
20574 floating-point format.
20579 The intrinsic function contains single argument - the value to be
20586 conversion from half single precision floating-point format to single
20587 precision floating-point format. The input half-float value is
20593 .. code-block:: llvm
20598 Saturating floating-point to integer conversions
20599 ------------------------------------------------
20602 :ref:`poison value <poisonvalues>` if the rounded-towards-zero value is not
20614 floating-point argument type and any integer result type, or vectors thereof.
20632 The argument may be any floating-point or vector of floating-point type. The
20641 - If the argument is any NaN, zero is returned.
20642 - If the argument is smaller than zero (this includes negative infinity),
20644 - If the argument is larger than the largest representable unsigned integer of
20647 - Otherwise, the result of rounding the argument towards zero is returned.
20652 .. code-block:: text
20655 %b = call i8 @llvm.fptoui.sat.i8.f32(float -5.75) ; yields i8: 0
20666 floating-point argument type and any integer result type, or vectors thereof.
20684 The argument may be any floating-point or vector of floating-point type. The
20693 - If the argument is any NaN, zero is returned.
20694 - If the argument is smaller than the smallest representable signed integer of
20697 - If the argument is larger than the largest representable signed integer of
20700 - Otherwise, the result of rounding the argument towards zero is returned.
20705 .. code-block:: text
20708 %b = call i8 @llvm.fptosi.sat.i8.f32(float -130.75) ; yields i8: -128
20713 ----------------------
20722 -------------------
20726 Debugging <SourceLevelDebugging.html#format-common-intrinsics>`_
20730 -----------------------------
20734 Handling <ExceptionHandling.html#format-common-intrinsics>`_ document.
20737 ---------------------------------
20746 ---------------------
20750 callable function pointer lacking the nest parameter - the caller does
20761 .. code-block:: llvm
20794 intrinsic. Note that the size and the alignment are target-specific -
20796 front-end that generates this intrinsic needs to have some
20797 target-specific knowledge. The ``func`` argument must hold a function.
20830 This performs any required machine-specific adjustment to the address of
20853 -----------------------------
20876 calculated with an element-wise AND from %mask and %EVLmask:
20915 condition vector, without IR-level branching.
20926 #. The optional ``fast-math flags`` marker indicates that the select has one or
20927 more :ref:`fast-math flags <fastmath>`. These are optimization hints to
20928 enable otherwise unsafe floating-point optimizations. Fast-math flags are
20929 only valid for selects that return :ref:`supported floating-point types
20946 .. code-block:: llvm
20973 condition vector and an index argument, without IR-level branching.
20984 #. The optional ``fast-math flags`` marker indicates that the merge has one or
20985 more :ref:`fast-math flags <fastmath>`. These are optimization hints to
20986 enable otherwise unsafe floating-point optimizations. Fast-math flags are
20987 only valid for merges that return :ref:`supported floating-point types
21003 .. code-block:: llvm
21056 .. code-block:: llvm
21059 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21103 .. code-block:: llvm
21106 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21151 .. code-block:: llvm
21154 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21199 .. code-block:: llvm
21202 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21247 .. code-block:: llvm
21250 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21296 .. code-block:: llvm
21299 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21345 .. code-block:: llvm
21348 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21372 Vector-predicated arithmetic right-shift.
21394 .. code-block:: llvm
21397 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21422 Vector-predicated logical right-shift.
21444 .. code-block:: llvm
21447 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21471 Vector-predicated left shift.
21492 .. code-block:: llvm
21495 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21519 Vector-predicated or.
21540 .. code-block:: llvm
21543 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21567 Vector-predicated and.
21588 .. code-block:: llvm
21591 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21615 Vector-predicated, bitwise xor.
21636 .. code-block:: llvm
21639 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21685 .. code-block:: llvm
21688 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21734 .. code-block:: llvm
21737 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21782 .. code-block:: llvm
21785 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21830 .. code-block:: llvm
21833 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21878 .. code-block:: llvm
21881 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21905 Predicated floating-point copysign of two vectors of floating-point values.
21911 The first two arguments and the result have the same vector of floating-point type. The
21919 The '``llvm.vp.copysign``' intrinsic performs floating-point copysign (:ref:`copysign <int_copysign>`)
21922 performed in the default floating-point environment.
21927 .. code-block:: llvm
21930 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
21954 Predicated floating-point IEEE-754 minNum of two vectors of floating-point values.
21960 The first two arguments and the result have the same vector of floating-point type. The
21968 The '``llvm.vp.minnum``' intrinsic performs floating-point minimum (:ref:`minnum <i_minnum>`)
21971 performed in the default floating-point environment.
21976 .. code-block:: llvm
21979 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22003 Predicated floating-point IEEE-754 maxNum of two vectors of floating-point values.
22009 The first two arguments and the result have the same vector of floating-point type. The
22017 The '``llvm.vp.maxnum``' intrinsic performs floating-point maximum (:ref:`maxnum <i_maxnum>`)
22020 performed in the default floating-point environment.
22025 .. code-block:: llvm
22028 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22052 Predicated floating-point minimum of two vectors of floating-point values,
22053 propagating NaNs and treating -0.0 as less than +0.0.
22058 The first two arguments and the result have the same vector of floating-point type. The
22066 The '``llvm.vp.minimum``' intrinsic performs floating-point minimum (:ref:`minimum <i_minimum>`)
22068 NaN if either argument is a NaN. -0.0 is considered to be less than +0.0 for this
22070 The operation is performed in the default floating-point environment.
22075 .. code-block:: llvm
22078 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22102 Predicated floating-point maximum of two vectors of floating-point values,
22103 propagating NaNs and treating -0.0 as less than +0.0.
22108 The first two arguments and the result have the same vector of floating-point type. The
22116 The '``llvm.vp.maximum``' intrinsic performs floating-point maximum (:ref:`maximum <i_maximum>`)
22118 NaN if either argument is a NaN. -0.0 is considered to be less than +0.0 for this
22120 The operation is performed in the default floating-point environment.
22125 .. code-block:: llvm
22128 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22152 Predicated floating-point addition of two vectors of floating-point values.
22158 The first two arguments and the result have the same vector of floating-point type. The
22166 The '``llvm.vp.fadd``' intrinsic performs floating-point addition (:ref:`fadd <i_fadd>`)
22169 performed in the default floating-point environment.
22174 .. code-block:: llvm
22177 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22201 Predicated floating-point subtraction of two vectors of floating-point values.
22207 The first two arguments and the result have the same vector of floating-point type. The
22215 The '``llvm.vp.fsub``' intrinsic performs floating-point subtraction (:ref:`fsub <i_fsub>`)
22218 performed in the default floating-point environment.
22223 .. code-block:: llvm
22226 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22250 Predicated floating-point multiplication of two vectors of floating-point values.
22256 The first two arguments and the result have the same vector of floating-point type. The
22264 The '``llvm.vp.fmul``' intrinsic performs floating-point multiplication (:ref:`fmul <i_fmul>`)
22267 performed in the default floating-point environment.
22272 .. code-block:: llvm
22275 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22299 Predicated floating-point division of two vectors of floating-point values.
22305 The first two arguments and the result have the same vector of floating-point type. The
22313 The '``llvm.vp.fdiv``' intrinsic performs floating-point division (:ref:`fdiv <i_fdiv>`)
22316 performed in the default floating-point environment.
22321 .. code-block:: llvm
22324 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22348 Predicated floating-point remainder of two vectors of floating-point values.
22354 The first two arguments and the result have the same vector of floating-point type. The
22362 The '``llvm.vp.frem``' intrinsic performs floating-point remainder (:ref:`frem <i_frem>`)
22365 performed in the default floating-point environment.
22370 .. code-block:: llvm
22373 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22397 Predicated floating-point negation of a vector of floating-point values.
22403 The first argument and the result have the same vector of floating-point type.
22411 The '``llvm.vp.fneg``' intrinsic performs floating-point negation (:ref:`fneg <i_fneg>`)
22418 .. code-block:: llvm
22421 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22445 Predicated floating-point absolute value of a vector of floating-point values.
22451 The first argument and the result have the same vector of floating-point type.
22459 The '``llvm.vp.fabs``' intrinsic performs floating-point absolute value
22466 .. code-block:: llvm
22469 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22493 Predicated floating-point square root of a vector of floating-point values.
22499 The first argument and the result have the same vector of floating-point type.
22507 The '``llvm.vp.sqrt``' intrinsic performs floating-point square root (:ref:`sqrt <int_sqrt>`) of
22510 floating-point environment.
22515 .. code-block:: llvm
22518 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22542 Predicated floating-point fused multiply-add of two vectors of floating-point values.
22548 The first three arguments and the result have the same vector of floating-point type. The
22556 The '``llvm.vp.fma``' intrinsic performs floating-point fused multiply-add (:ref:`llvm.fma <int_fma>`)
22559 performed in the default floating-point environment.
22564 .. code-block:: llvm
22567 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22591 Predicated floating-point multiply-add of two vectors of floating-point values
22599 The first three arguments and the result have the same vector of floating-point
22607 The '``llvm.vp.fmuladd``' intrinsic performs floating-point multiply-add (:ref:`llvm.fuladd <int_fmuladd>`)
22610 performed in the default floating-point environment.
22615 .. code-block:: llvm
22618 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
22669 .. code-block:: llvm
22697 Predicated floating-point ``ADD`` reduction of a vector and a scalar starting
22704 floating-point type equal to the result type. The second argument is the vector
22705 on which the reduction is performed and must be a vector of floating-point
22714 The '``llvm.vp.reduce.fadd``' intrinsic performs the floating-point ``ADD``
22718 ``-0.0`` (i.e. having no effect on the reduction operation). If no lanes are
22729 .. code-block:: llvm
22735 %masked.a = select <4 x i1> %mask, <4 x float> %a, <4 x float> <float -0.0, float -0.0, float -0.0, float -0.0>
22785 .. code-block:: llvm
22812 Predicated floating-point ``MUL`` reduction of a vector and a scalar starting
22820 floating-point type equal to the result type. The second argument is the vector
22821 on which the reduction is performed and must be a vector of floating-point
22830 The '``llvm.vp.reduce.fmul``' intrinsic performs the floating-point ``MUL``
22845 .. code-block:: llvm
22893 value ``UINT_MAX``, or ``-1`` (i.e. having no effect on the reduction
22901 .. code-block:: llvm
22907 %masked.a = select <4 x i1> %mask, <4 x i32> %a, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
22958 .. code-block:: llvm
23014 .. code-block:: llvm
23042 Predicated signed-integer ``MAX`` reduction of a vector and a scalar starting
23059 The '``llvm.vp.reduce.smax``' intrinsic performs the signed-integer ``MAX``
23071 .. code-block:: llvm
23077 %masked.a = select <4 x i1> %mask, <4 x i8> %a, <4 x i8> <i8 -128, i8 -128, i8 -128, i8 -128>
23099 Predicated signed-integer ``MIN`` reduction of a vector and a scalar starting
23116 The '``llvm.vp.reduce.smin``' intrinsic performs the signed-integer ``MIN``
23128 .. code-block:: llvm
23156 Predicated unsigned-integer ``MAX`` reduction of a vector and a scalar starting
23173 The '``llvm.vp.reduce.umax``' intrinsic performs the unsigned-integer ``MAX``
23185 .. code-block:: llvm
23213 Predicated unsigned-integer ``MIN`` reduction of a vector and a scalar starting
23230 The '``llvm.vp.reduce.umin``' intrinsic performs the unsigned-integer ``MIN``
23234 value ``UINT_MAX``, or ``-1`` (i.e. having no effect on the reduction
23242 .. code-block:: llvm
23248 %masked.a = select <4 x i1> %mask, <4 x i32> %a, <4 x i32> <i32 -1, i32 -1, i32 -1, i32 -1>
23270 Predicated floating-point ``MAX`` reduction of a vector and a scalar starting
23278 floating-point type equal to the result type. The second argument is the vector
23279 on which the reduction is performed and must be a vector of floating-point
23288 The '``llvm.vp.reduce.fmax``' intrinsic performs the floating-point ``MAX``
23295 The neutral value is dependent on the :ref:`fast-math flags <fastmath>`. If no
23296 flags are set, the neutral value is ``-QNAN``. If ``nnan`` and ``ninf`` are
23297 both set, then the neutral value is the smallest floating-point value for the
23298 result type. If only ``nnan`` is set then the neutral value is ``-Infinity``.
23305 ``-0.0`` elements, the sign of the result is unspecified.
23312 .. code-block:: llvm
23340 Predicated floating-point ``MIN`` reduction of a vector and a scalar starting
23348 floating-point type equal to the result type. The second argument is the vector
23349 on which the reduction is performed and must be a vector of floating-point
23358 The '``llvm.vp.reduce.fmin``' intrinsic performs the floating-point ``MIN``
23365 The neutral value is dependent on the :ref:`fast-math flags <fastmath>`. If no
23367 both set, then the neutral value is the largest floating-point value for the
23375 ``-0.0`` elements, the sign of the result is unspecified.
23382 .. code-block:: llvm
23410 Predicated floating-point ``MAX`` reduction of a vector and a scalar starting
23418 floating-point type equal to the result type. The second argument is the vector
23419 on which the reduction is performed and must be a vector of floating-point
23428 The '``llvm.vp.reduce.fmaximum``' intrinsic performs the floating-point ``MAX``
23435 The neutral value is dependent on the :ref:`fast-math flags <fastmath>`. If no
23436 flags are set or only the ``nnan`` is set, the neutral value is ``-Infinity``.
23437 If ``ninf`` is set, then the neutral value is the smallest floating-point value
23444 ``NaN``. Namely, this intrinsic propagates ``NaN``. Also, -0.0 is considered
23452 .. code-block:: llvm
23458 %masked.a = select <4 x i1> %mask, <4 x float> %a, <4 x float> <float -infinity, float -infinity, float -infinity, float -infinity>
23480 Predicated floating-point ``MIN`` reduction of a vector and a scalar starting
23488 floating-point type equal to the result type. The second argument is the vector
23489 on which the reduction is performed and must be a vector of floating-point
23498 The '``llvm.vp.reduce.fminimum``' intrinsic performs the floating-point ``MIN``
23505 The neutral value is dependent on the :ref:`fast-math flags <fastmath>`. If no
23507 If ``ninf`` is set, then the neutral value is the largest floating-point value
23514 ``NaN``. Namely, this intrinsic propagates ``NaN``. Also, -0.0 is considered
23522 .. code-block:: llvm
23575 the unsigned less-than comparison operator. Overflow cannot occur in
23586 ``%n`` is the loop tripcount. Thus, these intrinsics perform an element-wise
23596 back-edge taken count of the original scalar loop is explicit as the second
23603 .. code-block:: llvm
23638 respect the following constraints: ``-evl1 <= imm < evl1``, ``0 <= evl1 <= VL``
23645 Effectively, this intrinsic concatenates ``vec1[0..evl1-1]`` and
23646 ``vec2[0..evl2-1]`` and creates the result vector by selecting the elements in a
23650 vector of active vector length ``evl2`` contains ``evl1 - imm`` (``-imm`` for
23651 negative ``imm``) elements from indices ``[imm..evl1 - 1]``
23652 (``[evl1 + imm..evl1 -1]`` for negative ``imm``) of ``vec1`` followed by the
23653 first ``evl2 - (evl1 - imm)`` (``evl2 + imm`` for negative ``imm``) elements of
23654 ``vec2``. If ``evl1 - imm`` (``-imm``) >= ``evl2``, only the first ``evl2``
23661 .. code-block:: text
23664 llvm.experimental.vp.splice(<A,B,C,D>, <E,F,G,H>, -2, 3, 2); ==> <B, C, poison, poison> trailing elements
23705 .. code-block:: llvm
23708 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
23798 .. code-block:: text
23801 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
23855 .. code-block:: text
23858 ;; For all lanes below %evl, the call above is lane-wise equivalent to the call below.
23910 .. code-block:: text
23971 .. code-block:: text
24032 .. code-block:: text
24035 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24083 vector-of-pointers argument. Otherwise it is taken as the ABI alignment of the
24090 .. code-block:: text
24093 ;; For all lanes below %evl, the call above is lane-wise equivalent to the call below.
24134 than the destination size, '``llvm.vp.trunc``' cannot be a *no-op cast*. It will
24136 explicit vector length and where the vector mask is true. Masked-off lanes are
24142 .. code-block:: llvm
24145 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24189 Masked-off lanes are ``poison``.
24194 .. code-block:: llvm
24197 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24239 type. When sign extending from i1, the result will always be either -1 or 0.
24241 and where the vector mask is true. Masked-off lanes are ``poison``.
24246 .. code-block:: llvm
24249 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24281 :ref:`floating-point <t_floating>` type. The bit size of the value must be
24283 '``llvm.vp.fptrunc``' cannot be used to make a *no-op cast*. The second argument
24292 :ref:`floating-point <t_floating>` type to a smaller :ref:`floating-point
24294 This instruction is assumed to execute in the default :ref:`floating-point
24296 explicit vector length and where the vector mask is true. Masked-off lanes are
24302 .. code-block:: llvm
24305 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24337 :ref:`floating-point <t_floating>` type. The bit size of the value must be
24339 '``llvm.vp.fpext``' cannot be used to make a *no-op cast*. The second argument
24348 :ref:`floating-point <t_floating>` type to a larger :ref:`floating-point
24350 *no-op cast* because it always changes bits. Use ``bitcast`` to make a
24351 *no-op cast* for a floating-point cast.
24353 and where the vector mask is true. Masked-off lanes are ``poison``.
24358 .. code-block:: llvm
24361 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24385 The '``llvm.vp.fptoui``' intrinsic converts the :ref:`floating-point
24394 The value to cast must be a vector of :ref:`floating-point <t_floating>` type.
24404 The '``llvm.vp.fptoui``' intrinsic converts its :ref:`floating-point
24407 vector mask is true. Masked-off lanes are ``poison``. On enabled lanes where
24414 .. code-block:: llvm
24417 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24441 The '``llvm.vp.fptosi``' intrinsic converts the :ref:`floating-point
24450 The value to cast must be a vector of :ref:`floating-point <t_floating>` type.
24460 The '``llvm.vp.fptosi``' intrinsic converts its :ref:`floating-point
24463 vector mask is true. Masked-off lanes are ``poison``. On enabled lanes where
24470 .. code-block:: llvm
24473 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24498 :ref:`floating-point <t_floating>` return type. The operation has a mask and
24508 of :ref:`floating-point <t_floating>` type. The second argument is the vector
24517 integer quantity and converts it to the corresponding floating-point value. If
24520 explicit vector length and where the vector mask is true. Masked-off lanes are
24526 .. code-block:: llvm
24529 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24554 :ref:`floating-point <t_floating>` return type. The operation has a mask and
24564 of :ref:`floating-point <t_floating>` type. The second argument is the vector
24573 integer quantity and converts it to the corresponding floating-point value. If
24576 explicit vector length and where the vector mask is true. Masked-off lanes are
24582 .. code-block:: llvm
24585 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24631 the same size, then nothing is done (*no-op cast*) other than a type
24634 and where the vector mask is true. Masked-off lanes are ``poison``.
24639 .. code-block:: llvm
24642 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24687 zero extension is done. If they are the same size, nothing is done (*no-op cast*).
24689 and where the vector mask is true. Masked-off lanes are ``poison``.
24694 .. code-block:: llvm
24697 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24730 and second arguments. These two values must be vectors of :ref:`floating-point
24737 supported floating-point condition code values <fcmp_md_cc>`. The fifth argument
24746 defined :ref:`according to the condition code <fcmp_md_cc_sem>`. Masked-off
24752 .. code-block:: llvm
24755 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24804 defined :ref:`according to the condition code <icmp_md_cc_sem>`. Masked-off
24810 .. code-block:: llvm
24813 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24836 Predicated floating-point ceiling of a vector of floating-point values.
24842 The first argument and the result have the same vector of floating-point type.
24850 The '``llvm.vp.ceil``' intrinsic performs floating-point ceiling
24857 .. code-block:: llvm
24860 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24883 Predicated floating-point floor of a vector of floating-point values.
24889 The first argument and the result have the same vector of floating-point type.
24897 The '``llvm.vp.floor``' intrinsic performs floating-point floor
24904 .. code-block:: llvm
24907 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24930 Predicated floating-point rint of a vector of floating-point values.
24936 The first argument and the result have the same vector of floating-point type.
24944 The '``llvm.vp.rint``' intrinsic performs floating-point rint
24951 .. code-block:: llvm
24954 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
24977 Predicated floating-point nearbyint of a vector of floating-point values.
24983 The first argument and the result have the same vector of floating-point type.
24991 The '``llvm.vp.nearbyint``' intrinsic performs floating-point nearbyint
24998 .. code-block:: llvm
25001 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25024 Predicated floating-point round of a vector of floating-point values.
25030 The first argument and the result have the same vector of floating-point type.
25038 The '``llvm.vp.round``' intrinsic performs floating-point round
25045 .. code-block:: llvm
25048 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25071 Predicated floating-point roundeven of a vector of floating-point values.
25077 The first argument and the result have the same vector of floating-point type.
25085 The '``llvm.vp.roundeven``' intrinsic performs floating-point roundeven
25092 .. code-block:: llvm
25095 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25118 Predicated floating-point round-to-zero of a vector of floating-point values.
25124 The first argument and the result have the same vector of floating-point type.
25132 The '``llvm.vp.roundtozero``' intrinsic performs floating-point roundeven
25139 .. code-block:: llvm
25142 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25165 Predicated lrint of a vector of floating-point values.
25171 The result is an integer vector and the first argument is a vector of :ref:`floating-point <t_floating>`
25186 .. code-block:: llvm
25189 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25212 Predicated llrint of a vector of floating-point values.
25217 The result is an integer vector and the first argument is a vector of :ref:`floating-point <t_floating>`
25232 .. code-block:: llvm
25235 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25279 .. code-block:: llvm
25282 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25326 .. code-block:: llvm
25329 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25373 .. code-block:: llvm
25376 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25422 .. code-block:: llvm
25425 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25471 .. code-block:: llvm
25474 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25500 elements of a vector. This is basically the vector-predicated version of
25523 significant / lowest-numbered) zero elements in the first argument on each
25568 .. code-block:: llvm
25571 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25617 .. code-block:: llvm
25620 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25666 .. code-block:: llvm
25669 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25715 .. code-block:: llvm
25718 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25763 .. code-block:: llvm
25766 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25809 .. code-block:: llvm
25812 ;; For all lanes below %evl, %r is lane-wise equivalent to %also.r
25837 The first argument is a floating-point vector, the result type is a vector of
25853 .. code-block:: llvm
25861 ---------------------------------------
25872 This is an overloaded intrinsic. The loaded data is a vector of any integer, floating-point or pointer data type.
25884 Reads a vector from memory according to the provided mask. The mask holds a bit for each vector lane, and is used to prevent memory accesses to the masked-off lanes. The masked-off lanes in the result vector are taken from the corresponding lanes of the '``passthru``' argument.
25890 The first argument is the base pointer for the load. The second argument is the alignment of the source location. It must be a power of two constant integer value. The third argument, mask, is a vector of boolean values with the same number of elements as the return type. The fourth is a pass-through value that is used to fill the masked-off lanes of the result. The return type, underlying type of the base pointer and the type of the '``passthru``' argument are the same vector types.
25896 The result of this operation is equivalent to a regular vector load instruction followed by a 'select' between the loaded and the passthru values, predicated on the same mask, except that the masked-off lanes are not accessed.
25897 Only the masked-on lanes of the vector need to be inbounds of an allocation (but all these lanes need to be inbounds of the same allocation).
25898 In particular, using this intrinsic prevents exceptions on memory accesses to masked-off lanes.
25899 Masked-off lanes are also not considered accessed for the purpose of data races or ``noalias`` constraints.
25917 This is an overloaded intrinsic. The data stored in memory is a vector of any integer, floating-point or pointer data type.
25929 Writes a vector to memory according to the provided mask. The mask holds a bit for each vector lane, and is used to prevent memory accesses to the masked-off lanes.
25941 The result of this operation is equivalent to a load-modify-store sequence, except that the masked-off lanes are not accessed.
25942 Only the masked-on lanes of the vector need to be inbounds of an allocation (but all these lanes need to be inbounds of the same allocation).
25943 In particular, using this intrinsic prevents exceptions on memory accesses to masked-off lanes.
25944 Masked-off lanes are also not considered accessed for the purpose of data races or ``noalias`` constraints.
25957 -------------------------------------------
25968 This is an overloaded intrinsic. The loaded data are multiple scalar values of any integer, floating-point or pointer data type gathered together into one vector.
25979 Reads scalar values from arbitrary memory locations and gathers them into one vector. The memory locations are provided in the vector of pointers '``ptrs``'. The memory is accessed according to the provided mask. The mask holds a bit for each vector lane, and is used to prevent memory accesses to the masked-off lanes. The masked-off lanes in the result vector are taken from the corresponding lanes of the '``passthru``' argument.
25985 The first argument is a vector of pointers which holds all memory addresses to read. The second argument is an alignment of the source addresses. It must be 0 or a power of two constant integer value. The third argument, mask, is a vector of boolean values with the same number of elements as the return type. The fourth is a pass-through value that is used to fill the masked-off lanes of the result. The return type, underlying type of the vector of pointers and the type of the '``passthru``' argument are the same vector types.
25998 ;; The gather with all-true mask is equivalent to the following instruction sequence
26021 This is an overloaded intrinsic. The data stored in memory is a vector of any integer, floating-point or pointer data type. Each vector element is stored in an arbitrary memory address. Scatter with overlapping addresses is guaranteed to be ordered from least-significant to most-significant element.
26032 Writes each element from the value vector to the corresponding memory address. The memory addresses are represented as a vector of pointers. Writing is done according to the provided mask. The mask holds a bit for each vector lane, and is used to prevent memory accesses to the masked-off lanes.
26066 -------------------------------------------------------------
26068 LLVM provides intrinsics for expanding load and compressing store operations. Data selected from a vector according to a mask is stored in consecutive memory addresses (compressed store), and vice-versa (expanding load). These operations effective map to "if (cond.i) a[j++] = v.i" and "if (cond.i) v.i = a[j++]" patterns, respectively. Note that when the mask starts with '1' bits followed by '0' bits, these operations are identical to :ref:`llvm.masked.store <int_mstore>` and :ref:`llvm.masked.load <int_mload>`.
26087 Reads a number of scalar values sequentially from memory location provided in '``ptr``' and spreads them in a vector. The '``mask``' holds a bit for each vector lane. The number of elements read from memory is equal to the number of '1' bits in the mask. The loaded elements are positioned in the destination vector according to the sequence of '1' and '0' bits in the mask. E.g., if the mask vector is '10010001', "expandload" reads 3 values from memory addresses ptr, ptr+1, ptr+2 and places them in lanes 0, 3 and 7 accordingly. The masked-off lanes are filled by elements from the corresponding lanes of the '``passthru``' argument.
26093 The first argument is the base pointer for the load. It has the same underlying type as the element of the returned vector. The second argument, mask, is a vector of boolean values with the same number of elements as the return type. The third is a pass-through value that is used to fill the masked-off lanes of the result. The return type and the type of the '``passthru``' argument have the same vector type.
26101 The '``llvm.masked.expandload``' intrinsic is designed for reading multiple scalar values from adjacent memory addresses into possibly non-adjacent vector lanes. It is useful for targets that support vector expanding loads and allows vectorizing loop with cross-iteration dependency like in the following example:
26103 .. code-block:: c
26113 .. code-block:: llvm
26161 The '``llvm.masked.compressstore``' intrinsic is designed for compressing data in memory. It allows to collect elements from possibly non-adjacent lanes of a vector and store them contiguously in memory in one IR operation. It is useful for targets that support compressing store operations and allows vectorizing loops with cross-iteration dependencies like in the following example:
26163 .. code-block:: c
26173 .. code-block:: llvm
26191 ------------------
26219 object, or -1 if it is variable sized. The second argument is a pointer
26225 If ``ptr`` is a stack-allocated object and it points to the first byte of
26227 ``ptr`` is conservatively considered as a non-stack-allocated object if
26229 conclude that ``ptr`` is a stack-allocated object.
26242 If ``ptr`` is a non-stack-allocated object, it does not point to the first
26269 object, or -1 if it is variable sized. The second argument is a pointer
26275 If ``ptr`` is a stack-allocated object and it points to the first byte of the
26277 ``ptr`` is conservatively considered as a non-stack-allocated object if
26279 conclude that ``ptr`` is a stack-allocated object.
26281 Calling ``llvm.lifetime.end`` on an already dead alloca is no-op.
26283 If ``ptr`` is a non-stack-allocated object or it does not point to the first
26309 object, or -1 if it is variable sized. The second argument is a pointer
26341 object, or -1 if it is variable sized and the third argument is a
26424 Constrained Floating-Point Intrinsics
26425 -------------------------------------
26427 These intrinsics are used to provide special handling of floating-point
26428 operations when specific rounding mode or floating-point exception behavior is
26430 round-to-nearest and that floating-point exceptions will not be monitored.
26431 Constrained FP intrinsics are used to support non-default rounding modes and
26442 Each of these intrinsics corresponds to a normal floating-point operation. The
26469 For example, 'x-0'->'x' is not a valid transformation if the rounding mode is
26471 'x-0' should evaluate to '-0' when rounding downward. However, this
26475 actual runtime rounding mode (as defined in a target-specific manner) matches
26477 non-dynamic rounding mode which does not match the actual rounding mode at
26491 exception status flags will not be read and that floating-point exceptions will
26505 strictly preserve the floating-point exception semantics of the original code.
26513 The number and order of floating-point exceptions is NOT guaranteed. For
26553 intrinsic must be :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
26554 of floating-point values. Both arguments must have identical types.
26562 The value produced is the floating-point sum of the two value arguments and has
26590 intrinsic must be :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
26591 of floating-point values. Both arguments must have identical types.
26599 The value produced is the floating-point difference of the two value arguments
26627 intrinsic must be :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
26628 of floating-point values. Both arguments must have identical types.
26636 The value produced is the floating-point product of the two value arguments and
26664 intrinsic must be :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
26665 of floating-point values. Both arguments must have identical types.
26673 The value produced is the floating-point quotient of the two value arguments and
26701 intrinsic must be :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
26702 of floating-point values. Both arguments must have identical types.
26707 consistency with the other constrained floating-point intrinsics.
26712 The value produced is the floating-point remainder from the division of the two
26733 fused-multiply-add operation on its arguments.
26739 intrinsic must be :ref:`floating-point <t_floating>` or :ref:`vector
26740 <t_vector>` of floating-point values. All arguments must have identical types.
26768 floating-point ``value`` to its unsigned integer equivalent of type ``ty2``.
26801 :ref:`floating-point <t_floating>` ``value`` to type ``ty2``.
26835 unsigned integer ``value`` to a floating-point of type ``ty2``.
26850 An inexact floating-point exception will be raised if rounding is required.
26871 signed integer ``value`` to a floating-point of type ``ty2``.
26886 An inexact floating-point exception will be raised if rounding is required.
26942 floating-point ``value`` to a larger floating-point value.
26985 If the arguments are floating-point scalars, then the result type is a
26988 If the arguments are floating-point vectors, then the result type is a
27001 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
27002 of floating-point values. Both arguments must have identical types.
27009 - "``oeq``": ordered and equal
27010 - "``ogt``": ordered and greater than
27011 - "``oge``": ordered and greater than or equal
27012 - "``olt``": ordered and less than
27013 - "``ole``": ordered and less than or equal
27014 - "``one``": ordered and not equal
27015 - "``ord``": ordered (no nans)
27016 - "``ueq``": unordered or equal
27017 - "``ugt``": unordered or greater than
27018 - "``uge``": unordered or greater than or equal
27019 - "``ult``": unordered or less than
27020 - "``ule``": unordered or less than or equal
27021 - "``une``": unordered or not equal
27022 - "``uno``": unordered (either nans)
27039 - "``oeq``": yields ``true`` if both arguments are not a NAN and ``op1``
27041 - "``ogt``": yields ``true`` if both arguments are not a NAN and ``op1``
27043 - "``oge``": yields ``true`` if both arguments are not a NAN and ``op1``
27045 - "``olt``": yields ``true`` if both arguments are not a NAN and ``op1``
27047 - "``ole``": yields ``true`` if both arguments are not a NAN and ``op1``
27049 - "``one``": yields ``true`` if both arguments are not a NAN and ``op1``
27051 - "``ord``": yields ``true`` if both arguments are not a NAN.
27052 - "``ueq``": yields ``true`` if either argument is a NAN or ``op1`` is
27054 - "``ugt``": yields ``true`` if either argument is a NAN or ``op1`` is
27056 - "``uge``": yields ``true`` if either argument is a NAN or ``op1`` is
27058 - "``ult``": yields ``true`` if either argument is a NAN or ``op1`` is
27060 - "``ule``": yields ``true`` if either argument is a NAN or ``op1`` is
27062 - "``une``": yields ``true`` if either argument is a NAN or ``op1`` is
27064 - "``uno``": yields ``true`` if either argument is a NAN.
27094 multiply-add expressions that can be fused if the code generator determines
27103 intrinsic must be floating-point or vector of floating-point values.
27134 If a fused multiply-add is required, the corresponding
27139 Constrained libm-equivalent Intrinsics
27140 --------------------------------------
27142 In addition to the basic floating-point operations for which constrained
27148 As with the basic constrained floating-point intrinsics, the rounding mode
27150 They do not change the runtime floating-point environment.
27176 The first argument and the return type are floating-point numbers of the same
27186 If the value is less than negative zero, a floating-point exception occurs
27212 The first two arguments and the return value are floating-point numbers of the
27246 floating-point type is used, the second argument remains a scalar integer value.
27252 The first argument and the return value are floating-point numbers of the same
27253 type. The second argument is a 32-bit signed integer specifying the power to
27288 The first argument and the return value are :ref:`floating-point
27289 <t_floating>` or :ref:`vector <t_vector>` of floating-point values of
27329 The first argument and the return type are floating-point numbers of the same
27365 The first argument and the return type are floating-point numbers of the same
27401 The first argument and the return type are floating-point numbers of the same
27436 The first argument and the return type are floating-point numbers of the same
27472 The first argument and the return type are floating-point numbers of the same
27508 The first argument and the return type are floating-point numbers of the same
27544 The first two arguments and the return value are floating-point numbers of the
27553 This function returns the quadrant-specific arctangent using the specified
27579 The first argument and the return type are floating-point numbers of the same
27615 The first argument and the return type are floating-point numbers of the same
27651 The first argument and the return type are floating-point numbers of the same
27680 The '``llvm.experimental.constrained.exp``' intrinsic computes the base-e
27686 The first argument and the return value are floating-point numbers of the same
27715 The '``llvm.experimental.constrained.exp2``' intrinsic computes the base-2
27722 The first argument and the return value are floating-point numbers of the same
27751 The '``llvm.experimental.constrained.log``' intrinsic computes the base-e
27757 The first argument and the return value are floating-point numbers of the same
27787 The '``llvm.experimental.constrained.log10``' intrinsic computes the base-10
27793 The first argument and the return value are floating-point numbers of the same
27822 The '``llvm.experimental.constrained.log2``' intrinsic computes the base-2
27828 The first argument and the return value are floating-point numbers of the same
27858 argument rounded to the nearest integer. It may raise an inexact floating-point
27864 The first argument and the return value are floating-point numbers of the same
27876 mode is determined by the runtime floating-point environment. The rounding
27897 argument rounded to the nearest integer. An inexact floating-point exception
27905 The first argument is a floating-point number. The return value is an
27920 argument. The actual rounding mode is determined by the runtime floating-point
27924 If the runtime floating-point environment is using the default rounding mode
27945 argument rounded to the nearest integer. An inexact floating-point exception
27953 The first argument is a floating-point number. The return value is an
27968 argument. The actual rounding mode is determined by the runtime floating-point
27972 If the runtime floating-point environment is using the default rounding mode
27994 floating-point exception if the argument is not an integer.
28000 The first argument and the return value are floating-point numbers of the same
28012 mode is determined by the runtime floating-point environment. The rounding
28037 The first two arguments and the return value are floating-point numbers
28045 This function follows the IEEE-754 semantics for maxNum.
28069 The first two arguments and the return value are floating-point numbers
28077 This function follows the IEEE-754 semantics for minNum.
28096 of the two arguments, propagating NaNs and treating -0.0 as less than +0.0.
28101 The first two arguments and the return value are floating-point numbers
28109 This function follows semantics specified in the draft of IEEE 754-2019.
28128 of the two arguments, propagating NaNs and treating -0.0 as less than +0.0.
28133 The first two arguments and the return value are floating-point numbers
28141 This function follows semantics specified in the draft of IEEE 754-2019.
28165 The first argument and the return value are floating-point numbers of the same
28198 The first argument and the return value are floating-point numbers of the same
28231 The first argument and the return value are floating-point numbers of the same
28259 argument rounded to the nearest integer in floating-point format, rounding
28266 The first argument and the return value are floating-point numbers of the same
28274 This function implements IEEE-754 operation ``roundToIntegralTiesToEven``. It
28296 raise an inexact floating-point exception if the argument is not an integer.
28303 The first argument is a floating-point number. The return value is an
28334 raise an inexact floating-point exception if the argument is not an integer.
28341 The first argument is a floating-point number. The return value is an
28377 The first argument and the return value are floating-point numbers of the same
28430 .. code-block:: llvm
28466 --------------------------------------------------
28498 0 - toward zero
28499 1 - to nearest, ties to even
28500 2 - toward positive infinity
28501 3 - toward negative infinity
28502 4 - to nearest, ties away from zero
28505 target. These values are target-specific.
28535 return any value and uses platform-independent representation of IEEE rounding
28553 The '``llvm.get.fpenv``' intrinsic returns bits of the current floating-point
28554 environment. The return value type is platform-specific.
28559 The '``llvm.get.fpenv``' intrinsic reads the current floating-point environment
28577 The '``llvm.set.fpenv``' intrinsic sets the current floating-point environment.
28582 The argument is an integer representing the new floating-point environment. The
28583 integer type is platform-specific.
28588 The '``llvm.set.fpenv``' intrinsic sets the current floating-point environment
28590 call to '``llvm.get.fpenv``' or synthesized in a platform-dependent way.
28606 The '``llvm.reset.fpenv``' intrinsic sets the default floating-point environment.
28611 The '``llvm.reset.fpenv``' intrinsic sets the current floating-point environment
28623 The '``llvm.get.fpmode``' intrinsic returns bits of the current floating-point
28624 control modes. The return value type is platform-specific.
28633 The '``llvm.get.fpmode``' intrinsic reads the current dynamic floating-point
28644 The '``llvm.get.fpmode``' intrinsic reads the current dynamic floating-point
28648 an integer value. Interpretation of the bits in this value is target-dependent.
28656 The '``llvm.set.fpmode``' intrinsic sets the current floating-point control modes.
28665 The '``llvm.set.fpmode``' intrinsic sets the current dynamic floating-point
28671 The argument is a set of floating-point control modes, represented as an integer
28672 value in a target-dependent way.
28677 The '``llvm.set.fpmode``' intrinsic sets the current dynamic floating-point
28679 a call to '``llvm.get.fpmode``' or constructed in a target-specific way. It is
28696 The '``llvm.reset.fpmode``' intrinsic sets the default dynamic floating-point
28707 The '``llvm.reset.fpmode``' intrinsic sets the current dynamic floating-point
28712 Floating-Point Test Intrinsics
28713 ------------------------------
28715 These functions get properties of floating-point values.
28729 declare <N x i1> @llvm.is.fpclass(<vector-fptype> <op>, i32 <test>)
28738 If the first argument is a floating-point scalar, then the result type is a
28741 If the first argument is a floating-point vector, then the result type is a
28748 :ref:`floating-point <t_floating>` or :ref:`vector <t_vector>`
28749 of floating-point values.
28751 The second argument specifies, which tests to perform. It must be a compile-time
28752 integer constant, each bit in which specifies floating-point class:
28754 +-------+----------------------+
28755 | Bit # | floating-point class |
28758 +-------+----------------------+
28760 +-------+----------------------+
28762 +-------+----------------------+
28764 +-------+----------------------+
28766 +-------+----------------------+
28768 +-------+----------------------+
28770 +-------+----------------------+
28772 +-------+----------------------+
28774 +-------+----------------------+
28776 +-------+----------------------+
28781 The function checks if ``op`` belongs to any of the floating-point classes
28785 bit mask where each bit specifies floating-point class to test. For example, the
28786 value 0x108 makes test for normal value, - bits 3 and 8 in it are set, which
28788 normal value. The function never raises floating-point exceptions. The
28790 on the floating-point environment. If the floating-point environment
28792 by the ``"denormal-fp-math"`` attribute), a subnormal value will be
28797 ------------------
28867 annotations on a best-effort basis but are allowed to replace the intrinsic with
28907 transformations preserve annotations on a best-effort basis but are allowed to
29088 Currently some platforms have IR-level customized stack guard loading (e.g.
29117 ``llvm.objectsize`` returns 0 (if true) or -1 (if false) when the object size is
29121 the ``null`` is in a non-zero address space or if ``true`` is given for the
29133 returns ``i32/i64 -1 or 0`` (depending on the ``min`` argument).
29337 - If the given pointer is associated with the given type metadata identifier,
29341 - If the given pointer is not associated with the given type metadata
29348 2. If the function has a non-void return type, a pointer to a function that
29392 is to prevent the optimizer from performing fast-math optimizations,
29401 The argument and the return value are floating-point numbers,
29402 or vector floating-point numbers, of the same type.
29457 frame-local state from the currently executing (typically more specialized,
29480 the continuation itself is out of scope of the language reference --
29489 - ``@llvm.experimental.deoptimize`` cannot be invoked.
29490 - The call must immediately precede a :ref:`ret <i_ret>` instruction.
29491 - The ``ret`` instruction must return the value produced by the
29534 ``@llvm.experimental.deoptimize`` -- its body is defined to be
29537 .. code-block:: text
29586 well-defined.
29619 .. code-block:: text
29625 ; Apply memory-consuming but fast solution for a task.
29638 .. code-block:: text
29648 .. code-block:: text
29679 .. code-block:: text
29687 .. code-block:: text
29695 well-defined `i1` value. By making guard widening, we may
29706 freely do it if it can benefit from non-default lowering.
29751 .. code-block:: text
29785 This intrinsic is non-ubsan specific version of ``@llvm.allow.ubsan.check()``.
29811 .. code-block:: text
29836 This intrinsic loads a 32-bit value from the address ``%ptr + %offset``,
29840 ``i32 trunc(x - %ptr)``, the intrinsic call is folded to ``x``.
29898 is known to be a manifest compile-time constant. It is guaranteed to
29905 manifest compile-time constant value, then the intrinsic will be
29915 passes -- e.g., the result can change depending on whether a
29947 to facilitate alias analysis and underlying-object detection.
30038 The ``llvm.fake.use`` intrinsic is a no-op. It takes a single
30048 function-local SSA value. Note that the signature is variadic so that the
30061 --------------------
30067 Element Wise Atomic Memory Intrinsics
30068 -------------------------------------
30113 ``element_size`` must be a compile-time constant positive power of two no greater than
30114 target-specific atomic access size limit.
30189 ``element_size`` must be a compile-time constant positive power of two no
30190 greater than a target-specific atomic access size limit.
30268 ``element_size`` must be a compile-time constant positive power of two no greater than
30269 target-specific atomic access size limit.
30300 Objective-C ARC Runtime Intrinsics
30301 ----------------------------------
30303 LLVM provides intrinsics that lower to Objective-C ARC runtime entry points.
30305 knowledge. You can read more about the details of Objective-C ARC `here
30320 Lowers to a call to `objc_autorelease <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autorelease>`_.
30334 Lowers to a call to `objc_autoreleasePoolPop <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-autoreleasepoolpop-void-pool>`_.
30348 Lowers to a call to `objc_autoreleasePoolPush <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-autoreleasepoolpush-void>`_.
30362 Lowers to a call to `objc_autoreleaseReturnValue <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue>`_.
30376 Lowers to a call to `objc_copyWeak <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-copyweak-id-dest-id-src>`_.
30390 Lowers to a call to `objc_destroyWeak <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-destroyweak-id-object>`_.
30404 Lowers to a call to `objc_initWeak <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-initweak>`_.
30418 Lowers to a call to `objc_loadWeak <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-loadweak>`_.
30432 Lowers to a call to `objc_loadWeakRetained <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-loadweakretained>`_.
30446 Lowers to a call to `objc_moveWeak <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-moveweak-id-dest-id-src>`_.
30460 Lowers to a call to `objc_release <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-release-id-value>`_.
30474 Lowers to a call to `objc_retain <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-retain>`_.
30488 Lowers to a call to `objc_retainAutorelease <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-retainautorelease>`_.
30502 Lowers to a call to `objc_retainAutoreleaseReturnValue <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-retainautoreleasereturnvalue>`_.
30516 Lowers to a call to `objc_retainAutoreleasedReturnValue <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-retainautoreleasedreturnvalue>`_.
30530 Lowers to a call to `objc_retainBlock <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-retainblock>`_.
30544 Lowers to a call to `objc_storeStrong <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#void-objc-storestrong-id-object-id-value>`_.
30558 Lowers to a call to `objc_storeWeak <https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-storeweak>`_.
30561 ---------------------------------------
30564 IR-level operations. For example, it may be desirable to
30565 know the structure/union name and the original user-level field
30603 <attr_elementtype>` attribute at the call-site. This attribute specifies the
30672 <attr_elementtype>` attribute at the call-site. This attribute specifies the
30696 :ref:`floating-point <t_floating>` ``value`` to type ``ty2``
30702 The '``llvm.fptrunc.round``' intrinsic takes a :ref:`floating-point
30703 <t_floating>` value to cast and a :ref:`floating-point <t_floating>` type
30714 :ref:`floating-point <t_floating>` type to a smaller :ref:`floating-point
30716 This intrinsic is assumed to execute in the default :ref:`floating-point