C2 uses a variant of Granlund & Montgomery's algorithm (as described in Hacker's delight, Warren, Jr) for long and integer division and modulo by a constant divisor: https://github.com/openjdk/jdk/blob/01c0d5dd0a4f7587288219bad8ed4648f4e456ce/src/hotspot/share/opto/divnode.cpp#L161
Other techniques/algorithms has been proposed since that might improve things, especially mod/remainder calculations. For example the one proposed by Lemire et in "Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries": https://arxiv.org/abs/1902.01961 or the "modular inverse function" described by Neri in https://accu.org/journals/overload/27/154/neri_2722/
We should examine applying either of these in C2.
Other techniques/algorithms has been proposed since that might improve things, especially mod/remainder calculations. For example the one proposed by Lemire et in "Faster Remainder by Direct Computation: Applications to Compilers and Software Libraries": https://arxiv.org/abs/1902.01961 or the "modular inverse function" described by Neri in https://accu.org/journals/overload/27/154/neri_2722/
We should examine applying either of these in C2.