RFR: 8318723: RISC-V: C2 UDivL
Quan Anh Mai
qamai at openjdk.org
Wed Oct 25 18:57:26 UTC 2023
On Wed, 25 Oct 2023 17:53:15 GMT, Andrew Haley <aph at openjdk.org> wrote:
>> Ok, so let's keep the version with branch. You should add a comment at https://github.com/openjdk/jdk/pull/16346/files#diff-7a5c3ed05b6f3f06ed1c59f5fc2a14ec566a6a5bd1d09606115767daa99115bdR2435 explaining just that.
>
> But you're putting a conditional branch in the way of the common cases, and you're greatly increasing icache pressure, for the sake of a rare case. How does that make any sense?
I agree with @theRealAph here, this seems like a micro optimisation for the sake of microbenchmark that will not be beneficial in general. And if a considerable portion of divisors does lie in this range, the optimisation can always be applied from the caller side. Furthermore, by doing so we will even have the benefit of branch profiling, which will help achieve better results. Another note is that I do not know any compiler that does this premature optimisation. Thanks.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16346#discussion_r1372194253
More information about the hotspot-dev
mailing list