RFR: 8324655: Identify integer minimum and maximum patterns created with if statements
Andrew Haley
aph-open at littlepinkcloud.com
Mon Jan 29 09:19:52 UTC 2024
On 1/26/24 09:55, Aleksey Shipilev wrote:
> On Thu, 25 Jan 2024 18:59:23 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:
>
>> Ah true, I hadn't considered that- do you think it makes sense to only do the transform if the if statement isn't highly predictable?
>
> Yeah, I think if this is effectively translating branches to cmovs, it should be gated by cmov conversion heuristics somehow. Not sure how to do this cleanly, given the choice for cmov-s for min/max is done only later in matching rules.
I believe the performance of branch predictors has improved so much
that cmov is of little benefit in most cases. Even when we have
recorded 50/50 branching for true/false, we still don't know much
about how well a branch will be predicted.
Having said that, max and min require both arguments to be fully
evaluated, so it's not quite such a big deal.
More information about the hotspot-compiler-dev
mailing list