[PATCH] SelectionDAG: Enable (and (setcc x), (setcc y)) -> (setcc (and x, y)) for vectors

Matt Arsenault arsenm2 at gmail.com
Wed Jul 2 13:24:16 PDT 2014


On Jun 12, 2014, at 9:52 AM, Tom Stellard <thomas.stellard at amd.com> wrote:

> +      if (ISD::isAllZeros(LR.getNode()) && Op1 == ISD::SETEQ) {
>         SDValue ORNode = DAG.getNode(ISD::OR, SDLoc(N0),
>                                      LR.getValueType(), LL, RL);
>         AddToWorkList(ORNode.getNode());
>         return DAG.getSetCC(SDLoc(N), VT, ORNode, LR, Op1);
>       }
>       // fold (and (seteq X, -1), (seteq Y, -1)) -> (seteq (and X, Y), -1)
> -      if (cast<ConstantSDNode>(LR)->isAllOnesValue() && Op1 == ISD::SETEQ) {
> +      if (ISD::isAllOnes(LR.getNode()) && Op1 == ISD::SETEQ) {
>         SDValue ANDNode = DAG.getNode(ISD::AND, SDLoc(N0),
>                                       LR.getValueType(), LL, RL);
>         AddToWorkList(ANDNode.getNode());
>         return DAG.getSetCC(SDLoc(N), VT, ANDNode, LR, Op1);
>       }
>       // fold (and (setgt X,  -1), (setgt Y,  -1)) -> (setgt (or X, Y), -1)
> -      if (cast<ConstantSDNode>(LR)->isAllOnesValue() && Op1 == ISD::SETGT) {
> +      if (ISD::isAllOnes(LR.getNode()) && Op1 == ISD::SETGT) {

These checks should be reversed since the condition checks are cheaper than the isAllOnes calls
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140702/c5de2506/attachment.html>


More information about the llvm-commits mailing list