[PATCH] D68651: [InstCombine] Signed saturation patterns

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 10:17:15 PDT 2019


lebedev.ri added a comment.

In D68651#1699976 <https://reviews.llvm.org/D68651#1699976>, @dmgreen wrote:

> Hello.
>
> Can you explain what you mean by "native format"? Do you mean without the extends/truncs, as a different way of specifying them?


Err, i meant native bitwidth, so yes, without any extends/truncs.

> (I think the problem at least from C is dealing with overflowing arithmetic being undefined. If you extend at least one bit then the arithmetic can't overflow, so you can do the min/max like it's done here).

True.
This highlights that we also might want to form it from `.with.overflow()` intrinsics.

> I don't think there is anywhere in instcombine that currently forms a sadd_sat or ssub_sat (as opposed to uadd_sat or usub_sat), unless it's from an existing sadd_sat. We do form uadd_sat as in rL357012 <https://reviews.llvm.org/rL357012> and usub_sat from selects.
> 
> I really just need some way to generate sadd_sats for vectorisation. If there's a better way than this, I'm all ears :)




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

https://reviews.llvm.org/D68651





More information about the llvm-commits mailing list