RFR: 8276162: Optimise unsigned comparison pattern [v4]
John R Rose
jrose at openjdk.org
Thu Oct 17 00:29:24 UTC 2024
On Sat, 13 Nov 2021 05:22:07 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:
>> This patch changes operations in the form `x +- Integer.MIN_VALUE <=> y +- Integer.MIN_VALUE`, which is a pattern used to do unsigned comparisons, into `x u<=> y`.
>>
>> In addition to being basic operations, they may be utilised to implement range checks such as the methods in `jdk.internal.util.Preconditions`, or in places where the compiler cannot deduce the non-negativeness of the bound as in `java.util.ArrayList`.
>>
>> Thank you very much.
>
> Quan Anh Mai has updated the pull request incrementally with two additional commits since the last revision:
>
> - add tests cover constant comparison and calling library
> - add eq/ne, add correction test, refine micro
More completely, it is x +-^ Integer.MIN_VALUE
That is, add, sub, xor are all legitimate idioms for flipping the sign
-------------
PR Comment: https://git.openjdk.org/jdk/pull/6101#issuecomment-2418223166
More information about the hotspot-compiler-dev
mailing list