diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-03-09 16:20:52 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-03-09 16:20:52 +0000 |
| commit | 2b1f6f4b92b28278f38812e4497aa115b904b161 (patch) | |
| tree | 98862032e367f6078260ff41f46422d97d415047 /llvm/docs | |
| parent | 129edab125931162665df2ceecb87bf917f2425d (diff) | |
| download | bcm5719-llvm-2b1f6f4b92b28278f38812e4497aa115b904b161.tar.gz bcm5719-llvm-2b1f6f4b92b28278f38812e4497aa115b904b161.zip | |
[InstSimplify] vector div/rem with any zero element in divisor is undef
This was suggested as a DAG simplification in the review for rL297026 :
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170306/435253.html
...but let's start with IR since we have actual docs for IR (LangRef).
Differential Revision:
https://reviews.llvm.org/D30665
llvm-svn: 297390
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/LangRef.rst | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst index cf09a89db33..c5771ad5248 100644 --- a/llvm/docs/LangRef.rst +++ b/llvm/docs/LangRef.rst @@ -6329,7 +6329,9 @@ The value produced is the unsigned integer quotient of the two operands. Note that unsigned integer division and signed integer division are distinct operations; for signed integer division, use '``sdiv``'. -Division by zero leads to undefined behavior. +Division by zero is undefined behavior. For vectors, if any element +of the divisor is zero, the operation has undefined behavior. + If the ``exact`` keyword is present, the result value of the ``udiv`` is a :ref:`poison value <poisonvalues>` if %op1 is not a multiple of %op2 (as @@ -6374,9 +6376,10 @@ rounded towards zero. Note that signed integer division and unsigned integer division are distinct operations; for unsigned integer division, use '``udiv``'. -Division by zero leads to undefined behavior. Overflow also leads to -undefined behavior; this is a rare case, but can occur, for example, by -doing a 32-bit division of -2147483648 by -1. +Division by zero is undefined behavior. For vectors, if any element +of the divisor is zero, the operation has undefined behavior. +Overflow also leads to undefined behavior; this is a rare case, but can +occur, for example, by doing a 32-bit division of -2147483648 by -1. If the ``exact`` keyword is present, the result value of the ``sdiv`` is a :ref:`poison value <poisonvalues>` if the result would be rounded. @@ -6459,8 +6462,10 @@ remainder. Note that unsigned integer remainder and signed integer remainder are distinct operations; for signed integer remainder, use '``srem``'. - -Taking the remainder of a division by zero leads to undefined behavior. + +Taking the remainder of a division by zero is undefined behavior. +For vectors, if any element of the divisor is zero, the operation has +undefined behavior. Example: """""""" @@ -6510,7 +6515,9 @@ operation <http://en.wikipedia.org/wiki/Modulo_operation>`_. Note that signed integer remainder and unsigned integer remainder are distinct operations; for unsigned integer remainder, use '``urem``'. -Taking the remainder of a division by zero leads to undefined behavior. +Taking the remainder of a division by zero is undefined behavior. +For vectors, if any element of the divisor is zero, the operation has +undefined behavior. Overflow also leads to undefined behavior; this is a rare case, but can occur, for example, by taking the remainder of a 32-bit division of -2147483648 by -1. (The remainder doesn't actually overflow, but this |

