Rust: Faster divide operation?

Created on 11 Feb 2019  路  2Comments  路  Source: rust-lang/rust

https://lemire.me/blog/2019/02/08/faster-remainders-when-the-divisor-is-a-constant-beating-compilers-and-libdivide/
Seems to describe a nice optimisation to have.
Maybe this is more on the llvm side than rustc side?
Some complementary comments:
https://news.ycombinator.com/item?id=19116020

Most helpful comment

I think this is called strength reduction and LLVM should already do it easily. Even if not, this should be implemented in LLVM, not rustc, so I'll close this. If you can demonstrate the optimization not happening, please post a reproduction and I'll reopen.

All 2 comments

LLVM or gcc should be able to do that optimization.

I think this is called strength reduction and LLVM should already do it easily. Even if not, this should be implemented in LLVM, not rustc, so I'll close this. If you can demonstrate the optimization not happening, please post a reproduction and I'll reopen.

Was this page helpful?
0 / 5 - 0 ratings