[llvm] [SelectionDAG] Optimize zero-extended multiplies on targets without native LOHI mul (PR #203135)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 10 17:57:36 PDT 2026
topperc wrote:
> One thing I'm slightly unsure of can be seen in the RISC-V tests. When the smaller multiply also requires a libcall, we are basically replacing each wider libcall (e.g. __multi3) with up to 4 smaller libcalls (e.g. __muldi3). This is an improvement in that it will result in fewer multiplications in the end (or additions/shifts in the case of fully soft-mul) but it does result in a code size increase. It still seems better to me overall but interested in opinions.
It looks like libgcc has a custom version of multi3 for RISC-V that computes a full product from the low parts, then does a check for the high half of the inputs being 0 before computing their effect. The compiler-rt version does not have such a check.
https://github.com/llvm/llvm-project/pull/203135
More information about the llvm-commits
mailing list