mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-26 14:25:18 +00:00
[Docs] clarify semantics of x.with.overflow intrinsics
Differential Revision: http://reviews.llvm.org/D20151 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@269346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d9641c92d5
commit
39fa507537
@ -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…
x
Reference in New Issue
Block a user