RFR: 8346664: C2: Optimize mask check with constant offset [v3]

Emanuel Peter epeter at openjdk.org
Thu Jan 23 08:05:52 UTC 2025


On Wed, 8 Jan 2025 13:00:59 GMT, Matthias Ernst <duke at openjdk.org> wrote:

>> src/hotspot/share/opto/mulnode.cpp line 2113:
>> 
>>> 2111: 
>>> 2112:   jint zeros = AndIL_min_trailing_zeros(phase, expr, bt);
>>> 2113:   return zeros > 0 && ((((jlong)1) << zeros) > mask_t->hi_as_long() && mask_t->lo_as_long() >= 0);
>> 
>> This line indicates that the `mask` could be a variable. You should make sure to add some tests for that in your patterns. You can create a variable in a specific range like this `Math.min(5, Math.max(1, x))`, should get you `x` clamped into the region `1..5`.
>
> Added a variant for adding consts using the same pattern as the other "NonConstMask" tests.

Can you please point me to the tests where `mask_t` is a range, and not a constant?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/22856#discussion_r1926513918


More information about the hotspot-compiler-dev mailing list