[PATCH] D53340: [Intrinsic] Unigned Saturation Addition Intrinsic

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 09:41:37 PDT 2018


bjope added a comment.

In https://reviews.llvm.org/D53340#1267851, @leonardchan wrote:

> In https://reviews.llvm.org/D53340#1267393, @bjope wrote:
>
> > Is this intrinsic really needed for the fixed point support?
> >
> > Maybe I've missed something in the discussions about support for unsigned fixed point types, but in our implementation the unsigned types are using the positive range of the signed type, such as [0, SIGNED_MAX].  So we keep the sign bit zero for the unsigned fixed point types.  Are you planning for something different here?
> >
> > In our implementation we lower addition of two saturated unsigned fixed point types to `sadd.sat` (if the input values are in the range [0, SIGNED_MAX] the result will be in the range [0, SIGNED_MAX] as well). So we haven't really found a need for implementing `uadd.sat`.
>
>
> By default we have unsigned fixed point types in clang to use the entire length of the int, so it ranges from [0, UNSIGNED_MAX]. In this case I think it would be useful to have an unsigned version as well. This could also be used for regular unsigned integers that do not have a padding bit, and I believe @craig.topper was interested in this so they could be replaced with target specific calls to x86 intrinsics like PADDUSB and PADDUSW.


Ok, I see. That explains the need for it.

I haven't really reviewed the test case in detail (I'm not that familiar with the X86 vector instructions), but this LGTM.


Repository:
  rL LLVM

https://reviews.llvm.org/D53340





More information about the llvm-commits mailing list