@@ -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
@@ -20054,7 +20055,7 @@ static SDValue LowerAVXExtend(SDValue Op, SelectionDAG &DAG,
20054
20055
20055
20056
if (VT == MVT::v32i16 && !Subtarget.hasBWI()) {
20056
20057
assert(InVT == MVT::v32i8 && "Unexpected VT!");
20057
- return splitVectorIntUnary(Op, DAG);
20058
+ return splitVectorIntUnary(Op, DAG, dl );
20058
20059
}
20059
20060
20060
20061
if (Subtarget.hasInt256())
@@ -20635,7 +20636,7 @@ SDValue X86TargetLowering::LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const {
20635
20636
if (Subtarget.hasAVX512()) {
20636
20637
if (InVT == MVT::v32i16 && !Subtarget.hasBWI()) {
20637
20638
assert(VT == MVT::v32i8 && "Unexpected VT!");
20638
- return splitVectorIntUnary(Op, DAG);
20639
+ return splitVectorIntUnary(Op, DAG, DL );
20639
20640
}
20640
20641
20641
20642
// word to byte only under BWI. Otherwise we have to promoted to v16i32
@@ -21615,7 +21616,8 @@ SDValue X86TargetLowering::LowerFP_TO_BF16(SDValue Op,
21615
21616
21616
21617
/// Depending on uarch and/or optimizing for size, we might prefer to use a
21617
21618
/// vector operation in place of the typical scalar operation.
21618
- static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
21619
+ static SDValue lowerAddSubToHorizontalOp(SDValue Op, const SDLoc &DL,
21620
+ SelectionDAG &DAG,
21619
21621
const X86Subtarget &Subtarget) {
21620
21622
// If both operands have other uses, this is probably not profitable.
21621
21623
SDValue LHS = Op.getOperand(0);
@@ -21671,7 +21673,6 @@ static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
21671
21673
21672
21674
// Creating a 256-bit horizontal op would be wasteful, and there is no 512-bit
21673
21675
// equivalent, so extract the 256/512-bit source op to 128-bit if we can.
21674
- SDLoc DL(Op);
21675
21676
if (BitWidth == 256 || BitWidth == 512) {
21676
21677
unsigned LaneIdx = LExtIndex / NumEltsPerLane;
21677
21678
X = extract128BitVector(X, LaneIdx * NumEltsPerLane, DAG, DL);
@@ -21692,7 +21693,7 @@ static SDValue lowerAddSubToHorizontalOp(SDValue Op, SelectionDAG &DAG,
21692
21693
SDValue X86TargetLowering::lowerFaddFsub(SDValue Op, SelectionDAG &DAG) const {
21693
21694
assert((Op.getValueType() == MVT::f32 || Op.getValueType() == MVT::f64) &&
21694
21695
"Only expecting float/double");
21695
- return lowerAddSubToHorizontalOp(Op, DAG, Subtarget);
21696
+ return lowerAddSubToHorizontalOp(Op, SDLoc(Op), DAG, Subtarget);
21696
21697
}
21697
21698
21698
21699
/// ISD::FROUND is defined to round to nearest with ties rounding away from 0.
@@ -24449,7 +24450,7 @@ static SDValue LowerSIGN_EXTEND(SDValue Op, const X86Subtarget &Subtarget,
24449
24450
24450
24451
if (VT == MVT::v32i16 && !Subtarget.hasBWI()) {
24451
24452
assert(InVT == MVT::v32i8 && "Unexpected VT!");
24452
- return splitVectorIntUnary(Op, DAG);
24453
+ return splitVectorIntUnary(Op, DAG, dl );
24453
24454
}
24454
24455
24455
24456
if (Subtarget.hasInt256())
@@ -27812,7 +27813,7 @@ static SDValue LowerVectorCTLZ_AVX512CDI(SDValue Op, SelectionDAG &DAG,
27812
27813
// Split vector, it's Lo and Hi parts will be handled in next iteration.
27813
27814
if (NumElems > 16 ||
27814
27815
(NumElems == 16 && !Subtarget.canExtendTo512DQ()))
27815
- return splitVectorIntUnary(Op, DAG);
27816
+ return splitVectorIntUnary(Op, DAG, dl );
27816
27817
27817
27818
MVT NewVT = MVT::getVectorVT(MVT::i32, NumElems);
27818
27819
assert((NewVT.is256BitVector() || NewVT.is512BitVector()) &&
@@ -27922,11 +27923,11 @@ static SDValue LowerVectorCTLZ(SDValue Op, const SDLoc &DL,
27922
27923
27923
27924
// Decompose 256-bit ops into smaller 128-bit ops.
27924
27925
if (VT.is256BitVector() && !Subtarget.hasInt256())
27925
- return splitVectorIntUnary(Op, DAG);
27926
+ return splitVectorIntUnary(Op, DAG, DL );
27926
27927
27927
27928
// Decompose 512-bit ops into smaller 256-bit ops.
27928
27929
if (VT.is512BitVector() && !Subtarget.hasBWI())
27929
- return splitVectorIntUnary(Op, DAG);
27930
+ return splitVectorIntUnary(Op, DAG, DL );
27930
27931
27931
27932
assert(Subtarget.hasSSSE3() && "Expected SSSE3 support for PSHUFB");
27932
27933
return LowerVectorCTLZInRegLUT(Op, DL, Subtarget, DAG);
@@ -27999,16 +28000,18 @@ static SDValue LowerCTTZ(SDValue Op, const X86Subtarget &Subtarget,
27999
28000
static SDValue lowerAddSub(SDValue Op, SelectionDAG &DAG,
28000
28001
const X86Subtarget &Subtarget) {
28001
28002
MVT VT = Op.getSimpleValueType();
28003
+ SDLoc DL(Op);
28004
+
28002
28005
if (VT == MVT::i16 || VT == MVT::i32)
28003
- return lowerAddSubToHorizontalOp(Op, DAG, Subtarget);
28006
+ return lowerAddSubToHorizontalOp(Op, DL, DAG, Subtarget);
28004
28007
28005
28008
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28006
- return splitVectorIntBinary(Op, DAG);
28009
+ return splitVectorIntBinary(Op, DAG, DL );
28007
28010
28008
28011
assert(Op.getSimpleValueType().is256BitVector() &&
28009
28012
Op.getSimpleValueType().isInteger() &&
28010
28013
"Only handle AVX 256-bit vector integer operation");
28011
- return splitVectorIntBinary(Op, DAG);
28014
+ return splitVectorIntBinary(Op, DAG, DL );
28012
28015
}
28013
28016
28014
28017
static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
@@ -28022,7 +28025,7 @@ static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
28022
28025
(VT.is256BitVector() && !Subtarget.hasInt256())) {
28023
28026
assert(Op.getSimpleValueType().isInteger() &&
28024
28027
"Only handle AVX vector integer operation");
28025
- return splitVectorIntBinary(Op, DAG);
28028
+ return splitVectorIntBinary(Op, DAG, DL );
28026
28029
}
28027
28030
28028
28031
// Avoid the generic expansion with min/max if we don't have pminu*/pmaxu*.
@@ -28084,10 +28087,11 @@ static SDValue LowerADDSAT_SUBSAT(SDValue Op, SelectionDAG &DAG,
28084
28087
static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28085
28088
SelectionDAG &DAG) {
28086
28089
MVT VT = Op.getSimpleValueType();
28090
+ SDLoc DL(Op);
28091
+
28087
28092
if (VT == MVT::i16 || VT == MVT::i32 || VT == MVT::i64) {
28088
28093
// Since X86 does not have CMOV for 8-bit integer, we don't convert
28089
28094
// 8-bit integer abs to NEG and CMOV.
28090
- SDLoc DL(Op);
28091
28095
SDValue N0 = Op.getOperand(0);
28092
28096
SDValue Neg = DAG.getNode(X86ISD::SUB, DL, DAG.getVTList(VT, MVT::i32),
28093
28097
DAG.getConstant(0, DL, VT), N0);
@@ -28098,7 +28102,6 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28098
28102
28099
28103
// ABS(vXi64 X) --> VPBLENDVPD(X, 0-X, X).
28100
28104
if ((VT == MVT::v2i64 || VT == MVT::v4i64) && Subtarget.hasSSE41()) {
28101
- SDLoc DL(Op);
28102
28105
SDValue Src = Op.getOperand(0);
28103
28106
SDValue Sub =
28104
28107
DAG.getNode(ISD::SUB, DL, VT, DAG.getConstant(0, DL, VT), Src);
@@ -28108,11 +28111,11 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28108
28111
if (VT.is256BitVector() && !Subtarget.hasInt256()) {
28109
28112
assert(VT.isInteger() &&
28110
28113
"Only handle AVX 256-bit vector integer operation");
28111
- return splitVectorIntUnary(Op, DAG);
28114
+ return splitVectorIntUnary(Op, DAG, DL );
28112
28115
}
28113
28116
28114
28117
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28115
- return splitVectorIntUnary(Op, DAG);
28118
+ return splitVectorIntUnary(Op, DAG, DL );
28116
28119
28117
28120
// Default to expand.
28118
28121
return SDValue();
@@ -28121,13 +28124,14 @@ static SDValue LowerABS(SDValue Op, const X86Subtarget &Subtarget,
28121
28124
static SDValue LowerAVG(SDValue Op, const X86Subtarget &Subtarget,
28122
28125
SelectionDAG &DAG) {
28123
28126
MVT VT = Op.getSimpleValueType();
28127
+ SDLoc DL(Op);
28124
28128
28125
28129
// For AVX1 cases, split to use legal ops.
28126
28130
if (VT.is256BitVector() && !Subtarget.hasInt256())
28127
- return splitVectorIntBinary(Op, DAG);
28131
+ return splitVectorIntBinary(Op, DAG, DL );
28128
28132
28129
28133
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28130
- return splitVectorIntBinary(Op, DAG);
28134
+ return splitVectorIntBinary(Op, DAG, DL );
28131
28135
28132
28136
// Default to expand.
28133
28137
return SDValue();
@@ -28136,13 +28140,14 @@ static SDValue LowerAVG(SDValue Op, const X86Subtarget &Subtarget,
28136
28140
static SDValue LowerMINMAX(SDValue Op, const X86Subtarget &Subtarget,
28137
28141
SelectionDAG &DAG) {
28138
28142
MVT VT = Op.getSimpleValueType();
28143
+ SDLoc DL(Op);
28139
28144
28140
28145
// For AVX1 cases, split to use legal ops.
28141
28146
if (VT.is256BitVector() && !Subtarget.hasInt256())
28142
- return splitVectorIntBinary(Op, DAG);
28147
+ return splitVectorIntBinary(Op, DAG, DL );
28143
28148
28144
28149
if (VT == MVT::v32i16 || VT == MVT::v64i8)
28145
- return splitVectorIntBinary(Op, DAG);
28150
+ return splitVectorIntBinary(Op, DAG, DL );
28146
28151
28147
28152
// Default to expand.
28148
28153
return SDValue();
@@ -28299,15 +28304,15 @@ static SDValue LowerFMINIMUM_FMAXIMUM(SDValue Op, const X86Subtarget &Subtarget,
28299
28304
static SDValue LowerABD(SDValue Op, const X86Subtarget &Subtarget,
28300
28305
SelectionDAG &DAG) {
28301
28306
MVT VT = Op.getSimpleValueType();
28307
+ SDLoc dl(Op);
28302
28308
28303
28309
// For AVX1 cases, split to use legal ops.
28304
28310
if (VT.is256BitVector() && !Subtarget.hasInt256())
28305
- return splitVectorIntBinary(Op, DAG);
28311
+ return splitVectorIntBinary(Op, DAG, dl );
28306
28312
28307
28313
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.useBWIRegs())
28308
- return splitVectorIntBinary(Op, DAG);
28314
+ return splitVectorIntBinary(Op, DAG, dl );
28309
28315
28310
- SDLoc dl(Op);
28311
28316
bool IsSigned = Op.getOpcode() == ISD::ABDS;
28312
28317
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
28313
28318
@@ -28350,10 +28355,10 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget,
28350
28355
28351
28356
// Decompose 256-bit ops into 128-bit ops.
28352
28357
if (VT.is256BitVector() && !Subtarget.hasInt256())
28353
- return splitVectorIntBinary(Op, DAG);
28358
+ return splitVectorIntBinary(Op, DAG, dl );
28354
28359
28355
28360
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28356
- return splitVectorIntBinary(Op, DAG);
28361
+ return splitVectorIntBinary(Op, DAG, dl );
28357
28362
28358
28363
SDValue A = Op.getOperand(0);
28359
28364
SDValue B = Op.getOperand(1);
@@ -28576,10 +28581,10 @@ static SDValue LowerMULH(SDValue Op, const X86Subtarget &Subtarget,
28576
28581
28577
28582
// Decompose 256-bit ops into 128-bit ops.
28578
28583
if (VT.is256BitVector() && !Subtarget.hasInt256())
28579
- return splitVectorIntBinary(Op, DAG);
28584
+ return splitVectorIntBinary(Op, DAG, dl );
28580
28585
28581
28586
if ((VT == MVT::v32i16 || VT == MVT::v64i8) && !Subtarget.hasBWI())
28582
- return splitVectorIntBinary(Op, DAG);
28587
+ return splitVectorIntBinary(Op, DAG, dl );
28583
28588
28584
28589
if (VT == MVT::v4i32 || VT == MVT::v8i32 || VT == MVT::v16i32) {
28585
28590
assert((VT == MVT::v4i32 && Subtarget.hasSSE2()) ||
@@ -29757,10 +29762,10 @@ static SDValue LowerShift(SDValue Op, const X86Subtarget &Subtarget,
29757
29762
29758
29763
// Decompose 256-bit shifts into 128-bit shifts.
29759
29764
if (VT.is256BitVector())
29760
- return splitVectorIntBinary(Op, DAG);
29765
+ return splitVectorIntBinary(Op, DAG, dl );
29761
29766
29762
29767
if (VT == MVT::v32i16 || VT == MVT::v64i8)
29763
- return splitVectorIntBinary(Op, DAG);
29768
+ return splitVectorIntBinary(Op, DAG, dl );
29764
29769
29765
29770
return SDValue();
29766
29771
}
@@ -29837,7 +29842,7 @@ static SDValue LowerFunnelShift(SDValue Op, const X86Subtarget &Subtarget,
29837
29842
EltSizeInBits < 32)) {
29838
29843
// Pre-mask the amount modulo using the wider vector.
29839
29844
Op = DAG.getNode(Op.getOpcode(), DL, VT, Op0, Op1, AmtMod);
29840
- return splitVectorOp(Op, DAG);
29845
+ return splitVectorOp(Op, DAG, DL );
29841
29846
}
29842
29847
29843
29848
// Attempt to fold scalar shift as unpack(y,x) << zext(splat(z))
@@ -29999,7 +30004,7 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget &Subtarget,
29999
30004
30000
30005
// Split 256-bit integers on XOP/pre-AVX2 targets.
30001
30006
if (VT.is256BitVector() && (Subtarget.hasXOP() || !Subtarget.hasAVX2()))
30002
- return splitVectorIntBinary(Op, DAG);
30007
+ return splitVectorIntBinary(Op, DAG, DL );
30003
30008
30004
30009
// XOP has 128-bit vector variable + immediate rotates.
30005
30010
// +ve/-ve Amt = rotate left/right - just need to handle ISD::ROTL.
@@ -30035,7 +30040,7 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget &Subtarget,
30035
30040
30036
30041
// Split 512-bit integers on non 512-bit BWI targets.
30037
30042
if (VT.is512BitVector() && !Subtarget.useBWIRegs())
30038
- return splitVectorIntBinary(Op, DAG);
30043
+ return splitVectorIntBinary(Op, DAG, DL );
30039
30044
30040
30045
assert(
30041
30046
(VT == MVT::v4i32 || VT == MVT::v8i16 || VT == MVT::v16i8 ||
@@ -31115,11 +31120,11 @@ static SDValue LowerVectorCTPOP(SDValue Op, const SDLoc &DL,
31115
31120
31116
31121
// Decompose 256-bit ops into smaller 128-bit ops.
31117
31122
if (VT.is256BitVector() && !Subtarget.hasInt256())
31118
- return splitVectorIntUnary(Op, DAG);
31123
+ return splitVectorIntUnary(Op, DAG, DL );
31119
31124
31120
31125
// Decompose 512-bit ops into smaller 256-bit ops.
31121
31126
if (VT.is512BitVector() && !Subtarget.hasBWI())
31122
- return splitVectorIntUnary(Op, DAG);
31127
+ return splitVectorIntUnary(Op, DAG, DL );
31123
31128
31124
31129
// For element types greater than i8, do vXi8 pop counts and a bytesum.
31125
31130
if (VT.getScalarType() != MVT::i8) {
@@ -31243,7 +31248,7 @@ static SDValue LowerBITREVERSE_XOP(SDValue Op, SelectionDAG &DAG) {
31243
31248
31244
31249
// Decompose 256-bit ops into smaller 128-bit ops.
31245
31250
if (VT.is256BitVector())
31246
- return splitVectorIntUnary(Op, DAG);
31251
+ return splitVectorIntUnary(Op, DAG, DL );
31247
31252
31248
31253
assert(VT.is128BitVector() &&
31249
31254
"Only 128-bit vector bitreverse lowering supported.");
@@ -31282,11 +31287,11 @@ static SDValue LowerBITREVERSE(SDValue Op, const X86Subtarget &Subtarget,
31282
31287
31283
31288
// Split 512-bit ops without BWI so that we can still use the PSHUFB lowering.
31284
31289
if (VT.is512BitVector() && !Subtarget.hasBWI())
31285
- return splitVectorIntUnary(Op, DAG);
31290
+ return splitVectorIntUnary(Op, DAG, DL );
31286
31291
31287
31292
// Decompose 256-bit ops into smaller 128-bit ops on pre-AVX2.
31288
31293
if (VT.is256BitVector() && !Subtarget.hasInt256())
31289
- return splitVectorIntUnary(Op, DAG);
31294
+ return splitVectorIntUnary(Op, DAG, DL );
31290
31295
31291
31296
// Lower vXi16/vXi32/vXi64 as BSWAP + vXi8 BITREVERSE.
31292
31297
if (VT.getScalarType() != MVT::i8) {
@@ -55933,7 +55938,7 @@ static SDValue combineEXTRACT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
55933
55938
if (isConcatenatedNot(InVecBC.getOperand(0)) ||
55934
55939
isConcatenatedNot(InVecBC.getOperand(1))) {
55935
55940
// extract (and v4i64 X, (not (concat Y1, Y2))), n -> andnp v2i64 X(n), Y1
55936
- SDValue Concat = splitVectorIntBinary(InVecBC, DAG);
55941
+ SDValue Concat = splitVectorIntBinary(InVecBC, DAG, SDLoc(InVecBC) );
55937
55942
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT,
55938
55943
DAG.getBitcast(InVecVT, Concat), N->getOperand(1));
55939
55944
}
0 commit comments