[Bug rtl-optimization/86627] Inefficient division of 128-bit ints by small constant integers
amonakov at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jul 22 11:19:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86627
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amonakov at gcc dot gnu.org
--- Comment #2 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Division by 2 is very cheap only for unsigned. For possibly-negative operands
as in your example, it needs a not-so-trivial sequence (see e.g. gcc-4.9 or
llvm output).
Division by non-pot constants is very hard to improve. The ISA does not have
multiply-high for 128-bit integers, so it's not going to be fast anyway.
I wonder what changed between gcc-4.9 and gcc-5 that we stopped RTL-expanding
signed 128-bit division by 2 inline (to a 128-bit right shift with a fixup). I
suggest to focus only on power-of-two division in this bug.
More information about the Gcc-bugs
mailing list