RFR: 8342103: C2 compiler support for Float16 type and associated scalar operations [v3]

Emanuel Peter epeter at openjdk.org
Tue Dec 17 16:43:39 UTC 2024


On Tue, 17 Dec 2024 11:06:13 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> src/hotspot/share/opto/convertnode.cpp line 282:
>> 
>>> 280:       return new ReinterpretHF2SNode(binop);
>>> 281:     }
>>> 282:   }
>> 
>> Where are the constant folding tests for this?
>
> This is the core idealization logic which infers FP16 IR. Every test point added in the test points added in test/hotspot/jtreg/compiler/c2/irTests/TestFloat16ScalarOperations.java verifies this.

Picking a random line from `testAddConstantFolding()`
` assertResult(add(Float16.POSITIVE_INFINITY, Float16.POSITIVE_INFINITY).floatValue(), Float.POSITIVE_INFINITY, "testAddConstantFolding");`

So this seems to do a FP16 -> FP16 add, then convert to float, so I don't immediately see the FP16 -> Float -> FP16 conversion.

Ah, how do we intrinsify this?

    public static Float16 add(Float16 addend, Float16 augend) {
        return valueOf(addend.floatValue() + augend.floatValue());
    }

Is it not the `add` that is intfinsified, but the `valueOf`, `floatValue` and Float `+`?

Why not intrinsify the `Float16.add` directly?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22754#discussion_r1888858048


More information about the hotspot-compiler-dev mailing list