forked from OSchip/llvm-project
[X86] Handle splats in LowerBUILD_VECTORvXi1 by directly emitting scalar selects instead of deferring that to LowerSELECT.
LoweSELECT will detect the constant inputs and convert to scalar selects, but we can do it directly here. I might remove some of the code from LowerSELECT and move it to DAG combine so doing this explicitly will make us less dependent on it happening in lowering.
This commit is contained in:
parent
048239e46e
commit
0dbc4658d8
|
@ -8836,9 +8836,24 @@ static SDValue LowerBUILD_VECTORvXi1(SDValue Op, SelectionDAG &DAG,
|
|||
if (Cond.getOpcode() != ISD::SETCC)
|
||||
Cond = DAG.getNode(ISD::AND, dl, MVT::i8, Cond,
|
||||
DAG.getConstant(1, dl, MVT::i8));
|
||||
return DAG.getSelect(dl, VT, Cond,
|
||||
DAG.getConstant(1, dl, VT),
|
||||
DAG.getConstant(0, dl, VT));
|
||||
|
||||
// Perform the select in the scalar domain so we can use cmov.
|
||||
if (VT == MVT::v64i1 && !Subtarget.is64Bit()) {
|
||||
SDValue Select = DAG.getSelect(dl, MVT::i32, Cond,
|
||||
DAG.getAllOnesConstant(dl, MVT::i32),
|
||||
DAG.getConstant(0, dl, MVT::i32));
|
||||
Select = DAG.getBitcast(MVT::v32i1, Select);
|
||||
return DAG.getNode(ISD::CONCAT_VECTORS, dl, MVT::v64i1, Select, Select);
|
||||
} else {
|
||||
MVT ImmVT = MVT::getIntegerVT(std::max((unsigned)VT.getSizeInBits(), 8U));
|
||||
SDValue Select = DAG.getSelect(dl, ImmVT, Cond,
|
||||
DAG.getAllOnesConstant(dl, ImmVT),
|
||||
DAG.getConstant(0, dl, ImmVT));
|
||||
MVT VecVT = VT.getSizeInBits() >= 8 ? VT : MVT::v8i1;
|
||||
Select = DAG.getBitcast(VecVT, Select);
|
||||
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, VT, Select,
|
||||
DAG.getIntPtrConstant(0, dl));
|
||||
}
|
||||
}
|
||||
|
||||
// insert elements one by one
|
||||
|
|
Loading…
Reference in New Issue