RFR: 8347459: C2: missing transformation for chain of shifts/multiplications by constants [v4]
Marc Chevalier
duke at openjdk.org
Thu Feb 27 08:36:01 UTC 2025
On Wed, 26 Feb 2025 16:33:05 GMT, Damon Fenacci <dfenacci at openjdk.org> wrote:
>> Marc Chevalier has updated the pull request incrementally with one additional commit since the last revision:
>>
>> comment
>
> test/hotspot/jtreg/compiler/c2/irTests/LShiftINodeIdealizationTests.java line 255:
>
>> 253: res[0] = (short) (a[0] << 3);
>> 254: return res;
>> 255: }
>
> In the comment of method `StoreNode::Ideal_sign_extended_input` you mention shifting left by more than 24. Do you think it would be possible to have a test for that case too (shifting left by more than 16 in this case I guess)?
I'm talking about is the case where the shift exceed 24, but taking into account the double shifting used to sign-extend the value. In the case of this test, we would get a `((a[0] << 3) << 16) >> 16` that my improvement will change into `(a[0] << 19) >> 16`which used not to be supported. The 19 here is the shift larger than 16.
But I think you meant replacing the `3` in the test with something like `17`. Then, the expression will look like `((a[0] << 17) << 16) >> 16` that my change collapses into `0 >> 16`, since 16 + 17 = 33 is bigger than the length of an int. (It is tested by one of the previous cases in the same file). So nothing really exciting happens there.
Or maybe you're suggesting something else I've missed?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23728#discussion_r1973111044
More information about the hotspot-compiler-dev
mailing list