From f02e73018fcc0f0361950926f36a32105591700f Mon Sep 17 00:00:00 2001
From: Anton Korobeynikov
Half precision floating point is storage-only format. That is why the values + in such format should be promoted to single precision format before any + operations. LLVM provides intrinsics for conversions to single precision and + back.
+ ++ declare i16 @llvm.convert.to.fp16(f32 %a) ++ +
The 'llvm.convert.to.fp16' intrinsic function performs + a conversion from single precision floating point format to half precision + floating point format.
+ +The intrinsic function contains single argument - the value to be + converted.
+ +The 'llvm.convert.to.fp16' intrinsic function performs + a conversion from single precision floating point format to half precision + floating point format. Since the format is storage only the return value is + just an i16 which contains the converted number.
+ ++ %res = call i16 @llvm.convert.to.fp16(f32 %a) + store i16 %res, i16* @x, align 2 ++ +
+ declare f32 @llvm.convert.from.fp16(i16 %a) ++ +
The 'llvm.convert.from.fp16' intrinsic function performs + a conversion from half precision floating point format to single precision + floating point format.
+ +The intrinsic function contains single argument - the value to be + converted.
+ +The 'llvm.convert.from.fp16' intrinsic function performs a + conversion from half single precision floating point format to signle + precision floating point format. Since the format is storage only the + argument is represented by an i16 value.
+ ++ %a = load i16* @x, align 2 + %res = call f32 @llvm.convert.from.fp16(i16 %a) ++ +