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

2022-06-09 Thread Sandhya Viswanathan
On Wed, 8 Jun 2022 09:39:04 GMT, Quan Anh Mai  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.compareUnsigned500  avgt   15  0.677 ± 0.014  0.561 ± 0.006 
>  us/op

@merykitty Could you please also add the micro benchmark where compareUnsigned 
result is stored directly in an integer and show the performance of that?

-

PR: https://git.openjdk.org/jdk/pull/9068


Re: RFR: 8283726: x86_64 intrinsics for compareUnsigned method in Integer and Long [v2]

2022-06-08 Thread Vladimir Kozlov
On Wed, 8 Jun 2022 09:39:23 GMT, Quan Anh Mai  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.
>
> Quan Anh Mai has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - remove comments
>  - review comments

Tier1-4 testing passed - no new failures. I suggest to push it into JDK 20 
after fork and after you get second review.

-

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


Re: RFR: 8283726: x86_64 intrinsics for compareUnsigned method in Integer and Long [v2]

2022-06-08 Thread Vladimir Kozlov
On Wed, 8 Jun 2022 09:39:23 GMT, Quan Anh Mai  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.
>
> Quan Anh Mai has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - remove comments
>  - review comments

Good. I submitted testing.
You need second review.

-

Marked as reviewed by kvn (Reviewer).

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


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

2022-06-08 Thread Quan Anh Mai
On Tue, 7 Jun 2022 17:14:18 GMT, Quan Anh Mai  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.compareUnsigned500  avgt   15  0.677 ± 0.014  0.561 ± 0.006  
us/op

-

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


Re: RFR: 8283726: x86_64 intrinsics for compareUnsigned method in Integer and Long [v2]

2022-06-08 Thread Quan Anh Mai
On Tue, 7 Jun 2022 17:41:13 GMT, Vladimir Kozlov  wrote:

>> Quan Anh Mai has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - remove comments
>>  - review comments
>
> src/hotspot/share/opto/subnode.hpp line 217:
> 
>> 215: 
>> //--CmpU3Node--
>> 216: // Compare 2 unsigned values, returning integer value (-1, 0 or 1).
>> 217: class CmpU3Node : public CmpUNode {
> 
> Place it after `CmpUNode` class.

Done

-

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


Re: RFR: 8283726: x86_64 intrinsics for compareUnsigned method in Integer and Long [v2]

2022-06-08 Thread Quan Anh Mai
> 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.

Quan Anh Mai has updated the pull request incrementally with two additional 
commits since the last revision:

 - remove comments
 - review comments

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/9068/files
  - new: https://git.openjdk.java.net/jdk/pull/9068/files/01c0a07c..b5627135

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=9068=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=9068=00-01

  Stats: 44 lines in 3 files changed: 32 ins; 12 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/9068.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/9068/head:pull/9068

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


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

2022-06-07 Thread Vladimir Kozlov
On Tue, 7 Jun 2022 17:14:18 GMT, Quan Anh Mai  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.

Please add microbenchmark and show its results.

src/hotspot/share/opto/subnode.hpp line 217:

> 215: 
> //--CmpU3Node--
> 216: // Compare 2 unsigned values, returning integer value (-1, 0 or 1).
> 217: class CmpU3Node : public CmpUNode {

Place it after `CmpUNode` class.

-

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