CodeGen: emit IR-level f16 conversion intrinsics as fptrunc/fpext
authorTim Northover <tnorthover@apple.com>
Mon, 21 Jul 2014 09:13:56 +0000 (09:13 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 21 Jul 2014 09:13:56 +0000 (09:13 +0000)
commitf8d927f22ba2ca0ae56230b8c665cb9cb648e812
treef005747b8f3b86b361c58b836a2ef757158e8331
parentd4cde8670c46060ff2222fe0f05cb5ef062fff67
CodeGen: emit IR-level f16 conversion intrinsics as fptrunc/fpext

This makes the first stage DAG for @llvm.convert.to.fp16 an fptrunc,
and correspondingly @llvm.convert.from.fp16 an fpext. The legalisation
path is now uniform, regardless of the input IR:

  fptrunc -> FP_TO_FP16 (if f16 illegal) -> libcall
  fpext -> FP16_TO_FP (if f16 illegal) -> libcall

Each target should be able to select the version that best matches its
operations and not be required to duplicate patterns for both fptrunc
and FP_TO_FP16 (for example).

As a result we can remove some redundant AArch64 patterns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213507 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/TargetLoweringBase.cpp
lib/Target/AArch64/AArch64InstrInfo.td
test/CodeGen/AArch64/f16-convert.ll