mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
CodeGen: extend f16 conversions to permit types > float.
This makes the two intrinsics @llvm.convert.from.f16 and @llvm.convert.to.f16 accept types other than simple "float". This is only strictly needed for the truncate operation, since otherwise double rounding occurs and there's no way to represent the strict IEEE conversion. However, for symmetry we allow larger types in the extend too. During legalization, we can expand an "fp16_to_double" operation into two extends for convenience, but abort when the truncate isn't legal. A new libcall is probably needed here. Even after this commit, various target tweaks are needed to actually use the extended intrinsics. I've put these into separate commits for clarity, so there are no actual tests of f64 conversion here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213248 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -8653,14 +8653,14 @@ Syntax:
|
||||
|
||||
::
|
||||
|
||||
declare i16 @llvm.convert.to.fp16(float %a)
|
||||
declare i16 @llvm.convert.to.fp16.f32(float %a)
|
||||
declare i16 @llvm.convert.to.fp16.f64(double %a)
|
||||
|
||||
Overview:
|
||||
"""""""""
|
||||
|
||||
The '``llvm.convert.to.fp16``' intrinsic function performs a conversion
|
||||
from single precision floating point format to half precision floating
|
||||
point format.
|
||||
The '``llvm.convert.to.fp16``' intrinsic function performs a conversion from a
|
||||
conventional floating point type to half precision floating point format.
|
||||
|
||||
Arguments:
|
||||
""""""""""
|
||||
@@ -8671,17 +8671,16 @@ converted.
|
||||
Semantics:
|
||||
""""""""""
|
||||
|
||||
The '``llvm.convert.to.fp16``' intrinsic function performs a conversion
|
||||
from single precision floating point format to half precision floating
|
||||
point format. The return value is an ``i16`` which contains the
|
||||
converted number.
|
||||
The '``llvm.convert.to.fp16``' intrinsic function performs a conversion from a
|
||||
conventional floating point format to half precision floating point format. The
|
||||
return value is an ``i16`` which contains the converted number.
|
||||
|
||||
Examples:
|
||||
"""""""""
|
||||
|
||||
.. code-block:: llvm
|
||||
|
||||
%res = call i16 @llvm.convert.to.fp16(float %a)
|
||||
%res = call i16 @llvm.convert.to.fp16.f32(float %a)
|
||||
store i16 %res, i16* @x, align 2
|
||||
|
||||
.. _int_convert_from_fp16:
|
||||
@@ -8694,7 +8693,8 @@ Syntax:
|
||||
|
||||
::
|
||||
|
||||
declare float @llvm.convert.from.fp16(i16 %a)
|
||||
declare float @llvm.convert.from.fp16.f32(i16 %a)
|
||||
declare double @llvm.convert.from.fp16.f64(i16 %a)
|
||||
|
||||
Overview:
|
||||
"""""""""
|
||||
|
Reference in New Issue
Block a user