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)
commitfd7e4249359f510d21c2b682176cdb28dfa4e7e4
treec6f154b34d59f3708bea28534939101fdc74b37d
parent2355066e4303a8c948ee9c7b8e3f28d778eb2180
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.

llvm-svn: 213248
23 files changed:
llvm/docs/LangRef.rst
llvm/include/llvm/CodeGen/ISDOpcodes.h
llvm/include/llvm/IR/Intrinsics.td
llvm/include/llvm/Target/TargetSelectionDAG.td
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMInstrVFP.td
llvm/lib/Target/NVPTX/NVPTXIntrinsics.td
llvm/lib/Target/R600/SIInstructions.td
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86InstrSSE.td
llvm/test/CodeGen/AArch64/arm64-vcvt_f.ll
llvm/test/CodeGen/AArch64/f16-convert.ll
llvm/test/CodeGen/ARM/fp16.ll
llvm/test/CodeGen/R600/fp16_to_fp32.ll
llvm/test/CodeGen/R600/fp32_to_fp16.ll
llvm/test/CodeGen/X86/cvt16.ll