[Bug target/106484] Failure to optimize uint64_t/constant division on ARM32
rsaxvc at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 1 12:12:15 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106484
--- Comment #3 from rsaxvc at gmail dot com ---
> 32-bit division by constant relies on a 32x32->64 bit multiply.
I believe only the upper half of the bits are required for the product to
represent the integer component of the quotient. This makes parameter passing
much easier in the uint64_t/constant case.
> We don't have an instruction for that on arm nor does gcc support 128-bit integer types on a 32-bit compiler.
I ran into that as well. The attached uint64_t umulh( uint64_t a, uint64_t b )
implements a 64x64->64MSBsOf128BitProduct using only 32x32->64 bit
multiplication, 64-bit addition, and register-aligned shifting.
More information about the Gcc-bugs
mailing list