RFR: 8324655: Identify integer minimum and maximum patterns created with if statements [v3]
Emanuel Peter
epeter at openjdk.org
Fri Mar 1 13:06:56 UTC 2024
On Tue, 27 Feb 2024 18:23:41 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:
>> @jaskarth
>>> I've designed this benchmark
>>
>> Nice. Can you also post the generated assembly for Baseline/Patch?
>> I'm just worried that there is some method call, or something else that does not get cleanly inlined and could mess with the benchmark.
>
> @eme64 Sure, here is the assembly for the baseline: https://gist.github.com/jaskarth/1fe6f00a5b37fe3efb0dd6a2d24840e0
> And after: https://gist.github.com/jaskarth/99c56e2f081f996987b96d7e866aca6c
>
> I must have missed this originally when evaluating the benchmark, but looking at the assembly it seems like the baseline JDK creates a `CMove` for that ternary already. I made a quick patch to disable where `PhaseIdealLoop::conditional_move` is called, and the performance still stays the same on the benchmark. I've also attached that assembly if it's of interest: https://gist.github.com/jaskarth/7b12b688f82a3b8e854785f1827b0c20
@jaskarth now there are some platforms that have horrible branch predictors. On those the cost model would probably favor CMove and Min/Max in more cases.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17574#issuecomment-1973162293
More information about the hotspot-compiler-dev
mailing list