RFR: 8282365: Consolidate and improve division by constant idealizations [v46]

Raffaello Giulietti rgiulietti at openjdk.org
Wed Jan 31 18:09:16 UTC 2024


On Wed, 31 Jan 2024 17:29:23 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/divconstants.cpp line 55:
>> 
>>> 53: //
>>> 54: // ceil(x / d) = floor(x * c / m) + 1 for every integer x in [-N, 0)
>>> 55: //
>> 
>> For the record, the domain for non-negative dividends can be extended to `[0, v + d)`, which is usually larger than `[0, N]`, since `v <= N < v + d`.
>> Similarly, the domain for negative dividends can be extended to `(-(v + d), 0)`.
>
> Indeed, however if we go from a given `N` then the solution would be the same.

Nothing would change in the algorithm.
I just wanted to point it out to have a record here (and in the mailing list).

To the reviewers of the less math-oriented aspects: I'm pretty confident that this algorithm is correct, so I would approve it in isolation if this were possible ;-)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/9947#discussion_r1473254522


More information about the hotspot-compiler-dev mailing list