[llvm-dev] enable optimization of integer multiplication and modulo using faster operations?

Stephen Checkoway via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 5 23:38:11 PST 2019



> On Mar 5, 2019, at 23:34, Peng Yu via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Is clang able to produce optimized code for integer multiplication and
> modulo operations? Thanks.

It certainly seems to, just not in IR as Craig mentioned. I put your function into compiler explorer and you can see it was compiled to a left shift by 5 and a subtraction, just as you'd expect <https://godbolt.org/z/f4gRId>.

-- 
Stephen Checkoway







More information about the llvm-dev mailing list