[libc-commits] [PATCH] D131095: [libc] Prevent overflow from intermediate results when adding UInt<N> values.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Aug 4 11:45:47 PDT 2022


lntue added a comment.

In D131095#3699654 <https://reviews.llvm.org/D131095#3699654>, @tschuett wrote:

> Did you consider using builtins with overflow checking:
> https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
> It is platform independent and leaves some optimisations opportunities to the compiler.

Thanks for your suggestion!  We definitely want to use compiler builtins to improve the performance whenever they are available, and fall back to generic implementation otherwise.

As of now, this code is only used in a very limited way for arm32 platforms that do not have `__uint128_t` builtins, and we haven't finished setting up other requirements such as flags, environments or performance testings yet.

Once those are set, we will followup with performance enhancement using builtins, together with more comprehensive testings, including exception flags and performance, and making sure that the fallback works properly just as @orex mentioned.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131095



More information about the libc-commits mailing list