Skip to content

Commit 91ab832

Browse files
committed
[X86] combineConcatVectorOps - pull out repeated getConstantOperandAPInt calls for the same EXTRACT_SUBVECTOR indices. NFC.
1 parent 6955a7d commit 91ab832

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58475,12 +58475,13 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5847558475
EVT SrcVT1 = Src1.getOperand(0).getValueType();
5847658476
unsigned NumSrcElts0 = SrcVT0.getVectorNumElements();
5847758477
unsigned NumSrcElts1 = SrcVT1.getVectorNumElements();
58478+
const APInt &SrcIdx0 = Src0.getConstantOperandAPInt(1);
58479+
const APInt &SrcIdx1 = Src1.getConstantOperandAPInt(1);
5847858480
// concat(extract_subvector(v0), extract_subvector(v1)) -> vperm2x128.
5847958481
// Only concat of subvector high halves which vperm2x128 is best at.
5848058482
if (VT.is256BitVector() && SrcVT0.is256BitVector() &&
58481-
SrcVT1.is256BitVector() &&
58482-
Src0.getConstantOperandAPInt(1) == (NumSrcElts0 / 2) &&
58483-
Src1.getConstantOperandAPInt(1) == (NumSrcElts1 / 2)) {
58483+
SrcVT1.is256BitVector() && SrcIdx0 == (NumSrcElts0 / 2) &&
58484+
SrcIdx1 == (NumSrcElts1 / 2)) {
5848458485
return DAG.getNode(X86ISD::VPERM2X128, DL, VT,
5848558486
DAG.getBitcast(VT, Src0.getOperand(0)),
5848658487
DAG.getBitcast(VT, Src1.getOperand(0)),
@@ -58491,10 +58492,8 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5849158492
// --> extract_subvector(x,lo)
5849258493
unsigned NumSubElts0 = Src0.getValueType().getVectorNumElements();
5849358494
if (Src0.getOperand(0) == Src1.getOperand(0) &&
58494-
(Src0.getConstantOperandAPInt(1) == 0 ||
58495-
Src0.getConstantOperandAPInt(1) == (NumSrcElts0 / 2)) &&
58496-
Src1.getConstantOperandAPInt(1) ==
58497-
(Src0.getConstantOperandAPInt(1) + NumSubElts0)) {
58495+
(SrcIdx0 == 0 || SrcIdx0 == (NumSrcElts0 / 2)) &&
58496+
SrcIdx1 == (SrcIdx0 + NumSubElts0)) {
5849858497
return DAG.getBitcast(VT,
5849958498
extractSubVector(Src0.getOperand(0),
5850058499
Src0.getConstantOperandVal(1),

0 commit comments

Comments
 (0)