[llvm-commits] [llvm] r166125 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/extract-concat.ll

Michael Liao michael.liao at intel.com
Thu Oct 18 20:20:03 PDT 2012


Thanks for advise. Done in 166260.

Sorry for late reply. For unknown reason, this mail is lost into Junk
box. I just pull it back, :(

Yours
- Michael

On Thu, 2012-10-18 at 09:26 +0200, Duncan Sands wrote:
> Hi Michael,
> 
> > Teach DAG combine to fold (extract_subvec (concat v1, ..) i) to v_i
> 
> > --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Oct 17 15:48:33 2012
> > @@ -8628,6 +8628,21 @@
> >       }
> >     }
> >
> > +  if (V->getOpcode() == ISD::CONCAT_VECTORS) {
> > +    // Combine:
> > +    //    (extract_subvec (concat V1, V2, ...), i)
> > +    // Into:
> > +    //    Vi if possible
> > +    for (unsigned i = 0, e = V->getNumOperands(); i != e; ++i)
> > +      if (V->getOperand(i).getValueType() != NVT)
> > +        return SDValue();
> 
> since all operands are required to have the same type (see documentation in
> ISDOpcodes.h) this loop is not needed.
> 
> Ciao, Duncan.
> 
> > +    unsigned Idx = dyn_cast<ConstantSDNode>(N->getOperand(1))->getZExtValue();
> > +    unsigned NumElems = NVT.getVectorNumElements();
> > +    assert((Idx % NumElems) == 0 &&
> > +           "IDX in concat is not a multiple of the result vector length.");
> > +    return V->getOperand(Idx / NumElems);
> > +  }
> > +
> >     return SDValue();
> >   }
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list