@@ -55546,7 +55546,8 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55546
55546
/// legal, but there is almost no integer math/logic available for 256-bit.
55547
55547
/// This function should only be called with legal types (otherwise, the calls
55548
55548
/// to get simple value types will assert).
55549
- static SDValue narrowExtractedVectorSelect(SDNode *Ext, SelectionDAG &DAG) {
55549
+ static SDValue narrowExtractedVectorSelect(SDNode *Ext, const SDLoc &DL,
55550
+ SelectionDAG &DAG) {
55550
55551
SDValue Sel = Ext->getOperand(0);
55551
55552
if (Sel.getOpcode() != ISD::VSELECT ||
55552
55553
!isFreeToSplitVector(Sel.getOperand(0).getNode(), DAG))
@@ -55589,7 +55590,6 @@ static SDValue narrowExtractedVectorSelect(SDNode *Ext, SelectionDAG &DAG) {
55589
55590
unsigned NarrowingFactor = WideVT.getSizeInBits() / VT.getSizeInBits();
55590
55591
unsigned NarrowElts = SelElts / NarrowingFactor;
55591
55592
MVT NarrowSelVT = MVT::getVectorVT(SelVT.getVectorElementType(), NarrowElts);
55592
- SDLoc DL(Ext);
55593
55593
SDValue ExtCond = extract128BitVector(Sel.getOperand(0), ExtIdx, DAG, DL);
55594
55594
SDValue ExtT = extract128BitVector(Sel.getOperand(1), ExtIdx, DAG, DL);
55595
55595
SDValue ExtF = extract128BitVector(Sel.getOperand(2), ExtIdx, DAG, DL);
@@ -55622,6 +55622,7 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55622
55622
unsigned InSizeInBits = InVecVT.getSizeInBits();
55623
55623
unsigned NumSubElts = VT.getVectorNumElements();
55624
55624
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
55625
+ SDLoc DL(N);
55625
55626
55626
55627
if (Subtarget.hasAVX() && !Subtarget.hasAVX2() &&
55627
55628
TLI.isTypeLegal(InVecVT) &&
@@ -55637,29 +55638,28 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55637
55638
isConcatenatedNot(InVecBC.getOperand(1))) {
55638
55639
// extract (and v4i64 X, (not (concat Y1, Y2))), n -> andnp v2i64 X(n), Y1
55639
55640
SDValue Concat = splitVectorIntBinary(InVecBC, DAG);
55640
- return DAG.getNode(ISD::EXTRACT_SUBVECTOR, SDLoc(N) , VT,
55641
+ return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL , VT,
55641
55642
DAG.getBitcast(InVecVT, Concat), N->getOperand(1));
55642
55643
}
55643
55644
}
55644
55645
55645
55646
if (DCI.isBeforeLegalizeOps())
55646
55647
return SDValue();
55647
55648
55648
- if (SDValue V = narrowExtractedVectorSelect(N, DAG))
55649
+ if (SDValue V = narrowExtractedVectorSelect(N, DL, DAG))
55649
55650
return V;
55650
55651
55651
55652
if (ISD::isBuildVectorAllZeros(InVec.getNode()))
55652
- return getZeroVector(VT, Subtarget, DAG, SDLoc(N) );
55653
+ return getZeroVector(VT, Subtarget, DAG, DL );
55653
55654
55654
55655
if (ISD::isBuildVectorAllOnes(InVec.getNode())) {
55655
55656
if (VT.getScalarType() == MVT::i1)
55656
- return DAG.getConstant(1, SDLoc(N) , VT);
55657
- return getOnesVector(VT, DAG, SDLoc(N) );
55657
+ return DAG.getConstant(1, DL , VT);
55658
+ return getOnesVector(VT, DAG, DL );
55658
55659
}
55659
55660
55660
55661
if (InVec.getOpcode() == ISD::BUILD_VECTOR)
55661
- return DAG.getBuildVector(VT, SDLoc(N),
55662
- InVec->ops().slice(IdxVal, NumSubElts));
55662
+ return DAG.getBuildVector(VT, DL, InVec->ops().slice(IdxVal, NumSubElts));
55663
55663
55664
55664
// If we are extracting from an insert into a larger vector, replace with a
55665
55665
// smaller insert if we don't access less than the original subvector. Don't
@@ -55669,7 +55669,6 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55669
55669
InVec.getOpcode() == ISD::INSERT_SUBVECTOR && InVec.hasOneUse() &&
55670
55670
IdxVal == InVec.getConstantOperandVal(2) &&
55671
55671
InVec.getOperand(1).getValueSizeInBits() <= SizeInBits) {
55672
- SDLoc DL(N);
55673
55672
SDValue NewExt = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT,
55674
55673
InVec.getOperand(0), N->getOperand(1));
55675
55674
unsigned NewIdxVal = InVec.getConstantOperandVal(2) - IdxVal;
@@ -55684,12 +55683,12 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55684
55683
if (IdxVal != 0 && (InVec.getOpcode() == X86ISD::VBROADCAST ||
55685
55684
InVec.getOpcode() == X86ISD::VBROADCAST_LOAD ||
55686
55685
DAG.isSplatValue(InVec, /*AllowUndefs*/ false)))
55687
- return extractSubVector(InVec, 0, DAG, SDLoc(N) , SizeInBits);
55686
+ return extractSubVector(InVec, 0, DAG, DL , SizeInBits);
55688
55687
55689
55688
// If we're extracting a broadcasted subvector, just use the lowest subvector.
55690
55689
if (IdxVal != 0 && InVec.getOpcode() == X86ISD::SUBV_BROADCAST_LOAD &&
55691
55690
cast<MemIntrinsicSDNode>(InVec)->getMemoryVT() == VT)
55692
- return extractSubVector(InVec, 0, DAG, SDLoc(N) , SizeInBits);
55691
+ return extractSubVector(InVec, 0, DAG, DL , SizeInBits);
55693
55692
55694
55693
// Attempt to extract from the source of a shuffle vector.
55695
55694
if ((InSizeInBits % SizeInBits) == 0 && (IdxVal % NumSubElts) == 0) {
@@ -55704,13 +55703,13 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55704
55703
if (ScaledMask[SubVecIdx] == SM_SentinelUndef)
55705
55704
return DAG.getUNDEF(VT);
55706
55705
if (ScaledMask[SubVecIdx] == SM_SentinelZero)
55707
- return getZeroVector(VT, Subtarget, DAG, SDLoc(N) );
55706
+ return getZeroVector(VT, Subtarget, DAG, DL );
55708
55707
SDValue Src = ShuffleInputs[ScaledMask[SubVecIdx] / NumSubVecs];
55709
55708
if (Src.getValueSizeInBits() == InSizeInBits) {
55710
55709
unsigned SrcSubVecIdx = ScaledMask[SubVecIdx] % NumSubVecs;
55711
55710
unsigned SrcEltIdx = SrcSubVecIdx * NumSubElts;
55712
55711
return extractSubVector(DAG.getBitcast(InVecVT, Src), SrcEltIdx, DAG,
55713
- SDLoc(N) , SizeInBits);
55712
+ DL , SizeInBits);
55714
55713
}
55715
55714
}
55716
55715
}
@@ -55723,24 +55722,23 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55723
55722
// v2f64 CVTDQ2PD(v4i32).
55724
55723
if (InOpcode == ISD::SINT_TO_FP &&
55725
55724
InVec.getOperand(0).getValueType() == MVT::v4i32) {
55726
- return DAG.getNode(X86ISD::CVTSI2P, SDLoc(N) , VT, InVec.getOperand(0));
55725
+ return DAG.getNode(X86ISD::CVTSI2P, DL , VT, InVec.getOperand(0));
55727
55726
}
55728
55727
// v2f64 CVTUDQ2PD(v4i32).
55729
55728
if (InOpcode == ISD::UINT_TO_FP && Subtarget.hasVLX() &&
55730
55729
InVec.getOperand(0).getValueType() == MVT::v4i32) {
55731
- return DAG.getNode(X86ISD::CVTUI2P, SDLoc(N) , VT, InVec.getOperand(0));
55730
+ return DAG.getNode(X86ISD::CVTUI2P, DL , VT, InVec.getOperand(0));
55732
55731
}
55733
55732
// v2f64 CVTPS2PD(v4f32).
55734
55733
if (InOpcode == ISD::FP_EXTEND &&
55735
55734
InVec.getOperand(0).getValueType() == MVT::v4f32) {
55736
- return DAG.getNode(X86ISD::VFPEXT, SDLoc(N) , VT, InVec.getOperand(0));
55735
+ return DAG.getNode(X86ISD::VFPEXT, DL , VT, InVec.getOperand(0));
55737
55736
}
55738
55737
}
55739
55738
if (IdxVal == 0 &&
55740
55739
(ISD::isExtOpcode(InOpcode) || ISD::isExtVecInRegOpcode(InOpcode)) &&
55741
55740
(SizeInBits == 128 || SizeInBits == 256) &&
55742
55741
InVec.getOperand(0).getValueSizeInBits() >= SizeInBits) {
55743
- SDLoc DL(N);
55744
55742
SDValue Ext = InVec.getOperand(0);
55745
55743
if (Ext.getValueSizeInBits() > SizeInBits)
55746
55744
Ext = extractSubVector(Ext, 0, DAG, DL, SizeInBits);
@@ -55751,23 +55749,20 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55751
55749
InVec.getOperand(0).getValueType().is256BitVector() &&
55752
55750
InVec.getOperand(1).getValueType().is256BitVector() &&
55753
55751
InVec.getOperand(2).getValueType().is256BitVector()) {
55754
- SDLoc DL(N);
55755
55752
SDValue Ext0 = extractSubVector(InVec.getOperand(0), 0, DAG, DL, 128);
55756
55753
SDValue Ext1 = extractSubVector(InVec.getOperand(1), 0, DAG, DL, 128);
55757
55754
SDValue Ext2 = extractSubVector(InVec.getOperand(2), 0, DAG, DL, 128);
55758
55755
return DAG.getNode(InOpcode, DL, VT, Ext0, Ext1, Ext2);
55759
55756
}
55760
55757
if (IdxVal == 0 && InOpcode == ISD::TRUNCATE && Subtarget.hasVLX() &&
55761
55758
(VT.is128BitVector() || VT.is256BitVector())) {
55762
- SDLoc DL(N);
55763
55759
SDValue InVecSrc = InVec.getOperand(0);
55764
55760
unsigned Scale = InVecSrc.getValueSizeInBits() / InSizeInBits;
55765
55761
SDValue Ext = extractSubVector(InVecSrc, 0, DAG, DL, Scale * SizeInBits);
55766
55762
return DAG.getNode(InOpcode, DL, VT, Ext);
55767
55763
}
55768
55764
if (InOpcode == X86ISD::MOVDDUP &&
55769
55765
(VT.is128BitVector() || VT.is256BitVector())) {
55770
- SDLoc DL(N);
55771
55766
SDValue Ext0 =
55772
55767
extractSubVector(InVec.getOperand(0), IdxVal, DAG, DL, SizeInBits);
55773
55768
return DAG.getNode(InOpcode, DL, VT, Ext0);
@@ -55779,7 +55774,6 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55779
55774
if ((InOpcode == X86ISD::VSHLI || InOpcode == X86ISD::VSRLI) &&
55780
55775
InVecVT.getScalarSizeInBits() == 64 &&
55781
55776
InVec.getConstantOperandAPInt(1) == 32) {
55782
- SDLoc DL(N);
55783
55777
SDValue Ext =
55784
55778
extractSubVector(InVec.getOperand(0), IdxVal, DAG, DL, SizeInBits);
55785
55779
return DAG.getNode(InOpcode, DL, VT, Ext, InVec.getOperand(1));
0 commit comments