RFR: 8283726: x86_64 intrinsics for compareUnsigned method in Integer and Long

Quan Anh Mai duke at openjdk.java.net
Wed Jun 8 09:42:32 UTC 2022


On Tue, 7 Jun 2022 17:14:18 GMT, Quan Anh Mai <duke at openjdk.java.net> wrote:

> Hi,
> 
> This patch implements intrinsics for `Integer/Long::compareUnsigned` using the same approach as the JVM does for long and floating-point comparisons. This allows efficient and reliable usage of unsigned comparison in Java, which is a basic operation and is important for range checks such as discussed in #8620 .
> 
> Thank you very much.

I have added a benchmark for the intrinsic. The result is as follows, thanks a lot:

                                                    Before          After
    Benchmark                 (size)  Mode  Cnt  Score   Error  Score   Error  Units
    Integers.compareUnsigned     500  avgt   15  0.527 ± 0.002  0.498 ± 0.011  us/op
    Longs.compareUnsigned        500  avgt   15  0.677 ± 0.014  0.561 ± 0.006  us/op

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

PR: https://git.openjdk.java.net/jdk/pull/9068


More information about the hotspot-compiler-dev mailing list