RFR: 8335444: Generalize implementation of AndNode mul_ring [v3]
Jasmine Karthikeyan
jkarthikeyan at openjdk.org
Thu Aug 22 20:27:06 UTC 2024
On Mon, 19 Aug 2024 11:51:53 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:
>> You're totally right! It is not even related to the LSB (`-14 & -6` would have the same problem with `-12`). Finding the leading 1s is the right solution. Thanks a lot for the clarification!
>
> Can the upper limit be improved similar to what you added for the "both ranges are positive" case if we know that both ranges are negative?
> In the positive case, we have values from:
>
> 011...1
> 000...0
> ```
> while in the negative case, we have values from:
>
> 111...1
> 100...0
>
> It suggests that we can then use the same argument as for the positive case and say that the maximum will be the maximum of the smaller range (i.e. `MIN2(r0->_hi, r1->_hi)`?
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20066#discussion_r1727766730
More information about the hotspot-compiler-dev
mailing list