<div dir="ltr">As per the develpoment guidelines, please attach the patch?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 2, 2014 at 1:14 PM, Tom Stellard <span dir="ltr"><<a href="mailto:tom@stellard.net" target="_blank">tom@stellard.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ping.<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, Jun 12, 2014 at 09:52:37AM -0700, Tom Stellard wrote:<br>
> This patch adds isAllOnes and isAllZeros helpers for SDNodes that<br>
> checks both ConstantSDNodes and BuildVectorSDNodes.<br>
> ---<br>
> include/llvm/CodeGen/SelectionDAGNodes.h | 9 +++++++++<br>
> lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 ++++----<br>
> lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 10 ++++++++++<br>
> test/CodeGen/R600/setcc-equivalent.ll | 1 -<br>
> 4 files changed, 23 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h<br>
> index b209268..4dd0bda 100644<br>
> --- a/include/llvm/CodeGen/SelectionDAGNodes.h<br>
> +++ b/include/llvm/CodeGen/SelectionDAGNodes.h<br>
> @@ -94,6 +94,15 @@ namespace ISD {<br>
> /// all ConstantSDNode or undef.<br>
> bool isBuildVectorOfConstantSDNodes(const SDNode *N);<br>
><br>
> + /// \brief Return true if \p N is a constant with all bits set or a<br>
> + // BUILD_VECTOR of all ~0 values.<br>
> + bool isAllOnes(const SDNode *N);<br>
> +<br>
> + /// \brief Return true if \p N is a constant no bits set or a<br>
> + // BUILD_VECTOR of all 0 values.<br>
> + bool isAllZeros(const SDNode *N);<br>
> +<br>
> +<br>
> /// isScalarToVector - Return true if the specified node is a<br>
> /// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low<br>
> /// element is not an undef.<br>
> diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
> index 0f50184..2ec3271 100644<br>
> --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
> +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
> @@ -2758,24 +2758,24 @@ SDValue DAGCombiner::visitAND(SDNode *N) {<br>
> ISD::CondCode Op0 = cast<CondCodeSDNode>(CC0)->get();<br>
> ISD::CondCode Op1 = cast<CondCodeSDNode>(CC1)->get();<br>
><br>
> - if (LR == RR && isa<ConstantSDNode>(LR) && Op0 == Op1 &&<br>
> + if (LR == RR && Op0 == Op1 &&<br>
> LL.getValueType().isInteger()) {<br>
> // fold (and (seteq X, 0), (seteq Y, 0)) -> (seteq (or X, Y), 0)<br>
> - if (cast<ConstantSDNode>(LR)->isNullValue() && Op1 == ISD::SETEQ) {<br>
> + if (ISD::isAllZeros(LR.getNode()) && Op1 == ISD::SETEQ) {<br>
> SDValue ORNode = DAG.getNode(ISD::OR, SDLoc(N0),<br>
> LR.getValueType(), LL, RL);<br>
> AddToWorkList(ORNode.getNode());<br>
> return DAG.getSetCC(SDLoc(N), VT, ORNode, LR, Op1);<br>
> }<br>
> // fold (and (seteq X, -1), (seteq Y, -1)) -> (seteq (and X, Y), -1)<br>
> - if (cast<ConstantSDNode>(LR)->isAllOnesValue() && Op1 == ISD::SETEQ) {<br>
> + if (ISD::isAllOnes(LR.getNode()) && Op1 == ISD::SETEQ) {<br>
> SDValue ANDNode = DAG.getNode(ISD::AND, SDLoc(N0),<br>
> LR.getValueType(), LL, RL);<br>
> AddToWorkList(ANDNode.getNode());<br>
> return DAG.getSetCC(SDLoc(N), VT, ANDNode, LR, Op1);<br>
> }<br>
> // fold (and (setgt X, -1), (setgt Y, -1)) -> (setgt (or X, Y), -1)<br>
> - if (cast<ConstantSDNode>(LR)->isAllOnesValue() && Op1 == ISD::SETGT) {<br>
> + if (ISD::isAllOnes(LR.getNode()) && Op1 == ISD::SETGT) {<br>
> SDValue ORNode = DAG.getNode(ISD::OR, SDLoc(N0),<br>
> LR.getValueType(), LL, RL);<br>
> AddToWorkList(ORNode.getNode());<br>
> diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp<br>
> index 010431e..e015e83 100644<br>
> --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp<br>
> +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp<br>
> @@ -232,6 +232,16 @@ bool ISD::allOperandsUndef(const SDNode *N) {<br>
> return true;<br>
> }<br>
><br>
> +bool ISD::isAllOnes(const SDNode *N) {<br>
> + const ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N);<br>
> + return (CN && CN->isAllOnesValue()) || ISD::isBuildVectorAllOnes(N);<br>
> +}<br>
> +<br>
> +bool ISD::isAllZeros(const SDNode *N) {<br>
> + const ConstantSDNode *CN = dyn_cast<ConstantSDNode>(N);<br>
> + return (CN && CN->isNullValue()) || ISD::isBuildVectorAllZeros(N);<br>
> +}<br>
> +<br>
> ISD::NodeType ISD::getExtForLoadExtType(ISD::LoadExtType ExtType) {<br>
> switch (ExtType) {<br>
> case ISD::EXTLOAD:<br>
> diff --git a/test/CodeGen/R600/setcc-equivalent.ll b/test/CodeGen/R600/setcc-equivalent.ll<br>
> index f796748..4c50aa3 100644<br>
> --- a/test/CodeGen/R600/setcc-equivalent.ll<br>
> +++ b/test/CodeGen/R600/setcc-equivalent.ll<br>
> @@ -1,5 +1,4 @@<br>
> ; RUN: llc -march=r600 -mcpu=cypress < %s | FileCheck -check-prefix=EG %s<br>
> -; XFAIL: *<br>
><br>
> ; EG-LABEL: @and_setcc_setcc_i32<br>
> ; EG: AND_INT<br>
> --<br>
> 1.8.1.4<br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>