[llvm] 758732a - [X86] Use ISD::PARITY directly instead of emitting CTPOP and AND from combineHorizontalPredicateResult.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 12 20:07:27 PDT 2020


Author: Craig Topper
Date: 2020-09-12T20:01:17-07:00
New Revision: 758732a34ed005cb135afcf14c9750a5483a49d3

URL: https://github.com/llvm/llvm-project/commit/758732a34ed005cb135afcf14c9750a5483a49d3
DIFF: https://github.com/llvm/llvm-project/commit/758732a34ed005cb135afcf14c9750a5483a49d3.diff

LOG: [X86] Use ISD::PARITY directly instead of emitting CTPOP and AND from combineHorizontalPredicateResult.

We have a PARITY ISD node now so might as well use it. It will
get re-expanded later.

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 5f7721267db0..34a1517ac70f 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -39373,10 +39373,8 @@ static SDValue combineHorizontalPredicateResult(SDNode *Extract,
 
   MVT CmpVT = NumElts == 64 ? MVT::i64 : MVT::i32;
   if (BinOp == ISD::XOR) {
-    // parity -> (AND (CTPOP(MOVMSK X)), 1)
-    SDValue Mask = DAG.getConstant(1, DL, CmpVT);
-    SDValue Result = DAG.getNode(ISD::CTPOP, DL, CmpVT, Movmsk);
-    Result = DAG.getNode(ISD::AND, DL, CmpVT, Result, Mask);
+    // parity -> (PARITY(MOVMSK X))
+    SDValue Result = DAG.getNode(ISD::PARITY, DL, CmpVT, Movmsk);
     return DAG.getZExtOrTrunc(Result, DL, ExtractVT);
   }
 


        


More information about the llvm-commits mailing list