@@ -4070,10 +4070,9 @@ static std::pair<SDValue, SDValue> splitVector(SDValue Op, SelectionDAG &DAG,
4070
4070
}
4071
4071
4072
4072
/// Break an operation into 2 half sized ops and then concatenate the results.
4073
- static SDValue splitVectorOp(SDValue Op, SelectionDAG &DAG) {
4073
+ static SDValue splitVectorOp(SDValue Op, SelectionDAG &DAG, const SDLoc &dl ) {
4074
4074
unsigned NumOps = Op.getNumOperands();
4075
4075
EVT VT = Op.getValueType();
4076
- SDLoc dl(Op);
4077
4076
4078
4077
// Extract the LHS Lo/Hi vectors
4079
4078
SmallVector<SDValue> LoOps(NumOps, SDValue());
@@ -4096,7 +4095,8 @@ static SDValue splitVectorOp(SDValue Op, SelectionDAG &DAG) {
4096
4095
4097
4096
/// Break an unary integer operation into 2 half sized ops and then
4098
4097
/// concatenate the result back.
4099
- static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG) {
4098
+ static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG,
4099
+ const SDLoc &dl) {
4100
4100
// Make sure we only try to split 256/512-bit types to avoid creating
4101
4101
// narrow vectors.
4102
4102
EVT VT = Op.getValueType();
@@ -4107,19 +4107,20 @@ static SDValue splitVectorIntUnary(SDValue Op, SelectionDAG &DAG) {
4107
4107
assert(Op.getOperand(0).getValueType().getVectorNumElements() ==
4108
4108
VT.getVectorNumElements() &&
4109
4109
"Unexpected VTs!");
4110
- return splitVectorOp(Op, DAG);
4110
+ return splitVectorOp(Op, DAG, dl );
4111
4111
}
4112
4112
4113
4113
/// Break a binary integer operation into 2 half sized ops and then
4114
4114
/// concatenate the result back.
4115
- static SDValue splitVectorIntBinary(SDValue Op, SelectionDAG &DAG) {
4115
+ static SDValue splitVectorIntBinary(SDValue Op, SelectionDAG &DAG,
4116
+ const SDLoc &dl) {
4116
4117
// Assert that all the types match.
4117
4118
EVT VT = Op.getValueType();
4118
4119
(void)VT;
4119
4120
assert(Op.getOperand(0).getValueType() == VT &&
4120
4121
Op.getOperand(1).getValueType() == VT && "Unexpected VTs!");
4121
4122
assert((VT.is256BitVector() || VT.is512BitVector()) && "Unsupported VT!");
4122
- return splitVectorOp(Op, DAG);
4123
+ return splitVectorOp(Op, DAG, dl );
4123
4124
}
4124
4125
4125
4126
// Helper for splitting operands of an operation to legal target size and
@@ -20075,7 +20076,7 @@ static SDValue LowerAVXExtend(SDValue Op, SelectionDAG &DAG,
20075
20076
20076
20077
if (VT == MVT::v32i16 && !Subtarget.hasBWI()) {
20077
20078
assert(InVT == MVT::v32i8 && "Unexpected VT!");
20078
- return splitVectorIntUnary(Op, DAG);
20079
+ return splitVectorIntUnary(Op, DAG, dl );
20079
20080
}
20080
20081
20081
20082
if (Subtarget.hasInt256())
@@ -20656,7 +20657,7 @@ SDValue X86TargetLowering::LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const {
20656
20657
if (Subtarget.hasAVX512()) {
20657
20658
if (InVT == MVT::v32i16 && !Subtarget.hasBWI()) {
20658
20659
assert(VT == MVT::v32i8 && "Unexpected VT!");
20659
- return splitVectorIntUnary(Op, DAG);
20660
+ return splitVectorIntUnary(Op, DAG, DL );
20660
20661
}
20661
20662
20662
20663
// word to byte only under BWI. Otherwise we have to promoted to v16i32
@@ -21636,7 +21637,8 @@ SDValue X86TargetLowering::LowerFP_TO_BF16(SDValue Op,
21636
21637
21637
21638
/// Depending on uarch and/or optimizing for size, we might prefer to use a
21638
21639
/// vector operation in place of the typical scalar operation.
21639
- static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
21640
+ static SDValue lowerAddSubToHorizontalOp(SDValue Op, const SDLoc &DL,
21641
+ SelectionDAG &DAG,
21640
21642
const X86Subtarget &Subtarget) {
21641
21643
// If both operands have other uses, this is probably not profitable.
21642
21644
SDValue LHS = Op.getOperand(0);
@@ -21692,7 +21694,6 @@ static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
21692
21694
21693
21695
// Creating a 256-bit horizontal op would be wasteful, and there is no 512-bit
21694
21696
// equivalent, so extract the 256/512-bit source op to 128-bit if we can.
21695
- SDLoc DL(Op);
21696
21697
if (BitWidth == 256 || BitWidth == 512) {
21697
21698
unsigned LaneIdx = LExtIndex / NumEltsPerLane;
21698
21699
X = extract128BitVector(X, LaneIdx * NumEltsPerLane, DAG, DL);
@@ -21713,7 +21714,7 @@ static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
21713
21714
SDValue X86TargetLowering::lowerFaddFsub(SDValue Op, SelectionDAG &DAG) const {
21714
21715
assert((Op.getValueType() == MVT::f32 || Op.getValueType() == MVT::f64) &&
21715
21716
"Only expecting float/double");
21716
- return lowerAddSubToHorizontalOp(Op, DAG, Subtarget);
21717
+ return lowerAddSubToHorizontalOp(Op, SDLoc(Op), DAG, Subtarget);
21717
21718
}
21718
21719
21719
21720
/// ISD::FROUND is defined to round to nearest with ties rounding away from 0.
@@ -24470,7 +24471,7 @@ static SDValue LowerSIGN_EXTEND(SDValue Op, const X86Subtarget &Subtarget,
24470
24471
24471
24472
if (VT == MVT::v32i16 && !Subtarget.hasBWI()) {
24472
24473
assert(InVT == MVT::v32i8 && "Unexpected VT!");
24473
- return splitVectorIntUnary(Op, DAG);
24474
+ return splitVectorIntUnary(Op, DAG, dl );
24474
24475
}
24475
24476
24476
24477
if (Subtarget.hasInt256())
@@ -27833,7 +27834,7 @@ static SDValue LowerVectorCTLZ_AVX512CDI(SDValue Op, SelectionDAG &DAG,
27833
27834
// Split vector, it's Lo and Hi parts will be handled in next iteration.
27834
27835
if (NumElems > 16 ||
27835
27836
(NumElems == 16 && !Subtarget.canExtendTo512DQ()))
27836
- return splitVectorIntUnary(Op, DAG);
27837
+ return splitVectorIntUnary(Op, DAG, dl );
27837
27838
27838
27839
MVT NewVT = MVT::getVectorVT(MVT::i32, NumElems);
27839
27840
assert((NewVT.is256BitVector() || NewVT.is512BitVector()) &&
@@ -27943,11 +27944,11 @@ static SDValue LowerVectorCTLZ(SDValue Op, const SDLoc &DL,
27943
27944
27944
27945
// Decompose 256-bit ops into smaller 128-bit ops.
27945
27946
if (VT.is256BitVector() && !Subtarget.hasInt256())
27946
- return splitVectorIntUnary(Op, DAG);
27947
+ return splitVectorIntUnary(Op, DAG, DL );
27947
27948
27948
27949
// Decompose 512-bit ops into smaller 256-bit ops.
27949
27950
if (VT.is512BitVector() && !Subtarget.hasBWI())
27950
- return splitVectorIntUnary(Op, DAG);
27951
+ return splitVectorIntUnary(Op, DAG, DL );
27951
27952
27952
27953
assert(Subtarget.hasSSSE3() && "Expected SSSE3 support for PSHUFB");
27953
27954
return LowerVectorCTLZInRegLUT(Op, DL, Subtarget, DAG);
@@ -28020,16 +28021,18 @@ static SDValue LowerCTTZ(SDValue Op, const X86Subtarget &Subtarget,
28020
28021
static SDValue lowerAddSub(SDValue Op, SelectionDAG &DAG,
28021
28022
const X86Subtarget &Subtarget) {
28022
28023
MVT VT = Op.getSimpleValueType();
28024
+ SDLoc DL(Op);
28025
+
28023
28026
if (VT == MVT::i16 || VT == MVT::i32)
28024
- return lowerAddSubToHorizontalOp(Op, DAG, Subtarget);
28027
+ return lowerAddSubToHorizontalOp(Op, DL, DAG, Subtarget);
28025
28028
28026
28029
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28027
- return splitVectorIntBinary(Op, DAG);
28030
+ return splitVectorIntBinary(Op, DAG, DL );
28028
28031
28029
28032
assert(Op.getSimpleValueType().is256BitVector() &&
28030
28033
Op.getSimpleValueType().isInteger() &&
28031
28034
"Only handle AVX 256-bit vector integer operation");
28032
- return splitVectorIntBinary(Op, DAG);
28035
+ return splitVectorIntBinary(Op, DAG, DL );
28033
28036
}
28034
28037
28035
28038
static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
@@ -28043,7 +28046,7 @@ static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
28043
28046
(VT.is256BitVector() && !Subtarget.hasInt256())) {
28044
28047
assert(Op.getSimpleValueType().isInteger() &&
28045
28048
"Only handle AVX vector integer operation");
28046
- return splitVectorIntBinary(Op, DAG);
28049
+ return splitVectorIntBinary(Op, DAG, DL );
28047
28050
}
28048
28051
28049
28052
// Avoid the generic expansion with min/max if we don't have pminu*/pmaxu*.
@@ -28105,10 +28108,11 @@ static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
28105
28108
static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28106
28109
SelectionDAG &DAG) {
28107
28110
MVT VT = Op.getSimpleValueType();
28111
+ SDLoc DL(Op);
28112
+
28108
28113
if (VT == MVT::i16 || VT == MVT::i32 || VT == MVT::i64) {
28109
28114
// Since X86 does not have CMOV for 8-bit integer, we don't convert
28110
28115
// 8-bit integer abs to NEG and CMOV.
28111
- SDLoc DL(Op);
28112
28116
SDValue N0 = Op.getOperand(0);
28113
28117
SDValue Neg = DAG.getNode(X86ISD::SUB, DL, DAG.getVTList(VT, MVT::i32),
28114
28118
DAG.getConstant(0, DL, VT), N0);
@@ -28119,7 +28123,6 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28119
28123
28120
28124
// ABS(vXi64 X) --> VPBLENDVPD(X, 0-X, X).
28121
28125
if ((VT == MVT::v2i64 || VT == MVT::v4i64) && Subtarget.hasSSE41()) {
28122
- SDLoc DL(Op);
28123
28126
SDValue Src = Op.getOperand(0);
28124
28127
SDValue Sub =
28125
28128
DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT), Src);
@@ -28129,11 +28132,11 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28129
28132
if (VT.is256BitVector() && !Subtarget.hasInt256()) {
28130
28133
assert(VT.isInteger() &&
28131
28134
"Only handle AVX 256-bit vector integer operation");
28132
- return splitVectorIntUnary(Op, DAG);
28135
+ return splitVectorIntUnary(Op, DAG, DL );
28133
28136
}
28134
28137
28135
28138
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28136
- return splitVectorIntUnary(Op, DAG);
28139
+ return splitVectorIntUnary(Op, DAG, DL );
28137
28140
28138
28141
// Default to expand.
28139
28142
return SDValue();
@@ -28142,13 +28145,14 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28142
28145
static SDValue LowerAVG(SDValue Op, const X86Subtarget &Subtarget,
28143
28146
SelectionDAG &DAG) {
28144
28147
MVT VT = Op.getSimpleValueType();
28148
+ SDLoc DL(Op);
28145
28149
28146
28150
// For AVX1 cases, split to use legal ops.
28147
28151
if (VT.is256BitVector() && !Subtarget.hasInt256())
28148
- return splitVectorIntBinary(Op, DAG);
28152
+ return splitVectorIntBinary(Op, DAG, DL );
28149
28153
28150
28154
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28151
- return splitVectorIntBinary(Op, DAG);
28155
+ return splitVectorIntBinary(Op, DAG, DL );
28152
28156
28153
28157
// Default to expand.
28154
28158
return SDValue();
@@ -28157,13 +28161,14 @@ static SDValue LowerAVG(SDValue Op, const X86Subtarget &Subtarget,
28157
28161
static SDValue LowerMINMAX(SDValue Op, const X86Subtarget &Subtarget,
28158
28162
SelectionDAG &DAG) {
28159
28163
MVT VT = Op.getSimpleValueType();
28164
+ SDLoc DL(Op);
28160
28165
28161
28166
// For AVX1 cases, split to use legal ops.
28162
28167
if (VT.is256BitVector() && !Subtarget.hasInt256())
28163
- return splitVectorIntBinary(Op, DAG);
28168
+ return splitVectorIntBinary(Op, DAG, DL );
28164
28169
28165
28170
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28166
- return splitVectorIntBinary(Op, DAG);
28171
+ return splitVectorIntBinary(Op, DAG, DL );
28167
28172
28168
28173
// Default to expand.
28169
28174
return SDValue();
@@ -28320,15 +28325,15 @@ static SDValue LowerFMINIMUM_FMAXIMUM(SDValue Op, const X86Subtarget &Subtarget,
28320
28325
static SDValue LowerABD(SDValue Op, const X86Subtarget &Subtarget,
28321
28326
SelectionDAG &DAG) {
28322
28327
MVT VT = Op.getSimpleValueType();
28328
+ SDLoc dl(Op);
28323
28329
28324
28330
// For AVX1 cases, split to use legal ops.
28325
28331
if (VT.is256BitVector() && !Subtarget.hasInt256())
28326
- return splitVectorIntBinary(Op, DAG);
28332
+ return splitVectorIntBinary(Op, DAG, dl );
28327
28333
28328
28334
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.useBWIRegs())
28329
- return splitVectorIntBinary(Op, DAG);
28335
+ return splitVectorIntBinary(Op, DAG, dl );
28330
28336
28331
- SDLoc dl(Op);
28332
28337
bool IsSigned = Op.getOpcode() == ISD::ABDS;
28333
28338
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
28334
28339
@@ -28371,10 +28376,10 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget,
28371
28376
28372
28377
// Decompose 256-bit ops into 128-bit ops.
28373
28378
if (VT.is256BitVector() && !Subtarget.hasInt256())
28374
- return splitVectorIntBinary(Op, DAG);
28379
+ return splitVectorIntBinary(Op, DAG, dl );
28375
28380
28376
28381
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28377
- return splitVectorIntBinary(Op, DAG);
28382
+ return splitVectorIntBinary(Op, DAG, dl );
28378
28383
28379
28384
SDValue A = Op.getOperand(0);
28380
28385
SDValue B = Op.getOperand(1);
@@ -28597,10 +28602,10 @@ static SDValue LowerMULH(SDValue Op, const X86Subtarget &Subtarget,
28597
28602
28598
28603
// Decompose 256-bit ops into 128-bit ops.
28599
28604
if (VT.is256BitVector() && !Subtarget.hasInt256())
28600
- return splitVectorIntBinary(Op, DAG);
28605
+ return splitVectorIntBinary(Op, DAG, dl );
28601
28606
28602
28607
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28603
- return splitVectorIntBinary(Op, DAG);
28608
+ return splitVectorIntBinary(Op, DAG, dl );
28604
28609
28605
28610
if (VT == MVT::v4i32 || VT == MVT::v8i32 || VT == MVT::v16i32) {
28606
28611
assert((VT == MVT::v4i32 && Subtarget.hasSSE2()) ||
@@ -29778,10 +29783,10 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
29778
29783
29779
29784
// Decompose 256-bit shifts into 128-bit shifts.
29780
29785
if (VT.is256BitVector())
29781
- return splitVectorIntBinary(Op, DAG);
29786
+ return splitVectorIntBinary(Op, DAG, dl );
29782
29787
29783
29788
if (VT == MVT::v32i16 || VT == MVT::v64i8)
29784
- return splitVectorIntBinary(Op, DAG);
29789
+ return splitVectorIntBinary(Op, DAG, dl );
29785
29790
29786
29791
return SDValue();
29787
29792
}
@@ -29858,7 +29863,7 @@ static SDValue LowerFunnelShift(SDValue Op, const X86Subtarget &Subtarget,
29858
29863
EltSizeInBits < 32)) {
29859
29864
// Pre-mask the amount modulo using the wider vector.
29860
29865
Op = DAG.getNode(Op.getOpcode(), DL, VT, Op0, Op1, AmtMod);
29861
- return splitVectorOp(Op, DAG);
29866
+ return splitVectorOp(Op, DAG, DL );
29862
29867
}
29863
29868
29864
29869
// Attempt to fold scalar shift as unpack(y,x) << zext(splat(z))
@@ -30020,7 +30025,7 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget &Subtarget,
30020
30025
30021
30026
// Split 256-bit integers on XOP/pre-AVX2 targets.
30022
30027
if (VT.is256BitVector() && (Subtarget.hasXOP() || !Subtarget.hasAVX2()))
30023
- return splitVectorIntBinary(Op, DAG);
30028
+ return splitVectorIntBinary(Op, DAG, DL );
30024
30029
30025
30030
// XOP has 128-bit vector variable + immediate rotates.
30026
30031
// +ve/-ve Amt = rotate left/right - just need to handle ISD::ROTL.
@@ -30056,7 +30061,7 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget &Subtarget,
30056
30061
30057
30062
// Split 512-bit integers on non 512-bit BWI targets.
30058
30063
if (VT.is512BitVector() && !Subtarget.useBWIRegs())
30059
- return splitVectorIntBinary(Op, DAG);
30064
+ return splitVectorIntBinary(Op, DAG, DL );
30060
30065
30061
30066
assert(
30062
30067
(VT == MVT::v4i32 || VT == MVT::v8i16 || VT == MVT::v16i8 ||
@@ -31136,11 +31141,11 @@ static SDValue LowerVectorCTPOP(SDValue Op, const SDLoc &DL,
31136
31141
31137
31142
// Decompose 256-bit ops into smaller 128-bit ops.
31138
31143
if (VT.is256BitVector() && !Subtarget.hasInt256())
31139
- return splitVectorIntUnary(Op, DAG);
31144
+ return splitVectorIntUnary(Op, DAG, DL );
31140
31145
31141
31146
// Decompose 512-bit ops into smaller 256-bit ops.
31142
31147
if (VT.is512BitVector() && !Subtarget.hasBWI())
31143
- return splitVectorIntUnary(Op, DAG);
31148
+ return splitVectorIntUnary(Op, DAG, DL );
31144
31149
31145
31150
// For element types greater than i8, do vXi8 pop counts and a bytesum.
31146
31151
if (VT.getScalarType() != MVT::i8) {
@@ -31264,7 +31269,7 @@ static SDValue LowerBITREVERSE_XOP(SDValue Op, SelectionDAG &DAG) {
31264
31269
31265
31270
// Decompose 256-bit ops into smaller 128-bit ops.
31266
31271
if (VT.is256BitVector())
31267
- return splitVectorIntUnary(Op, DAG);
31272
+ return splitVectorIntUnary(Op, DAG, DL );
31268
31273
31269
31274
assert(VT.is128BitVector() &&
31270
31275
"Only 128-bit vector bitreverse lowering supported.");
@@ -31303,11 +31308,11 @@ static SDValue LowerBITREVERSE(SDValue Op, const X86Subtarget &Subtarget,
31303
31308
31304
31309
// Split 512-bit ops without BWI so that we can still use the PSHUFB lowering.
31305
31310
if (VT.is512BitVector() && !Subtarget.hasBWI())
31306
- return splitVectorIntUnary(Op, DAG);
31311
+ return splitVectorIntUnary(Op, DAG, DL );
31307
31312
31308
31313
// Decompose 256-bit ops into smaller 128-bit ops on pre-AVX2.
31309
31314
if (VT.is256BitVector() && !Subtarget.hasInt256())
31310
- return splitVectorIntUnary(Op, DAG);
31315
+ return splitVectorIntUnary(Op, DAG, DL );
31311
31316
31312
31317
// Lower vXi16/vXi32/vXi64 as BSWAP + vXi8 BITREVERSE.
31313
31318
if (VT.getScalarType() != MVT::i8) {
@@ -55980,7 +55985,7 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55980
55985
if (isConcatenatedNot(InVecBC.getOperand(0)) ||
55981
55986
isConcatenatedNot(InVecBC.getOperand(1))) {
55982
55987
// extract (and v4i64 X, (not (concat Y1, Y2))), n -> andnp v2i64 X(n), Y1
55983
- SDValue Concat = splitVectorIntBinary(InVecBC, DAG);
55988
+ SDValue Concat = splitVectorIntBinary(InVecBC, DAG, SDLoc(InVecBC) );
55984
55989
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT,
55985
55990
DAG.getBitcast(InVecVT, Concat), N->getOperand(1));
55986
55991
}
0 commit comments