Skip to content

Commit 595a738

Browse files
committed
[X86] combineBitOpWithMOVMSK - avoid duplicate SDLoc/operands code. NFC.
Reuse values from the callers directly.
1 parent dee44b2 commit 595a738

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49853,14 +49853,11 @@ static SDValue convertIntLogicToFPLogic(SDNode *N, SelectionDAG &DAG,
4985349853

4985449854
// Attempt to fold BITOP(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(BITOP(X,Y))
4985549855
// to reduce XMM->GPR traffic.
49856-
static SDValue combineBitOpWithMOVMSK(SDNode *N, SelectionDAG &DAG) {
49857-
unsigned Opc = N->getOpcode();
49856+
static SDValue combineBitOpWithMOVMSK(unsigned Opc, const SDLoc &DL, SDValue N0,
49857+
SDValue N1, SelectionDAG &DAG) {
4985849858
assert((Opc == ISD::OR || Opc == ISD::AND || Opc == ISD::XOR) &&
4985949859
"Unexpected bit opcode");
4986049860

49861-
SDValue N0 = N->getOperand(0);
49862-
SDValue N1 = N->getOperand(1);
49863-
4986449861
// Both operands must be single use MOVMSK.
4986549862
if (N0.getOpcode() != X86ISD::MOVMSK || !N0.hasOneUse() ||
4986649863
N1.getOpcode() != X86ISD::MOVMSK || !N1.hasOneUse())
@@ -49877,7 +49874,6 @@ static SDValue combineBitOpWithMOVMSK(SDNode *N, SelectionDAG &DAG) {
4987749874
VecVT0.getScalarSizeInBits() != VecVT1.getScalarSizeInBits())
4987849875
return SDValue();
4987949876

49880-
SDLoc DL(N);
4988149877
unsigned VecOpc =
4988249878
VecVT0.isFloatingPoint() ? convertIntLogicToFPLogicOpcode(Opc) : Opc;
4988349879
SDValue Result =
@@ -50521,7 +50517,7 @@ static SDValue combineAnd(SDNode *N, SelectionDAG &DAG,
5052150517
if (SDValue V = combineScalarAndWithMaskSetcc(N, DAG, Subtarget))
5052250518
return V;
5052350519

50524-
if (SDValue R = combineBitOpWithMOVMSK(N, DAG))
50520+
if (SDValue R = combineBitOpWithMOVMSK(N->getOpcode(), dl, N0, N1, DAG))
5052550521
return R;
5052650522

5052750523
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
@@ -51306,7 +51302,7 @@ static SDValue combineOr(SDNode *N, SelectionDAG &DAG,
5130651302
if (SDValue SetCC = combineAndOrForCcmpCtest(N, DAG, DCI, Subtarget))
5130751303
return SetCC;
5130851304

51309-
if (SDValue R = combineBitOpWithMOVMSK(N, DAG))
51305+
if (SDValue R = combineBitOpWithMOVMSK(N->getOpcode(), dl, N0, N1, DAG))
5131051306
return R;
5131151307

5131251308
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
@@ -53623,7 +53619,7 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
5362353619
if (SDValue Cmp = foldVectorXorShiftIntoCmp(N, DAG, Subtarget))
5362453620
return Cmp;
5362553621

53626-
if (SDValue R = combineBitOpWithMOVMSK(N, DAG))
53622+
if (SDValue R = combineBitOpWithMOVMSK(N->getOpcode(), DL, N0, N1, DAG))
5362753623
return R;
5362853624

5362953625
if (SDValue R = combineBitOpWithShift(N->getOpcode(), DL, VT, N0, N1, DAG))

0 commit comments

Comments
 (0)