atrosinenko added a comment. In D86547#2284095 <https://reviews.llvm.org/D86547#2284095>, @MaskRay wrote:
> The `(aWidth - 1) - clzsi(a)` change is correct, but why is the ctz change? `d.s.low` and `d.s.high` are `su_int`. While some helpers from `libgcc` are documented with `int`, `long`, etc. types //for simplicity// and use machine modes under the hood, the `__builtin_ctz()` function (as well as clz), on the other hand, seems to **really** accept an `int`-sized argument: $ clang --version clang version 10.0.0-4ubuntu1 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin $ clang -S -O3 -o- -x c - <<< "int f() { return __builtin_ctz(0x100000); }" .text .file "-" .globl f # -- Begin function f .p2align 4, 0x90 .type f,@function f: # @f .cfi_startproc # %bb.0: movl $20, %eax retq .Lfunc_end0: .size f, .Lfunc_end0-f .cfi_endproc # -- End function .ident "clang version 10.0.0-4ubuntu1 " .section ".note.GNU-stack","",@progbits .addrsig $ clang -S -O3 -target msp430 -o- -x c - <<< "int f() { return __builtin_ctz(0x100000); }" <stdin>:1:32: warning: implicit conversion from 'long' to 'unsigned int' changes value from 1048576 to 0 [-Wconstant-conversion] int f() { return __builtin_ctz(0x100000); } ~~~~~~~~~~~~~ ^~~~~~~~ .text .file "-" .globl f ; -- Begin function f .p2align 1 .type f,@function f: ; @f ; %bb.0: ret .Lfunc_end0: .size f, .Lfunc_end0-f ; -- End function .ident "clang version 10.0.0-4ubuntu1 " .section ".note.GNU-stack","",@progbits .addrsig 1 warning generated. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D86547/new/ https://reviews.llvm.org/D86547 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits