Skip to content

Commit 8ebd401

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

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49922,15 +49922,11 @@ static SDValue combineBitOpWithShift(unsigned Opc, const SDLoc &DL, EVT VT,
4992249922
// Attempt to fold:
4992349923
// BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)).
4992449924
// TODO: Handle PACKUS handling.
49925-
static SDValue combineBitOpWithPACK(SDNode *N, SelectionDAG &DAG) {
49926-
unsigned Opc = N->getOpcode();
49925+
static SDValue combineBitOpWithPACK(unsigned Opc, const SDLoc &DL, EVT VT,
49926+
SDValue N0, SDValue N1, SelectionDAG &DAG) {
4992749927
assert((Opc == ISD::OR || Opc == ISD::AND || Opc == ISD::XOR) &&
4992849928
"Unexpected bit opcode");
4992949929

49930-
SDValue N0 = N->getOperand(0);
49931-
SDValue N1 = N->getOperand(1);
49932-
EVT VT = N->getValueType(0);
49933-
4993449930
// Both operands must be single use.
4993549931
if (!N0.hasOneUse() || !N1.hasOneUse())
4993649932
return SDValue();
@@ -49956,7 +49952,6 @@ static SDValue combineBitOpWithPACK(SDNode *N, SelectionDAG &DAG) {
4995649952
DAG.ComputeNumSignBits(N1.getOperand(1)) != NumSrcBits)
4995749953
return SDValue();
4995849954

49959-
SDLoc DL(N);
4996049955
SDValue LHS = DAG.getNode(Opc, DL, SrcVT, N0.getOperand(0), N1.getOperand(0));
4996149956
SDValue RHS = DAG.getNode(Opc, DL, SrcVT, N0.getOperand(1), N1.getOperand(1));
4996249957
return DAG.getBitcast(VT, DAG.getNode(X86ISD::PACKSS, DL, DstVT, LHS, RHS));
@@ -50523,7 +50518,7 @@ static SDValue combineAnd(SDNode *N, SelectionDAG &DAG,
5052350518
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
5052450519
return R;
5052550520

50526-
if (SDValue R = combineBitOpWithPACK(N, DAG))
50521+
if (SDValue R = combineBitOpWithPACK(N->getOpcode(), dl, VT, N0, N1, DAG))
5052750522
return R;
5052850523

5052950524
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))
@@ -51308,7 +51303,7 @@ static SDValue combineOr(SDNode *N, SelectionDAG &DAG,
5130851303
if (SDValue R = combineBitOpWithShift(N->getOpcode(), dl, VT, N0, N1, DAG))
5130951304
return R;
5131051305

51311-
if (SDValue R = combineBitOpWithPACK(N, DAG))
51306+
if (SDValue R = combineBitOpWithPACK(N->getOpcode(), dl, VT, N0, N1, DAG))
5131251307
return R;
5131351308

5131451309
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))
@@ -53625,7 +53620,7 @@ static SDValue combineXor(SDNode *N, SelectionDAG &DAG,
5362553620
if (SDValue R = combineBitOpWithShift(N->getOpcode(), DL, VT, N0, N1, DAG))
5362653621
return R;
5362753622

53628-
if (SDValue R = combineBitOpWithPACK(N, DAG))
53623+
if (SDValue R = combineBitOpWithPACK(N->getOpcode(), DL, VT, N0, N1, DAG))
5362953624
return R;
5363053625

5363153626
if (SDValue FPLogic = convertIntLogicToFPLogic(N, DAG, DCI, Subtarget))

0 commit comments

Comments
 (0)