mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[Docs] clarify semantics of x.with.overflow intrinsics
Differential Revision: http://reviews.llvm.org/D20151 llvm-svn: 269346
This commit is contained in:
parent
73741e2745
commit
c1b0c5a7b4
@ -10858,7 +10858,26 @@ then the result is the size in bits of the type of ``src`` if
|
||||
Arithmetic with Overflow Intrinsics
|
||||
-----------------------------------
|
||||
|
||||
LLVM provides intrinsics for some arithmetic with overflow operations.
|
||||
LLVM provides intrinsics for fast arithmetic overflow checking.
|
||||
|
||||
Each of these intrinsics returns a two-element struct. The first
|
||||
element of this struct contains the result of the corresponding
|
||||
arithmetic operation modulo 2\ :sup:`n`\ , where n is the bit width of
|
||||
the result. Therefore, for example, the first element of the struct
|
||||
returned by ``llvm.sadd.with.overflow.i32`` is always the same as the
|
||||
result of a 32-bit ``add`` instruction with the same operands, where
|
||||
the ``add`` is *not* modified by an ``nsw`` or ``nuw`` flag.
|
||||
|
||||
The second element of the result is an ``i1`` that is 1 if the
|
||||
arithmetic operation overflowed and 0 otherwise. An operation
|
||||
overflows if, for any values of its operands ``A`` and ``B`` and for
|
||||
any ``N`` larger than the operands' width, ``ext(A op B) to iN`` is
|
||||
not equal to ``(ext(A) to iN) op (ext(B) to iN)`` where ``ext`` is
|
||||
``sext`` for signed overflow and ``zext`` for unsigned overflow, and
|
||||
``op`` is the underlying arithmetic operation.
|
||||
|
||||
The behavior of these intrinsics is well-defined for all argument
|
||||
values.
|
||||
|
||||
'``llvm.sadd.with.overflow.*``' Intrinsics
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
Loading…
Reference in New Issue
Block a user