[llvm-commits] Re: llvm-commits Digest, Vol 14, Issue 18

Andrew Lenharth alenhar2 at cs.uiuc.edu
Fri Aug 12 08:30:25 PDT 2005


> Message: 10
> Date: Wed, 10 Aug 2005 21:18:27 -0500
> From: Nate Begeman <natebegeman at mac.com>
> Subject: [llvm-commits] CVS:
> 	llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp 
> To: llvm-commits at cs.uiuc.edu
> Message-ID: <200508110218.VAA28747 at zion.cs.uiuc.edu>
> 
> 
> 
> Changes in directory llvm/lib/CodeGen/SelectionDAG:
> 
> SelectionDAG.cpp updated: 1.135 -> 1.136
> ---
> Log message:
> 
> Add a select_cc optimization for recognizing abs(int).  This speeds up an
> integer MPEG encoding loop by a factor of two.

1) Should this be replicated in select?  
2) What warrents select_cc being its own node?

> 
> ---
> Diffs of the changes:  (+16 -0)
> 
>  SelectionDAG.cpp |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+)
> 
> 
> Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.135 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.136
> --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.135	Wed Aug 10 20:12:20 2005
> +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Wed Aug 10 21:18:13 2005
> @@ -1495,6 +1495,22 @@
>          return getNode(ISD::AND, AType, Shift, N3);
>        }
>      }
> +    
> +    // Check to see if this is an integer abs. select_cc setl[te] X, 0, -X, X ->
> +    // Y = sra (X, size(X)-1); xor (add (X, Y), Y)
> +    if (N2C && N2C->isNullValue() && (CC == ISD::SETLT || CC == ISD::SETLE) &&
> +        N1 == N4 && N3.getOpcode() == ISD::SUB && N1 == N3.getOperand(1)) {
> +      if (ConstantSDNode *SubC = dyn_cast<ConstantSDNode>(N3.getOperand(0))) {
> +        MVT::ValueType XType = N1.getValueType();
> +        if (SubC->isNullValue() && MVT::isInteger(XType)) {
> +          SDOperand Shift = getNode(ISD::SRA, XType, N1,
> +                                    getConstant(MVT::getSizeInBits(XType)-1,
> +                                                TLI.getShiftAmountTy()));
> +          return getNode(ISD::XOR, XType, getNode(ISD::ADD, XType, N1, Shift), 
> +                         Shift);
> +        }
> +      }
> +    }
>    }
>          
>    std::vector<SDOperand> Ops;
> 
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 
> 
> End of llvm-commits Digest, Vol 14, Issue 18
> ********************************************
-- 
Andrew Lenharth <alenhar2 at cs.uiuc.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20050812/5d9f7513/attachment.sig>


More information about the llvm-commits mailing list