[llvm] 6320c3e - [X86] combineAndnp - pull out repeated operands. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 12 08:37:34 PST 2022
Author: Simon Pilgrim
Date: 2022-02-12T16:35:24Z
New Revision: 6320c3e77ca7148d76e7be04542cf15600bfff7e
URL: https://github.com/llvm/llvm-project/commit/6320c3e77ca7148d76e7be04542cf15600bfff7e
DIFF: https://github.com/llvm/llvm-project/commit/6320c3e77ca7148d76e7be04542cf15600bfff7e.diff
LOG: [X86] combineAndnp - pull out repeated operands. NFC.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index d779a469c56a..d1d0de420c0b 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -50341,20 +50341,21 @@ static SDValue combineCVTP2I_CVTTP2I(SDNode *N, SelectionDAG &DAG,
static SDValue combineAndnp(SDNode *N, SelectionDAG &DAG,
TargetLowering::DAGCombinerInfo &DCI,
const X86Subtarget &Subtarget) {
+ SDValue N0 = N->getOperand(0);
+ SDValue N1 = N->getOperand(1);
MVT VT = N->getSimpleValueType(0);
// ANDNP(0, x) -> x
- if (ISD::isBuildVectorAllZeros(N->getOperand(0).getNode()))
- return N->getOperand(1);
+ if (ISD::isBuildVectorAllZeros(N0.getNode()))
+ return N1;
// ANDNP(x, 0) -> 0
- if (ISD::isBuildVectorAllZeros(N->getOperand(1).getNode()))
+ if (ISD::isBuildVectorAllZeros(N1.getNode()))
return DAG.getConstant(0, SDLoc(N), VT);
// Turn ANDNP back to AND if input is inverted.
- if (SDValue Not = IsNOT(N->getOperand(0), DAG))
- return DAG.getNode(ISD::AND, SDLoc(N), VT, DAG.getBitcast(VT, Not),
- N->getOperand(1));
+ if (SDValue Not = IsNOT(N0, DAG))
+ return DAG.getNode(ISD::AND, SDLoc(N), VT, DAG.getBitcast(VT, Not), N1);
// Attempt to recursively combine a bitmask ANDNP with shuffles.
if (VT.isVector() && (VT.getScalarSizeInBits() % 8) == 0) {
More information about the llvm-commits
mailing list