diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 42ef817e01456..6e6431008e680 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -4014,6 +4014,7 @@ static SDValue getConstVector(ArrayRef Bits, const APInt &Undefs, } MVT EltVT = ConstVecVT.getVectorElementType(); + MVT EltIntVT = EltVT.changeTypeToInteger(); for (unsigned i = 0, e = Bits.size(); i != e; ++i) { if (Undefs[i]) { Ops.append(Split ? 2 : 1, DAG.getUNDEF(EltVT)); @@ -4024,14 +4025,8 @@ static SDValue getConstVector(ArrayRef Bits, const APInt &Undefs, if (Split) { Ops.push_back(DAG.getConstant(V.extractBits(32, 0), dl, EltVT)); Ops.push_back(DAG.getConstant(V.extractBits(32, 32), dl, EltVT)); - } else if (EltVT == MVT::f32) { - APFloat FV(APFloat::IEEEsingle(), V); - Ops.push_back(DAG.getConstantFP(FV, dl, EltVT)); - } else if (EltVT == MVT::f64) { - APFloat FV(APFloat::IEEEdouble(), V); - Ops.push_back(DAG.getConstantFP(FV, dl, EltVT)); } else { - Ops.push_back(DAG.getConstant(V, dl, EltVT)); + Ops.push_back(DAG.getBitcast(EltVT, DAG.getConstant(V, dl, EltIntVT))); } }