diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2010-03-14 18:42:15 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2010-03-14 18:42:15 +0000 |
| commit | 39ed49df718af5a4a7617b2a1c4110a7be740fbf (patch) | |
| tree | da352dedbf2457e6ff78234d7cc193f19ac98eea | |
| parent | b975fa6d9bf04b995e63bbd2ef4c51b8cc2c595c (diff) | |
| download | bcm5719-llvm-39ed49df718af5a4a7617b2a1c4110a7be740fbf.tar.gz bcm5719-llvm-39ed49df718af5a4a7617b2a1c4110a7be740fbf.zip | |
Add DAG nodes to represent FP16 <-> FP32 intrinsics
llvm-svn: 98500
| -rw-r--r-- | llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 6 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index e61672dc3bc..c16a48aea2a 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -439,6 +439,12 @@ namespace ISD { // 5) ISD::CvtCode indicating the type of conversion to do CONVERT_RNDSAT, + // FP16_TO_FP32, FP32_TO_FP16 - These operators are used to perform + // promotions and truncation for half-precision (16 bit) floating + // numbers. We need special nodes since FP16 is a storage-only type with + // special semantics of operations. + FP16_TO_FP32, FP32_TO_FP16, + // FNEG, FABS, FSQRT, FSIN, FCOS, FPOWI, FPOW, // FLOG, FLOG2, FLOG10, FEXP, FEXP2, // FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR - Perform various unary floating diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index fc14e9047ea..a034b4cc514 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -4000,6 +4000,14 @@ SelectionDAGBuilder::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { case Intrinsic::pow: visitPow(I); return 0; + case Intrinsic::convert_to_fp16: + setValue(&I, DAG.getNode(ISD::FP32_TO_FP16, dl, + MVT::i16, getValue(I.getOperand(1)))); + return 0; + case Intrinsic::convert_from_fp16: + setValue(&I, DAG.getNode(ISD::FP16_TO_FP32, dl, + MVT::f32, getValue(I.getOperand(1)))); + return 0; case Intrinsic::pcmarker: { SDValue Tmp = getValue(I.getOperand(1)); DAG.setRoot(DAG.getNode(ISD::PCMARKER, dl, MVT::Other, getRoot(), Tmp)); |

