[PATCH] D78300: [builtins] Do not assume sizeof(long long)==8 in int_div_impl.inc

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 09:10:02 PDT 2020


bjope added a comment.

In D78300#1989021 <https://reviews.llvm.org/D78300#1989021>, @MaskRay wrote:

> Pushed 17772995d48b8c10a3142d602e228f3ebeed85bf <https://reviews.llvm.org/rG17772995d48b8c10a3142d602e228f3ebeed85bf> instead
>
> It is still unclear to me why assuming `sizeof(long long)==8` can cause problems. You need to provide more information.


__udivdi3 use du_int, which maps to unsigned long long. And with CHAR_BIT=16 we get sizeof(du_int)==sizeof(unsigned long lon)==4. 
For udivdi3.c (which is doing `typedef du_int fixuint_t`)  we ended up using __bultin_clz for the unsigned long long division, as the comparison was checking if sizeof(fixuint_t) was 8.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78300





More information about the llvm-commits mailing list