RFR: 8318723: RISC-V: C2 UDivL

Ludovic Henry luhenry at openjdk.org
Wed Oct 25 14:50:36 UTC 2023


On Wed, 25 Oct 2023 13:39:35 GMT, Hamlin Li <mli at openjdk.org> wrote:

>> IIUC, with the branch, the results are `6376.674 ±  16.869  ns/op`, and without the branch, they are `29518.033 ± 49.056`, correct? If so, the branch makes more sense, at least of the board you've tested.
>
> Yes, for negtive divisor, unsigned div can go through a quick path which is must faster than built-in instructions.
> And this is demonstrated in the div cost in riscv.ad, and also verified by benchmark tests run on the board.
> 
> ( I'm not sure if in the future built-in div will be faster, if it turns out in the future, we should also need to redefine the div cost in riscv.ad, and re-visit this intrinsic. )

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.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16346#discussion_r1371898530


More information about the hotspot-dev mailing list