[lworld+fp16] RFR: 8341414: Add support for FP16 conversion routines [v2]
Bhavana Kilambi
bkilambi at openjdk.org
Mon Nov 18 16:48:47 UTC 2024
On Fri, 15 Nov 2024 11:09:53 GMT, Bhavana Kilambi <bkilambi at openjdk.org> wrote:
>> We can also update existing test for new conversion
>>
>> test/hotspot/jtreg/compiler/c2/irTests/TestPhiDuplicatedConversion.java
>
>> This transformation is moving conversion across the Phi node thereby saving expensive conversion instructions.
>>
>> `Phi (ConvHF2F src1) (ConvHF2F src2) => ConvHF2F (Phi src1 src2) `
>>
>> For the Op_ConvF2HF case, type parameter will be of float type and thus we will never enter control flow between L1905 - L1907.
>>
>> I think it will be harmless if we remove convert_op == Op_ConvF2HF check...
>
> Hi @jatin-bhateja , I think that check should be there. The lines 1905-1907 will be reachable when get_convert_type() is called again with the dest_type (`short`) when it is supposed to return `short`. If this check is not there, it will return `T_INT`. For the following example -
> `rng.nextBoolean() ? Float.floatToFloat16(a) : Float.floatToFloat16(b)
> `
> it will generate `ConvF2I` instead of `ConvF2HF`.
I have added tests in `TestPhiDuplicatedConversion.java`
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1283#discussion_r1846924260
More information about the valhalla-dev
mailing list