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)
commitf7a02c17628e825082e845f865a3ac4616cb5e01
tree0f2ba29b7c5eeca92344adbd4c47b54a744bfcc4
parent3c0012beb68f692c2c6c23183085698565877d92
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.

llvm-svn: 213507
llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/test/CodeGen/AArch64/f16-convert.ll