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

Vamsi Parasa duke at openjdk.java.net
Thu Feb 24 19:08:08 UTC 2022


On Thu, 24 Feb 2022 14:13:47 GMT, Jatin Bhateja <jbhateja at openjdk.org> 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


More information about the hotspot-compiler-dev mailing list