RFR: 8346664: C2: Optimize mask check with constant offset [v3]
Matthias Ernst
duke at openjdk.org
Thu Jan 23 09:06:10 UTC 2025
On Thu, 23 Jan 2025 07:52:34 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
>> Matthias Ernst has updated the pull request incrementally with one additional commit since the last revision:
>>
>> (c)
>
> src/hotspot/share/opto/mulnode.hpp line 87:
>
>> 85:
>> 86: protected:
>> 87: Node* AndIL_sum_and_mask(PhaseGVN* phase, BasicType bt);
>
> Can you please update the copyright from 2024 -> 2025?
Done.
> test/hotspot/jtreg/compiler/c2/irTests/TestShiftAndMask.java line 47:
>
>> 45:
>> 46: // any X << INT_MASK_WIDTH is zero under any INT_MASK
>> 47: static final int INT_MASK_WIDTH = 1 + RANDOM.nextInt(30);
>
> I wonder if we should additionally have some tests where the mask can have arbitrary width. This may not allow us to do IR rules, but it would ensure we get the correct values.
>
> Because you have some assert above that checks that the shift should have been masked already, for example. It would be good to have a corresponding test.
Can you clarify? The masks tested are up to 30 bits / 62 bits wide to test the maximum possible masked values with 31 / 63 trailing zeros.
Do you mean arbitrary _shift_ ala
return (j + i << 129) & 32; // NOT eliminated, only lower 5 bits of shift count.
I've added a test to that effect.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22856#discussion_r1926603518
PR Review Comment: https://git.openjdk.org/jdk/pull/22856#discussion_r1926584830
More information about the hotspot-compiler-dev
mailing list