OSDN Git Service

[X86] combineAndnp - use isNOT instead of manually checking for (XOR x, -1)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 21 Jun 2019 11:13:15 +0000 (11:13 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 21 Jun 2019 11:13:15 +0000 (11:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index e15acc7..9c03f58 100644 (file)
@@ -41023,11 +41023,9 @@ static SDValue combineAndnp(SDNode *N, SelectionDAG &DAG,
     return DAG.getConstant(0, SDLoc(N), VT);
 
   // Turn ANDNP back to AND if input is inverted.
-  if (VT.isVector() && N->getOperand(0).getOpcode() == ISD::XOR &&
-      ISD::isBuildVectorAllOnes(N->getOperand(0).getOperand(1).getNode())) {
-    return DAG.getNode(ISD::AND, SDLoc(N), VT,
-                       N->getOperand(0).getOperand(0), N->getOperand(1));
-  }
+  if (SDValue Not = IsNOT(N->getOperand(0), DAG))
+    return DAG.getNode(ISD::AND, SDLoc(N), VT, DAG.getBitcast(VT, Not),
+                       N->getOperand(1));
 
   // Attempt to recursively combine a bitmask ANDNP with shuffles.
   if (VT.isVector() && (VT.getScalarSizeInBits() % 8) == 0) {