forked from OSchip/llvm-project
[X86] Simplify some code in LowerBUILD_VECTORvXi1. NFCI
The case were Immediate is 0 and HasConstElts is true should never happen since that would mean the constant elts were all zero. But we check for all zero build vector earlier. So just use HasConstElts and blindly take Immediate without checking if its 0. Move the code that bitcasts and extract the immediate into the the HasConstElts case since the other code just creates an undef with the right type. No casting needed. llvm-svn: 372153
This commit is contained in:
parent
a1e29a3407
commit
b50894b9c3
llvm/lib/Target/X86
|
@ -8538,22 +8538,15 @@ static SDValue LowerBUILD_VECTORvXi1(SDValue Op, SelectionDAG &DAG,
|
|||
|
||||
// insert elements one by one
|
||||
SDValue DstVec;
|
||||
SDValue Imm;
|
||||
if (Immediate) {
|
||||
MVT ImmVT = MVT::getIntegerVT(std::max((int)VT.getSizeInBits(), 8));
|
||||
Imm = DAG.getConstant(Immediate, dl, ImmVT);
|
||||
}
|
||||
else if (HasConstElts)
|
||||
Imm = DAG.getConstant(0, dl, VT);
|
||||
else
|
||||
Imm = DAG.getUNDEF(VT);
|
||||
if (Imm.getValueSizeInBits() == VT.getSizeInBits())
|
||||
DstVec = DAG.getBitcast(VT, Imm);
|
||||
else {
|
||||
SDValue ExtVec = DAG.getBitcast(MVT::v8i1, Imm);
|
||||
DstVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, ExtVec,
|
||||
if (HasConstElts) {
|
||||
MVT ImmVT = MVT::getIntegerVT(std::max(VT.getSizeInBits(), 8U));
|
||||
SDValue Imm = DAG.getConstant(Immediate, dl, ImmVT);
|
||||
MVT VecVT = VT.getSizeInBits() >= 8 ? VT : MVT::v8i1;
|
||||
DstVec = DAG.getBitcast(VecVT, Imm);
|
||||
DstVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, DstVec,
|
||||
DAG.getIntPtrConstant(0, dl));
|
||||
}
|
||||
} else
|
||||
DstVec = DAG.getUNDEF(VT);
|
||||
|
||||
for (unsigned i = 0, e = NonConstIdx.size(); i != e; ++i) {
|
||||
unsigned InsertIdx = NonConstIdx[i];
|
||||
|
|
Loading…
Reference in New Issue