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

Quan Anh Mai qamai at openjdk.org
Mon Oct 30 13:47:58 UTC 2023


On Mon, 30 Oct 2023 11:44:24 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> I don't see how to perform the computations in W-bit arithmetic without severely restricting the range of the dividend

Yes the compiler can track the value range of a variable in a reasonably rigorous manner. For example, it can deduce that the value of the expression `x & 100` must be in the range [0. 100]. As a result, it can take advantage of this range when transforming the division. You can see the effect in the benchmark `IntegerDivMod.testDivideConstantBounded` where the computation can be done in `int` instead of `long`, leading to higher parallelism after vectorisation. As a result, my approach takes the bounds in both positive and negative ranges and tries to find the best coefficients.

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

PR Comment: https://git.openjdk.org/jdk/pull/9947#issuecomment-1785233748


More information about the hotspot-compiler-dev mailing list