RFR: 8347459: C2: missing transformation for chain of shifts/multiplications by constants [v9]

Marc Chevalier duke at openjdk.org
Tue Mar 11 10:03:44 UTC 2025


On Mon, 10 Mar 2025 15:38:56 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> src/hotspot/share/opto/memnode.cpp line 3541:
>> 
>>> 3539: // +------------------------+---------+
>>> 3540: //  31                     8 7        0
>>> 3541: // v[0..7] is meaningful, but v[8..31] is not. In this case, num_rejected_bits == 24.
>> 
>> Would this example not be nice with the original case above?
>> 
>> // Check for useless sign-extension before a partial-word store
>> // (StoreB ... (RShiftI _ (LShiftI _ valIn conIL ) conIR) )
>> // If (conIL == conIR && conIR <= num_bits)  this simplifies to
>> // (StoreB ... (valIn) )
>> 
>> Because it seems you are assuming here that `conIL == conIR`, right? And then below you ask what if they are not equal.
>
> It could also be nice to introduce the `num_rejected_bits` somewhere.

I don't understand what you mean. I'm not speaking about `conIR` and `conIL` here. I'm just saying we have a value v that we want to store in a 8-bit long storage (a byte). We can see v as made of its 8 lower bits (that we want to actually store) and the 24 upper bits (that we don't care about). I'm just introducing notations, but I haven't done any operation yet. I tried to rephrase around there.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23728#discussion_r1988862498


More information about the hotspot-compiler-dev mailing list