RFR: 8323429: Missing C2 optimization for FP min/max when both inputs are same [v2]

Christian Hagedorn chagedorn at openjdk.org
Tue Apr 16 07:00:00 UTC 2024


On Mon, 15 Apr 2024 12:31:59 GMT, Galder Zamarreño <galder at openjdk.org> wrote:

>> Added C2 identity optimization for min/max calls, whereby if both inputs are the same, either is returned.
>> 
>> It includes an IR test to verify that the optimization gets applied. The optimization applies not only to floating points, but also long and ints. The test includes tests for all of those.
>> 
>> `BasicDoubleOpTest.vectorMax_8322090` has also been adjusted to match expectations after implementing the optimization.
>> 
>> I've run hotspot compiler tests successfully on x86_64.
>
> Galder Zamarreño has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Small IR test fixes
>   
>   * Fixed bug ID number.
>   * Added test summary.
>   * Removed unnecessary @requires.
>   * Added @Check methods to verify optimizations return the expected result.

Thanks for the update, looks good! I'll submit some testing.

test/hotspot/jtreg/compiler/vectorization/runner/BasicDoubleOpTest.java line 243:

> 241:     @Test
> 242:     @IR(applyIfCPUFeatureOr = {"asimd", "true", "avx", "true"},
> 243:         counts = {IRNode.MAX_VD, "0"})

Can be changed to `failOn` now.

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18738#pullrequestreview-2002757165
PR Review Comment: https://git.openjdk.org/jdk/pull/18738#discussion_r1566816505


More information about the hotspot-compiler-dev mailing list