[llvm] 7e01675 - [SelectionDAG] Add MVT::bf16 to getConstantFP()

Aaron Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 16 15:10:39 PDT 2020


Author: Aaron Smith
Date: 2020-06-16T15:10:05-07:00
New Revision: 7e01675ea50ec88eb78cd6fcb4017baa614027c0

URL: https://github.com/llvm/llvm-project/commit/7e01675ea50ec88eb78cd6fcb4017baa614027c0
DIFF: https://github.com/llvm/llvm-project/commit/7e01675ea50ec88eb78cd6fcb4017baa614027c0.diff

LOG: [SelectionDAG] Add MVT::bf16 to getConstantFP()

Summary:
This was probably overlooked in recent bfloat patches.
Needed to handle bf16 constants in SelectionDAG.

  ConstantFP:bf16<APFloat(0)>

Reviewers: stuij

Reviewed By: stuij

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D81779

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index e0352f8f3bb4..c2b5ea0cb097 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1394,7 +1394,7 @@ SDValue SelectionDAG::getConstantFP(double Val, const SDLoc &DL, EVT VT,
   else if (EltVT == MVT::f64)
     return getConstantFP(APFloat(Val), DL, VT, isTarget);
   else if (EltVT == MVT::f80 || EltVT == MVT::f128 || EltVT == MVT::ppcf128 ||
-           EltVT == MVT::f16) {
+           EltVT == MVT::f16 || EltVT == MVT::bf16) {
     bool Ignored;
     APFloat APF = APFloat(Val);
     APF.convert(EVTToAPFloatSemantics(EltVT), APFloat::rmNearestTiesToEven,


        


More information about the llvm-commits mailing list