RFR: 8352635: Improve inferencing of Float16 operations with constant inputs [v13]

Jatin Bhateja jbhateja at openjdk.org
Wed Jun 25 04:44:12 UTC 2025


On Tue, 24 Jun 2025 21:42:47 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> Jatin Bhateja has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/hotspot/share/opto/subnode.cpp
>>   
>>   Co-authored-by: Emanuel Peter <emanuel.peter at oracle.com>
>
> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 81:
> 
>> 79:     private static final float EXACT_FP16 = 2052.0f;
>> 80:     private static final float SNAN_FP16 = Float.intBitsToFloat(0x7F8000F0);
>> 81:     private static final float QNAN_FP16 = Float.intBitsToFloat(0x7FC00000);
> 
> A nitpick, the values assigned here are float SNaN and QNaN. The FP16 suffix could be removed.

Nomenclature is in the context of its usage.

> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 381:
> 
>> 379: 
>> 380:     @Check(test="testSNaNFP16ConstantPatterns")
>> 381:     public void checkSNaNFP16ConstantPatterns(short actual) throws Exception {
> 
> Why throw exception here? This is short comparison in Verify.checkEQ. Also Java doesn't inherently throw exception for SNaN.

I restructured the tests to use Verify.checkEQ, this was an artifact of an earlier changes. Removing it.

> test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java line 649:
> 
>> 647:         // FIXME : C2 compiler limitaition to identify sign of ZERO value.
>> 648:         // assertResult(divide(valueOf(2.0f), NEGATIVE_ZERO).floatValue(), Float.NEGATIVE_INFINITY, "testDivConstantFolding");
>> 649:         // assertResult(divide(valueOf(2.0f), POSITIVE_ZERO).floatValue(), Float.POSITIVE_INFINITY, "testDivConstantFolding");
> 
> Would be good to file a JBS for this compiler limitation.

Good catch, it's a wrong comment, lifted it.  I also filed another JBS for missing value transforms for DivF/DivD
https://bugs.openjdk.org/browse/JDK-8360460

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2165724360
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2165724495
PR Review Comment: https://git.openjdk.org/jdk/pull/24179#discussion_r2165724618


More information about the hotspot-compiler-dev mailing list