Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-04-10 Thread Srinivas Vamsi Parasa
On Wed, 6 Apr 2022 06:23:47 GMT, Jatin Bhateja  wrote:

>>> Also need a jtreg test for this.
>> 
>> Thanks Sandhya for the review. Made the suggested changes and added jtreg 
>> tests as well.
>
> Hi @vamsi-parasa , thanks for addressing my comments, looks good to me 
> otherwise apart from the outstanding comments.

@jatin-bhateja Thank you Jatin!

-

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


Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-04-07 Thread Srinivas Vamsi Parasa
On Wed, 6 Apr 2022 00:45:37 GMT, Vladimir Kozlov  wrote:

>> Thanks for suggesting the enhancement. This enhancement will be implemented 
>> as a part of https://bugs.openjdk.java.net/browse/JDK-8282365
>
> You do need `Ideal()` methods at least to check for dead code.

Added the Ideal() methods for checking dead code. Pls see the new commit.

-

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


Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-04-06 Thread Jatin Bhateja
On Mon, 4 Apr 2022 07:24:12 GMT, Vamsi Parasa  wrote:

>> Also need a jtreg test for this.
>
>> Also need a jtreg test for this.
> 
> Thanks Sandhya for the review. Made the suggested changes and added jtreg 
> tests as well.

Hi @vamsi-parasa , thanks for addressing my comments, looks good to me 
otherwise apart from the outstanding comments.

-

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


Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-04-05 Thread Vladimir Kozlov
On Thu, 24 Feb 2022 19:04:37 GMT, Vamsi Parasa  wrote:

>> src/hotspot/share/opto/divnode.cpp line 881:
>> 
>>> 879:   return (phase->type( in(2) )->higher_equal(TypeLong::ONE)) ? in(1) : 
>>> this;
>>> 880: }
>>> 881: 
>>> //--Value--
>> 
>> Ideal transform to replace unsigned divide by cheaper logical right shift 
>> instruction if divisor is POW will be useful.
>
> Thanks for suggesting the enhancement. This enhancement will be implemented 
> as a part of https://bugs.openjdk.java.net/browse/JDK-8282365

You do need `Ideal()` methods at least to check for dead code.

-

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


Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-02-24 Thread Vamsi Parasa
On Thu, 24 Feb 2022 14:13:47 GMT, Jatin Bhateja  wrote:

>> Vamsi Parasa has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   fix 32bit build issues
>
> src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4408:
> 
>> 4406:   jmp(done);
>> 4407:   bind(neg_divisor_fastpath);
>> 4408:   // Fastpath for divisor < 0:
> 
> How about checking if divisor is +ve or -ve constant and non-constant 
> dividend in identity routine and setting a flag in IR node, which can be used 
> to either emit fast / slow path in a new instruction selection pattern. It 
> will save emitting redundant instructions.

Thanks for suggesting the enhancement. This enhancement will be implemented as 
a part of https://bugs.openjdk.java.net/browse/JDK-8282365

> src/hotspot/share/opto/divnode.cpp line 881:
> 
>> 879:   return (phase->type( in(2) )->higher_equal(TypeLong::ONE)) ? in(1) : 
>> this;
>> 880: }
>> 881: 
>> //--Value--
> 
> Ideal transform to replace unsigned divide by cheaper logical right shift 
> instruction if divisor is POW will be useful.

Thanks for suggesting the enhancement. This enhancement will be implemented as 
a part of https://bugs.openjdk.java.net/browse/JDK-8282365

> src/hotspot/share/opto/divnode.cpp line 897:
> 
>> 895: 
>> 896:   // Either input is BOTTOM ==> the result is the local BOTTOM
>> 897:   const Type *bot = bottom_type();
> 
> Can we add constant folding handling when both dividend and divisor are 
> constants.

Thanks for suggesting the enhancement. This enhancement will be implemented as 
a part of https://bugs.openjdk.java.net/browse/JDK-8282365

-

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


Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-02-24 Thread Jatin Bhateja
On Thu, 24 Feb 2022 02:43:46 GMT, Vamsi Parasa  wrote:

>> Optimizes the divideUnsigned() and remainderUnsigned() methods in 
>> java.lang.Integer and java.lang.Long classes using x86 intrinsics. This 
>> change shows 3x improvement for Integer methods and upto 25% improvement for 
>> Long. This change also implements the DivMod optimization which fuses 
>> division and modulus operations if needed. The DivMod optimization shows 3x 
>> improvement for Integer and ~65% improvement for Long.
>
> Vamsi Parasa has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fix 32bit build issues

src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp line 4408:

> 4406:   jmp(done);
> 4407:   bind(neg_divisor_fastpath);
> 4408:   // Fastpath for divisor < 0:

How about checking if divisor is +ve or -ve constant and non-constant dividend 
in identity routine and setting a flag in IR node, which can be used to either 
emit fast / slow path in a new instruction selection pattern. It will save 
emitting redundant instructions.

src/hotspot/share/opto/divnode.cpp line 881:

> 879:   return (phase->type( in(2) )->higher_equal(TypeLong::ONE)) ? in(1) : 
> this;
> 880: }
> 881: 
> //--Value--

Ideal transform to replace unsigned divide by cheaper logical right shift 
instruction if divisor is POW will be useful.

src/hotspot/share/opto/divnode.cpp line 897:

> 895: 
> 896:   // Either input is BOTTOM ==> the result is the local BOTTOM
> 897:   const Type *bot = bottom_type();

Can we add constant folding handling when both dividend and divisor are 
constants.

-

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


Re: RFR: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long [v4]

2022-02-23 Thread Vamsi Parasa
> Optimizes the divideUnsigned() and remainderUnsigned() methods in 
> java.lang.Integer and java.lang.Long classes using x86 intrinsics. This 
> change shows 3x improvement for Integer methods and upto 25% improvement for 
> Long. This change also implements the DivMod optimization which fuses 
> division and modulus operations if needed. The DivMod optimization shows 3x 
> improvement for Integer and ~65% improvement for Long.

Vamsi Parasa has updated the pull request incrementally with one additional 
commit since the last revision:

  fix 32bit build issues

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/7572/files
  - new: https://git.openjdk.java.net/jdk/pull/7572/files/13549290..2915b2e7

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=7572=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=7572=02-03

  Stats: 91 lines in 2 files changed: 49 ins; 42 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7572.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7572/head:pull/7572

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