Skip to content

Commit 69f5928

Browse files
authored
[X86] combineConcatVectorOps - convert X86ISD::PCMPEQ/PCMPGT concatenation to use combineConcatVectorOps recursion instead of IsConcatFree (#130814)
Only concatenate X86ISD::PCMPEQ/PCMPGT nodes (or convert to CMPPS on AVX1) if at least one operand is beneficial to concatenate
1 parent 9e64fc6 commit 69f5928

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58352,14 +58352,17 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5835258352
break;
5835358353
case X86ISD::PCMPEQ:
5835458354
case X86ISD::PCMPGT:
58355-
if (!IsSplat && VT.is256BitVector() &&
58356-
(Subtarget.hasInt256() || VT == MVT::v8i32) &&
58357-
(IsConcatFree(VT, Ops, 0) || IsConcatFree(VT, Ops, 1))) {
58358-
if (Subtarget.hasInt256())
58355+
if (!IsSplat && VT.is256BitVector() && Subtarget.hasInt256()) {
58356+
SDValue Concat0 = CombineSubOperand(VT, Ops, 0);
58357+
SDValue Concat1 = CombineSubOperand(VT, Ops, 1);
58358+
if (Concat0 || Concat1)
5835958359
return DAG.getNode(Op0.getOpcode(), DL, VT,
58360-
ConcatSubOperand(VT, Ops, 0),
58361-
ConcatSubOperand(VT, Ops, 1));
58360+
Concat0 ? Concat0 : ConcatSubOperand(VT, Ops, 0),
58361+
Concat1 ? Concat1 : ConcatSubOperand(VT, Ops, 1));
58362+
break;
58363+
}
5836258364

58365+
if (!IsSplat && VT == MVT::v8i32) {
5836358366
// Without AVX2, see if we can cast the values to v8f32 and use fcmp.
5836458367
// TODO: Handle v4f64 as well?
5836558368
unsigned MaxSigBitsLHS = 0, MaxSigBitsRHS = 0;
@@ -58384,8 +58387,10 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5838458387

5838558388
if (std::optional<unsigned> CastOpc =
5838658389
CastIntSETCCtoFP(FpVT, ICC, MaxSigBitsLHS, MaxSigBitsRHS)) {
58387-
SDValue LHS = ConcatSubOperand(VT, Ops, 0);
58388-
SDValue RHS = ConcatSubOperand(VT, Ops, 1);
58390+
SDValue LHS = CombineSubOperand(VT, Ops, 0);
58391+
SDValue RHS = CombineSubOperand(VT, Ops, 1);
58392+
LHS = LHS ? LHS : ConcatSubOperand(VT, Ops, 0);
58393+
RHS = RHS ? RHS : ConcatSubOperand(VT, Ops, 1);
5838958394
LHS = DAG.getNode(*CastOpc, DL, FpVT, LHS);
5839058395
RHS = DAG.getNode(*CastOpc, DL, FpVT, RHS);
5839158396

0 commit comments

Comments
 (0)