Skip to content

Commit 0a376e8

Browse files
committed
[X86] getConstVector - remove raw bits -> fp handling and leave it to getNode/FoldConstantArithmetic
getConstVector could only handle f32/f64 vector element types from raw APInt bit data - instead of trying to add all supported fp types, just bitcast the integer equivalent and leave it getNode/FoldConstantArithmetic to perform the constant bitcast conversion Tentative fix for a regression reported after llvm#133913
1 parent 8a351f1 commit 0a376e8

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4014,6 +4014,7 @@ static SDValue getConstVector(ArrayRef<APInt> Bits, const APInt &Undefs,
40144014
}
40154015

40164016
MVT EltVT = ConstVecVT.getVectorElementType();
4017+
MVT EltIntVT = EltVT.changeTypeToInteger();
40174018
for (unsigned i = 0, e = Bits.size(); i != e; ++i) {
40184019
if (Undefs[i]) {
40194020
Ops.append(Split ? 2 : 1, DAG.getUNDEF(EltVT));
@@ -4024,14 +4025,8 @@ static SDValue getConstVector(ArrayRef<APInt> Bits, const APInt &Undefs,
40244025
if (Split) {
40254026
Ops.push_back(DAG.getConstant(V.extractBits(32, 0), dl, EltVT));
40264027
Ops.push_back(DAG.getConstant(V.extractBits(32, 32), dl, EltVT));
4027-
} else if (EltVT == MVT::f32) {
4028-
APFloat FV(APFloat::IEEEsingle(), V);
4029-
Ops.push_back(DAG.getConstantFP(FV, dl, EltVT));
4030-
} else if (EltVT == MVT::f64) {
4031-
APFloat FV(APFloat::IEEEdouble(), V);
4032-
Ops.push_back(DAG.getConstantFP(FV, dl, EltVT));
40334028
} else {
4034-
Ops.push_back(DAG.getConstant(V, dl, EltVT));
4029+
Ops.push_back(DAG.getBitcast(EltVT, DAG.getConstant(V, dl, EltIntVT)));
40354030
}
40364031
}
40374032

0 commit comments

Comments
 (0)