[llvm] [RISCV][NFC] Avoid iteration and division while selecting SHXADD instructions (PR #158851)

Piotr Fusik via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 11:14:49 PDT 2025


pfusik wrote:

> I would expect these loops to be unrolled and the divides to be simplified on any reasonable compiler, do you actual see these surviving? Mostly just curious if this is purely stylistic or not.

I haven't looked at the assembly, but if both levels of 3/5/9 loops are unrolled, that's quite some binary bloat.

The point is that we can match the `(3/5/9 << N)` pattern without any (possibly optimized to muls) divisions -- see the new function in RISCVInstrInfo.h.

https://github.com/llvm/llvm-project/pull/158851


More information about the llvm-commits mailing list