]> granicus.if.org Git - llvm/commitdiff
[X86] Add SimplifyDemandedBits support for PEXTRB/PEXTRW (PR39709)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 13 May 2019 15:31:27 +0000 (15:31 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 13 May 2019 15:31:27 +0000 (15:31 +0000)
Test case will be included in a followup - its being used but its tricky to show a case that isn't caught at a later stage anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360588 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 10632434c3d054c915a55fdc7f8a67c2b236b9db..58815524b0a41dbeb33e31b8f2525ac3fadb57d7 100644 (file)
@@ -35112,8 +35112,13 @@ static SDValue combineExtractVectorElt(SDNode *N, SelectionDAG &DAG,
   // X86ISD::PEXTRW/X86ISD::PEXTRB in:
   // XFormVExtractWithShuffleIntoLoad, combineHorizontalPredicateResult and
   // combineBasicSADPattern.
-  if (IsPextr)
+  if (IsPextr) {
+    const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+    if (TLI.SimplifyDemandedBits(
+            SDValue(N, 0), APInt::getAllOnesValue(VT.getSizeInBits()), DCI))
+      return SDValue(N, 0);
     return SDValue();
+  }
 
   if (SDValue NewOp = XFormVExtractWithShuffleIntoLoad(N, DAG, DCI))
     return NewOp;