CodeGen: extend f16 conversions to permit types > float.
authorTim Northover <tnorthover@apple.com>
Thu, 17 Jul 2014 10:51:23 +0000 (10:51 +0000)
committerTim Northover <tnorthover@apple.com>
Thu, 17 Jul 2014 10:51:23 +0000 (10:51 +0000)
commit3e61ccdded8fbed8f80be36b65f78b909fe9d9d8
tree75c24518c2241cf5c8a70a1cceb99509ea77d710
parentf33a30cdd02460a469e3bd93f424a2dc602d2ca4
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
23 files changed:
docs/LangRef.rst
include/llvm/CodeGen/ISDOpcodes.h
include/llvm/IR/Intrinsics.td
include/llvm/Target/TargetSelectionDAG.td
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeTypes.h
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
lib/Target/AArch64/AArch64InstrInfo.td
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMInstrVFP.td
lib/Target/NVPTX/NVPTXIntrinsics.td
lib/Target/R600/SIInstructions.td
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86InstrSSE.td
test/CodeGen/AArch64/arm64-vcvt_f.ll
test/CodeGen/AArch64/f16-convert.ll
test/CodeGen/ARM/fp16.ll
test/CodeGen/R600/fp16_to_fp32.ll
test/CodeGen/R600/fp32_to_fp16.ll
test/CodeGen/X86/cvt16.ll