[PATCH] D31483: [DAGCombiner] convert and-of-seteq to bitwise logic+seteq (PR32401)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 11:51:11 PDT 2017


efriedma added a comment.

Someone is inevitably going to request a target hook for this; the reason this transform looks good is that all the targets you have tests for require at least 3 instructions to lower seteq.  If you have a one-instruction seteq operation, the seteq+seteq+and sequence is cheaper.  (Not sure what targets have this for scalars, but a lot of targets have this for vectors, e.g. x86 pcmpeqd.)



================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3251
+    SDValue Zero = DAG.getConstant(0, DL, OpVT);
+    return DAG.getSetCC(DL, VT, Or, Zero, ISD::SETEQ);
+  }
----------------
spatel wrote:
> efriedma wrote:
> > If you're going to do this, it would be nice to at least handle the inverse case: or(setne, setne).  Not sure what other related cases are worth transforming.
> Sure - I was planning to look at the related patterns in "visitORLike" as well as the vector cases as follow-ups. Would you prefer that I pull it together in one patch, or I can add another FIXME comment?
It doesn't need to be in the same patch, as long as you don't forget about it.


https://reviews.llvm.org/D31483





More information about the llvm-commits mailing list