RFR: 8324655: Identify integer minimum and maximum patterns created with if statements [v7]

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Mon Mar 18 16:47:33 UTC 2024


On Mon, 18 Mar 2024 13:40:16 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Jasmine Karthikeyan has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move logic to CMoveNode::Ideal and improve IR test
>
> src/hotspot/share/opto/movenode.cpp line 213:
> 
>> 211: 
>> 212:   // Ensure comparison is an integral type, and that the cmove is of the same type.
>> 213:   if ((cmp_op != Op_CmpI || cmove_op != Op_CMoveI) && (cmp_op != Op_CmpL || cmove_op != Op_CMoveL)) {
> 
> What if we combine a `CmpI` with a `CMoveL`?
> Or maybe there is some strange way to use a `Float.floatToIntBits` and combine a `CmpI` with a `CMoveF`?
> 
> Ah, wait. I think it is correct. It's just difficult to read these "inverted" formulas.
> I suggest you rewrite it to be:
> `! (both-int or both-long)`

Ah yep, I had originally wrote it that way but I factored out the `!`. I agree that it would be cleaner that way, though.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17574#discussion_r1528908129


More information about the hotspot-compiler-dev mailing list