[PATCH] D61189: [X86][SSE] Extract i1 elements from vXi1 bool vectors

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 11:10:29 PDT 2019


spatel added a comment.

This looks like a good refinement of the earlier patch, so I'm happy to abandon D59669 <https://reviews.llvm.org/D59669> and move forward here.



================
Comment at: lib/Target/X86/X86ISelLowering.cpp:34919
+    };
+    if (llvm::all_of(InputVector->uses(), IsBoolExtract) &&
+        BoolExtracts.size() > 1) {
----------------
Matter of taste, but don't need to explicitly use "llvm::" here.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:34925-34926
+              combineBitcastvxi1(DAG, BCVT, InputVector, dl, Subtarget)) {
+        for (SDNode *Use : BoolExtracts) {
+          assert(Use->getOpcode() == ISD::EXTRACT_VECTOR_ELT);
+          unsigned MaskIdx = Use->getConstantOperandVal(1);
----------------
Could use a formula comment of the transform around here such as:
    // extelt vXi1 X, MaskIdx --> ((movmsk X) & Mask) == Mask


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:34931
+          SDValue Res = DAG.getNode(ISD::AND, dl, BCVT, BC, Mask);
+          Res = DAG.getSetCC(dl, MVT::i1, Res, Mask, ISD::SETEQ);
+          DCI.CombineTo(Use, Res);
----------------
Did framing this as:
  (x & Mask == Mask)
rather than:
  (x & Mask != 0)
make a difference in the output? If so, add a TODO comment about trying to avoid that problem.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61189/new/

https://reviews.llvm.org/D61189





More information about the llvm-commits mailing list