RFR: 8283894: Intrinsify compress and expand bits on x86 [v2]
Sandhya Viswanathan
sviswanathan at openjdk.java.net
Tue May 17 00:53:50 UTC 2022
On Mon, 16 May 2022 15:25:55 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> Summary of changes:
>>
>> - Patch intrinsifies following newly added Java SE APIs
>> - Integer.compress
>> - Integer.expand
>> - Long.compress
>> - Long.expand
>>
>> - Adds C2 IR nodes and corresponding ideal transformations for new operations.
>> - We see around ~10x performance speedup due to intrinsification over X86 target.
>> - Adds an IR framework based test to validate newly introduced IR transformations.
>>
>> Kindly review and share your feedback.
>>
>> Best Regards,
>> Jatin
>
> Jatin Bhateja has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>
> - 8283894: Review comments resolutions.
> - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8283894
> - 8283894: Extending IR framework testcase with some functional test points.
> - 8283894: Intrinsify compress and expand bits on x86
src/hotspot/cpu/x86/x86_32.ad line 11478:
> 11476: //----------------------------- CompressBits/ExpandBits ------------------------
> 11477:
> 11478: instruct compressBitsL_reg(eADXRegL dst, eBCXRegL src, eBDPRegL mask, eSIRegI rtmp, regF xtmp) %{
eFlags should be added here in effect statement. Same for expand.
src/hotspot/cpu/x86/x86_32.ad line 11482:
> 11480: match(Set dst (CompressBits src mask));
> 11481: effect(TEMP rtmp, TEMP xtmp);
> 11482: format %{ "compress_bits32 $dst, $src, $mask\t! using $rtmp and $xtmp as TEMP" %}
We are compressing 64 bits here so the name usage as compress_bits32 would cause confusion. You are probably indicating that this is on 32 bits platform but that distinction is not required.
As you are using XMM register and not all 32 bit platforms support XMM, you also need to check for UseSSE > 0 in the predicate. The UseSSE > 0 check is needed for expand as well.
src/hotspot/cpu/x86/x86_32.ad line 11552:
> 11550: // from lower source register.
> 11551: __ bind(mask_clipping);
> 11552: __ blsrl($mask$$Register, $mask$$Register);
Need to add check for BMI1 support in predicate.
src/hotspot/share/opto/intrinsicnode.cpp line 275:
> 273: mask >>= 1;
> 274: }
> 275: return TypeInteger::make(res, res, w, bt);
For bt == T_INT res needs to be sign extended properly. Otherwise the checked_cast in TypeInteger::make() would assert if the bit 31 (MSB) is set in the res. Both jint and jlong are signed types.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8498
More information about the hotspot-compiler-dev
mailing list