RFR: 8335444: Generalize implementation of AndNode mul_ring [v3]
Quan Anh Mai
qamai at openjdk.org
Fri Aug 23 17:56:08 UTC 2024
On Fri, 23 Aug 2024 17:52:19 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> This is a great observation! Since bitwise-and can only remove bits, the largest possible value is the smaller of each range's `hi` value so I think it's correct to use the minimum here rather than the maximum. I didn't look into this case too deeply initially since I didn't find any bitwise-and nodes of two negative ranges in my investigation, but I think we should include it since it's a simple enough condition to check.
>
> Another point of view, you can decompose `[lo, hi]` into `[lo, -1] v [0, hi]`. Then `[lo1, hi1] & [lo2, hi2]` can be calculated as:
>
> ([lo1, -1] & [lo2, -1]) v ([lo1, -1] & [0, hi2]) v ([0, hi1] & [lo2, -1]) v ([0, hi1] & [0, hi2]) =
> [lo, -1] v [0, hi2] v [0, h1] v [0, min(hi1, hi2)] =
> [lo, max(hi1, hi2)]`
>
> with `lo` being the lower bound you calculated right above.
Just to be clear I think `MAX2` is the correct thing here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20066#discussion_r1729329256
More information about the hotspot-compiler-dev
mailing list