[lworld+fp16] RFR: 8336406: Add support for FP16 binary operations

Jatin Bhateja jbhateja at openjdk.org
Wed Jul 31 11:23:51 UTC 2024


On Tue, 23 Jul 2024 13:39:14 GMT, Bhavana Kilambi <bkilambi at openjdk.org> wrote:

> This patch adds middle end support in C2 for a few FP16 binary operations, namely - subtract, multiply, divide, min and max. It also adds aarch64 backend support for these operations.
> 
> Tested JTREG tests -
> hotspot/jtreg/compiler/vectorization/TestFloat16VectorOps.java, hotspot/jtreg/compiler/vectorization/TestFloat16VectorReinterpretConv.java, hotspot/jtreg/compiler/intrinsics/float16 and test/jdk/java/lang/Float16 and they successfully pass on aarch64 and x86 machines.

src/hotspot/share/opto/mulnode.hpp line 149:

> 147: // Multiply 2 half floats
> 148: class MulHFNode : public MulFNode {
> 149: public:

While its good to use MulFNode constant folding (Value) routines and generic Ideal transforms, we should skip any specific Idealization transformations which may end up generating purely [floating point IR](https://github.com/openjdk/valhalla/blob/lworld%2Bfp16/src/hotspot/share/opto/mulnode.cpp#L547)

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1175#discussion_r1698261514


More information about the valhalla-dev mailing list