[PATCH] D83216: [Intrinsic] Add sshl.sat/ushl.sat, saturated shift intrinsics.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 11:45:06 PDT 2020


lebedev.ri added inline comments.


================
Comment at: llvm/docs/LangRef.rst:14269
+bit width, but they must have the same bit width. ``%a`` is the value to be
+shifted, and ``%b`` is the amount to shift by. ``%b`` must be less than the bit
+width.
----------------
efriedma wrote:
> Not sure what "must be" means in this context; the shift amount is a variable, so we can't enforce anything about it statically.
> 
> Is it poison?  Or undefined behavior?  Or does the shift clamp to the min/max value?
Right, we should spell that out.
IMO this should be consistent with normal shifts, i.e. poison),
```
If ``b`` is (statically or
dynamically) equal to or larger than the number of bits in
``a``, this instruction returns a :ref:`poison value <poisonvalues>`.
If the arguments are vectors, each vector element of ``a`` is shifted
by the corresponding shift amount in ``b``.
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83216/new/

https://reviews.llvm.org/D83216





More information about the llvm-commits mailing list