RFR: 8256438: AArch64: Implement match rules with ROR shift register value [v3]
Roland Westrelin
roland at openjdk.java.net
Mon Feb 22 09:08:43 UTC 2021
On Mon, 1 Feb 2021 11:20:20 GMT, Eric Liu <github.com+10482586+theRealELiu at openjdk.org> wrote:
>> This patch transforms '(x >>> rshift) + (x << lshift)' into
>> 'RotateRight(x, rshift)' during GVN phase when both the shift exponents
>> are constants and their sum equals to the number of bits for the type
>> of shift base.
>>
>> This patch implements some new match rules for AArch64 instructions
>> which can take ROR as the optional shift. Such instructions are 'and',
>> 'or', 'eor', 'eon', 'bic' and 'orn'.
>>
>> ror w11, w2, #5
>> eor w0, w1, w11
>>
>> With this patch, above code could be optimized to below:
>>
>> eor w0, w1, w2, ror #5
>>
>> Finally, the patch refactors TestRotate.java[1][2].
>>
>> Tested jtreg TestRotate.java, hotspot::hotspot_all_no_apps,
>> jdk::jdk_core, langtools::tier1.
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8252776
>> [2] https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2020-September/039911.html
>
> Eric Liu has updated the pull request incrementally with one additional commit since the last revision:
>
> Add benchmark test
>
> Change-Id: I63ca51d06070a07e5c20daf4b42d2c8d7237a1da
Changes requested by roland (Reviewer).
src/hotspot/share/opto/addnode.cpp line 349:
> 347: }
> 348: }
> 349:
Even though existing code in that method seems to assume node's inputs can't be NULL, it's a good practice to protect against unexpected NULLs as that can happen when sub-graphs die during IGVN. So in(1)->in(1), in(1)->in(2), in(2)->in(2) need to be tested for NULL.
That logic and the one for AddLNode are almost identical. So it would be good to have it in a shared method. I've been adding helper methods to make that possible but not all of that code is in yet. Could you file a bug to revisit this issue later and assign it to me?
-------------
PR: https://git.openjdk.java.net/jdk/pull/1858
More information about the hotspot-compiler-dev
mailing list